Add layer field to event when reporting (#159)

This commit is contained in:
Hoshea Jiang 2022-04-18 16:24:43 +08:00 committed by GitHub
parent 07cc03a35f
commit 65032a9b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -6,6 +6,7 @@ Release Notes.
------------------ ------------------
* Fix `cluster` and `namespace` value duplicated(`namespace` value) in properties report. * Fix `cluster` and `namespace` value duplicated(`namespace` value) in properties report.
* Add layer field to event when reporting.
#### Documentation #### Documentation

@ -1 +1 @@
Subproject commit 667134d08ffd63122062971d320c34e7e10a7c9e Subproject commit f9066463deb7f9d1fbe8110eab3524694b0db298

View File

@ -26,4 +26,8 @@ public class Constants {
public static String EMPTY_STRING = ""; public static String EMPTY_STRING = "";
public static char SERVICE_NAME_PART_CONNECTOR = '|'; public static char SERVICE_NAME_PART_CONNECTOR = '|';
// The name of the layer that represents agent-installed services,
// which is defined at https://github.com/apache/skywalking/blob/85ce1645be53e46286f36c0ea206c60db2d1a716/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java#L30
public static String EVENT_LAYER_NAME = "GENERAL";
} }

View File

@ -41,6 +41,7 @@ import org.apache.skywalking.apm.network.event.v3.Source;
import org.apache.skywalking.apm.network.event.v3.Type; import org.apache.skywalking.apm.network.event.v3.Type;
import static org.apache.skywalking.apm.agent.core.conf.Config.Collector.GRPC_UPSTREAM_TIMEOUT; import static org.apache.skywalking.apm.agent.core.conf.Config.Collector.GRPC_UPSTREAM_TIMEOUT;
import static org.apache.skywalking.apm.agent.core.conf.Constants.EVENT_LAYER_NAME;
import static org.apache.skywalking.apm.agent.core.remote.GRPCChannelStatus.CONNECTED; import static org.apache.skywalking.apm.agent.core.remote.GRPCChannelStatus.CONNECTED;
@DefaultImplementor @DefaultImplementor
@ -78,7 +79,8 @@ public class EventReportServiceClient implements BootService, GRPCChannelListene
.stream() .stream()
.sorted() .sorted()
.collect(Collectors.joining(" ")) .collect(Collectors.joining(" "))
); )
.setLayer(EVENT_LAYER_NAME);
} }
@Override @Override
@ -112,7 +114,8 @@ public class EventReportServiceClient implements BootService, GRPCChannelListene
.setService(Config.Agent.SERVICE_NAME) .setService(Config.Agent.SERVICE_NAME)
.setServiceInstance(Config.Agent.INSTANCE_NAME) .setServiceInstance(Config.Agent.INSTANCE_NAME)
.build() .build()
); )
.setLayer(EVENT_LAYER_NAME);
final StreamObserver<Event> collector = eventServiceStub.collect(new StreamObserver<Commands>() { final StreamObserver<Event> collector = eventServiceStub.collect(new StreamObserver<Commands>() {
@Override @Override