Hello,

I have a scheduled task that periodically pushes metrics to the prometheus 
gateway.

My desired behaviour would be for each "push" to overwrite previous pushes, 
even if the metrics and labels pushed are not one-for-one compared to 
previous push.

Reading the documentation on PUT 
<https://github.com/prometheus/pushgateway#put-method> vs POST 
<https://github.com/prometheus/pushgateway#post-method> I see this:

> PUT is used to push a group of metrics. All metrics with the grouping key 
specified in the URL are replaced by the metrics pushed with PUT.

My understanding of the above is that PUT will do exactly what I want. 
However, in the POST section I read:

> POST works exactly like the PUT method but only metrics with the same 
name as the newly pushed metrics are replaced (among those with the same 
grouping key).

What does "metrics with the same name" mean? Let's say I have 2 consecutive 
pushes with the payloads below. What using POST would do vs using PUT? 
Which are the "metrics with the same name" that would be replaced? Would it 
be `external_ats_metric1`, regardless the fact that there are different 
labels in the 2nd push?

Thank you,

Markos

PUSH #1

# TYPE external_ats_metric1 gauge
external_ats_metric1{app=\"foo\",component=\"component1\",priority=\"low\"} 
1
external_ats_metric1{app=\"foo\",component=\"component2\",priority=\"low\"} 
2
external_ats_metric1{app=\"foo\",component=\"component3\",priority=\"low\"} 
3

# TYPE external_ats_metric2 gauge
external_ats_metric2{app=\"foo\",component=\"component1\",priority=\"low\"} 
1
external_ats_metric2{app=\"foo\",component=\"component2\",priority=\"low\"} 
2
external_ats_metric2{app=\"foo\",component=\"component3\",priority=\"low\"} 
3

PUSH #2

# TYPE external_ats_metric1 gauge
external_ats_metric1{app=\"foo\",component=\"component4\",priority=\"low\"} 
1
external_ats_metric1{app=\"foo\",component=\"component5\",priority=\"low\"} 
2
external_ats_metric1{app=\"foo\",component=\"component6\",priority=\"low\"} 
3

# TYPE external_ats_metric3 gauge
external_ats_metric3{app=\"foo\",component=\"component1\",priority=\"low\"} 
1
external_ats_metric3{app=\"foo\",component=\"component2\",priority=\"low\"} 
2
external_ats_metric3{app=\"foo\",component=\"component3\",priority=\"low\"} 
3

-- 
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/7d3796e9-6592-47af-8ed4-6c593ea67d36n%40googlegroups.com.

Reply via email to