You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/scopes.mdx
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,57 @@ Data from all three scope types MUST be merged in a specific order before being
52
52
53
53

54
54
55
+
## Scope Methods
56
+
57
+
### Setting Attributes
58
+
59
+
Users MUST be able to attach attributes to any scope using a dedicated method (e.g., `scope.setAttributes()` or `scope.setAttribute()`). These attributes follow the structure defined in the [Span Protocol](/sdk/telemetry/spans/span-protocol/#attribute-object-properties).
60
+
61
+
Attributes are key-value pairs where each value is an object containing:
62
+
63
+
-`type`: The data type (`"string"`, `"integer"`, `"double"`, `"boolean"`, `"string[]"`, `"integer[]"` and `"double[]"`)
64
+
-`value`: The actual attribute value, which MUST match the specified type
65
+
-`unit` (optional): The unit of measurement (e.g., `"ms"`, `"s"`, `"bytes"`, `"count"`, `"percent"`)
66
+
67
+
#### Example Usage
68
+
69
+
```javascript
70
+
Sentry.getGlobalScope().setAttributes({
71
+
"app.feature_flag.enabled":true,
72
+
"app.session_duration": {
73
+
type:"integer",
74
+
value:3600,
75
+
unit:"s"
76
+
}
77
+
});
78
+
```
79
+
80
+
```python
81
+
sentry_sdk.get_global_scope().set_attributes({
82
+
"app.feature_flag.enabled": True,
83
+
"app.session_duration": {
84
+
"type": "integer",
85
+
"value": 3600,
86
+
"unit": "s"
87
+
}
88
+
})
89
+
```
90
+
91
+
#### Method Signature
92
+
93
+
The method SHOULD accept a dictionary/map/object where:
94
+
- Keys are attribute names (strings)
95
+
- Values are attribute objects with `type`, `value`, and optionally `unit` properties
96
+
97
+
#### Behavior
98
+
99
+
- Attributes set on the global scope MUST be applied to all logs
100
+
- Attributes set on the isolation scope MUST be applied to all logs in that execution context
101
+
- Attributes set on the current scope MUST be applied only to the current log
102
+
- When the same attribute key exists in multiple scopes, the more specific scope's value takes precedence (current > isolation > global)
103
+
104
+
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.
105
+
55
106
## Related Documents
56
107
57
108
This document provides a concise summary of the [Hub & Scope Refactoring](/sdk/miscellaneous/hub_and_scope_refactoring/), focusing on implementation details and expected features. The original document remains unchanged, offering additional historical context and migration strategies.
| Can create and remove projects for the organization || ✓\*\*\*| ✓ | ✓ | ✓ |
44
45
| Can edit Global Integrations ||| ✓ | ✓ | ✓ |
45
46
| Can remove repositories ||| ✓ | ✓ | ✓ |
46
47
| Can add, remove, and change Org Members |||| ✓ | ✓ |
@@ -52,9 +53,11 @@ Organization-level roles enable broad access to the entire organization, as desc
52
53
| Can transfer projects to another organization ||||| ✓ |
53
54
| Can remove an organization ||||| ✓ |
54
55
55
-
\*Org Members will only be able to edit [ownership rules](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/action-release/ownership/) for the project.
56
+
\*Only Owners and Billing users can see complete subscription details. Org Members, Admins, and Managers have access to a limited view of the subscription details.
56
57
57
-
\*\*If your organization is on a Business or Enterprise plan, anyone who's part of the org will be able to create a project without having to be a Team Admin. When org members create a project, they'll become the Team Admin for that project by default and have all the permissions of the [Team Admin](#permissions-1) for that project.
58
+
\*\*Org Members will only be able to edit [ownership rules](https://sentry.io/orgredirect/organizations/:orgslug/settings/projects/action-release/ownership/) for the project.
59
+
60
+
\*\*\*If your organization is on a Business or Enterprise plan, anyone who's part of the org will be able to create a project without having to be a Team Admin. When org members create a project, they'll become the Team Admin for that project by default and have all the permissions of the [Team Admin](#permissions-1) for that project.
0 commit comments