traceId / spanId generated are changed post WebClient call
See original GitHub issueWe are using ReactorNettyHttpTracing with our Spring Web + Spring WebFlux + Spring Cloud Sleuth application. The traceId / spanId generated are getting changed post the WebClient call.
Spring Boot v2.6.1 and Spring Cloud v3.1.0
How do we retain the same traceId and spanId for the entire Spring Web request?
@Bean
public ReactorNettyHttpTracing reactorNettyHttpTracing(HttpTracing httpTracing) {
return ReactorNettyHttpTracing.create(httpTracing);
}
WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(tracing.decorateHttpClient(httpClient)))
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.filters(exchangeFilters -> {
exchangeFilters.add(exchangeFilter.logRequest());
exchangeFilters.add(exchangeFilter.logResponse());
}).build();
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (6 by maintainers)
Top Results From Across the Web
traceId / spanId generated are changed post WebClient call
The traceId / spanId generated are getting changed post the WebClient call. Spring Boot v2.6.1 and Spring Cloud v3.1.0.
Read more >Spring Boot and Tracing Calls - The Blog of Ivan Krizsan
The trace id from the request to the circle resource is preserved but a new span id is generated for the request to...
Read more >Tracing messages in Choreography with Sleuth and Zipkin
It runs from request to response. These traceId and spanId propagate through REST calls automatically. You really don't need to do anything ...
Read more >Spring Cloud Sleuth Features
Distributed tracing works by propagating fields inside and across services that connect the trace together: traceId and spanId notably.
Read more >Spring Cloud Sleuth | Auto Configuration for Distributed Tracing
Sleuth is nothing but the tool which was provided by spring cloud, used to generate service calls, the diagnostic context of mapping and...
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
I’m having an almost similar issue with Spring cloud sleuth 3.x.x. I recently upgraded to Spring boot 2.6.6 and Sleuth 3.x.x. After the upgrade I see my HandlerInterceptor class is giving a different traceId in the afterCompletion() method. More info available here
@marcingrzejszczak @syedyusufh Any solution for this problem?
From what I see in this sample https://github.com/syedyusufh/sleuth-web-webflux.git it has nothing to do with
WebClient
. It’s more with the fact that theTraceValve
didn’t properly support async dispatch. That means callingTraceValve
twice with an span attribute already set once would not reuse span but create the new one.