Skip to content

Commit

Permalink
.count metric naming convention only applies to UpDownCounters
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Jun 13, 2023
1 parent f07495d commit 2caaafd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ release.
([#70](https://github.com/open-telemetry/semantic-conventions/pull/70))
- Clarify that OTEL_SEMCONV_STABILITY_OPT_IN is a comma-separated list of values
([#104](https://github.com/open-telemetry/semantic-conventions/pull/104))
- Update `.count` metric naming convention so that it only applies to UpDownCounters,
and add that `.total` should not be used by either Counters or UpDownCounters
([#107](https://github.com/open-telemetry/opentelemetry-specification/pull/107))
21 changes: 19 additions & 2 deletions specification/metrics/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ linkTitle: Semantic Conventions
* [Name Reuse Prohibition](#name-reuse-prohibition)
* [Units](#units)
* [Pluralization](#pluralization)
+ [Use `count` Instead of Pluralization](#use-count-instead-of-pluralization)
+ [Use `count` Instead of Pluralization for UpDownCounters](#use-count-instead-of-pluralization-for-updowncounters)
+ [Do not use `total`](#do-not-use-total)
- [General Metric Semantic Conventions](#general-metric-semantic-conventions)
* [Instrument Naming](#instrument-naming)
* [Instrument Units](#instrument-units)
Expand Down Expand Up @@ -114,7 +115,7 @@ should not be pluralized, even if many data points are recorded.
* `system.paging.faults`, `system.disk.operations`, and `system.network.packets`
should be pluralized, even if only a single data point is recorded.

#### Use `count` Instead of Pluralization
#### Use `count` Instead of Pluralization for UpDownCounters

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

This rule SHOULD only be applied to UpDownCounters, since (monotonic) Counters have
`_total` appended to their names when they are
[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),
which would lead to `_count_total`.

#### Do not use `total`

Counters SHOULD NOT append `_total` to their names. Counters have `_total` appended to their names when they are
[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),
which would lead to `_total_total`. The reason that the Prometheus mapping cannot
suppress adding the duplicate `_total` is because then the mapping wouldn't be
bidirectional.

UpDownCounters SHOULD NOT use `_total` either because then they will look like
monotonic sums in Prometheus.

## General Metric Semantic Conventions

**Status**: [Mixed][DocumentStatus]
Expand Down

0 comments on commit 2caaafd

Please sign in to comment.