wu-sheng closed pull request #891: Get the MQ server address id from reference.
URL: https://github.com/apache/incubator-skywalking/pull/891
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/refmetric/ServiceReferenceMetricSpanListener.java
 
b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/refmetric/ServiceReferenceMetricSpanListener.java
index 91f502ba7..dc47b0f2a 100644
--- 
a/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/refmetric/ServiceReferenceMetricSpanListener.java
+++ 
b/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/refmetric/ServiceReferenceMetricSpanListener.java
@@ -80,9 +80,8 @@ public void parseEntry(SpanDecorator spanDecorator, int 
applicationId, int insta
                 
serviceReferenceMetric.setFrontServiceId(reference.getParentServiceId());
 
                 if (spanDecorator.getSpanLayer().equals(SpanLayer.MQ)) {
-                    int peerId = spanDecorator.getPeerId();
-                    int applicationIdByPeerId = 
applicationCacheService.getApplicationIdByAddressId(peerId);
-                    int instanceIdByPeerId = 
instanceCacheService.getInstanceIdByAddressId(applicationIdByPeerId, peerId);
+                    int applicationIdByPeerId = 
applicationCacheService.getApplicationIdByAddressId(reference.getNetworkAddressId());
+                    int instanceIdByPeerId = 
instanceCacheService.getInstanceIdByAddressId(applicationIdByPeerId, 
reference.getNetworkAddressId());
                     
serviceReferenceMetric.setFrontInstanceId(instanceIdByPeerId);
                     
serviceReferenceMetric.setFrontApplicationId(applicationIdByPeerId);
                 } else {
diff --git 
a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
 
b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
index c729bf142..f41d2481d 100644
--- 
a/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
+++ 
b/apm-collector/apm-collector-analysis/analysis-segment-parser/segment-parser-provider/src/test/java/org/apache/skywalking/apm/collector/analysis/segment/parser/provider/service/SegmentBase64Printer.java
@@ -35,7 +35,7 @@
     private static final Logger LOGGER = 
LoggerFactory.getLogger(SegmentBase64Printer.class);
 
     public static void main(String[] args) throws 
InvalidProtocolBufferException {
-        String segmentBase64 = 
"CgwKCgIBsv/x1L2vgBsSggEQ////////////ARirnsP1niwg9Z7D9Z4sOhhIMi9KREJJL0Nvbm5lY3Rpb24vY2xvc2VKDGxvY2FsaG9zdDotMVABWAFgBHoOCgdkYi50eXBlEgNzcWx6GQoLZGIuaW5zdGFuY2USCmRhdGFTb3VyY2V6DgoMZGIuc3RhdGVtZW50GP///////////wEgAg==";
+        String segmentBase64 = 
"CgwKCgMXjPKUga3WgBsSvAEIARiF7Jq1nywgp+yatZ8sKlASDAoKAnPAqKD5rNaAGxgBIAIqDjEyNy4wLjAuMTo5MDkyOAJCFC9zZW5kTWVzc2FnZS97Y291bnR9UhQvc2VuZE1lc3NhZ2Uve2NvdW50fTocS2Fma2EvVHJhY2UtdG9waWMtMS9Db25zdW1lclgEYBt6GwoJbXEuYnJva2VyEg4xMjcuMC4wLjE6OTA5MnoZCghtcS50b3BpYxINVHJhY2UtdG9waWMtMRImEP///////////wEY/+uatZ8sILTsmrWfLDD///////////8BUAIYAiAD";
         byte[] binarySegment = Base64.getDecoder().decode(segmentBase64);
         TraceSegmentObject segmentObject = 
TraceSegmentObject.parseFrom(binarySegment);
 
@@ -72,6 +72,15 @@ public static void main(String[] args) throws 
InvalidProtocolBufferException {
             LOGGER.info("       reference:");
             span.getRefsList().forEach(reference -> {
                 LOGGER.info("           EntryApplicationInstanceId: {}", 
reference.getEntryApplicationInstanceId());
+                LOGGER.info("           EntryServiceId: {}", 
reference.getEntryServiceId());
+                LOGGER.info("           EntryServiceName: {}", 
reference.getEntryServiceName());
+                LOGGER.info("           ParentTraceSegmentId: {}", 
reference.getParentTraceSegmentId());
+                LOGGER.info("           ParentSpanId: {}", 
reference.getParentSpanId());
+                LOGGER.info("           ParentApplicationInstanceId: {}", 
reference.getParentApplicationInstanceId());
+                LOGGER.info("           ParentServiceId: {}", 
reference.getParentServiceId());
+                LOGGER.info("           ParentServiceName: {}", 
reference.getParentServiceName());
+                LOGGER.info("           NetworkAddressId: {}", 
reference.getNetworkAddressId());
+                LOGGER.info("           NetworkAddress: {}", 
reference.getNetworkAddress());
             });
         });
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to