You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every time my metric is updated, I'd like to clear all existing data before doing the update. This is because the existing data might be stale, and I want to make sure that the data associated with the metric is fresh.
It seems like the only way to do this is something like the following - removing the metric and then creating it again.
function updateMyGauge(x,y,z,val) {
register.removeSingleMetric('myMetric');
myGauge = new promClient.Gauge({name: 'myMetric',
help: 'myMetric_help',
labelNames: ['label1',
'label2',
'label3']});
myGauge.set({label1: x, label2: y, label3: z}, val)
}
Is there a better way? Otherwise, it'd be nice to have a method register.clearMetricData that clears all labels to value mappings but keeps the metric definition itself intact.
The text was updated successfully, but these errors were encountered:
The sense I'm getting from reading the Prometheus forums (i.e. prometheus/client_golang#187, prometheus/collectd_exporter#24) is that specifying timestamps for metrics is discouraged. The Prometheus philosophy seems to be that the client side endpoint should always provide truthful and up to date data at time of scrape.
Every time my metric is updated, I'd like to clear all existing data before doing the update. This is because the existing data might be stale, and I want to make sure that the data associated with the metric is fresh.
It seems like the only way to do this is something like the following - removing the metric and then creating it again.
Is there a better way? Otherwise, it'd be nice to have a method
register.clearMetricData
that clears all labels to value mappings but keeps the metric definition itself intact.The text was updated successfully, but these errors were encountered: