Skip to content

feat: Set the segment name on the scope with NoOpStreamedSpan - #7162

Merged
alexander-alderman-webb merged 9 commits into
masterfrom
webb/set-transaction-on-scope
Aug 12, 2026
Merged

feat: Set the segment name on the scope with NoOpStreamedSpan#7162
alexander-alderman-webb merged 9 commits into
masterfrom
webb/set-transaction-on-scope

Conversation

@alexander-alderman-webb

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

Copy link
Copy Markdown
Contributor

Description

Add the name parameter to NoOpStreamedSpan.__init__().

Set the transaction name on the scope when a segment NoOpStreamedSpan is set on the scope.

The commit 11c1e90 removed validation of tracing without performance, so I've added a new test where tracing is disabled.

Issues

Reminders

@alexander-alderman-webb alexander-alderman-webb changed the title feat: Set segment name on scope when span is NoOpStreamedSpan feat: Set segment name on scope forNoOpStreamedSpan Aug 11, 2026
@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 27s

📊 Comparison with Base Branch

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

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2485 uncovered lines.
❌ Project coverage is 90.12%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/scope.py 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    90.15%    90.12%    -0.03%
==========================================
  Files          193       193         —
  Lines        25147     25153        +6
  Branches      9136      9140        +4
==========================================
+ Hits         22669     22668        -1
- Misses        2478      2485        +7
- Partials      1431      1431         —

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 11, 2026 11:10
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 11, 2026 11:10

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

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 63e764a. Configure here.

Comment thread sentry_sdk/scope.py
Comment thread sentry_sdk/scope.py Outdated

@sentrivana sentrivana left a comment

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.

Looks good, just one question.

Comment thread sentry_sdk/traces.py Outdated

class NoOpStreamedSpan(StreamedSpan):
__slots__ = (
"_noop_name",

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.

I assume we can't use the existing _name slot for this?

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.

The parent _name is typed as str, and all the __init__ parameters are optional for NoOpStreamedSpan.

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.

Don't we do something similar for scope though? In the parent class it's not optional, but in NoOpStreamedSpan it is, and it uses the same slot.

I guess that's what the # type: ignore[assignment] is there for. TBH I'd prefer we do the same with _name to keep stuff consistent.

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 don't mind, fair to follow the existing pattern: f4986d9

@alexander-alderman-webb alexander-alderman-webb changed the title feat: Set segment name on scope forNoOpStreamedSpan feat: Set segment name on scope for NoOpStreamedSpan Aug 12, 2026
@alexander-alderman-webb alexander-alderman-webb changed the title feat: Set segment name on scope for NoOpStreamedSpan feat: Set the segment name on the scope with NoOpStreamedSpan Aug 12, 2026
@alexander-alderman-webb
alexander-alderman-webb merged commit 264addc into master Aug 12, 2026
145 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/set-transaction-on-scope branch August 12, 2026 08:31
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