Clarify metric attributes should be namespaced (#786)

Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
Co-authored-by: Chris Mark <chrismarkou92@gmail.com>
Co-authored-by: Liudmila Molkova <limolkova@microsoft.com>
This commit is contained in:
Joao Grassi 2024-03-08 13:29:44 +01:00 committed by GitHub
parent 3d409a7d4a
commit a3252cb605
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,5 @@
change_type: 'enhancement'
component: metrics
note: Clarify metric attributes should be namespaced.
issues: [394]
subtext:

View File

@ -11,6 +11,7 @@ aliases: [docs/specs/semconv/general/metrics-general]
- [General Guidelines](#general-guidelines) - [General Guidelines](#general-guidelines)
- [Name Reuse Prohibition](#name-reuse-prohibition) - [Name Reuse Prohibition](#name-reuse-prohibition)
- [Metric attributes](#metric-attributes)
- [Units](#units) - [Units](#units)
- [Naming rules for Counters and UpDownCounters](#naming-rules-for-counters-and-updowncounters) - [Naming rules for Counters and UpDownCounters](#naming-rules-for-counters-and-updowncounters)
- [Pluralization](#pluralization) - [Pluralization](#pluralization)
@ -89,6 +90,26 @@ When introducing a new metric name check all existing schema files to make sure
the name does not appear as a key of any "rename_metrics" section (keys denote the name does not appear as a key of any "rename_metrics" section (keys denote
old metric names in rename operations). old metric names in rename operations).
### Metric attributes
Metric attributes SHOULD follow the general [attribute naming rules](attribute-naming.md).
In particular, metric attributes SHOULD have a namespace.
Metric attributes SHOULD be added under the metric namespace when their usage and
semantics are exclusive to the metric.
Examples:
Attributes `mode` and `mountpoint` for metric `system.filesystem.usage`
should be namespaced as `system.filesystem.mode` and `system.filesystem.mountpoint`.
Metrics can also have attributes outside of their namespace.
Examples:
Metric `http.server.request.duration` uses attributes from the registry such as
`server.port`, `error.type`.
### Units ### Units
Conventional metrics or metrics that have their units included in Conventional metrics or metrics that have their units included in