for single HTTP request getting Different TraceId's in Micrometer

402 views Asked by At

currently using spring 3.1.2 and getting different traceId for the single request

I have added below dependencies in build gradle:

implementation 'io.micrometer:micrometer-tracing-bridge-brave'

dependency tree:

  +--- io.micrometer:micrometer-tracing-bridge-brave -> 1.1.3
|    +--- io.micrometer:micrometer-tracing:1.1.3
|    |    +--- io.micrometer:micrometer-observation:1.11.2 (*)
|    |    +--- io.micrometer:context-propagation:1.0.4
|    |    \--- aopalliance:aopalliance:1.0
|    +--- org.slf4j:slf4j-api:1.7.36 -> 2.0.7
|    +--- io.zipkin.brave:brave:5.14.1 -> 5.15.1
|    +--- io.zipkin.brave:brave-context-slf4j:5.14.1 -> 5.15.1
|    |    \--- io.zipkin.brave:brave:5.15.1
|    +--- io.zipkin.brave:brave-instrumentation-http:5.14.1 -> 5.15.1
|    |    \--- io.zipkin.brave:brave:5.15.1
|    \--- io.zipkin.aws:brave-propagation-aws:0.23.4
|         \--- io.zipkin.brave:brave:5.13.7 -> 5.15.1

Application.yml

management:
      tracing: # All traces should be sent to latency analysis tool
        sampling:
            probability: 1.0

Service code:

private final io.micrometer.tracing.Tracer tracer;

return Optional.ofNullable(tracer.currentSpan()) .map(span -> span.context().traceId()) .orElseGet(() -> UUID.randomUUID().toString())

Main class:

public static void main(String[] args) {
        Hooks.enableAutomaticContextPropagation();
        SpringApplication.run(CalcApiApplication.class, args);

am I missing any other configuration on application yml like management.tracing.propagation or any?

0

There are 0 answers