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
feat: support TraceState in SamplingResult #3530
feat: support TraceState in SamplingResult #3530
Changes from 7 commits
177931d
c709487
af52040
467b282
e008229
a886d08
861adce
11e8265
c4f174b
5527f6d
ac2bc02
3aae7ee
b45c670
3099265
b51fdea
a27dbac
6573804
c5526fa
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.
I think this depends on how you define empty tracestate.
I would interpret
new TraceState()
as empty and this is working as specified.not interpreting
samplingResult.traceState == null
sounds correct to me and not just a backward compat solution.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.
Would it make sense to handle null given the same can be done by passing the result of
createTraceState
? It's shorter but I don't remember seeing null anywhere else in the API.Either way agreed the comment isn't great, and the behaviour should probably also be described in the new field's doc comment.
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 don't think we should add special handling for
null
. I used== null
above which includesnull
andundefined
like the??
operator used in your change.If a sampler want's to clear the TraceState it should return an empty instance by calling
api.createTraceState()
.But I would expect that a sample is usually not clearing the whole TraceState as it may contain arbitrary keys not related to sampling. Instead I assume they only set/clear/update sampler specific keys like the
ot
key used by consistent probability samplers.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.
Gotcha, so the behaviour should already be correct. I updated the comments.