Merge branch '1.3.x'
This commit is contained in:
@@ -81,6 +81,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
final ThreadLocalSpan threadLocalSpan;
|
||||
final TraceContext.Injector<MessageHeaderAccessor> injector;
|
||||
final TraceContext.Extractor<MessageHeaderAccessor> extractor;
|
||||
final boolean integrationObjectSupportPresent;
|
||||
|
||||
TracingChannelInterceptor(Tracing tracing) {
|
||||
this.tracing = tracing;
|
||||
@@ -90,6 +91,9 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
.injector(MessageHeaderPropagation.INSTANCE);
|
||||
this.extractor = tracing.propagation()
|
||||
.extractor(MessageHeaderPropagation.INSTANCE);
|
||||
this.integrationObjectSupportPresent = ClassUtils.isPresent(
|
||||
"org.springframework.integration.context.IntegrationObjectSupport",
|
||||
null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,18 +264,16 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
/**
|
||||
* When an upstream context was not present, lookup keys are unlikely added
|
||||
*/
|
||||
static void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) {
|
||||
void addTags(Message<?> message, SpanCustomizer result, MessageChannel channel) {
|
||||
// TODO topic etc
|
||||
if (channel != null) {
|
||||
result.tag("channel", messageChannelName(channel));
|
||||
}
|
||||
}
|
||||
|
||||
private static String channelName(MessageChannel channel) {
|
||||
private String channelName(MessageChannel channel) {
|
||||
String name = null;
|
||||
if (ClassUtils.isPresent(
|
||||
"org.springframework.integration.context.IntegrationObjectSupport",
|
||||
null)) {
|
||||
if (this.integrationObjectSupportPresent) {
|
||||
if (channel instanceof IntegrationObjectSupport) {
|
||||
name = ((IntegrationObjectSupport) channel).getComponentName();
|
||||
}
|
||||
@@ -285,7 +287,7 @@ public final class TracingChannelInterceptor extends ChannelInterceptorAdapter
|
||||
return name;
|
||||
}
|
||||
|
||||
private static String messageChannelName(MessageChannel channel) {
|
||||
private String messageChannelName(MessageChannel channel) {
|
||||
return SpanNameUtil.shorten(channelName(channel));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user