On Thu, Apr 20, 2023 at 11:09 PM Aaron Reisman <[email protected]> wrote:

> The Grouping() method doesn't seem to leverage the instance id in the url
> of the push gateway.
>

So this works for me and correctly groups the metrics under both the job
and instance label:

https://gist.github.com/juliusv/58d383ce2a803ec781fd410c9fc557e0

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.
>

Hmm, yeah it's ok-ish, you'll just have to automate the instance-level
metrics deletion yourself (as you are trying to do).


> 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 <[email protected]> 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 [email protected].
>>> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/c7b4ed1d-97f6-434c-9f5a-06eb6eef6838n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/c7b4ed1d-97f6-434c-9f5a-06eb6eef6838n%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAObpH5y0GxerH%2Bj9yNye_ssudaWhzsgmtdB2%3DV-0343WNCWZUA%40mail.gmail.com.

Reply via email to