Skip to content

Commit 85ca194

Browse files
fix(develop-docs): Clearing scope attributes (#15578)
Clarify that calling scope.clear also removes the attributes.
1 parent b46b522 commit 85ca194

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

develop-docs/sdk/telemetry/scopes.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ sentry_sdk.get_global_scope().set_attributes({
9292

9393
The method SHOULD accept a dictionary/map/object where:
9494
- Keys are attribute names (strings)
95-
- Values are either directly values or attribute objects/dictionaries with `value`, and optionally `unit` properties (see [example](#example-usage)).
95+
- Values are either directly values or attribute objects/dictionaries with `value`, and optionally `unit` properties (see [example](#example-usage)).
9696
- The SDK SHOULD infer the `type` of the attribute at serialization time to spare users from setting a (potentially incorrect) `type`. Depending on platform or constraints, the SDK MAY instead also allow or require users to set the `type` explicitly.
9797

9898
#### Behavior
@@ -103,6 +103,7 @@ The method SHOULD accept a dictionary/map/object where:
103103
- When the same attribute key exists in multiple scopes, the more specific scope's value takes precedence (current > isolation > global)
104104
- When the same attribute key exists on the current log or metric, it MUST take precedence over an attribute with the same key set on any scope (log/metric > current > isolation > global)
105105
- The SDK SHOULD keep the attribute format consistent with the user-set format until user-provided processing callbacks like `before_send_log` have been called. This ensures compatibility with already existing callbacks and avoids unexpected changes to the attribute format.
106+
- Calling `scope.clear()` MUST remove all attributes from the corresponding scope.
106107

107108
See [Span Protocol - Common Attribute Keys](/sdk/telemetry/spans/span-protocol/#common-attribute-keys) for a list of standard attributes and [Sentry Conventions](https://github.com/getsentry/sentry-conventions/) for the complete attribute registry.
108109

0 commit comments

Comments
 (0)