Skip to content

OM 2.0: Clarify the relationship between Metric and MetricPoint #315

@dashpole

Description

@dashpole

Problem Statement

A Metric is defined as:

Metrics are defined by a unique LabelSet within a MetricFamily.

A MetricPoint is defined as:

Metrics MUST contain a list of one or more MetricPoints
Each MetricPoint consists of a set of values, depending on the MetricFamily type.

We have moved almost entirely to composite types instead of multi-line representations for metrics in OM 2.0. This issue considers whether to unify the concepts.

TIL that labels on a line of the text format are actually split into "labels associated with the Metric" and "labels associated with the MetricPoint". For example, the le label of a Histogram was the obvious example of a MetricPoint label. It isn't described in the specification, but I think for StateSets the label that is equal to the MetricFamily name is supposed to be considered a MetricPoint label, and others are Metric labels.

But I find this very confusing for Info metrics:

An Info MetricPoint's LabelSet MUST NOT have a label name which is the same as the name of a label of the LabelSet of its Metric.

Proposed solution

Remove the distinction between the Metric's LabelSet and the MetricPoint's LabelSet. Refer to only the "Metric's LabelSet" in the spec. The only remaining distinction between Metric and MetricPoint is for exposing the same metric with different timestamps (keeping this feature or not is a separate discussion).

a Metric is defined by a unique LabelSet. Metrics MUST contain a list of one or more MetricPoints. If a Metric contains more than one MetricPoint, they MUST have different timestamps.

Alternatives considered

The only remaining type which might conceptually be thought of as having multiple MetricPoints in a single Metric is StateSet, where we can think of exposition lines that differ only by the state label as being part of the same Metric. I personally find it simpler to just think about individual StateSet lines as grouped Metrics, rather than as multiple MetricPoints within a Metric. Practically, this distinction doesn't change the exposition -- it just makes the spec easier to read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions