From 36d2a848e949444cd1be0deac683d12a1c6e09fc Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 17 Mar 2018 10:06:24 +0800 Subject: [PATCH] Adds notes about default broker name in messaging --- .../messaging/TracingChannelInterceptor.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java index ac7aa81c1..5cd1c5b52 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptor.java @@ -56,6 +56,20 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter implements ExecutorChannelInterceptor { private static final Log log = LogFactory.getLog(TracingChannelInterceptor.class); + /** + * Using the literal "broker" until we come up with a better solution. + * + *

If the message originated from a binder (consumer binding), there will be different + * headers present (e.g. "KafkaHeaders.RECEIVED_TOPIC" Vs. "AmqpHeaders.CONSUMER_QUEUE" + * (unless the application removes them before sending). These don't represent the broker, + * rather a queue, and in any case the heuristics are not great. At least we might be able + * to tell if this is rabbit or not (ex how spring-rabbit works). We need to think this + * through before making an api, possibly experimenting. + * + *

If the app is outbound only (producer), there's no indication of what type the + * destination broker is. This may hint at a non-manual solution being overwriting the + * remoteServiceName later, similar to how servlet instrumentation lazy set "http.route". + */ private static final String REMOTE_SERVICE_NAME = "broker"; public static TracingChannelInterceptor create(Tracing tracing) {