Search code examples
prometheus

How do Prometheus clients identify metric types?


As per official documentation Prometheus doesn't keep the data type.

These are currently only differentiated in the client libraries (to enable APIs tailored to the usage of the specific types) and in the wire protocol. The Prometheus server does not yet make use of the type information and flattens all data into untyped time series.

I'm using a remote storage adapter and need data type to be sent along with each metric. How can I do this?


Solution

  • As you pointed out from the documentation, the metric type is not preserved.

    You can use the metric name to get a hint on what the metric represents. For example, for well instrumented applications and exporters, the suffixes _total, _count, _bucket, _sum... represent counters.