Skip to content

feat: add sentry_iter_trace_propagation_headers - #2240

Merged
jpnurmi merged 2 commits into
jpnurmi/feat/continue-tracefrom
jpnurmi/feat/iter-trace-headers
Oct 26, 2026
Merged

jpnurmi merged 2 commits into
jpnurmi/feat/continue-tracefrom
jpnurmi/feat/iter-trace-headers

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Add sentry_iter_trace_propagation_headers() and its scoped variant to fetch the sentry-trace and baggage headers without an active span, as required by the trace propagation spec's getTraceData.

The headers come from the span or transaction bound to the scope, if any, otherwise from its propagation context. Without a span, the sampling decision is deferred unless one was inherited with sentry_continue_trace(), so the sentry-trace header has no sampled flag and the baggage no sentry-sampled.

Close: #2050

@jpnurmi
jpnurmi added this pull request to stack #2238 October 23, 2026 10:39
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d55742b

@jpnurmi jpnurmi added the v1 Targets 1.0 (v1 branch) label Oct 23, 2026
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.07%. Comparing base (d8c7479) to head (d55742b).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           jpnurmi/feat/continue-trace    #2240      +/-   ##
===============================================================
- Coverage                        76.27%   76.07%   -0.21%     
===============================================================
  Files                              104      104              
  Lines                            29694    29714      +20     
  Branches                          5500     5504       +4     
===============================================================
- Hits                             22649    22604      -45     
- Misses                            5663     5736      +73     
+ Partials                          1382     1374       -8     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi

jpnurmi commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator Author

@limbonaut Are you using trace propagation APIs from other SDKs yet? Do you happen to have any integration/e2e tests that could verify Native's trace propagation API? Asking because these tests are just running against a mock server...

@limbonaut

limbonaut commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

The tests we have1 in the Godot SDK also run against a mock server. For a proper end-to-end setup, we'd have to introduce a two-app setup with another server SDK sending envelops, I think.

UPDATE: If we add continue_trace() support in native, we could probably set it up within the same SDK.

Footnotes

  1. https://github.com/getsentry/sentry-godot/blob/8f112b518a546e31e52246d3701d98eb8e5051b4/project/test/isolated/test_http_request.gd#L76-L101 ↩

@limbonaut limbonaut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The code and logic are solid. And it's a great addition!

Add `sentry_iter_trace_propagation_headers()` and
`sentry_scope_iter_trace_propagation_headers()` to fetch the
`sentry-trace` and `baggage` headers for downstream services without
an active span, as required by the trace propagation spec's
`getTraceData`. Until now, only `sentry_span_iter_headers()` and
`sentry_transaction_iter_headers()` existed, so a trace could not be
propagated without tracing.

The headers come from the span or transaction bound to the scope, if
any, otherwise from the scope's propagation context. Without a span,
the sampling decision is deferred unless one was inherited with
`sentry_continue_trace()`. Per the spec, the `sentry-trace` header then
has no sampled flag and the SDK-built baggage has no `sentry-sampled`.
The scoped variant falls back to the parent scopes for what the scope
does not set.

Ref: #2050
@jpnurmi
jpnurmi force-pushed the jpnurmi/feat/iter-trace-headers branch from 201acb1 to d55742b Compare October 26, 2026 10:11
@jpnurmi
jpnurmi merged commit 3e1a9c8 into v1 Oct 26, 2026
64 of 67 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/feat/iter-trace-headers branch October 26, 2026 12:07
@jpnurmi jpnurmi linked an issue Oct 26, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Targets 1.0 (v1 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align and flesh out trace propagation API

3 participants