Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Breaking Changes 🛠
New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Deps
Other
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Event processor overwrites entire trace context losing fields
- The event processor now updates
trace_idandspan_idin the existingevent.Contexts["trace"]map (creating it only when absent), preserving SDK-populated trace fields.
- The event processor now updates
Or push these changes by commenting:
@cursor push 38eedc31b4
Preview (38eedc31b4)
diff --git a/otel/internal/common/event_processor.go b/otel/internal/common/event_processor.go
--- a/otel/internal/common/event_processor.go
+++ b/otel/internal/common/event_processor.go
@@ -27,9 +27,12 @@
if event.Contexts == nil {
event.Contexts = make(map[string]map[string]any)
}
- event.Contexts["trace"] = map[string]any{
- "trace_id": otelSpanContext.TraceID().String(),
- "span_id": otelSpanContext.SpanID().String(),
+ traceContext, found := event.Contexts["trace"]
+ if !found || traceContext == nil {
+ traceContext = make(map[string]any)
+ event.Contexts["trace"] = traceContext
}
+ traceContext["trace_id"] = otelSpanContext.TraceID().String()
+ traceContext["span_id"] = otelSpanContext.SpanID().String()
return event
}
diff --git a/otel/internal/common/event_processor_test.go b/otel/internal/common/event_processor_test.go
--- a/otel/internal/common/event_processor_test.go
+++ b/otel/internal/common/event_processor_test.go
@@ -22,7 +22,7 @@
{name: "without existing trace context"},
{
name: "with existing trace context",
- existingTrace: map[string]any{"trace_id": "123", "parent_span_id": "456"},
+ existingTrace: map[string]any{"trace_id": "123", "parent_span_id": "456", "op": "http.server"},
},
}
@@ -43,10 +43,12 @@
}))
got := linkTraceContextToErrorEvent(event, &sentry.EventHint{Context: ctx})
- assert.Equal(t, map[string]any{
- "trace_id": traceID.String(),
- "span_id": spanID.String(),
- }, got.Contexts["trace"])
+ assert.Equal(t, traceID.String(), got.Contexts["trace"]["trace_id"])
+ assert.Equal(t, spanID.String(), got.Contexts["trace"]["span_id"])
+ if tt.existingTrace != nil {
+ assert.Equal(t, "456", got.Contexts["trace"]["parent_span_id"])
+ assert.Equal(t, "http.server", got.Contexts["trace"]["op"])
+ }
})
}
}This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
sl0thentr0py
approved these changes
Mar 30, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
bumps the grpc version to eliminate GHSA-p77j-4mvh-x3m3
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.


Description
This PR adds the OpenTelemetry integration for OTLP, while also separating the error linking from the span exporter. The PR also includes some deviations from the Spec, so that the package follows closely the OTel conventions.
The main changes:
sentryotel.NewErrorLinkingIntegration()for OTel users to link errors with traces.sentryotlppackage where users can create aNewTraceExporterto send to sentry's otlp endpoint using theotlptracehttpexporter.Deviations from the spec:
setup_otlp_traces_exporterflag since users need to manually provide the exporter to theTracerProvidercollector_url. For users that are already using the collector, the only thing they need to set up is theErrorLinkingIntegration. Having aWithCollectorURLoption mixes concerns, since thesentryotlptrace exporter should only forward to sentry. Using the collector with Sentry requires changing the otlp http configuration on the collector and not the integration level.Issues
Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)