0

I would like to propagate the request-foo header value received in a service (foo) to another header header-bar for service (bar). I would like to leverage sleuth/brave instrumentation for this without including it into the business logic

foo-service --------> HTTP ------> bar-service (request-foo) (request-bar)

There is already support in Sleuth and Brave for propagation when the header names match. For example by setting in the foo-service the following

spring.sleuth.propagation-keys=request-foo

This would propagate the request-foo header value to bar-service with the request-foo header name.

Unfortunately, in my case, I have no control over the bar-service and it expects the header value as request-bar and also no control to rename request-foo header name because the foo-service receives it also from an upstream service.

I was thinking to provide an Injector similar to the ExtraFieldInjector but is not extendable the ExtraFieldPropagation, so I would need to provide my own Propagation implementation.

Wondering do I miss something? Is there an easier approach?

Thank you.

Zoltan Altfatter
  • 802
  • 2
  • 11
  • 25
  • I don't really understand. It should be enough to pass the extra propagation and it should be put in the headers. Is it not working? – Marcin Grzejszczak Nov 07 '18 at 09:26
  • Yes, it works if the header names are the same. In my case the header names are not the same, the bar-service expects the header value as request-bar and the foo-service receives the value in the request-foo header. How to propagate this way the correlation id? – Zoltan Altfatter Nov 08 '18 at 10:10
  • 1
    You can create your own HttpParser bean and parse the request in the way you want to – Marcin Grzejszczak Nov 08 '18 at 10:30

0 Answers0