Skip to content

[Prometheus SPECS] metric name overloading and labels #138

@incertum

Description

@incertum

https://prometheus.io/docs/instrumenting/writing_exporters/

"
Don’t do this:

my_metric{label="a"} 1
my_metric{label="b"} 6
my_metric{label="total"} 7

or this:

my_metric{label="a"} 1
my_metric{label="b"} 6
my_metric{} 7

The former breaks for people who do a sum() over your metric, and the latter breaks sum and is quite difficult to work with. Some client libraries, for example Go, will actively try to stop you doing the latter in a custom collector, and all client libraries should stop you from doing the latter with direct instrumentation. Never do either of these, rely on Prometheus aggregation instead.
"

Amendment to #125 fixes. See new fixes in #135.

TODO:

  • Prevent using reserved label names such as le

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions