Add the implement of remote module.
This commit is contained in:
parent
80fcbf37a4
commit
baa0a3c080
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public enum RemoteDataMapping {
|
||||
InstPerformance
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.skywalking.apm.collector.remote.service.SerializableAndDeserialize;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteDataMappingContainer {
|
||||
|
||||
private Map<Integer, SerializableAndDeserialize> mapping = new HashMap<>();
|
||||
|
||||
public void addMapping(SerializableAndDeserialize instance) {
|
||||
mapping.put(instance.mapping().ordinal(), instance);
|
||||
}
|
||||
|
||||
public SerializableAndDeserialize get(Integer mappingId) {
|
||||
return mapping.get(mappingId);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,25 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.skywalking.apm.collector.core.module.Module;
|
||||
import org.skywalking.apm.collector.remote.service.DataService;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteServerService;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -15,6 +33,6 @@ public class RemoteModule extends Module {
|
|||
}
|
||||
|
||||
@Override public Class[] services() {
|
||||
return new Class[] {DataService.class};
|
||||
return new Class[] {RemoteServerService.class};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
/*
|
||||
* 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 interface DataReceiver {
|
||||
void receive(Data data);
|
||||
void receive(String roleName, Data data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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 DataReceiverRegisterListener {
|
||||
|
||||
private DataReceiver dataReceiver;
|
||||
|
||||
public DataReceiver getDataReceiver() {
|
||||
return dataReceiver;
|
||||
}
|
||||
|
||||
public void setDataReceiver(DataReceiver dataReceiver) {
|
||||
this.dataReceiver = dataReceiver;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
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,28 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMapping;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface RemoteClient {
|
||||
void send(String roleName, Data data, RemoteDataMapping mapping);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.skywalking.apm.collector.core.module.Service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface RemoteClientService extends Service {
|
||||
RemoteClient create(String host, int port);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.skywalking.apm.collector.core.module.Service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface RemoteServerService extends Service {
|
||||
void registerReceiver(DataReceiver receiver);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMapping;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface SerializableAndDeserialize<T, B> {
|
||||
|
||||
RemoteDataMapping mapping();
|
||||
|
||||
Data deserialize(T remoteData);
|
||||
|
||||
B serialize(Data data);
|
||||
}
|
||||
|
|
@ -12,11 +12,66 @@
|
|||
<artifactId>collector-remote-grpc-define</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.4.0</grpc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-remote-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-grpc-manager-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>kr.motd.maven</groupId>
|
||||
<artifactId>os-maven-plugin</artifactId>
|
||||
<version>1.4.1.Final</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.xolstice.maven.plugins</groupId>
|
||||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<configuration>
|
||||
<!--
|
||||
The version of protoc must match protobuf-java. If you don't depend on
|
||||
protobuf-java directly, you will be transitively depending on the
|
||||
protobuf-java version that grpc depends on.
|
||||
-->
|
||||
<protocArtifact>com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier}
|
||||
</protocArtifact>
|
||||
<pluginId>grpc-java</pluginId>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.4.0:exe:${os.detected.classifier}
|
||||
</pluginArtifact>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>compile-custom</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -1,18 +1,35 @@
|
|||
package org.skywalking.apm.collector.remote.grpc;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.skywalking.apm.collector.cluster.ClusterModule;
|
||||
import org.skywalking.apm.collector.cluster.service.ModuleRegisterService;
|
||||
import org.skywalking.apm.collector.core.module.Module;
|
||||
import org.skywalking.apm.collector.core.module.ModuleNotFoundException;
|
||||
import org.skywalking.apm.collector.core.module.ModuleProvider;
|
||||
import org.skywalking.apm.collector.core.module.ServiceNotProvidedException;
|
||||
import org.skywalking.apm.collector.grpc.manager.GRPCManagerModule;
|
||||
import org.skywalking.apm.collector.grpc.manager.service.GRPCManagerService;
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMappingContainer;
|
||||
import org.skywalking.apm.collector.remote.RemoteModule;
|
||||
import org.skywalking.apm.collector.remote.grpc.service.GRPCDataService;
|
||||
import org.skywalking.apm.collector.remote.service.DataService;
|
||||
import org.skywalking.apm.collector.remote.grpc.data.instance.InstPerformanceData;
|
||||
import org.skywalking.apm.collector.remote.grpc.handler.RemoteCommonServiceHandler;
|
||||
import org.skywalking.apm.collector.remote.grpc.service.GRPCRemoteClientService;
|
||||
import org.skywalking.apm.collector.remote.grpc.service.GRPCRemoteServerService;
|
||||
import org.skywalking.apm.collector.remote.service.DataReceiverRegisterListener;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteClientService;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteServerService;
|
||||
import org.skywalking.apm.collector.server.Server;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteModuleGRPCProvider extends ModuleProvider {
|
||||
|
||||
private static final String HOST = "host";
|
||||
private static final String PORT = "port";
|
||||
private RemoteDataMappingContainer container;
|
||||
private final DataReceiverRegisterListener listener = new DataReceiverRegisterListener();
|
||||
|
||||
@Override public String name() {
|
||||
return "gRPC";
|
||||
}
|
||||
|
|
@ -22,11 +39,25 @@ public class RemoteModuleGRPCProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
|
||||
this.registerServiceImplementation(DataService.class, new GRPCDataService());
|
||||
container = loadMapping();
|
||||
this.registerServiceImplementation(RemoteServerService.class, new GRPCRemoteServerService(listener));
|
||||
this.registerServiceImplementation(RemoteClientService.class, new GRPCRemoteClientService(container));
|
||||
}
|
||||
|
||||
@Override public void start(Properties config) throws ServiceNotProvidedException {
|
||||
String host = config.getProperty(HOST);
|
||||
Integer port = (Integer)config.get(PORT);
|
||||
|
||||
try {
|
||||
GRPCManagerService managerService = getManager().find(GRPCManagerModule.NAME).getService(GRPCManagerService.class);
|
||||
Server gRPCServer = managerService.getOrCreateIfAbsent(host, port);
|
||||
gRPCServer.addHandler(new RemoteCommonServiceHandler(container, listener));
|
||||
|
||||
ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
|
||||
moduleRegisterService.register(RemoteModule.NAME, this.name(), new RemoteModuleGRPCRegistration(host, port));
|
||||
} catch (ModuleNotFoundException e) {
|
||||
throw new ServiceNotProvidedException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void notifyAfterCompleted() throws ServiceNotProvidedException {
|
||||
|
|
@ -36,4 +67,10 @@ public class RemoteModuleGRPCProvider extends ModuleProvider {
|
|||
@Override public String[] requiredModules() {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
private RemoteDataMappingContainer loadMapping() {
|
||||
RemoteDataMappingContainer container = new RemoteDataMappingContainer();
|
||||
container.addMapping(new InstPerformanceData());
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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.grpc;
|
||||
|
||||
import org.skywalking.apm.collector.cluster.ModuleRegistration;
|
||||
import org.skywalking.apm.collector.core.util.Const;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteModuleGRPCRegistration extends ModuleRegistration {
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
|
||||
public RemoteModuleGRPCRegistration(String host, int port) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
@Override public Value buildValue() {
|
||||
return new Value(host, port, Const.EMPTY_STRING);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.grpc.data;
|
||||
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteData;
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
import org.skywalking.apm.collector.remote.service.SerializableAndDeserialize;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class GRPCData implements SerializableAndDeserialize<RemoteData, RemoteData.Builder> {
|
||||
|
||||
protected Data build(RemoteData remoteData) {
|
||||
return new Data(remoteData.getDataStrings(0), remoteData.getStringCapacity(), remoteData.getLongCapacity(), remoteData.getDoubleCapacity(), remoteData.getIntegerCapacity(), remoteData.getBooleanCapacity(), remoteData.getByteCapacity());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.grpc.data.instance;
|
||||
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMapping;
|
||||
import org.skywalking.apm.collector.remote.grpc.data.GRPCData;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteData;
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class InstPerformanceData extends GRPCData {
|
||||
|
||||
@Override public RemoteDataMapping mapping() {
|
||||
return RemoteDataMapping.InstPerformance;
|
||||
}
|
||||
|
||||
@Override public Data deserialize(RemoteData remoteData) {
|
||||
Data data = build(remoteData);
|
||||
data.setDataInteger(0, remoteData.getDataIntegers(0));
|
||||
data.setDataInteger(1, remoteData.getDataIntegers(1));
|
||||
data.setDataInteger(2, remoteData.getDataIntegers(2));
|
||||
data.setDataLong(0, remoteData.getDataLongs(0));
|
||||
data.setDataLong(1, remoteData.getDataLongs(1));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override public RemoteData.Builder serialize(Data data) {
|
||||
RemoteData.Builder builder = RemoteData.newBuilder();
|
||||
builder.addDataStrings(data.getDataString(0));
|
||||
builder.addDataIntegers(data.getDataInteger(0));
|
||||
builder.addDataIntegers(data.getDataInteger(1));
|
||||
builder.addDataIntegers(data.getDataInteger(2));
|
||||
builder.addDataLongs(data.getDataLong(0));
|
||||
builder.addDataLongs(data.getDataLong(1));
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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.grpc.handler;
|
||||
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMappingContainer;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.Empty;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteCommonServiceGrpc;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteData;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteMessage;
|
||||
import org.skywalking.apm.collector.remote.service.DataReceiverRegisterListener;
|
||||
import org.skywalking.apm.collector.server.grpc.GRPCHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class RemoteCommonServiceHandler extends RemoteCommonServiceGrpc.RemoteCommonServiceImplBase implements GRPCHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(RemoteCommonServiceHandler.class);
|
||||
|
||||
private final RemoteDataMappingContainer container;
|
||||
private final DataReceiverRegisterListener listener;
|
||||
|
||||
public RemoteCommonServiceHandler(RemoteDataMappingContainer container, DataReceiverRegisterListener listener) {
|
||||
this.container = container;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override public StreamObserver<RemoteMessage> call(StreamObserver<Empty> responseObserver) {
|
||||
return new StreamObserver<RemoteMessage>() {
|
||||
@Override public void onNext(RemoteMessage message) {
|
||||
String roleName = message.getWorkerRole();
|
||||
RemoteData remoteData = message.getRemoteData();
|
||||
listener.getDataReceiver().receive(roleName, container.get(remoteData.getMappingId()).deserialize(remoteData));
|
||||
}
|
||||
|
||||
@Override public void onError(Throwable throwable) {
|
||||
logger.error(throwable.getMessage(), throwable);
|
||||
}
|
||||
|
||||
@Override public void onCompleted() {
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
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,50 @@
|
|||
/*
|
||||
* 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.grpc.service;
|
||||
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMapping;
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMappingContainer;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteData;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteMessage;
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteClient;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GRPCRemoteClient implements RemoteClient {
|
||||
|
||||
private final RemoteDataMappingContainer container;
|
||||
private final StreamObserver<RemoteMessage> streamObserver;
|
||||
|
||||
public GRPCRemoteClient(RemoteDataMappingContainer container, StreamObserver<RemoteMessage> streamObserver) {
|
||||
this.container = container;
|
||||
this.streamObserver = streamObserver;
|
||||
}
|
||||
|
||||
@Override public void send(String roleName, Data data, RemoteDataMapping mapping) {
|
||||
RemoteData remoteData = (RemoteData)container.get(mapping.ordinal()).serialize(data);
|
||||
RemoteMessage.Builder builder = RemoteMessage.newBuilder();
|
||||
builder.setWorkerRole(roleName);
|
||||
builder.setRemoteData(remoteData);
|
||||
|
||||
streamObserver.onNext(builder.build());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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.grpc.service;
|
||||
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import org.skywalking.apm.collector.client.ClientException;
|
||||
import org.skywalking.apm.collector.client.grpc.GRPCClient;
|
||||
import org.skywalking.apm.collector.remote.RemoteDataMappingContainer;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.Empty;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteCommonServiceGrpc;
|
||||
import org.skywalking.apm.collector.remote.grpc.proto.RemoteMessage;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteClient;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteClientService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GRPCRemoteClientService implements RemoteClientService {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(GRPCRemoteClientService.class);
|
||||
|
||||
private final RemoteDataMappingContainer container;
|
||||
|
||||
public GRPCRemoteClientService(RemoteDataMappingContainer container) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Override public RemoteClient create(String host, int port) {
|
||||
GRPCClient client = new GRPCClient(host, port);
|
||||
try {
|
||||
client.initialize();
|
||||
} catch (ClientException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
RemoteCommonServiceGrpc.RemoteCommonServiceStub stub = RemoteCommonServiceGrpc.newStub(client.getChannel());
|
||||
StreamObserver<RemoteMessage> streamObserver = createStreamObserver(stub);
|
||||
return new GRPCRemoteClient(container, streamObserver);
|
||||
}
|
||||
|
||||
private StreamObserver<RemoteMessage> createStreamObserver(RemoteCommonServiceGrpc.RemoteCommonServiceStub stub) {
|
||||
StreamStatus status = new StreamStatus(false);
|
||||
return stub.call(new StreamObserver<Empty>() {
|
||||
@Override public void onNext(Empty empty) {
|
||||
}
|
||||
|
||||
@Override public void onError(Throwable throwable) {
|
||||
logger.error(throwable.getMessage(), throwable);
|
||||
}
|
||||
|
||||
@Override public void onCompleted() {
|
||||
status.finished();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class StreamStatus {
|
||||
private volatile boolean status;
|
||||
|
||||
public StreamStatus(boolean status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public boolean isFinish() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void finished() {
|
||||
this.status = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maxTimeout max wait time, milliseconds.
|
||||
*/
|
||||
public void wait4Finish(long maxTimeout) {
|
||||
long time = 0;
|
||||
while (!status) {
|
||||
if (time > maxTimeout) {
|
||||
break;
|
||||
}
|
||||
try2Sleep(5);
|
||||
time += 5;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to sleep, and ignore the {@link InterruptedException}
|
||||
*
|
||||
* @param millis the length of time to sleep in milliseconds
|
||||
*/
|
||||
private void try2Sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package org.skywalking.apm.collector.remote.grpc.service;
|
||||
|
||||
import org.skywalking.apm.collector.remote.service.DataReceiver;
|
||||
import org.skywalking.apm.collector.remote.service.DataReceiverRegisterListener;
|
||||
import org.skywalking.apm.collector.remote.service.RemoteServerService;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GRPCRemoteServerService implements RemoteServerService {
|
||||
|
||||
private DataReceiverRegisterListener listener;
|
||||
|
||||
public GRPCRemoteServerService(DataReceiverRegisterListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override public void registerReceiver(DataReceiver receiver) {
|
||||
listener.setDataReceiver(receiver);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
syntax = "proto3";
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_package = "org.skywalking.apm.collector.remote.grpc.proto";
|
||||
|
||||
service RemoteCommonService {
|
||||
rpc call (stream RemoteMessage) returns (Empty) {
|
||||
}
|
||||
}
|
||||
|
||||
message RemoteMessage {
|
||||
string workerRole = 1;
|
||||
RemoteData remoteData = 2;
|
||||
}
|
||||
|
||||
message RemoteData {
|
||||
int32 mappingId = 1;
|
||||
int32 stringCapacity = 2;
|
||||
int32 longCapacity = 3;
|
||||
int32 doubleCapacity = 4;
|
||||
int32 integerCapacity = 5;
|
||||
int32 byteCapacity = 6;
|
||||
int32 booleanCapacity = 7;
|
||||
repeated string dataStrings = 8;
|
||||
repeated int64 dataLongs = 9;
|
||||
repeated double dataDoubles = 10;
|
||||
repeated int32 dataIntegers = 11;
|
||||
repeated bytes dataBytes = 12;
|
||||
repeated bool dataBooleans = 13;
|
||||
}
|
||||
|
||||
message Empty {
|
||||
}
|
||||
|
|
@ -22,6 +22,11 @@
|
|||
<artifactId>apm-collector-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-cluster-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>client-component</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* 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.storage;
|
||||
|
||||
import org.skywalking.apm.collector.core.CollectorException;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class Attribute {
|
||||
private final String name;
|
||||
private final AttributeType type;
|
||||
private final Operation operation;
|
||||
|
||||
public Attribute(String name, AttributeType type, Operation operation) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public AttributeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Operation getOperation() {
|
||||
return operation;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public enum AttributeType {
|
||||
STRING, LONG, DOUBLE, INTEGER, BYTE, BOOLEAN
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CommonTable {
|
||||
public static final String TABLE_TYPE = "type";
|
||||
public static final String COLUMN_ID = "id";
|
||||
public static final String COLUMN_AGG = "agg";
|
||||
public static final String COLUMN_TIME_BUCKET = "time_bucket";
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public abstract class DataDefine {
|
||||
private Attribute[] attributes;
|
||||
private int stringCapacity;
|
||||
private int longCapacity;
|
||||
private int doubleCapacity;
|
||||
private int integerCapacity;
|
||||
private int booleanCapacity;
|
||||
private int byteCapacity;
|
||||
|
||||
public DataDefine() {
|
||||
initial();
|
||||
}
|
||||
|
||||
private void initial() {
|
||||
attributes = new Attribute[initialCapacity()];
|
||||
attributeDefine();
|
||||
for (Attribute attribute : attributes) {
|
||||
if (AttributeType.STRING.equals(attribute.getType())) {
|
||||
stringCapacity++;
|
||||
} else if (AttributeType.LONG.equals(attribute.getType())) {
|
||||
longCapacity++;
|
||||
} else if (AttributeType.DOUBLE.equals(attribute.getType())) {
|
||||
doubleCapacity++;
|
||||
} else if (AttributeType.INTEGER.equals(attribute.getType())) {
|
||||
integerCapacity++;
|
||||
} else if (AttributeType.BOOLEAN.equals(attribute.getType())) {
|
||||
booleanCapacity++;
|
||||
} else if (AttributeType.BYTE.equals(attribute.getType())) {
|
||||
byteCapacity++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void addAttribute(int position, Attribute attribute) {
|
||||
attributes[position] = attribute;
|
||||
}
|
||||
|
||||
protected abstract int initialCapacity();
|
||||
|
||||
protected abstract void attributeDefine();
|
||||
|
||||
public final Data build(String id) {
|
||||
return new Data(id, stringCapacity, longCapacity, doubleCapacity, integerCapacity, booleanCapacity, byteCapacity);
|
||||
}
|
||||
|
||||
public void mergeData(Data newData, Data oldData) {
|
||||
int stringPosition = 0;
|
||||
int longPosition = 0;
|
||||
int doublePosition = 0;
|
||||
int integerPosition = 0;
|
||||
int booleanPosition = 0;
|
||||
int bytePosition = 0;
|
||||
for (int i = 0; i < initialCapacity(); i++) {
|
||||
Attribute attribute = attributes[i];
|
||||
if (AttributeType.STRING.equals(attribute.getType())) {
|
||||
String stringData = attribute.getOperation().operate(newData.getDataString(stringPosition), oldData.getDataString(stringPosition));
|
||||
newData.setDataString(stringPosition, stringData);
|
||||
stringPosition++;
|
||||
} else if (AttributeType.LONG.equals(attribute.getType())) {
|
||||
Long longData = attribute.getOperation().operate(newData.getDataLong(longPosition), oldData.getDataLong(longPosition));
|
||||
newData.setDataLong(longPosition, longData);
|
||||
longPosition++;
|
||||
} else if (AttributeType.DOUBLE.equals(attribute.getType())) {
|
||||
Double doubleData = attribute.getOperation().operate(newData.getDataDouble(doublePosition), oldData.getDataDouble(doublePosition));
|
||||
newData.setDataDouble(doublePosition, doubleData);
|
||||
doublePosition++;
|
||||
} else if (AttributeType.INTEGER.equals(attribute.getType())) {
|
||||
Integer integerData = attribute.getOperation().operate(newData.getDataInteger(integerPosition), oldData.getDataInteger(integerPosition));
|
||||
newData.setDataInteger(integerPosition, integerData);
|
||||
integerPosition++;
|
||||
} else if (AttributeType.BOOLEAN.equals(attribute.getType())) {
|
||||
Boolean booleanData = attribute.getOperation().operate(newData.getDataBoolean(booleanPosition), oldData.getDataBoolean(booleanPosition));
|
||||
newData.setDataBoolean(booleanPosition, booleanData);
|
||||
booleanPosition++;
|
||||
} else if (AttributeType.BYTE.equals(attribute.getType())) {
|
||||
byte[] byteData = attribute.getOperation().operate(newData.getDataBytes(bytePosition), oldData.getDataBytes(integerPosition));
|
||||
newData.setDataBytes(bytePosition, byteData);
|
||||
bytePosition++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface Operation {
|
||||
String operate(String newValue, String oldValue);
|
||||
|
||||
Long operate(Long newValue, Long oldValue);
|
||||
|
||||
Double operate(Double newValue, Double oldValue);
|
||||
|
||||
Integer operate(Integer newValue, Integer oldValue);
|
||||
|
||||
Boolean operate(Boolean newValue, Boolean oldValue);
|
||||
|
||||
byte[] operate(byte[] newValue, byte[] oldValue);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.storage.define;
|
||||
|
||||
import org.skywalking.apm.collector.remote.service.Data;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public interface Transform<T> {
|
||||
Data toData();
|
||||
|
||||
T toSelf(Data data);
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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.storage.define.operator;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.Operation;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class AddOperation implements Operation {
|
||||
|
||||
@Override public String operate(String newValue, String oldValue) {
|
||||
throw new UnsupportedOperationException("not support string addition operation");
|
||||
}
|
||||
|
||||
@Override public Long operate(Long newValue, Long oldValue) {
|
||||
return newValue + oldValue;
|
||||
}
|
||||
|
||||
@Override public Double operate(Double newValue, Double oldValue) {
|
||||
return newValue + oldValue;
|
||||
}
|
||||
|
||||
@Override public Integer operate(Integer newValue, Integer oldValue) {
|
||||
return newValue + oldValue;
|
||||
}
|
||||
|
||||
@Override public Boolean operate(Boolean newValue, Boolean oldValue) {
|
||||
throw new UnsupportedOperationException("not support boolean addition operation");
|
||||
}
|
||||
|
||||
@Override public byte[] operate(byte[] newValue, byte[] oldValue) {
|
||||
throw new UnsupportedOperationException("not support byte addition operation");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.storage.define.operator;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.Operation;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CoverOperation implements Operation {
|
||||
@Override public String operate(String newValue, String oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override public Long operate(Long newValue, Long oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override public Double operate(Double newValue, Double oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override public Integer operate(Integer newValue, Integer oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override public Boolean operate(Boolean newValue, Boolean oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
@Override public byte[] operate(byte[] newValue, byte[] oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.storage.define.operator;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.Operation;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class NonOperation implements Operation {
|
||||
@Override public String operate(String newValue, String oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override public Long operate(Long newValue, Long oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override public Double operate(Double newValue, Double oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override public Integer operate(Integer newValue, Integer oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override public Boolean operate(Boolean newValue, Boolean oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override public byte[] operate(byte[] newValue, byte[] oldValue) {
|
||||
return oldValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.storage.table.global;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GlobalTraceTable extends CommonTable {
|
||||
public static final String TABLE = "global_trace";
|
||||
public static final String COLUMN_SEGMENT_ID = "segment_id";
|
||||
public static final String COLUMN_GLOBAL_TRACE_ID = "global_trace_id";
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.storage.table.instance;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class InstPerformanceTable extends CommonTable {
|
||||
public static final String TABLE = "instance_performance";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_INSTANCE_ID = "instance_id";
|
||||
public static final String COLUMN_CALLS = "calls";
|
||||
public static final String COLUMN_COST_TOTAL = "cost_total";
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.storage.table.jvm;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class CpuMetricTable extends CommonTable {
|
||||
public static final String TABLE = "cpu_metric";
|
||||
public static final String COLUMN_INSTANCE_ID = "instance_id";
|
||||
public static final String COLUMN_USAGE_PERCENT = "usage_percent";
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.storage.table.jvm;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class GCMetricTable extends CommonTable {
|
||||
public static final String TABLE = "gc_metric";
|
||||
public static final String COLUMN_INSTANCE_ID = "instance_id";
|
||||
public static final String COLUMN_PHRASE = "phrase";
|
||||
public static final String COLUMN_COUNT = "count";
|
||||
public static final String COLUMN_TIME = "time";
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.storage.table.jvm;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class MemoryMetricTable extends CommonTable {
|
||||
public static final String TABLE = "memory_metric";
|
||||
public static final String COLUMN_APPLICATION_INSTANCE_ID = "application_instance_id";
|
||||
public static final String COLUMN_IS_HEAP = "is_heap";
|
||||
public static final String COLUMN_INIT = "init";
|
||||
public static final String COLUMN_MAX = "max";
|
||||
public static final String COLUMN_USED = "used";
|
||||
public static final String COLUMN_COMMITTED = "committed";
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.storage.table.jvm;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class MemoryPoolMetricTable extends CommonTable {
|
||||
public static final String TABLE = "memory_pool_metric";
|
||||
public static final String COLUMN_INSTANCE_ID = "instance_id";
|
||||
public static final String COLUMN_POOL_TYPE = "pool_type";
|
||||
public static final String COLUMN_INIT = "init";
|
||||
public static final String COLUMN_MAX = "max";
|
||||
public static final String COLUMN_USED = "used";
|
||||
public static final String COLUMN_COMMITTED = "committed";
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.storage.table.node;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class NodeComponentTable extends CommonTable {
|
||||
public static final String TABLE = "node_component";
|
||||
public static final String COLUMN_COMPONENT_ID = "component_id";
|
||||
public static final String COLUMN_COMPONENT_NAME = "component_name";
|
||||
public static final String COLUMN_PEER = "peer";
|
||||
public static final String COLUMN_PEER_ID = "peer_id";
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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.storage.table.node;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class NodeMappingTable extends CommonTable {
|
||||
public static final String TABLE = "node_mapping";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_ADDRESS_ID = "address_id";
|
||||
public static final String COLUMN_ADDRESS = "address";
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.storage.table.noderef;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class NodeReferenceTable extends CommonTable {
|
||||
public static final String TABLE = "node_reference";
|
||||
public static final String COLUMN_FRONT_APPLICATION_ID = "front_application_id";
|
||||
public static final String COLUMN_BEHIND_APPLICATION_ID = "behind_application_id";
|
||||
public static final String COLUMN_BEHIND_PEER = "behind_peer";
|
||||
public static final String COLUMN_S1_LTE = "s1_lte";
|
||||
public static final String COLUMN_S3_LTE = "s3_lte";
|
||||
public static final String COLUMN_S5_LTE = "s5_lte";
|
||||
public static final String COLUMN_S5_GT = "s5_gt";
|
||||
public static final String COLUMN_SUMMARY = "summary";
|
||||
public static final String COLUMN_ERROR = "error";
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.storage.table.register;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ApplicationTable extends CommonTable {
|
||||
public static final String TABLE = "application";
|
||||
public static final String COLUMN_APPLICATION_CODE = "application_code";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.storage.table.register;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class InstanceTable extends CommonTable {
|
||||
public static final String TABLE = "instance";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_AGENT_UUID = "agent_uuid";
|
||||
public static final String COLUMN_REGISTER_TIME = "register_time";
|
||||
public static final String COLUMN_INSTANCE_ID = "instance_id";
|
||||
public static final String COLUMN_HEARTBEAT_TIME = "heartbeat_time";
|
||||
public static final String COLUMN_OS_INFO = "os_info";
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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.storage.table.register;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceNameTable extends CommonTable {
|
||||
public static final String TABLE = "service_name";
|
||||
public static final String COLUMN_SERVICE_NAME = "service_name";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_SERVICE_ID = "service_id";
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.storage.table.segment;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class SegmentCostTable extends CommonTable {
|
||||
public static final String TABLE = "segment_cost";
|
||||
public static final String COLUMN_SEGMENT_ID = "segment_id";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_START_TIME = "start_time";
|
||||
public static final String COLUMN_END_TIME = "end_time";
|
||||
public static final String COLUMN_SERVICE_NAME = "service_name";
|
||||
public static final String COLUMN_COST = "cost";
|
||||
public static final String COLUMN_IS_ERROR = "is_error";
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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.storage.table.segment;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class SegmentTable extends CommonTable {
|
||||
public static final String TABLE = "segment";
|
||||
public static final String COLUMN_DATA_BINARY = "data_binary";
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.storage.table.service;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceEntryTable extends CommonTable {
|
||||
public static final String TABLE = "service_entry";
|
||||
public static final String COLUMN_APPLICATION_ID = "application_id";
|
||||
public static final String COLUMN_ENTRY_SERVICE_ID = "entry_service_id";
|
||||
public static final String COLUMN_ENTRY_SERVICE_NAME = "entry_service_name";
|
||||
public static final String COLUMN_REGISTER_TIME = "register_time";
|
||||
public static final String COLUMN_NEWEST_TIME = "newest_time";
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.storage.table.serviceref;
|
||||
|
||||
import org.skywalking.apm.collector.storage.define.CommonTable;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceReferenceTable extends CommonTable {
|
||||
public static final String TABLE = "service_reference";
|
||||
public static final String COLUMN_ENTRY_SERVICE_ID = "entry_service_id";
|
||||
public static final String COLUMN_ENTRY_SERVICE_NAME = "entry_service_name";
|
||||
public static final String COLUMN_FRONT_SERVICE_ID = "front_service_id";
|
||||
public static final String COLUMN_FRONT_SERVICE_NAME = "front_service_name";
|
||||
public static final String COLUMN_BEHIND_SERVICE_ID = "behind_service_id";
|
||||
public static final String COLUMN_BEHIND_SERVICE_NAME = "behind_service_name";
|
||||
public static final String COLUMN_S1_LTE = "s1_lte";
|
||||
public static final String COLUMN_S3_LTE = "s3_lte";
|
||||
public static final String COLUMN_S5_LTE = "s5_lte";
|
||||
public static final String COLUMN_S5_GT = "s5_gt";
|
||||
public static final String COLUMN_SUMMARY = "summary";
|
||||
public static final String COLUMN_COST_SUMMARY = "cost_summary";
|
||||
public static final String COLUMN_ERROR = "error";
|
||||
}
|
||||
|
|
@ -28,5 +28,10 @@
|
|||
<artifactId>client-component</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skywalking</groupId>
|
||||
<artifactId>collector-remote-define</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -67,7 +67,7 @@ public class UIModuleJettyProvider extends ModuleProvider {
|
|||
jettyServer.addHandler(new ApplicationsGetHandler());
|
||||
|
||||
ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
|
||||
moduleRegisterService.register(UIModule.NAME, this.name(), new UIModuleRegistration(host, port, contextPath));
|
||||
moduleRegisterService.register(UIModule.NAME, this.name(), new UIModuleJettyRegistration(host, port, contextPath));
|
||||
|
||||
UIJettyNamingListener namingListener = new UIJettyNamingListener();
|
||||
ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ import org.skywalking.apm.collector.cluster.ModuleRegistration;
|
|||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class UIModuleRegistration extends ModuleRegistration {
|
||||
public class UIModuleJettyRegistration extends ModuleRegistration {
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
private final String contextPath;
|
||||
|
||||
public UIModuleRegistration(String host, int port, String contextPath) {
|
||||
public UIModuleJettyRegistration(String host, int port, String contextPath) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.contextPath = contextPath;
|
||||
Loading…
Reference in New Issue