Re: [prometheus-users] What is the difference between pushgateway post and put methods

39 views
Skip to first unread message

Mat Arye

unread,
Jun 26, 2020, 12:19:26 PM6/26/20
to Roman Ratsun, Prometheus Users
So from my understanding, given a grouping key specified in the url and a metric m1 that exists in the data with the grouping key but /is not/ in the payload. Under put, that metric would be deleted since put overrides all the data for the grouping key. Push on the other hand will leave m1 alone, thats whats meant be "but only metrics with the same name as the newly pushed metrics are replaced"

Another way to see this clearly is this line from the docs "PUT request with an empty body effectively deletes all metrics with the specified grouping key."

On Fri, Jun 26, 2020 at 6:57 AM Roman Ratsun <r.ratsu...@gmail.com> wrote:
https://github.com/prometheus/pushgateway#post-method
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).

I don't understand this definition. When I send request by post method the metrics are replaced and when I send request by put the metric are replaced. What is the difference? And ofcourse I send post and put with the same grouping key.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/88e7aded-2e24-4fb2-9f2f-e8ba624f4ba4o%40googlegroups.com.


--
Mat Arye, Timescale-Prometheus Team Lead
See what we're working on (feedback welcome!): tsdb.co/prom-design-doc

Julius Volz

unread,
Jun 27, 2020, 12:42:15 PM6/27/20
to Mat Arye, Roman Ratsun, Prometheus Users
Yeah. POST preserving metrics from an old run can be useful for example when you have a batch job that pushes certain metrics only on success, but still pushes a subset of metrics when it does not succeed. For example, it might always push "my_batch_job_last_run_timestamp_seconds" to tell you the last time it ran, but only push "my_batch_job_last_success_timestamp_seconds" when it actually succeeded. By using POST, you can keep the success timestamp metric from the old run by not sending that metric at all, but only the last run timestamp.



--
Julius Volz
PromLabs - promlabs.com
Reply all
Reply to author
Forward
0 new messages