Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metrics): Add maximum length for metric components #1286

Merged
merged 7 commits into from
May 22, 2024
Merged
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
17 changes: 11 additions & 6 deletions src/docs/sdk/metrics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ class Aggregator:

## Normalization

Normalization shall be done for `statsd` envelope items with unicode support if possible.

* **Namespaces and Units:** regex `[^a-zA-Z0-9_]+` with no replacement character.
* **Metric Keys/Names:** regex `[^a-zA-Z0-9_\-.]+` with replacement character `_`.
* **Tag Keys:** regex `[^a-zA-Z0-9_\-.\/]+` with no replacement character.
* **Tag Values:** See below
Normalization shall be done for `statsd` envelope items with unicode support if possible:
* **Metric Name**: Regex `[^a-zA-Z0-9_\-.]+` with replacement character `_`.
* **Metric Namespace and Unit**: Regex `[^a-zA-Z0-9_]+` with no replacement character.
* **Metric Tag Key**: Regex `[^a-zA-Z0-9_\-.\/]+` with no replacement character.
* **Metric Tag Value**: See below.

{/* Internal note: We can't use `\w` instead of `a-zA-Z0-9` because on some Regex engines `\w` includes chars such as `ä`, `ö` or `é`. */}

Expand All @@ -84,6 +83,12 @@ Reserved characters for Tag Values are `\n`, `\r`, `\t`, `\`, `|`, `,`. The repl
| Pipe (`\|`) | `\u{7c}` |
| Comma (`,`) | `\u{2c}` |

### Maximum Lengths

The lengths of the following components of the `statsd` envelope items should be limited:
- **Metric Name**: 150 characters.
- **Metric Unit**: 15 characters.
Comment on lines +89 to +90
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refers to the exact limiting being done in Relay parsing.


## Units

SDKs should permit any string unit, but some of them are known to the system and
Expand Down
Loading