Skip to content

Commit

Permalink
Add metric naming conventions (open-telemetry/oteps#108)
Browse files Browse the repository at this point in the history
* Proposal for metric naming conventions

* Add Node example metrics

* Node.js instead of Node

* Rename file, add Prometheus quote

* Second round of revisions

* Working group feedback

* More feedback changes

* Minor clarifications

* Word choice

* Whitespace to check CLA status

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update text/metrics/0108-naming-conventions.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Code review feedback, remove discussion section

* Remove some discussion topics, and fix an example

* Rename OTEP 108 to metric naming _guidelines_

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: jfoote <jfoote@newrelic.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
5 people authored and carlosalberto committed Nov 8, 2024
1 parent b24405e commit 30e863b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions oteps/metrics/0108-naming-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Metric instrument naming guidelines

## Purpose

Names and labels for metric instruments are primarily how humans interact with metric data -- users rely on these names to build dashboards and perform analysis. The names and hierarchical structure need to be understandable and discoverable during routine exploration -- and this becomes critical during incidents.

To ensure these goals and consistency in future metric naming standards, this outlines a meta-standard for these names.

## Guidelines

Metric names and labels exist within a single universe and a single hierarchy. Metric names and labels MUST be considered within the universe of all existing metric names. When defining new metric names and labels, consider the prior art of existing standard metrics and metrics from frameworks/libraries.

Associated metrics SHOULD be nested together in a hierarchy based on their usage. Define a top-level hierarchy for common metric categories: for OS metrics, like CPU and network; for app runtimes, like GC internals. Libraries and frameworks should nest their metrics into a hierarchy as well. This aids in discovery and adhoc comparison. This allows a user to find similar metrics given a certain metric.

The hierarchical structure of metrics defines the namespacing. Supporting OpenTelemetry artifacts define the metric structures and hierarchies for some categories of metrics, and these can assist decisions when creating future metrics.

Common labels SHOULD be consistently named. This aids in discoverability and disambiguates similar labels to metric names.

["As a rule of thumb, **aggregations** over all the dimensions of a given metric **SHOULD** be meaningful,"](https://prometheus.io/docs/practices/naming/#metric-names) as Prometheus recommends.

Semantic ambiguity SHOULD be avoided. Use prefixed metric names in cases where similar metrics have significantly different implementations across the breadth of all existing metrics. For example, every garbage collected runtime has slightly different strategies and measures. Using a single set of metric names for GC, not divided by the runtime, could create dissimilar comparisons and confusion for end users. (For example, prefer `runtime.java.gc*` over `runtime.gc.*`.) Measures of many operating system metrics are similar.

For conventional metrics or metrics that have their units included in OpenTelemetry metadata (eg `metric.WithUnit` in Go), SHOULD NOT include the units in the metric name. Units may be included when it provides additional meaning to the metric name. Metrics MUST, above all, be understandable and usable.

0 comments on commit 30e863b

Please sign in to comment.