PoC: bridge Go Auto SDK manual spans#2258
Draft
MrAlias wants to merge 2 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2258 +/- ##
==========================================
- Coverage 69.97% 69.74% -0.23%
==========================================
Files 301 301
Lines 38884 38962 +78
==========================================
- Hits 27209 27174 -35
- Misses 10152 10256 +104
- Partials 1523 1532 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
grcevski
reviewed
Jun 8, 2026
grcevski
left a comment
Contributor
There was a problem hiding this comment.
Awesome, I like the direction!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this is
This is a PoC / steel-thread implementation for making OBI interoperate with manually instrumented Go spans through the same basic mechanism used by
go.opentelemetry.io/auto.I am opening this as a draft because I want maintainers to review the shape of the approach before we split it into smaller production-ready pieces. The goal here is to prove that we can support the full Go OTel API path, including the Auto SDK
Span_ended(buf []byte)JSON payload, while preserving OBI's existing fallback behavior whenbpf_probe_write_useris not available.What changed
This adds an opportunistic privileged path for Go manual spans:
bpf_probe_write_user, it attaches additional Go OTel probes.go.opentelemetry.io/otel/internal/global.(*tracer).newSpanflips theautoSpanflag so the global OTel API routes throughgo.opentelemetry.io/auto/sdk.go.opentelemetry.io/auto/sdk.(*tracer).startwrites parent span context, child span context, and sampled state into the Auto SDK output args.go.opentelemetry.io/auto/sdk.(*span).endedemits the Auto SDK OTLP JSON span payload into a new OBI event.The existing synthetic manual-span path remains the fallback. There is no user-facing config toggle in this PoC: if OBI has the needed permissions, the richer path should work; otherwise OBI keeps doing what it does today.
Upstream probe references
The BPF code in this PR is intentionally modeled after the
go.opentelemetry.io/autoprobes:Why this shape
The important bit is the Auto SDK
ended(buf []byte)path. That payload is already OTLP JSON-shaped, and it includes the manual span data we would otherwise have to reconstruct ourselves: attributes, events, links, status, dropped counts, trace state, IDs, kind, timestamps, and scope data.Instead of hand-modeling all of that in OBI's fixed synthetic span event, this PR treats the Auto SDK payload as the source of truth and lets pdata decode it. That keeps the BPF event simple and gives us much better parity with the Go OTel API.
Fallback behavior
The privileged path is guarded by the same context-propagation capability checks OBI already uses. If the kernel or process permissions do not allow
bpf_probe_write_user, OBI's existing integrity-mode override path should continue to fall back to the current synthetic manual span behavior.This is intentionally not a new config option in this PoC. The model I want to test is: if the operator granted the privilege needed for this support, use it; if not, degrade gracefully.
Known gaps
This is not a final production split yet.
trace.SpanContext, matching the upstream Autowrite_span_contexthelper behavior, but it is preserved from the Auto SDK JSON payload once emitted.Validation
I validated the steel thread locally with:
make generate go test ./pkg/ebpf/common ./pkg/export/otel/tracesgen ./pkg/internal/goexec ./pkg/internal/ebpf/gotracer ./cmd/obi