Skip to content
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

new SamplingResult spec makes it more expensive/difficult for Samplers that don't want to modify TraceState #1031

Open
jkwatson opened this issue Sep 28, 2020 · 4 comments
Labels
area:sampling Related to trace sampling area:sdk Related to the SDK priority:p3 Lowest priority level release:allowed-for-ga Editorial changes that can still be added before GA since they don't require action by SIGs spec:trace Related to the specification/trace directory

Comments

@jkwatson
Copy link
Contributor

What are you trying to achieve?

Recently merged PR #988 added a field to the SamplingResult API for the modified TraceState. Most samplers (and, indeed, all the built-in samplers) do not modify the TraceState, and hence could previously return one of several constant SamplingResults in almost all cases. Now, every response needs to include the passed in parent TraceState if it doesn't want to modify it. I would like to make it easy to do the most common thing, but possible to do the more complex thing (i.e. modifying the TraceState).

I propose that the SamplingResult be extended to include a boolean field, defaulting to false that signals to the SDK whether a new, updated TraceState is to be used for the Span. So, by default, Samplers will not modify the TraceState.

@Oberon00
Copy link
Member

I propose that the SamplingResult be extended to include a boolean field, defaulting to false

While that may be a possible implementation, I think the spec should be written in a way that avoids going into so much detail. E.g. some languages may prefer something like

type TraceStateUpdate = NewTraceState(TraceState) | KeepParent

as the type for the tracestate in the result instead of returning one. Or in C# you might pass the tracestate as an ref parameter so it can be reassigned but if it is not reassigned it implicitly stays the same.

Agree with the gist of the issue though that it should be made hard to accidentally clear the tracestate and easy to use the parent unmodified.

@arminru arminru added area:sampling Related to trace sampling area:sdk Related to the SDK labels Sep 29, 2020
@andrewhsu andrewhsu added the release:allowed-for-ga Editorial changes that can still be added before GA since they don't require action by SIGs label Sep 29, 2020
@arminru
Copy link
Member

arminru commented Sep 29, 2020

cc @Kanwaldeep @paulosman

@jkwatson
Copy link
Contributor Author

I am very much in favor of the spec being changed to specify the capability of allowing Samplers to modify TraceState, and leave the precise technical details up to the various language implementations.

@andrewhsu andrewhsu added the priority:p3 Lowest priority level label Oct 9, 2020
@andrewhsu
Copy link
Member

from issue triage mtg today, setting as p3 since small backwards-compat change if it comes in before ga since it is just adding a field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:sampling Related to trace sampling area:sdk Related to the SDK priority:p3 Lowest priority level release:allowed-for-ga Editorial changes that can still be added before GA since they don't require action by SIGs spec:trace Related to the specification/trace directory
Projects
None yet
Development

No branches or pull requests

4 participants