Skip to content

traceId / spanId generated are changed post WebClient call #2075

@syedyusufh

Description

@syedyusufh

We 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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions