Skip to content

misc: Add support for bridge spans#5895

Merged
jmartinesp merged 3 commits into
mainfrom
misc/add-distributed-tracing
Nov 25, 2025
Merged

misc: Add support for bridge spans#5895
jmartinesp merged 3 commits into
mainfrom
misc/add-distributed-tracing

Conversation

@jmartinesp
Copy link
Copy Markdown
Contributor

@jmartinesp jmartinesp commented Nov 25, 2025

Bridge spans will use bridge_trace_id to map an existing client transactions/spans to Rust ones so they'll be displayed as a single one in Sentry.

This is done through the sentry.trace field, which will be used by sentry-tracing to differentiate these kinds of special spans (see docs).

The special fields need to be added on the Span creation, that's why we do it in the constructor instead of just using span.record(...) later.

Also bumps Sentry SDK to the latest version.


Note this doesn't seem to work 100% of the time:

  • It might be some bug in the Sentry SDK.
  • Ot a race condition that happens when the SDK spans are received before the client ones.
  • Or maybe our Sentry instance has a bug since it's a bit out of date.

Until all the code that runs using that span has finished (including spawned long running tasks) Sentry doesn't consider the span as ready to upload. We can't force sentry to send the span ahead of time (at least, there is no way that I know given how sentry-tracing works), so in those cases the spans just won't be uploaded.

The result is sometimes you get flawless results, everything is uploaded and works smoothly, and other times no matter how many times you try, the SDK spans won't be uploaded/attached. However, the time metrics for the spans won't change, so not having the SDK spans, while not ideal, it's not mandatory to have consistent metrics.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

These will use `bridge_trace_id` to map an exising client transaction/span to this one so they'll be displayed as a single one in Sentry.

This is done through the `sentry.trace` field, which will be used by `sentry-tracing` to differentiate these kinds of special spans.

The special fields need to be added on the Span creation, that's why we do it in the constructor instead of just using `span.record(...)` later.
@jmartinesp jmartinesp requested a review from a team as a code owner November 25, 2025 08:38
@jmartinesp jmartinesp requested review from Hywan and removed request for a team November 25, 2025 08:38
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.64%. Comparing base (aa79e34) to head (a5d097b).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5895      +/-   ##
==========================================
- Coverage   88.65%   88.64%   -0.01%     
==========================================
  Files         362      362              
  Lines      103146   103146              
  Branches   103146   103146              
==========================================
- Hits        91440    91437       -3     
- Misses       7458     7460       +2     
- Partials     4248     4249       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Nov 25, 2025

CodSpeed Performance Report

Merging #5895 will not alter performance

Comparing misc/add-distributed-tracing (a5d097b) with main (ec44c74)

Summary

✅ 50 untouched

Copy link
Copy Markdown
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

LGTM

@jmartinesp jmartinesp enabled auto-merge (rebase) November 25, 2025 13:05
@jmartinesp jmartinesp merged commit 20ee85b into main Nov 25, 2025
52 checks passed
@jmartinesp jmartinesp deleted the misc/add-distributed-tracing branch November 25, 2025 13:19
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