The Grouping() method doesn't seem to leverage the instance id in the url
of the push gateway. In my use case I've inherited a batch framework where
the batch jobs push metrics to a common pushgateway solution, but nothing
is deleting them. I'm trying to write a service that will track the batch
jobs and delete the metrics after a period of time where the batch job type
was used as the job id and the specific instance of the batch job is used
as the instance id.
Having read through a fair amount of documentation, this setup seems like
an appropriate use of instance level metrics. I'd be happy to hear if there
is a better way to handle it. The best practices linked in the response
seems to indicate that maybe it shouldn't be used here, but it doesn't
cover what would be recommended instead.
On Wednesday, April 19, 2023 at 7:46:00 AM UTC-5 Julius Volz wrote:
> Yes, you can use the Grouping() method to add other labels to the grouping
> key:
> https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/push#Pusher.Grouping
>
> - it returns a new Pusher with the new label added.
>
> Note that instance-level usage of the Pushgateway is not usually
> encouraged (see
> https://prometheus.io/docs/practices/pushing/#when-to-use-the-pushgateway
> for why).
>
> On Tue, Apr 18, 2023 at 3:36 PM Aaron Reisman wrote:
>
>> The Pushgateway's documentation includes the ability to delete all
>> metrics for a given job and instance label.
>>
>> curl -X DELETE
>> http://pushgateway.example.org:9091/metrics/job/some_job/instance/some_instance
>>
>> The Prometheus go client has support for making a pusher for a specific
>> job label, but doesn't appear to have anywhere to specify the instance
>> label. Does anyone know if there is a way, using the go library, to delete
>> metrics for a specific job and instance label pair?
>>
>> Thanks,
>> Aaron
>>
>> --
>> 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/6e8eadf6-cba1-4838-afce-1f0546805674n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/prometheus-users/6e8eadf6-cba1-4838-afce-1f0546805674n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Julius Volz
> PromLabs - promlabs.com
>
--
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/c7b4ed1d-97f6-434c-9f5a-06eb6eef6838n%40googlegroups.com.