-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Change X-Trace-Id response header in favour of "traceresponse" #44431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bclozel Wouldn't it make sense make the header name configurable? Additionally, is there a reason for not supporting this for WebFlux? |
I'm not sure I understand; how would that work?
No, I'm working on it. We were just waiting for community feedback before expanding support. |
Instead of using this constant here: Lines 38 to 40 in 4c37267
The filter gets a bean property traceIdHeaderName that is being populated by ObservationFilterConfigurations from a new property, something like management.observations.http.server.requests.trace-header-name=x-my-custom-trace-id-header-name .
I see, thank you. |
@kzander91 but what would be the purpose of changing the header name? |
Sorry, I missed that we're not just discussing header names, but also different header values (i.e. formats). I guess if we're using established header names, it would not make sense to make them customizable, you're right. In my app, I have built a filter myself that exposes the trace id as a response header (under a name I have chosen myself). If this topic was just about exposing the trace id, and the header name was configurable, I could have replaced my own filter with Boot's new filter. |
No worries @kzander91 I was just making sure I didn't miss anything. As for the custom header that was our original intent but we got feedback and apparently that's not what people expect. Hopefully the "traceresponse" will be more adopted in the future. |
Prior to this commit, we added support for the "X-Trace-Id" HTTP response header in spring-projectsgh-40857. This wrote the traceId information for MVC applications, if the `management.observations.http.server.requests.write-trace-header` was set. After receiving feedback from the community, we are revisiting this feature with the following changes: * the header is now "traceresponse" and implements the W3C draft standard, see https://w3c.github.io/trace-context/#trace-context-http-response-headers-format * the property is now "management.observations.http.server.requests.write-traceresponse" * both MVC and WebFlux are now supported Closes spring-projectsgh-44431
Changes are now ready but on hold, as we are discussing with the Micrometer team whether this feature belongs in Micrometer directly. |
The original attempt has been reverted in #44752. The "traceresponse" implementation is quite straightforward. But it sounds like there is no strong consensus in the community nor in the industry about which header and format should be adopted for this. In the meantime, developers can override a protected method in the filter and contribute this as a bean, as seen in spring-projects/spring-framework#30632 (comment). Depending on how things evolve, we might consider this as a Spring Boot feature or Micrometer feature in the future. |
Would users that are asking for this feature share some details about their use case? That may help us understand how to best deliver this feature and how generally applicable the need may be. I haven't seen much shared about the underlying need that's motivated this request. |
I also have the same use case as @kzander91. I was also interested on having the choice of choosing a custom header name because I am using a service which expects a specific header name (different from the default you are proposing). |
Thanks for your feedback @glyiu98 ! If you need a custom header format then you can achieve that already with #44431 (comment) I would be interested to learn more. Can you name the service that is using this header and which format it is expecting? |
Yes indeed, that’s what we currently have in place. We have that constraint because our infra team have setup some analytics events for the API calls which would look for the specific response header “Correlation-Id”, so it was more because of a custom configuration :D |
I'm hoping to get more details about what that means. Presumably you're using a distributed tracing system, which doesn't use the trace ID in the response headers, so I'm wondering how it is being used. I presume it is some other system for some other purpose. |
We received feedback on our new
X-Trace-Id
response header support for Spring Boot 3.5 (see #40857). Instead of using anX-
header we could be considering one of the currently developed drafts.It seems both
traceresponse
andServer-Timing
are being considered at the moment, with no clear guidance from the observability community. As far as I understand,Server-Timing
has the following priorities:Browsers can use this header to include its information in their "Developer tools" tabs to give the full picture of the web page performance: from backend activity to resource loading and HTML rendering. The traceId information would only be useful if this UI is also capable of retrieving and rendering the full trace information in the same context.
I think we'll go with the
traceresponse
header and the related format, as its main goal is toidentify a completed request in a tracing system
, which better aligns with our intent here.The text was updated successfully, but these errors were encountered: