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
[pkg/ottl]Add trace_state.adjusted_count path to span context #36789
base: main
Are you sure you want to change the base?
[pkg/ottl]Add trace_state.adjusted_count path to span context #36789
Changes from 1 commit
291f263
a4ccbcf
a765859
b9e7f27
10a0ecd
d95e209
a680d76
c260e61
569eee8
8f44a8d
4b5f7d2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Is this defined by the sampling spec as a default value? If not we should probably error. It feels like accessing the trace state with an unset "key" is an issue.
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 it does but, IIUC, sampling spec will only apply if the OTel trace state is available and I am not sure if OTel state would always be available - I also don't see anything in the trace state handling.
Assuming that OTel trace state is not always present, if we were to error out when the OTel trace state is nil then the function would be far less useful as I would not want the adjusted count to be
0
in this case. Let me know if this makes sense.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.
If we return an error the
adjusted_count
won't be 0, the statement will fail and be subjected to the configured error mode. Erroring would mean you don't get a value back fromadjusted_count
that is inaccurate - I am worried if we return a default value of 1 that we could be misleading users. Should we default to unknown?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.
Because of tracestate propagation rules that limit the length of the tracestate, It is not an error to fail to find the appropriate values. However, we should return 0 in this case (meaning we have no information regarding adjusted count) rather than 1 (meaning that we have only one representative of this value).
Some users of this API may choose to assume that 0 effectively means 1, but others will prefer to be able to avoid accumulating inaccurate results. I know that means that some people will be forced to add an extra conditional, but I know that both types of users are real.
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.
Sound like that would make it difficult to differentiate between actual zero values and missing values. What do you think about adding the ability to specify a default value for when the value is not known/missing? I guess it would be difficult in with the current design as you can't pass a parameter to a path expression. But it would work well with a function, as prototyped in #36573.
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 like the idea of using unknown but how do we represent this? In the current sampling package we seem to be using
0
to indicate unknown too:opentelemetry-collector-contrib/pkg/sampling/oteltracestate.go
Lines 183 to 188 in 0c8e0fd
+1 on this. The same thing is true for the current sampling package too:
opentelemetry-collector-contrib/pkg/sampling/oteltracestate.go
Lines 183 to 188 in 0c8e0fd
It feels like we need a way to distinguish zero value and unknown value - similar to what is defined in the docs.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.