Skip to content

Commit 18e731b

Browse files
authored
ref(develop/scopes): Clarify unit type for attributes (#15546)
For now we specify units on attributes as follows: - accept all `MetricUnit`s (see [Relay](https://getsentry.github.io/relay/relay_metrics/enum.MetricUnit.html)) - except for `''`, `'none'` - except for custom units (arbitrary strings). <-- we can revisit this if we want to widen the type here
1 parent 53030d6 commit 18e731b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

develop-docs/sdk/telemetry/scopes.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ Users MUST be able to attach attributes to any scope using a dedicated method (e
6161
Attributes are key-value pairs where each value is either a an attribute value or an object containing:
6262

6363
- `value`: The actual attribute value, which MUST match the specified type
64-
- `unit` (optional): The unit of measurement (e.g., `"ms"`, `"s"`, `"bytes"`, `"count"`, `"percent"` or any other string value). SDKs MAY NOT add support for units for the moment, but MUST be able to do so at a later date without a breaking change.
64+
- `unit` (optional): The unit of measurement (e.g., `"millisecond"`, `"second"`, `"byte"`, `"ratio"`).
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'`).
6567
- `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.
6668

6769
#### Example Usage

0 commit comments

Comments
 (0)