Skip to content

Commit

Permalink
feat(metrics): Add maximum length for metric components (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
iambriccardo committed May 22, 2024
1 parent 0275ca5 commit 93d4f1b
Showing 1 changed file with 11 additions and 6 deletions.
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.

## Units

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

0 comments on commit 93d4f1b

Please sign in to comment.