Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More prescriptive guidance on metric naming #600

Closed
jmacd opened this issue May 13, 2020 · 5 comments · Fixed by #1154
Closed

More prescriptive guidance on metric naming #600

jmacd opened this issue May 13, 2020 · 5 comments · Fixed by #1154
Assignees
Labels
area:semantic-conventions Related to semantic conventions priority:p1 Highest priority level release:required-for-ga Must be resolved before GA release, or nice to have before GA spec:metrics Related to the specification/metrics directory
Milestone

Comments

@jmacd
Copy link
Contributor

jmacd commented May 13, 2020

The metric specification should include normative statements about naming metric instruments, including:

  • When to use labels instead of components in a name?
  • Avoid units in the name
  • Use of plural vs singular (latencies or latency)?
  • OpenMetrics guidance
  • Name-spacing instruments.

This was one of the "TODOs" mentioned mentioned in #598.

@jmacd jmacd added the spec:metrics Related to the specification/metrics directory label May 13, 2020
@bogdandrutu bogdandrutu added this to the v0.5 milestone May 13, 2020
@tedpennings
Copy link

I'm going to be working on this in the next few days and will post a draft

@tedpennings
Copy link

open-telemetry/oteps#108 for the spec mentioned above

@carlosalberto carlosalberto modified the milestones: v0.5, v0.6 Jun 9, 2020
@bogdandrutu bogdandrutu added the area:semantic-conventions Related to semantic conventions label Jun 26, 2020
@jmacd jmacd added the release:required-for-ga Must be resolved before GA release, or nice to have before GA label Jun 29, 2020
@andrewhsu andrewhsu added the priority:p2 Medium priority level label Jul 24, 2020
@andrewhsu andrewhsu added priority:p1 Highest priority level and removed priority:p2 Medium priority level labels Oct 16, 2020
@justinfoote
Copy link
Member

I see this was assigned to me this morning. Here's my thinking.
Several of the line items in this issue have been addressed by #937.

When to use labels instead of components in a name?

general-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.
...
"As a rule of thumb, aggregations over all the dimensions of a given metric SHOULD be meaningful," as Prometheus recommends.

Avoid units in the name

general-guidelines

Conventional metrics or metrics that have their units included in OpenTelemetry metadata (e.g. 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.

Name-spacing instruments.

general-guidelines

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.

@justinfoote
Copy link
Member

I'll address these (probably in two separate PRs):

Use of plural vs singular (latencies or latency)?

This seems straightforward.
It looks like we use the singular form for mass nouns like utilization, usage, and duration.
And we use the pluralized form for count nouns like operations, packets, and messages.

OpenMetrics guidance

The way I see it, there are two pieces that we ought to give guidance on here.

  1. Receiving a prometheus style metric that needs to be exported using OpenTelemetry
  • I think this can be straightforward. We will suggest that we don't mutate the name or attributes of such a metric.
  1. Exposing an OpenTelemetry metric using the prometheus exposition format.
  • This is less straightforward. I'll follow up with another comment on this issue with open questions (so they don't get buried in this wall of text).
  • I'd love input on what other guidance we need for OpenMetrics

@justinfoote
Copy link
Member

Open questions about OpenMetrics guidance:

  • I'm making the assumption right now that when we say OpenMetrics guidance, we're really describing interoperability with Prometheus. Is this an incorrect assumption?
  • Should we convert dots to underscores or colons?
  • Should we attempt to append units to the end of metric names?
  • Should we require that implementors convert units to the prometheus-accepted base units?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions priority:p1 Highest priority level release:required-for-ga Must be resolved before GA release, or nice to have before GA spec:metrics Related to the specification/metrics directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants