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
This document defines the format used by Sentry to represent attributes across different telemetry data types (Spans, Logs, Metrics).
7
+
8
+
## Attribute Object Structure
9
+
10
+
Attributes are stored as key-value pairs where each value is an object with type information.
11
+
12
+
```json
13
+
{
14
+
"my_attribute": {
15
+
"value": "some value",
16
+
"type": "string"
17
+
},
18
+
"response_time": {
19
+
"value": 123,
20
+
"unit": "millisecond",
21
+
"type": "integer"
22
+
}
23
+
}
24
+
```
25
+
26
+
### Properties
27
+
28
+
| Property | Type | Required | Description |
29
+
|----------|------|----------|-------------|
30
+
|`type`| string | Yes | The data type of the attribute value. |
31
+
|`value`| any | Yes | The actual attribute value, must match the specified type. |
32
+
|`unit`| string | No | The unit of the attribute value. See [Units](#units) for a full list of supported units. |
33
+
34
+
### Supported Types
35
+
36
+
The following types are supported:
37
+
38
+
-`string`
39
+
-`boolean`
40
+
-`integer` (64-bit signed integer)
41
+
-`double` (64-bit floating point number)
42
+
-`string[]`
43
+
-`boolean[]`
44
+
-`integer[]`
45
+
-`double[]`
46
+
47
+
**Note on Integers:** Integers should be 64-bit signed integers. For 64-bit unsigned integers, use the `string` type to avoid overflow issues until unsigned integers are natively supported.
48
+
49
+
## Units
50
+
51
+
The following units are [supported by Relay](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html).
52
+
53
+
### Duration Units
54
+
55
+
-`nanosecond`
56
+
-`microsecond`
57
+
-`millisecond`
58
+
-`second`
59
+
-`minute`
60
+
-`hour`
61
+
-`day`
62
+
-`week`
63
+
64
+
### Information Units
65
+
66
+
-`bit`
67
+
-`byte`
68
+
-`kilobyte`
69
+
-`kibibyte`
70
+
-`megabyte`
71
+
-`mebibyte`
72
+
-`gigabyte`
73
+
-`gibibyte`
74
+
-`terabyte`
75
+
-`tebibyte`
76
+
-`petabyte`
77
+
-`pebibyte`
78
+
-`exabyte`
79
+
-`exbibyte`
80
+
81
+
### Fraction Units
82
+
83
+
-`ratio`
84
+
-`percent`
85
+
86
+
## Semantic Conventions
87
+
88
+
See [Sentry Conventions](https://github.com/getsentry/sentry-conventions/) for a full list of supported attributes.
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/logs.mdx
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,9 +82,7 @@ It consists of the following fields:
82
82
83
83
`attributes`
84
84
85
-
: **Object, optional**. A dictionary of key-value pairs of arbitrary data attached to the log. Attributes must also declare the type of the value. The following types are supported: `string`, `boolean`, `integer`, `double`. In the future arrays will be supported (`string[]`, `boolean[]`, `integer[]`, `double[]`).
86
-
87
-
Integers should be a 64-bit signed integer, while doubles should be a 64-bit floating point number. For 64-bit unsigned integers, use the `string` type to avoid overflow issues. Make sure to always convert 64-bit unsigned integers to strings regardless of if they are in or out of the 64-bit signed range. In the future we will support sending 64-bit unsigned integers without converting them to strings.
85
+
: **Object, optional**. A dictionary of key-value pairs of arbitrary data attached to the log. Attributes must also declare the type of the value. See [Attributes](/sdk/telemetry/attributes) for the supported types and structure.
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/metrics.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,7 @@ Integers should be a 64-bit signed integer, while doubles should be a 64-bit flo
92
92
93
93
`attributes`
94
94
95
-
: **Object, optional**. A dictionary of key-value pairs of arbitrary data attached to the metric. Attributes must also declare the type of the value. The following types are supported: `string`, `boolean`, `integer`, `double`.
95
+
: **Object, optional**. A dictionary of key-value pairs of arbitrary data attached to the metric. Attributes must also declare the type of the value. See [Attributes](/sdk/telemetry/attributes) for the supported types and structure.
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/scopes.mdx
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,15 +56,14 @@ Data from all three scope types MUST be merged in a specific order before being
56
56
57
57
### Setting Attributes
58
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).
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 [Attributes](/sdk/telemetry/attributes) documentation.
60
60
61
-
Attributes are key-value pairs where each value is either a an attribute value or an object containing:
61
+
Attributes are key-value pairs where each value is either an attribute value or an object containing:
62
62
63
63
-`value`: The actual attribute value, which MUST match the specified type
64
-
-`unit` (optional): The unit of measurement (e.g., `"millisecond"`, `"second"`, `"byte"`, `"ratio"`).
64
+
-`unit` (optional): The unit of measurement. See [Units](/sdk/telemetry/attributes#units) for the full list of supported units.
65
65
- SDKs MAY delay adding support for units for the moment, but MUST be able to do so at a later date without a breaking change.
66
-
- SDKS MUST allow setting all units supported by Relay's [`MetricUnit` enum](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html) but MUST NOT allow custom units (i.e. arbitrary strings, defined in [`CustomUnit`](https://getsentry.github.io/relay/relay_metrics/struct.CustomUnit.html)) or "none" units (`''` or `'none'`).
67
-
-`type` (optional): The type of the attribute. SDKs SHOULD NOT expose this to users if they can reliably infer the type from the value. If not, SDKs MAY allow or require users to set the `type` explicitly.
66
+
-`type` (optional): The type of the attribute. See [Supported Types](/sdk/telemetry/attributes#supported-types) for the full list. SDKs SHOULD NOT expose this to users if they can reliably infer the type from the value. If not, SDKs MAY allow or require users to set the `type` explicitly.
68
67
69
68
#### Example Usage
70
69
@@ -105,7 +104,7 @@ The method SHOULD accept a dictionary/map/object where:
105
104
- 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
105
- Calling `scope.clear()` MUST remove all attributes from the corresponding scope.
107
106
108
-
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.
107
+
See [Attributes](/sdk/telemetry/attributes) for detailed information about attribute structure, supported types, units, and common attribute keys. Also see[Sentry Conventions](https://github.com/getsentry/sentry-conventions/) for the complete attribute registry.
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/spans/span-protocol.mdx
-10Lines changed: 0 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,16 +157,6 @@ The envelope item payload must contain an `items` array with span one and up to
157
157
|`attributes`| object | No | Key-value pairs containing additional metadata about the span |
158
158
|`links`| array | No | Array of links connecting this span to other spans or traces |
159
159
160
-
### Attribute Object Properties
161
-
162
-
Attributes are stored as key-value pairs where each value is an object with type information:
163
-
164
-
| Property | Type | Required | Description |
165
-
|----------|------|----------|-------------|
166
-
|`type`| string | Yes | The data type of the attribute value. Values: `"string"`, `"integer"`, `"double"`, `"boolean"`, `"string[]"`, `"integer[]"`, `"double[]"`, `"boolean[]"`|
167
-
|`value`| any | Yes | The actual attribute value, must match the specified type |
168
-
|`unit`| string | No | The unit of the attribute value. Example values: `"millisecond"`, `"second"`, `"byte"`, `"ratio"`. Units MUST be one of the [MetricUnit](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html)s supported by Relay, excluding `""`, `"none"` or custom units. |
169
-
170
160
#### Common Attribute Keys
171
161
172
162
All attributes mentioned below must be attached to every span being emitted from the SDK, depending on the platform.
0 commit comments