Customizing Message Spans sample code in Spring Cloud Sleuth Reference Documentation is incorrect
See original GitHub issueDescribe the bug
The sample code snippet for use of MessageSpanCustomizer is incorrect in that the return type and first parameter of each overriden method should be SpanCustomizer.
Current docs:
@Component
class MyMessageSpanCustomizer extends DefaultMessageSpanCustomizer {
@Override
public Span customizeHandle(Span spanCustomizer,
Message<?> message, MessageChannel messageChannel) {
return super.customizeHandle(spanCustomizer, message, messageChannel)
.name("changedHandle")
.tag("handleKey", "handleValue")
.tag("channelName", channelName(messageChannel));
}
@Override
public Span.Builder customizeSend(Span.Builder builder,
Message<?> message, MessageChannel messageChannel) {
return super.customizeSend(builder, message, messageChannel)
.name("changedSend")
.tag("sendKey", "sendValue")
.tag("channelName", channelName(messageChannel));
}
}
Suggested fix:
@Component
class MyMessageSpanCustomizer extends DefaultMessageSpanCustomizer {
@Override
public SpanCustomizer customizeHandle(SpanCustomizer spanCustomizer,
Message<?> message, MessageChannel messageChannel) {
return super.customizeHandle(spanCustomizer, message, messageChannel)
.name("changedHandle")
.tag("handleKey", "handleValue")
.tag("channelName", channelName(messageChannel));
}
@Override
public SpanCustomizer customizeSend(SpanCustomizer spanCustomizer,
Message<?> message, MessageChannel messageChannel) {
return super.customizeSend(spanCustomizer, message, messageChannel)
.name("changedSend")
.tag("sendKey", "sendValue")
.tag("channelName", channelName(messageChannel));
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Spring Cloud Sleuth customization
In this section, we describe how to customize various parts of Spring Cloud Sleuth. Please check the appendix for the list of spans,...
Read more >Why does Sleuth log a new Span when it isn't sending a ...
It looks like the Spans C, E and G from the image in the documentation are not there(in the log). I took the...
Read more >Spring Cloud Sleuth - Single Application - Baeldung
This article focuses on using Spring Sleuth for tracing requests within a single application use cases.
Read more >Tracing a Reactive Kotlin App with Spring Cloud Sleuth
This guide will discuss RSocket tracing with Spring Cloud Sleuth and Zipkin. We will ship data to Zipkin through HTTP/REST, Kafka, and RabbitMQ....
Read more >spring-cloud/spring-cloud-sleuth - Gitter
Hi guys, I have spring-cloud-sleuth working in a spring-boot app, ... Unfortunately no spans appear on Zipkin: Anything obvious missing or wrong from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

OK then I think I was just looking at the wrong docs for the sleuth jars I have, so feel free to close.
So 2.2.7 would be https://github.com/spring-cloud/spring-cloud-sleuth/blob/2.2.x/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/messaging/TracingChannelInterceptorTest.java#L459-L481