From 752d19309bc5321c924d1a05cc39c1366a63f376 Mon Sep 17 00:00:00 2001 From: pengys5 <8082209@qq.com> Date: Sun, 3 Sep 2017 23:29:42 +0800 Subject: [PATCH] Segment no entry span that will save a error entry service data --- .../worker/service/entry/ServiceEntrySpanListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java index aa60baa2e..d0c144f77 100644 --- a/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java +++ b/apm-collector/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java @@ -29,6 +29,7 @@ public class ServiceEntrySpanListener implements RefsListener, FirstSpanListener private int applicationId; private int entryServiceId; private String entryServiceName; + private boolean hasEntry = false; @Override public void parseEntry(SpanObject spanObject, int applicationId, int applicationInstanceId, String segmentId) { @@ -39,6 +40,7 @@ public class ServiceEntrySpanListener implements RefsListener, FirstSpanListener } else { this.entryServiceName = ServiceCache.getServiceName(this.entryServiceId); } + this.hasEntry = true; } @Override public void parseRef(TraceSegmentReference reference, int applicationId, int applicationInstanceId, @@ -54,7 +56,7 @@ public class ServiceEntrySpanListener implements RefsListener, FirstSpanListener @Override public void build() { logger.debug("entry service listener build"); StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - if (!hasReference) { + if (!hasReference && hasEntry) { ServiceEntryDataDefine.ServiceEntry serviceEntry = new ServiceEntryDataDefine.ServiceEntry(); serviceEntry.setId(applicationId + Const.ID_SPLIT + entryServiceName); serviceEntry.setApplicationId(applicationId);