spring-micrometermicrometer-tracing

How can I propagate a dynamic header downstream with micrometer tracing?


I have:

Currently, we can set management.tracing.baggage.remote-fields=f-user and expect that the header f-user will be propagated downstream using RestTemplate, RestClient or WebClient.

How can I set up the framework to propagate any header by regexp f-.*?

update:

One obvious way is to do it with MDC but this one is not thread-safe really, it will require configuration for async tasks

The same question I asked on GitHub


Solution

  • I could find a good way to use micrometer-tracing abstractions and I did like this: