On 8/26/21 06:14, Dorian Jaminais-Grellier wrote:
> Now the naive way is to create a gauge for the sensor and expose it all
> the time. The problem is that this makes it impossible for me to
> distinguish between the temperature staying constant and the sensor not
> reporting any metrics anymore.
> 
> Another way, as suggested in the docs
> <https://prometheus.io/docs/practices/instrumentation/#avoid-missing-metrics>,
> is to report 0, but then I can't distinguish between the temperature
> being 0 and a 0 meaning no data.
> 
> I could make the metrics disappear completely from my /metrics endpoint
> but I understand this is frown upon but it would have the advantage of
> being very clear to users that the data is missing.
> 
> Final idea that I have is to report two metrics, one for the temperature
> and one for the last collection time, but this is very confusing for
> users to use since they will need to think about invalidating the
> temperature data at query time whenever the last collection time goes
> above an arbitrary threshold. 
> 
> So here I am. Is there a recommended pattern for this type of metrics?
> Is there another option I haven't listed above?

I'd also love to know an answer for that (after considering the very
same work-arounds like you).

There's a metric value missing like None / NULL or whatever you're used
to in programming languages to express "nothing herein".

Ciao, Michael.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/faf82414-8c0c-996f-342e-0900ca0730aa%40stroeder.com.

Reply via email to