Comments (6)
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 main
branch for the latest version (which might contain unpublished edits that will never make it into a published spec) or the level-2
etc. branches for the respective level of the spec.
from trace-context.
Thanks Bastian - assigning to you per our discussion in the Working Group meeting.
from trace-context.
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
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.
How does it play with the following from https://w3c.github.io/trace-context/#combined-header-value:
Only one entry per key is allowed.
This fragment feels like duplicates are not really allowed.
from trace-context.
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 tracestate
are not supposed to add "their own" key multiple times. But I agree that the phrasing is a bit misleading.
How about we change
Only one entry per key is allowed. For example, if a vendor name is Congo and a trace started in their system and then went through a system named Rojo and later returned to Congo, the tracestate value would not be:
to
Tracing tools are not supposed to add the same header multiple times. For example, if a vendor name is Congo and a trace started in their system and then went through a system named Rojo and later returned to Congo, the tracestate value would not be:
Do you think that would clarify this point?
from trace-context.
Do you think that would clarify this point?
Yes 👍
from trace-context.
How about we change
Only one entry per key is allowed. For example, if a vendor name is Congo and a trace started in their system and then went through a system named Rojo and later returned to Congo, the tracestate value would not be:
to
Tracing tools are not supposed to add the same header multiple times. For example, if a vendor name is Congo and a trace started in their system and then went through a system named Rojo and later returned to Congo, the tracestate value would not be:
See #552.
from trace-context.
Related Issues (20)
- Why should keys be restricted to lowercase ASCII? HOT 7
- Adopt either span-id or parent-id for section headings HOT 4
- When headers should be propagated in browsers should be made more clear HOT 2
- Change the defining document for HTTP from RFC7230 to RFC9110 HOT 2
- Update tests to test Trace Context level 2 by default
- Incorporate Level 2 changes (random trace id flag) into traceresponse header in Level 3
- Add more normative text for flags processing in traceresponse
- Level 3 spec: Update privacy section to include information about traceresponse headers.
- Random part of trace ID should be uniformly distributed HOT 3
- Autopublishing level2/Level3 specs need to work with multiple markdown files HOT 2
- Does this specification define a way to handle retries? HOT 4
- Proposal: Add a "propagation-only-parent" flag to be set to true if parents is a no-tracing service HOT 6
- Proposal: Allow common base64 encoding in tracestate values HOT 5
- Should tracing headers be included in 304 Not Modified responses? HOT 14
- Revisit header name -- Server-Timing vs. traceresponse HOT 9
- Server-timing names HOT 6
- Remove all markdown includes
- Can Traceresponse enable parent-child relationship between browser and server spans?
- Trace Context Extensibility HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trace-context.