- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
OTLP trace exporter include W3C trace flags (bits 0–7) in Span.Flags #7438
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
OTLP trace exporter include W3C trace flags (bits 0–7) in Span.Flags #7438
Conversation
| Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@          Coverage Diff          @@
##            main   #7438   +/-   ##
=====================================
  Coverage   86.1%   86.1%           
=====================================
  Files        291     291           
  Lines      25613   25615    +2     
=====================================
+ Hits       22056   22059    +3     
+ Misses      3184    3183    -1     
  Partials     373     373           
 🚀 New features to boost your workflow:
 | 
| @dmathieu can we merge this? Resolving conflicts. | 
| We require 2 approvals. | 
| @flc1125 can you take a look please? | 
| 
 Sorry, I was on vacation recently. Just got back and have been quite busy lately. I need some time. | 
Closes #7436
Span.Flags should include:
Bits 0–7: span’s W3C TraceFlags (e.g., sampled)
Bits 8–9: “has parent isRemote” and “parent isRemote” per OTLP spec
Update the trace exporter to include the span’s W3C trace flags in the lower 8 bits and keep the existing 8–9 isRemote logic.
Conceptually:
For spans: flags := uint32(sd.SpanContext().TraceFlags() & 0xff)
Always set SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK
If sd.Parent().IsRemote(), also set SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK
Assign s.Flags = flags
Apply the same for links using the link’s SpanContext.TraceFlags() for bits 0–7 and the link’s SpanContext.IsRemote() for bits 8–9.