"i need to clear the metrics to remove the old stale values before i set 
the metrics to the respective values again."

I don't understand what you mean by that. Surely you just change the metric 
from the old value, to the new value?  What sort of metric is it?  Perhaps 
you are trying to use a gauge when a counter would be the right thing?

That is, don't return a metric for "the number of things that happened in 
the last 30 seconds": return a metric for "the total number of things that 
happened since the exporter started".

> Is there a way to enforce some syncronization between node exporter and 
prometheus scrape cycle ?

No, and that's by design. You should be able to point two, three or more 
prometheus instances at the same exporter, and it should continue to work. 
You should be able to make test scrapes using curl, and it shouldn't break 
scraping by other prometheus servers. If your exporter changes state when a 
scrape takes place, then it's not following the intended model.

Gauges should return *the current* or *most recently known* value of a 
metric, and counters should return *the current* or *most recently known* 
value of the counter.

You say that sometimes your additional data collection takes longer than 30 
seconds.  In that case, I'd suggest you write a periodic task which 
triggers itself every 30 seconds, and writes out the results to a file for 
the node_exporter textfile collector to pick up.  If it takes longer than 
30 seconds, then in principle it's fine to miss a cycle: you keep exporting 
the old values for longer.  Any values which are gauges will update to the 
most recent value on the next scrape, and any values which are counters 
should count all the events which occurred between the two scrapes.

With that model, you can have as many prometheus servers scraping the same 
exporter as you like, without creating extra load; and metrics will be 
delayed by no more than 30 seconds.

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/645fd383-00f9-45ab-9dbc-99d639b9ba1dn%40googlegroups.com.

Reply via email to