FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(api): Add top-level `set_attributes` API by sentrivana · Pull Request #6897 · getsentry/sentry-python · GitHub

feat(api): Add top-level set_attributes API - #6897

Merged
sentrivana merged 4 commits into
masterfrom
ivana/add-set-attributes-top-level-api
Jul 28, 2026
Merged

feat(api): Add top-level set_attributes API#6897
sentrivana merged 4 commits into
masterfrom
ivana/add-set-attributes-top-level-api

Conversation

sentrivana commented Jul 28, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

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.

Issues

Reminders

Comment thread sentry_sdk/api.py
Comment thread sentry_sdk/api.py

github-actions Bot commented Jul 28, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Codecov Results 📊

98741 passed | ⏭️ 6806 skipped | Total: 105547 | Pass Rate: 93.55% | Execution Time: 351m 23s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2561 uncovered lines.
✅ Project coverage is 89.56%. Comparing base (base) to head (head).

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        -1

Generated by Codecov Action

sentrivana marked this pull request as ready for review July 28, 2026 08:25
sentrivana requested a review from a team as a code owner July 28, 2026 08:25
Comment thread sentry_sdk/api.py


@scopemethod
def set_attributes(attributes: "dict[str, Any]") -> None:

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The type on set_attribute() is broader then Scope.set_attribute() as well

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yup just mirrored set_attribute here

sentrivana merged commit 8cc03fd into master Jul 28, 2026
271 of 273 checks passed
sentrivana deleted the ivana/add-set-attributes-top-level-api branch July 28, 2026 08:54
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)
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL