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

Issue 6037 - Wrapping "invalid" SpanContexts in Span does not preserve SpanContext #6044

Conversation

PeterF778
Copy link
Contributor

See Issue 6037 for context.

@PeterF778 PeterF778 requested a review from a team December 4, 2023 20:49
@@ -81,9 +81,6 @@ static Span wrap(SpanContext spanContext) {
ApiUsageLogger.log("context is null");
return getInvalid();
}
if (!spanContext.isValid()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to make sense to me, but the javadoc above somewhat implies that this behavior:

It will not be exported and all tracing operations are no-op, but it can be used to propagate a valid {@link SpanContext} downstream.

Can we remove the word "valid"?

Also, you could argue this is breaking behavior change, but I don't think so. If you provide an invalid span context (i.e. invalid span id / trace id) but useful TraceFlags / TraceState, you'll still get a Span with an invalid span context back. It would be odd for someone to be relying on the behavior of Span.wrap(SpanContext clearing effectively clearing TraceFlags / TraceState when span id and trace id are invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I fully agree. Furthermore, I think that using valid or invalid with respect to the SpanContext is a bit misleading. The context represents an empty trace (i.e. with no spans yet), and every trace starts from such a context.

Copy link

codecov bot commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3f1b9ed) 91.18% compared to head (de22853) 91.17%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6044      +/-   ##
============================================
- Coverage     91.18%   91.17%   -0.01%     
+ Complexity     5623     5622       -1     
============================================
  Files           618      618              
  Lines         16580    16578       -2     
  Branches       1642     1641       -1     
============================================
- Hits          15118    15115       -3     
  Misses         1013     1013              
- Partials        449      450       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jack-berg jack-berg merged commit 9f3456f into open-telemetry:main Dec 8, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants