Skip to content

Commit 41ef777

Browse files
committed
.count metric naming convention only applies to UpDownCounters
1 parent f07495d commit 41ef777

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ release.
8080
([#70](https://github.com/open-telemetry/semantic-conventions/pull/70))
8181
- Clarify that OTEL_SEMCONV_STABILITY_OPT_IN is a comma-separated list of values
8282
([#104](https://github.com/open-telemetry/semantic-conventions/pull/104))
83+
- Update `.count` metric naming convention so that it only applies to UpDownCounters,
84+
and add that `.total` should not be used by either Counters or UpDownCounters
85+
([#107](https://github.com/open-telemetry/opentelemetry-specification/pull/107))

specification/metrics/semantic_conventions/README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ linkTitle: Semantic Conventions
1313
* [Name Reuse Prohibition](#name-reuse-prohibition)
1414
* [Units](#units)
1515
* [Pluralization](#pluralization)
16-
+ [Use `count` Instead of Pluralization](#use-count-instead-of-pluralization)
16+
+ [Use `count` Instead of Pluralization for UpDownCounters](#use-count-instead-of-pluralization-for-updowncounters)
17+
+ [Do not use `total`](#do-not-use-total)
1718
- [General Metric Semantic Conventions](#general-metric-semantic-conventions)
1819
* [Instrument Naming](#instrument-naming)
1920
* [Instrument Units](#instrument-units)
@@ -114,7 +115,7 @@ should not be pluralized, even if many data points are recorded.
114115
* `system.paging.faults`, `system.disk.operations`, and `system.network.packets`
115116
should be pluralized, even if only a single data point is recorded.
116117

117-
#### Use `count` Instead of Pluralization
118+
#### Use `count` Instead of Pluralization for UpDownCounters
118119

119120
If the value being recorded represents the count of concepts signified
120121
by the namespace then the metric should be named `count` (within its namespace).
@@ -125,6 +126,21 @@ to the processes then to represent the count of the processes we can have a metr
125126
`system.processes.count`. The suffix `count` here indicates that it is the count of
126127
`system.processes`.
127128

129+
This rule SHOULD only be applied to UpDownCounters, since (monotonic) Counters have
130+
`_total` appended to their names when they are
131+
[mapped to Prometheus](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/compatibility/prometheus_and_openmetrics.md#otlp-metric-points-to-prometheus),
132+
which would lead to `_count_total`.
133+
134+
#### Do not use `total`
135+
136+
Counters SHOULD NOT append `_total` to their names. Counters have `_total` appended to their names when they are [mapped to Prometheus](../../compatibility/prometheus_and_openmetrics.md#otlp-metric-points-to-prometheus),
137+
which would lead to `_total_total`. The reason that the Prometheus mapping cannot
138+
suppress adding the duplicate `_total` is because then the mapping wouldn't be
139+
bidirectional.
140+
141+
UpDownCounters SHOULD NOT use `_total` either because then they will look like
142+
monotonic sums in Prometheus.
143+
128144
## General Metric Semantic Conventions
129145

130146
**Status**: [Mixed][DocumentStatus]

0 commit comments

Comments
 (0)