-
Notifications
You must be signed in to change notification settings - Fork 111
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
Different handling of traceparent #455
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #455 +/- ##
==========================================
- Coverage 43.80% 42.64% -1.16%
==========================================
Files 59 60 +1
Lines 4917 4877 -40
==========================================
- Hits 2154 2080 -74
- Misses 2629 2663 +34
Partials 134 134
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I think I need to make some additional documentation around how this works now. |
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.
Mostly LGTM!! My only concern is about backwards compatibility.
kernelMajor, kernelMinor := ebpf2.KernelVersion() | ||
if kernelMajor > 5 || (kernelMajor == 5 && kernelMinor >= 17) { | ||
p.log.Info("Found Linux kernel later than 5.17, enabling trace information parsing", "major", kernelMajor, "minor", kernelMinor) | ||
loader = loadBpf_tp | ||
if p.cfg.EBPF.BpfDebug { | ||
loader = loadBpf_tp_debug | ||
} | ||
} | ||
|
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.
Nice!
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.
Will this mean that 1.0 users getting Traceparent with kernel versions < 5.17 will stop getting it?
Should we enclose all this code in an if config.TrackRequestHeaders {
?
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.
Yes, good point. I'm not sure what to do there, there's no chance we'll ever be able to implement propagation of traces with userspace parsing of the traceparent, and passing along all of the headers caused a lot of overhead.
I'll implement this suggestion with the config option, it helps us test both paths in Github without having to use VMs.
One other option is to implement an alternative bpf_strstr
with a regular unrolled loop. It won't be able to go for long, but we might have partial support for traceparent if the header is seen in the first 100 bytes or so.
I'll follow-up with a PR to restore the userspace parsing of the tracebuffers for kprobes for older kernels. That way we don't break anything, or maybe I can figure out another way that's less CPU intensive. |
This PR sets the stage for implementing distributed tracing, by changing how we handle the incoming traceparent header field. We process the field on the BPF side and generate the traceID, spanID there so we can let the database match our calls. With this PR the matching of parent/child traces in traces.go is removed.
TODO in this PR:
TODO in follow up PRs: