question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customizing Message Spans sample code in Spring Cloud Sleuth Reference Documentation is incorrect

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wabritcommented, Jan 8, 2021

OK then I think I was just looking at the wrong docs for the sleuth jars I have, so feel free to close.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found