Define remote module, provider, service.
This commit is contained in:
parent
6e5789c327
commit
80fcbf37a4
|
|
@ -110,5 +110,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- storage provider -->
|
||||
<!-- remote provider -->
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-remote-grpc-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- remote provider -->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -16,7 +16,6 @@
|
|||
<module>server-component</module>
|
||||
<module>queue-component</module>
|
||||
<module>stream-component</module>
|
||||
<module>remote-component</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>apm-collector-component</artifactId>
|
||||
<artifactId>apm-collector-remote</artifactId>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<version>3.2.3-2017</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>remote-component</artifactId>
|
||||
<artifactId>collector-remote-define</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.skywalking.apm.collector.remote;
|
||||
|
||||
import org.skywalking.apm.collector.core.module.Module;
|
||||
import org.skywalking.apm.collector.remote.service.DataService;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteModule extends Module {
|
||||
|
||||
public static final String NAME = "remote";
|
||||
|
||||
@Override public String name() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override public Class[] services() {
|
||||
return new Class[] {DataService.class};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2017, OpenSkywalking Organization All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Project repository: https://github.com/OpenSkywalking/skywalking
|
||||
*/
|
||||
|
||||
package org.skywalking.apm.collector.remote.service;
|
||||
|
||||
/**
|
||||
* The <code>AbstractHashMessage</code> implementations represent aggregate message,
|
||||
* which use to aggregate metric.
|
||||
* <p>
|
||||
*
|
||||
* @author peng-yongsheng
|
||||
* @since v3.0-2017
|
||||
*/
|
||||
public abstract class AbstractHashMessage {
|
||||
private int hashCode;
|
||||
|
||||
public AbstractHashMessage(String key) {
|
||||
this.hashCode = key.hashCode();
|
||||
}
|
||||
|
||||
public int getHashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* Copyright 2017, OpenSkywalking Organization All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Project repository: https://github.com/OpenSkywalking/skywalking
|
||||
*/
|
||||
|
||||
package org.skywalking.apm.collector.remote.service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class Data extends AbstractHashMessage {
|
||||
private String[] dataStrings;
|
||||
private Long[] dataLongs;
|
||||
private Double[] dataDoubles;
|
||||
private Integer[] dataIntegers;
|
||||
private Boolean[] dataBooleans;
|
||||
private byte[][] dataBytes;
|
||||
|
||||
public Data(String id, int stringCapacity, int longCapacity, int doubleCapacity, int integerCapacity,
|
||||
int booleanCapacity, int byteCapacity) {
|
||||
super(id);
|
||||
this.dataStrings = new String[stringCapacity];
|
||||
this.dataStrings[0] = id;
|
||||
this.dataLongs = new Long[longCapacity];
|
||||
this.dataDoubles = new Double[doubleCapacity];
|
||||
this.dataIntegers = new Integer[integerCapacity];
|
||||
this.dataBooleans = new Boolean[booleanCapacity];
|
||||
this.dataBytes = new byte[byteCapacity][];
|
||||
}
|
||||
|
||||
public void setDataString(int position, String value) {
|
||||
dataStrings[position] = value;
|
||||
}
|
||||
|
||||
public void setDataLong(int position, Long value) {
|
||||
dataLongs[position] = value;
|
||||
}
|
||||
|
||||
public void setDataDouble(int position, Double value) {
|
||||
dataDoubles[position] = value;
|
||||
}
|
||||
|
||||
public void setDataInteger(int position, Integer value) {
|
||||
dataIntegers[position] = value;
|
||||
}
|
||||
|
||||
public void setDataBoolean(int position, Boolean value) {
|
||||
dataBooleans[position] = value;
|
||||
}
|
||||
|
||||
public void setDataBytes(int position, byte[] dataBytes) {
|
||||
this.dataBytes[position] = dataBytes;
|
||||
}
|
||||
|
||||
public String getDataString(int position) {
|
||||
return dataStrings[position];
|
||||
}
|
||||
|
||||
public Long getDataLong(int position) {
|
||||
return dataLongs[position];
|
||||
}
|
||||
|
||||
public Double getDataDouble(int position) {
|
||||
return dataDoubles[position];
|
||||
}
|
||||
|
||||
public Integer getDataInteger(int position) {
|
||||
return dataIntegers[position];
|
||||
}
|
||||
|
||||
public Boolean getDataBoolean(int position) {
|
||||
return dataBooleans[position];
|
||||
}
|
||||
|
||||
public byte[] getDataBytes(int position) {
|
||||
return dataBytes[position];
|
||||
}
|
||||
|
||||
public String id() {
|
||||
return dataStrings[0];
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
StringBuilder dataStr = new StringBuilder();
|
||||
dataStr.append("string: [");
|
||||
for (int i = 0; i < dataStrings.length; i++) {
|
||||
dataStr.append(dataStrings[i]).append(",");
|
||||
}
|
||||
dataStr.append("], longs: [");
|
||||
for (int i = 0; i < dataLongs.length; i++) {
|
||||
dataStr.append(dataLongs[i]).append(",");
|
||||
}
|
||||
dataStr.append("], double: [");
|
||||
for (int i = 0; i < dataDoubles.length; i++) {
|
||||
dataStr.append(dataDoubles[i]).append(",");
|
||||
}
|
||||
dataStr.append("], integer: [");
|
||||
for (int i = 0; i < dataIntegers.length; i++) {
|
||||
dataStr.append(dataIntegers[i]).append(",");
|
||||
}
|
||||
dataStr.append("], boolean: [");
|
||||
for (int i = 0; i < dataBooleans.length; i++) {
|
||||
dataStr.append(dataBooleans[i]).append(",");
|
||||
}
|
||||
return dataStr.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package org.skywalking.apm.collector.remote.service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface DataReceiver {
|
||||
void receive(Data data);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.skywalking.apm.collector.remote.service;
|
||||
|
||||
import org.skywalking.apm.collector.core.module.Service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface DataService extends Service {
|
||||
void send(Data data);
|
||||
|
||||
void registerReceiver(DataReceiver receiver);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Copyright 2017, OpenSkywalking Organization All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Project repository: https://github.com/OpenSkywalking/skywalking
|
||||
#
|
||||
|
||||
org.skywalking.apm.collector.remote.RemoteModule
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>apm-collector-remote</artifactId>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<version>3.2.3-2017</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>collector-remote-grpc-define</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-remote-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package org.skywalking.apm.collector.remote.grpc;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.skywalking.apm.collector.core.module.Module;
|
||||
import org.skywalking.apm.collector.core.module.ModuleProvider;
|
||||
import org.skywalking.apm.collector.core.module.ServiceNotProvidedException;
|
||||
import org.skywalking.apm.collector.remote.RemoteModule;
|
||||
import org.skywalking.apm.collector.remote.grpc.service.GRPCDataService;
|
||||
import org.skywalking.apm.collector.remote.service.DataService;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteModuleGRPCProvider extends ModuleProvider {
|
||||
|
||||
@Override public String name() {
|
||||
return "gRPC";
|
||||
}
|
||||
|
||||
@Override public Class<? extends Module> module() {
|
||||
return RemoteModule.class;
|
||||
}
|
||||
|
||||
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
|
||||
this.registerServiceImplementation(DataService.class, new GRPCDataService());
|
||||
}
|
||||
|
||||
@Override public void start(Properties config) throws ServiceNotProvidedException {
|
||||
|
||||
}
|
||||
|
||||
@Override public void notifyAfterCompleted() throws ServiceNotProvidedException {
|
||||
|
||||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package org.skywalking.apm.collector.remote.grpc.service;
|
||||
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
import org.skywalking.apm.collector.remote.service.DataReceiver;
|
||||
import org.skywalking.apm.collector.remote.service.DataService;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GRPCDataService implements DataService {
|
||||
|
||||
@Override public void send(Data data) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void registerReceiver(DataReceiver receiver) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Copyright 2017, OpenSkywalking Organization All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Project repository: https://github.com/OpenSkywalking/skywalking
|
||||
#
|
||||
|
||||
org.skywalking.apm.collector.remote.grpc.RemoteModuleGRPCProvider
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>apm-collector</artifactId>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<version>3.2.3-2017</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>apm-collector-remote</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>collector-remote-define</module>
|
||||
<module>collector-remote-grpc-define</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>apm-collector-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>client-component</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>server-component</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
<module>apm-collector-naming</module>
|
||||
<module>apm-collector-grpc-manager</module>
|
||||
<module>apm-collector-jetty-manager</module>
|
||||
<module>apm-collector-remote</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
|||
Loading…
Reference in New Issue