-
Notifications
You must be signed in to change notification settings - Fork 76
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
Document handling of tracestate duplicate keys #548
Comments
Thanks Bastian - assigning to you per our discussion in the Working Group meeting. |
Hey Robert, the intention of the wording in the spec is that there is a difference between receiving a tracestate header and modifying it for sending it downstream. That is, if you add a key to tracestate, you MUST make sure that this key only exists once in the list, no matter if it occurred 0 time, once or multiple times before you modified tracestate. This is what https://w3c.github.io/trace-context/#mutating-the-tracestate-field is about, in particular the sentence "Adding a key/value pair MUST NOT result in the same key being present multiple times." However, if you receive the tracestate header, you are not responsible for validating the uniqueness of tracestate list members, nor are you responsible for removing duplicated headers. But: If you want to, you can. (exact wording: "Finally, vendors MAY also discard duplicate keys that were not generated by them.") Reasoning: Some implementations might not want to spend the computational overhead of even reading/parsing the full tracestate header, and the spec should not force them to do that. OTOH, there are limits for the length of the tracestate keys, and sometimes, implementations may need to drop key value pairs. Allowing to drop key value pairs that are obviously invalid anyway (because of duplicated keys) seems reasonable. I am not sure if this background is helpful? In my opinion, the two pieces of test code you linked to agree with that interpretation. Do you see an issue with these tests? Or was your comment around the aspect that the spec should mandate one specific behavior instead of allowing two behaviors? By the way, you referenced a fork of the spec (coincidentlly, my fork :-) ) at https://github.com/instana/trace-context/blob/master/spec/20-http_request_header_format.md. Forks might be outdated/unmaintained. We recommend to always reference this repository. Use the |
First of all, thanks a lot for your response. I really apricate the amount of effort you put into explaining. The reason I am asking is that I try to double-check if the current behavior (returns an error when there is a duplicate key) of https://pkg.go.dev/go.opentelemetry.io/otel/trace#ParseTraceState is correct. Reference: open-telemetry/opentelemetry-go#4638
How does it play with the following from https://w3c.github.io/trace-context/#combined-header-value:
This fragment feels like duplicates are not really allowed. |
I think this is still in line with what I said earlier about the different responsibilities and perspectives when receiving the header and modifying it yourself. The intent of that paragraph is to explain that participants modifying How about we change
to
Do you think that would clarify this point? |
Yes 👍 |
Participants must not add duplicated tracestate keys, but they are not responsible for cleaning up duplicated tracestate keys that another updstream participant has added. fixes w3c#548
See #552. |
Participants must not add duplicated tracestate keys, but they are not responsible for cleaning up duplicated tracestate keys that another updstream participant has added. fixes w3c#548
Participants must not add duplicated tracestate keys, but they are not responsible for cleaning up duplicated tracestate keys that another updstream participant has added. fixes #548
I think that the following is not clearly defined in https://github.com/w3c/trace-context/blob/master/spec/20-http_request_header_format.md:
trace-context/test/test.py
Lines 563 to 568 in 551a5b0
trace-context/test/tracecontext/tracestate.py
Lines 61 to 63 in 551a5b0
See also #547
The text was updated successfully, but these errors were encountered: