This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch adjust-network-proto in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/adjust-network-proto by this push: new ef284dc Make the applicationCodeRegister only for single code. ef284dc is described below commit ef284dc6d504c2f5246ebd18588476cab97274c1 Author: wusheng <wu.sh...@foxmail.com> AuthorDate: Thu Jan 4 23:07:49 2018 +0800 Make the applicationCodeRegister only for single code. --- .../grpc/provider/handler/ApplicationRegisterServiceHandler.java | 8 ++++---- .../apm-network/src/main/proto/ApplicationRegisterService.proto | 6 +++--- .../apm/agent/core/remote/AppAndServiceRegisterClient.java | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java index e04aa22..2a063b2 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/ApplicationRegisterServiceHandler.java @@ -24,7 +24,7 @@ import org.apache.skywalking.apm.collector.analysis.register.define.service.IApp import org.apache.skywalking.apm.collector.core.module.ModuleManager; import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler; import org.apache.skywalking.apm.network.proto.Application; -import org.apache.skywalking.apm.network.proto.ApplicationMappings; +import org.apache.skywalking.apm.network.proto.ApplicationMapping; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; import org.apache.skywalking.apm.network.proto.KeyWithIntegerValue; import org.slf4j.Logger; @@ -44,16 +44,16 @@ public class ApplicationRegisterServiceHandler extends ApplicationRegisterServic } @Override - public void applicationCodeRegister(Application request, StreamObserver<ApplicationMappings> responseObserver) { + public void applicationCodeRegister(Application request, StreamObserver<ApplicationMapping> responseObserver) { logger.debug("register application"); - ApplicationMappings.Builder builder = ApplicationMappings.newBuilder(); + ApplicationMapping.Builder builder = ApplicationMapping.newBuilder(); String applicationCode = request.getApplicationCode(); int applicationId = applicationIDService.getOrCreateForApplicationCode(applicationCode); if (applicationId != 0) { KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build(); - builder.addApplications(value); + builder.setApplication(value); } responseObserver.onNext(builder.build()); responseObserver.onCompleted(); diff --git a/apm-protocol/apm-network/src/main/proto/ApplicationRegisterService.proto b/apm-protocol/apm-network/src/main/proto/ApplicationRegisterService.proto index c47875e..e5b4dee 100644 --- a/apm-protocol/apm-network/src/main/proto/ApplicationRegisterService.proto +++ b/apm-protocol/apm-network/src/main/proto/ApplicationRegisterService.proto @@ -7,7 +7,7 @@ import "KeyWithIntegerValue.proto"; //register service for ApplicationCode, this service is called when service starts. service ApplicationRegisterService { - rpc applicationCodeRegister (Application) returns (ApplicationMappings) { + rpc applicationCodeRegister (Application) returns (ApplicationMapping) { } } @@ -15,6 +15,6 @@ message Application { string applicationCode = 1; } -message ApplicationMappings { - repeated KeyWithIntegerValue applications = 1; +message ApplicationMapping { + KeyWithIntegerValue application = 1; } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java index 800f3d4..db5b3d9 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java @@ -41,7 +41,7 @@ import org.apache.skywalking.apm.network.proto.Application; import org.apache.skywalking.apm.network.proto.ApplicationInstance; import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat; import org.apache.skywalking.apm.network.proto.ApplicationInstanceMapping; -import org.apache.skywalking.apm.network.proto.ApplicationMappings; +import org.apache.skywalking.apm.network.proto.ApplicationMapping; import org.apache.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; import org.apache.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc; import org.apache.skywalking.apm.network.proto.NetworkAddressRegisterServiceGrpc; @@ -109,10 +109,10 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList try { if (RemoteDownstreamConfig.Agent.APPLICATION_ID == DictionaryUtil.nullValue()) { if (applicationRegisterServiceBlockingStub != null) { - ApplicationMappings applicationMapping = applicationRegisterServiceBlockingStub.applicationCodeRegister( + ApplicationMapping applicationMapping = applicationRegisterServiceBlockingStub.applicationCodeRegister( Application.newBuilder().setApplicationCode(Config.Agent.APPLICATION_CODE).build()); - if (applicationMapping.getApplicationsCount() > 0) { - RemoteDownstreamConfig.Agent.APPLICATION_ID = applicationMapping.getApplications(0).getValue(); + if (applicationMapping != null) { + RemoteDownstreamConfig.Agent.APPLICATION_ID = applicationMapping.getApplication().getValue(); shouldTry = true; } } -- To stop receiving notification emails like this one, please contact ['"commits@skywalking.apache.org" <commits@skywalking.apache.org>'].