Reputation: 658
I am trying to implement observations and monitoring in my local application.
I have a question that how is the trace id propagated from one application to another application. specifically how or where can i find the source code (spring or micrometer) which extracts the x-trace-id
, if present, from the request header and sets it to current tracerContext.
Basically i am interested in how the traceId is created.
I read blogs like https://spring.io/blog/2022/10/12/observability-with-spring-boot-3, others, stackoverflow questions and tried reviewing the source code but till i didn't get how its configured.
Upvotes: 0
Views: 601
Reputation: 59056
The base infrastructure for propagation is located in the io.micrometer.observation.transport
package in micrometer-observation.
Each instrumentation that needs propagation over the network will extend one of these classes for the Observation Context implementation. For example, Spring MVC will get the information from request headers and Micrometer will fetch the information from the relevant header (depending on configuration).
Same applies to HTTP clients, JMS, etc.
Upvotes: 0