0

I have two basic Springboot microservices and I am using Jaeger. Lets say two services are foo and bar. I am able to send User-Agent header from foo to bar service using Tracing Baggage property.

From foo service, I will be calling bar service using localhost:port as of now.

The users will also send an x-api-key header in the request. This header is not being forward from foo to bar service.

This is my code snippet,

public ResponseEntity<String> fooService(@RequestHeader("User-Agent") String userAgent, @RequestHeader(value="x-api-key", required = false) String apikeyHeader) {
        try {
            /**
             * Set baggage
             */
            tracer.activeSpan().setBaggageItem("user-agent", userAgent);

            if (apikeyHeader != null && !apikeyHeader.isEmpty()) {
                tracer.activeSpan().setBaggageItem("x-api-key", apikeyHeader);
            }

On the logs of my bar service, it is receiving these headers, uberctx-user-agent and uberctx-x-api-key

I am not sure why uber-ctx-* is appended, I only want x-api-key header to be forwarded.

John Seen
  • 701
  • 4
  • 15
  • 31

1 Answers1

0

Setting a baggage item is not the same as setting an HTTP header. You should use your HTTP client (not shown in your example) to set the HTTP header.

Baggage items might or not be available as individual HTTP headers: it's a detail implementation of the underlying tracer, such as Jaeger's.

jpkroehling
  • 13,881
  • 1
  • 37
  • 39