Why do Info metrics have two Label Sets?

24 views
Skip to first unread message

Fabian Stäber

unread,
Dec 7, 2022, 3:31:24 PM12/7/22
to Prometheus Developers
Hi,

in OpenMetrics, all metrics (metric == time series) are modelled like this:

message Metric {
    repeated Label labels = 1;
    repeated MetricPoint metric_points = 2;
}

However, Info metrics have another set of Labels as the value of their MetricPoint:

message InfoValue {
    repeated Label info = 1;
}

I first thought that might be a mistake, but then I found this cryptic statement in the spec:

A MetricPoint of an Info Metric contains a LabelSet. 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.

I'm curious why Info metrics are modelled that way. Is that something we should simplify?

Fabian

Matthias Rampke

unread,
Dec 8, 2022, 1:22:19 PM12/8/22
to Fabian Stäber, Prometheus Developers
I can't speak to the original thinking but I can speculate. In text format info metrics, we conflate two things into labels: the identification of the thing we are informing about, and the information itself. 

For example, an info metric about hard disks would have a label that identifies the disk (with more target labels added later), and "labels" that hold the string valued information like the firmware version.

It gets more extreme with e.g. kube_pod_labels, where the set of info labels itself is dynamic. At least in the past, kube-state-metrics had to hack open the Prometheus client library to subvert label consistency checks so that it could do this, since the set of (info) label keys is unknowable ex ante.

By splitting the labels from the info like this, you can make assertions about consistency within the *label* set without constraining the *info* set too much.

/MR

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAPX310hQLkeVEd5rNTtVkMuHJ11N4hqsyQwnAEeyterSPn3W0w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages