From a3252cb6058a428f0616b6e649765cd4d04f8578 Mon Sep 17 00:00:00 2001 From: Joao Grassi <5938087+joaopgrassi@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:29:44 +0100 Subject: [PATCH] Clarify metric attributes should be namespaced (#786) Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com> Co-authored-by: Chris Mark Co-authored-by: Liudmila Molkova --- .chloggen/clarify-metric-namespace.yaml | 5 +++++ docs/general/metrics.md | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 .chloggen/clarify-metric-namespace.yaml diff --git a/.chloggen/clarify-metric-namespace.yaml b/.chloggen/clarify-metric-namespace.yaml new file mode 100755 index 000000000..7fffee168 --- /dev/null +++ b/.chloggen/clarify-metric-namespace.yaml @@ -0,0 +1,5 @@ +change_type: 'enhancement' +component: metrics +note: Clarify metric attributes should be namespaced. +issues: [394] +subtext: diff --git a/docs/general/metrics.md b/docs/general/metrics.md index 2f235e23c..d76440f25 100644 --- a/docs/general/metrics.md +++ b/docs/general/metrics.md @@ -11,6 +11,7 @@ aliases: [docs/specs/semconv/general/metrics-general] - [General Guidelines](#general-guidelines) - [Name Reuse Prohibition](#name-reuse-prohibition) + - [Metric attributes](#metric-attributes) - [Units](#units) - [Naming rules for Counters and UpDownCounters](#naming-rules-for-counters-and-updowncounters) - [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 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 Conventional metrics or metrics that have their units included in