Getting the http.route to be sent in headers to downstream calls. #12752
Unanswered
ananthcodekarma
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to build a service graph and I would like to send some data based on the 'http.route' attribute in the call. The flow works like this.
Java 8+ on SpringBoot 2.5+
Step 1: Read the 'X-Custom-Header' value from the input request header and save it in the context. If the header is not present, just assume it to be empty.
Step 2: Get the http.route value from the span. This tell the Controller's path that was invoked as a part of the request.
Step 3: Create a new header which takes in the X-Custom-Header read in the input and the http.route of the span attribute and pass it as a new X-Custom-Header in any downstream calls.
This is done in every service in the service graph.
TextMapPropagator
interface. I was able to extract the header value in theextract
function.http.route
attribute in theinject
method and create a custom header out of it.Now the question.
I am finding no way to access the http.route attribute in the SpanContext. I tried a SpanProcessor but the value is not set till the Span is ended. Unfortunately, all the downstream calls made as a part of serving a request in SpringBoot. So the ControllerSpan is not ended while the Service is read.
I can write a custom agent to extract this value and somehow either store in otem Context of Baggage. But I am thinking if there is a way to do it by an Otem Agent Extension itself.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions