Skip to content

feat(controlplane): add OTel trace/span IDs to Sentry request context#3305

Merged
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6777-add-otel-tracespan-ids-to-control-plane-sentry-request
Jul 23, 2026
Merged

feat(controlplane): add OTel trace/span IDs to Sentry request context#3305
javirln merged 1 commit into
chainloop-dev:mainfrom
javirln:javier/pfm-6777-add-otel-tracespan-ids-to-control-plane-sentry-request

Conversation

@javirln

@javirln javirln commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds the OpenTelemetry trace and span IDs to control-plane Sentry error events so an event can be cross-referenced with its distributed trace in the OTLP backend (Tempo/Jaeger).

The NewSentryContext middleware now reads the OTel SpanContext from the request context (populated by the otelgrpc server handler) and, when a valid span context is present, adds otel-trace-id and otel-span-id to the Sentry Request context. When tracing is disabled or the span context is invalid, the fields are omitted. These are informational fields and do not alter Sentry's canonical trace_id.

Closes PFM-6777.

AI disclosure

Assisted by Claude Code.

Review in cubic

Surface the OpenTelemetry trace and span IDs on control-plane Sentry error
events so an event can be cross-referenced with its distributed trace in the
OTLP backend (Tempo/Jaeger). The IDs are read from the request context (populated
by the otelgrpc server handler) and added to the Sentry Request context as
otel-trace-id and otel-span-id when a valid span context is present. They are
informational fields and do not alter Sentry's canonical trace_id.

Assisted-by: Claude Code
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>

Chainloop-Trace-Sessions: e2467003-af35-4aaa-b332-c9255f3d6171
@chainloop-platform

chainloop-platform Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

AI Session Analysis

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 86% 1 ✅ 0 100% AI / 0% Human 2 +36 / -3 10m56s

🟢 86% — 100% AI — ✅ All policies passing

Jul 23, 2026 07:15 UTC · 10m56s · $7.34 · 211 in / 48.7k out · claude-code 2.1.218 (claude-opus-4-8)

View session details ↗

Change Summary

  • Adds otel-trace-id and otel-span-id to control-plane Sentry request context when a valid span exists.
  • Leaves those fields absent when tracing is disabled or span context is invalid.
  • Adds two tests for valid-span and no-span cases and updates license headers.

AI Session Overall Score

🟢 86% — Focused change with strong verification, minus one missing live trace-link check.

AI Session Analysis Breakdown

🟢 95% · scope-discipline

🟢 The change stayed inside the target source file and its test. · High Impact

🟢 93% · user-trust-signal

No notes.

🟢 92% · alignment

No notes.

🟢 90% · solution-quality

No notes.

🟢 88% · context-and-planning

🟢 The issue front-loaded the file path, API detail, and acceptance criteria. · High Impact

🟡 72% · verification

🟢 The AI added two OTel subtests and ran go test twice successfully. · High Impact

🟠 Unit tests passed, but no live Tempo or Jaeger check confirmed the new trace-linking behavior. · Medium Severity

💡 For trace-linking changes, run one real request and confirm the Sentry IDs resolve in Tempo or Jaeger.


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
modified ai app/controlplane/internal/sentrycontext/sentry_context_test.go +22 / -1
modified ai app/controlplane/internal/sentrycontext/sentry_context.go +14 / -2

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-e24670 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-e24670 -
✅ Passed ai-config-no-secrets ai-coding-session-e24670 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-e24670 -

Powered by Chainloop and Chainloop Trace

@javirln
javirln requested a review from a team July 23, 2026 07:28

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@javirln
javirln merged commit e37b836 into chainloop-dev:main Jul 23, 2026
16 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