Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix TraceState to adhere to specs #1502
Fix TraceState to adhere to specs #1502
Changes from 20 commits
4344ce2
ee01f21
a1ea2f9
640809c
a4660b9
39a4e4e
bbba511
c110522
e280fd4
a9eb66f
758bcb5
0e57e9e
af0c284
1687914
f255c5e
bcd433a
476e788
9e9a563
9a23c74
98a8e3d
883e80e
ae755d8
e2102d5
8cedb93
c89b7b6
c125fee
f5f7870
8ebe62c
df39956
e9deabe
344b6d6
dea21fd
2fb93c9
f85aa23
6234ae1
9a6ca2a
80a981e
26aa976
e72294a
233e15f
af7de36
2ff5aae
246f4a7
3f88937
4013599
09cd2c8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports shouldn't be named with underscore prefixes right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are for internal use and should have leading underscore. Ideally users should only rely on
TraceState
andinject/extract
API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should keep the previous behaviour and have
TraceState
be the actual dictionary, instead of having to construct aTraceState
object?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make the
TraceState
to be mutable by anyone and insertion order remembering is not a language feature untilpython3.7
. Specs says it should be immutable list of string key/value pairs, and all mutable operations (through add, update, delete) should validate the inputs and return a newTraceState
and order of pairs should always be preserved.API should provide the
add
,update
,delete
operations. To achieve this we would still need to inherit from mapping and implement them. In case if we consider to drop support for lower python versions we should override__setitem__
and__delitem__
to not allow mutating directly. Keeping all this in mind, I think we should haveTraceState
object and it wouldn't be feasible to follow spec with actual dictionary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not super familiar with the tracestate spec; do we need some escaping in the values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From W3C Trace Context spec
If I understand it correctly we don't need to do any escaping as this header will be ASCII only which is totally fine with HTTP Headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have util like
_is_valid_pair()
, why not have ais_valid_member()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the mutation operations on trace state should validate the key/value. The member would be in format of
key=value
. If we go withis_valid_member()
we will have construct member from key/value params. If we stick withis_valid_pair
we need to split the member from header to give pair. Either way would be fine.