Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- The `@trace` decorator accepts three optional arguments: `name`, `attributes`, `active` (default: `True`).
- `sentry_sdk.continue_trace` accepts a single dictionary with the incoming headers or environment data. It is no longer a context manager and it does not return a span/transaction anymore. A span needs to be started manually afterwards.
- `sentry_sdk.new_trace` resets the trace.
- The type hints of `sentry_sdk.set_attribute` and `sentry_sdk.set_attributes` now only accept primitives and lists of primitives, matching `Scope.set_attribute` and `Scope.set_attributes`. Unexpected values are still passed through `repr()` at runtime.

### Integrations

Expand Down
5 changes: 3 additions & 2 deletions sentry_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)

from sentry_sdk._types import (
AttributeValue,
Breadcrumb,
BreadcrumbHint,
Event,
Expand Down Expand Up @@ -188,7 +189,7 @@ def add_breadcrumb(


@scopemethod
def set_attribute(attribute: str, value: "Any") -> None:
def set_attribute(attribute: str, value: "AttributeValue") -> None:
"""
Set an attribute.

Expand All @@ -199,7 +200,7 @@ def set_attribute(attribute: str, value: "Any") -> None:


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

Expand Down
Loading