Skip to content

Exporter sends stale values instead of no value, from bursty source #749

@chadmiller

Description

@chadmiller

I have data source, power meters, who report at random times. I put their values into a Gauge.

Some meters report often, every 30 seconds. Some report every 12 hours.

When the data arrives at least a frequently as the prometheus time-frame interval, there is no weirdness. When the time between data points is longer, the exporter reports the last reported value, which looks like it's asserting that the value hasn't changed, when in fact it has no idea if the value has changed.

I am kind of new to Prometheus and I may be doing something wrong, I admit, but I think I can get a better idea from truthful time reports

1000,null,null,null,null,null,null,3000,null,null,null,null,null,null,null,null,null,null,null,null,8000

than a series of mostly lies

1000,1000,1000,1000,1000,1000,1000,3000,3000,3000,3000,3000,3000,3000,3000,3000,3000,3000,3000,3000,8000

from prometheus_client import start_http_server, Counter, Gauge

power_gauge = Gauge('powermeter_readings_kwh', 'power consumption', ["meterid"])

start_http_server(8000)

for reading in source():
    power_gauge.labels(meterid=reading.get("ID")).set(reading.get("Consumption"))

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