Skip to content

feat: Set segment source on scope for NoOpStreamedSpan - #7163

Open
alexander-alderman-webb wants to merge 9 commits into
webb/remove-set-transaction-name-early-returnfrom
webb/set-segment-source-on-scope
Open

feat: Set segment source on scope for NoOpStreamedSpan#7163
alexander-alderman-webb wants to merge 9 commits into
webb/remove-set-transaction-name-early-returnfrom
webb/set-segment-source-on-scope

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Add the attributes parameter to NoOpStreamedSpan.__init__().
Add a _segment_source field to NoOpStreamedSpan.

Set the segment source on the scope when a NoOpStreamedSpan is set on the scope.

Issues

Reminders

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

104113 passed | ⏭️ 6677 skipped | Total: 110790 | Pass Rate: 93.97% | Execution Time: 362m 16s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +129
Passed Tests 📈 +129
Failed Tests
Skipped Tests

All tests are passing successfully.

❌ Patch coverage is 73.33%. Project has 2488 uncovered lines.
❌ Project coverage is 90.11%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
sentry_sdk/traces.py 60.00% ⚠️ 4 Missing
sentry_sdk/scope.py 100.00% ⚠️ 2 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.14%    90.11%    -0.03%
==========================================
  Files          193       193         —
  Lines        25147     25162       +15
  Branches      9136      9150       +14
==========================================
+ Hits         22669     22674        +5
- Misses        2478      2488       +10
- Partials      1431      1433        +2

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb changed the base branch from webb/set-transaction-on-scope to webb/remove-set-transaction-name-early-return August 11, 2026 09:57
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 11, 2026 11:11
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 11, 2026 11:12
Comment thread sentry_sdk/traces.py Outdated
class NoOpStreamedSpan(StreamedSpan):
__slots__ = (
"_noop_name",
"_segment_source",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we directly access the segment attributes to get the source instead of adding a new slot? Right now it's a bit of a hybrid -- I'd either do it exclusively via attributes or exclusively via the new slot, but not both. (Preferring the attributes approach to avoid adding a slot and keeping source handling consistent in StreamedSpan vs NoOpStreamedSpan.)

@alexander-alderman-webb alexander-alderman-webb Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've used _attributes now but only store the sentry.segment.name.source attribute to avoid unnecessary pre-serialization.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 556c404. Configure here.

Comment thread sentry_sdk/traces.py Outdated
Comment thread sentry_sdk/traces.py Outdated
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