How prometheus.io annotations work

1,913 views
Skip to first unread message

paolo.p...@gmail.com

unread,
Dec 5, 2017, 10:59:59 AM12/5/17
to Prometheus Users
Hi,
in my understanding the prometheus.io/port (and prometheus/scrape) annotations are useful for specifying the port where Prometheus should scrape for metrics avoiding it to scrape on other ports.
I have a pod which expose different ports but only one expose metrics (9404). I annotated the pod with prometheus.io/port: 9404 but I still see that Prometheus tries to get metrics from other ports (I can see it in the "target" tab of the web UI).
I'm using kubernetes_sd_configs and I tried with role pod and service both in both cases more targets are created.
Is that right and just my wrong understanding of above annotations ?
In this case what's the way for avoiding Prometheus scraping on other ports ?

Thanks,
Paolo.

Simon Pasquier

unread,
Dec 7, 2017, 5:01:52 AM12/7/17
to paolo.p...@gmail.com, Prometheus Users
Hi,
You need to share your Prometheus SD config for us to help.
Simon

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4d4d3a5a-cc0e-4c0c-b1ee-ffd659c8f53e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias Rampke

unread,
Dec 7, 2017, 5:35:10 AM12/7/17
to Simon Pasquier, paolo.p...@gmail.com, Prometheus Users

The annotations are not "special" to the discovery; the example configuration uses relabelling rules that make use of them. You can include them in your configuration as they are or adapt to your needs; for example at SoundCloud we've removed the need for the "scrape" annotation and check for presence of the port annotation instead because other tooling we have makes sure it is always set.

/MR


On Thu, Dec 7, 2017, 11:01 Simon Pasquier <pasquie...@gmail.com> wrote:
Hi,
You need to share your Prometheus SD config for us to help.
Simon
2017-12-05 16:59 GMT+01:00 <paolo.p...@gmail.com>:
Hi,
in my understanding the prometheus.io/port (and prometheus/scrape) annotations are useful for specifying the port where Prometheus should scrape for metrics avoiding it to scrape on other ports.
I have a pod which expose different ports but only one expose metrics (9404). I annotated the pod with prometheus.io/port: 9404 but I still see that Prometheus tries to get metrics from other ports (I can see it in the "target" tab of the web UI).
I'm using kubernetes_sd_configs and I tried with role pod and service both in both cases more targets are created.
Is that right and just my wrong understanding of above annotations ?
In this case what's the way for avoiding Prometheus scraping on other ports ?

Thanks,
Paolo.

--
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 post to this group, send email to promethe...@googlegroups.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-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAPrrXedBZJ2fMduWhKjN%3DHoFsongtNbo7xtoHYv8%3D2Bh1tL4Zw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages