提交 6e892508 编写于 作者: 彭勇升 pengys 提交者: wu-sheng

Get the MQ server address id from reference. (#891)

上级 f17f69b3
...@@ -80,9 +80,8 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En ...@@ -80,9 +80,8 @@ public class ServiceReferenceMetricSpanListener implements FirstSpanListener, En
serviceReferenceMetric.setFrontServiceId(reference.getParentServiceId()); serviceReferenceMetric.setFrontServiceId(reference.getParentServiceId());
if (spanDecorator.getSpanLayer().equals(SpanLayer.MQ)) { if (spanDecorator.getSpanLayer().equals(SpanLayer.MQ)) {
int peerId = spanDecorator.getPeerId(); int applicationIdByPeerId = applicationCacheService.getApplicationIdByAddressId(reference.getNetworkAddressId());
int applicationIdByPeerId = applicationCacheService.getApplicationIdByAddressId(peerId); int instanceIdByPeerId = instanceCacheService.getInstanceIdByAddressId(applicationIdByPeerId, reference.getNetworkAddressId());
int instanceIdByPeerId = instanceCacheService.getInstanceIdByAddressId(applicationIdByPeerId, peerId);
serviceReferenceMetric.setFrontInstanceId(instanceIdByPeerId); serviceReferenceMetric.setFrontInstanceId(instanceIdByPeerId);
serviceReferenceMetric.setFrontApplicationId(applicationIdByPeerId); serviceReferenceMetric.setFrontApplicationId(applicationIdByPeerId);
} else { } else {
......
...@@ -35,7 +35,7 @@ public class SegmentBase64Printer { ...@@ -35,7 +35,7 @@ public class SegmentBase64Printer {
private static final Logger LOGGER = LoggerFactory.getLogger(SegmentBase64Printer.class); private static final Logger LOGGER = LoggerFactory.getLogger(SegmentBase64Printer.class);
public static void main(String[] args) throws InvalidProtocolBufferException { 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); byte[] binarySegment = Base64.getDecoder().decode(segmentBase64);
TraceSegmentObject segmentObject = TraceSegmentObject.parseFrom(binarySegment); TraceSegmentObject segmentObject = TraceSegmentObject.parseFrom(binarySegment);
...@@ -72,6 +72,15 @@ public class SegmentBase64Printer { ...@@ -72,6 +72,15 @@ public class SegmentBase64Printer {
LOGGER.info(" reference:"); LOGGER.info(" reference:");
span.getRefsList().forEach(reference -> { span.getRefsList().forEach(reference -> {
LOGGER.info(" EntryApplicationInstanceId: {}", reference.getEntryApplicationInstanceId()); 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());
}); });
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册