feat(api): Add top-level set_attributes API - #6897
Merged
Merged
Conversation
Contributor
Codecov Results 📊✅ 98741 passed | ⏭️ 6806 skipped | Total: 105547 | Pass Rate: 93.55% | Execution Time: 351m 23s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2561 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 89.55% 89.56% +0.01%
==========================================
Files 193 193 —
Lines 24514 24520 +6
Branches 8674 8676 +2
==========================================
+ Hits 21952 21959 +7
- Misses 2562 2561 -1
- Partials 1402 1401 -1Generated by Codecov Action |
sentrivana
marked this pull request as ready for review
July 28, 2026 08:25
alexander-alderman-webb
approved these changes
Jul 28, 2026
|
|
||
|
|
||
| @scopemethod | ||
| def set_attributes(attributes: "dict[str, Any]") -> None: |
Contributor
There was a problem hiding this comment.
The type on set_attribute() is broader then Scope.set_attribute() as well
Contributor
Author
There was a problem hiding this comment.
yup just mirrored set_attribute here
mgaligniana
pushed a commit
to mgaligniana/sentry-python
that referenced
this pull request
Aug 9, 2026
### Description Streamed spans have both a `set_attribute` as well as a `set_attributes` API. On the top level, for setting attributes on the scope, we only have `set_attribute`. This is a bit confusing. Align the two APIs by adding the missing top-level `set_attributes`. See also [dev docs](https://develop.sentry.dev/sdk/foundations/state-management/scopes/attributes/#python). #### Issues <!-- * resolves: getsentry#1234 * resolves: LIN-1234 --> #### Reminders - Please add tests to validate your changes, and lint your code using `uv run ruff`. - Add GH Issue ID _&_ Linear ID (if applicable) - PR title should use [conventional commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type) style (`feat:`, `fix:`, `ref:`, `meta:`) - For external contributors: [CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md), [Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord community](https://discord.gg/Ww9hbqr)
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Streamed spans have both a
set_attributeas well as aset_attributesAPI.On the top level, for setting attributes on the scope, we only have
set_attribute. This is a bit confusing.Align the two APIs by adding the missing top-level
set_attributes.See also dev docs.
Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)