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 vs
POST 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