Skip to content

CounterMetricFamily returns float values #1164

@epu

Description

@epu

I'm wrapping an application's telemetry into a format suitable for prom.

I might misunderstand the documentation at https://prometheus.github.io/client_python/collector/custom

My expectation for counters is that they are ever increasing integers. The CounterMetricFamily sets float values, if you pass an integer in its constructor value kwarg.

In the example, if you register a CounterMetricsFamily, assigning an int value, the value comes back as the float value of the integer.

For example, if you set the value to 4, it gets reported as 4.0

This makes sense, since the code of the implementation is setting the value explicitly as a float in its constructor.
Is that expected?

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