-
Notifications
You must be signed in to change notification settings - Fork 847
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
Add Information to TraceState Without Creating Span #6456
Comments
This sounds like more a use-case for Baggage, rather than trying to modify the TraceState. It is unlikely that we would allow the Java TraceState to be mutable without a preponderance of evidence that there is a use-case for it from multiple sources. Your is the first ask I have seen for this. I recommend using Baggage for this sort of operation, as it can be propagated whether or not there is a Span at all in the Context, rather than trying to put something into the W3C TraceState. Note this comment in the Javadoc for TraceState:
Changing this requirement for immutability would potentially be a breaking change, and would necessitate going to version 2 of the APIs, which we would like to avoid at all reasonable cost. |
I don't read Go well, but that Go method looks like it returns a new TraceState object as opposed to mutating a TraceState. the same is possible in Java using:
btw, the immutability that @jkwatson mentions above is required by the specification itself:
|
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Any update on this issue? I also need the requirement to add the tracestate key value pair. |
hi @shahparthiv! since this issue is closed, can you open a new one and include more details about your use case and why #6456 (comment) doesn't work for you? thanks |
Is your feature request related to a problem? Please describe.
I'm in need of a way to modify the trace state to add a custom key/value pair.
From what I can tell adding information to the
TraceState
requires either 1) hooking into the trace sampling mechanism or 2) creating a new span. Outside of those two use cases there does not appear to be a way to modify the trace state. My use case a customSpanProcessor
within an agent extension so neither of the above use cases applies.Describe the solution you'd like
A mechanism to append information to the trace state without creating a new
Span
. Perhaps aaddToTraceState
method could be added to theReadWriteSpan
interface so the details of modifying the internalTraceState
field could be encapsulated and the integrity of theTraceState
protected.Describe alternatives you've considered
There does not appear to be an alternative way to modify the trace state within the Java SDK. Currently the
Context
is used to propagate information to downstream services, but my understanding is theContext
fields are not guaranteed to be retained if the custom extension I'm developing is not configured on a intermediary service.Additional context
I'm attempting to develop a custom agent extension in which a decision made when considering the root span needs to be available to all participating services downstream in the trace. At the moment the extension is implemented as a custom
SpanProcessor
where the decision is made andTextMapPropagator
where the information encoded/decoded using theContext
as necessary. This setup works but does require every participating service to be configured to use the custom extension. It would be ideal if the information could be retained in the event that a service is not using the custom extension.Other language implementations do allow for explicit modification of the trace state. See golang for a specific example.
The text was updated successfully, but these errors were encountered: