Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSend arbitrary extra headers when scraping #1724
Comments
brian-brazil
added
the
kind/enhancement
label
Jun 10, 2016
This comment has been minimized.
This comment has been minimized.
|
FWIW, someone is currently adding header support to the blackbox exporter, so there is some precedent: prometheus/blackbox_exporter#32 @brian-brazil what do you think about having this in Prometheus as well? |
This comment has been minimized.
This comment has been minimized.
|
In the case of the blackbox exporter, it's intended to be able to do arbitrary http blackbox probing so what makes sense there (which is basically all HTTP settings) doesn't necessarily make sense in Prometheus. The question here is how complex do we want to allow scraping protocol to be, and how complex a knot are we willing to let users tie themselves in via the core configuration? Are we okay with making it easy for a scrape not to be quickly testable via a browser? At some point we have to tell users to use a proxy server to handle the more obscure use cases, rather than drawing their complexity into Prometheus. As far as I'm aware the use case here relates to a custom auth solution with a non-recommended network setup. It's not unlikely that the next request in this vein would be to make these relabelable, and as this is an auth-related request, per discussion on #1176 we're not going to do that. I think we'd need a stronger use case to justify adding this complexity. |
This comment has been minimized.
This comment has been minimized.
|
Sounds reasonable.
|
This comment has been minimized.
This comment has been minimized.
|
FWIW, JWT is not a custom auth and "recommended" is a very subjective term. I expect users to want their |
This comment has been minimized.
This comment has been minimized.
|
JWT only requires the Authorization header, which we support. Asking for headers on top of that indicates something custom. |
This comment has been minimized.
This comment has been minimized.
|
Closing this since it seems like we're deciding against implementing this for now. Please reopen if I'm wrong. |
juliusv
closed this
Jul 23, 2016
fabxc
referenced this issue
Aug 25, 2016
Closed
Support for specifying HTTP headers in scrape configs #1921
fabxc
referenced this issue
Jan 17, 2017
Closed
Support for HTTP Headers when performing metrics scraping #2346
This comment has been minimized.
This comment has been minimized.
sra
commented
Feb 24, 2017
|
Just in case others come looking here for how to do this (there are at least 2 other issues on it), I've got a little nginx config that works. I'm not an nginx expert so don't mock! ;) I run it in docker. A forward proxy config file for nginx listening on 9191:
Run the transparent forward proxy:
In your prometheus job (or global) add the
|
This comment has been minimized.
This comment has been minimized.
|
Are you sure that's the right config? I'm not an nginx expert but it seems to be taking part of the URL path and changing it to the port, rather than setting a header. |
This comment has been minimized.
This comment has been minimized.
sra
commented
Feb 24, 2017
|
It's working great! That part is needed to make it proxy to host:port pairs that are not known in advance. Well it is at least is the only way my limited nginx config experience found to do it. |
This comment has been minimized.
This comment has been minimized.
thangbn
commented
Jul 14, 2017
|
+1 |
This comment has been minimized.
This comment has been minimized.
robachmann
commented
Aug 22, 2017
|
@thangbn we are using Cloud Foundry too and setting custom headers in Prometheus would be most appreciated. I register applications in Consul and set X-CF-APP-INSTANCE as a tag which in a further step should be read and used by Prometheus in order to target individual instances. Until then, we use Prometheus' PushGateway to push instance specific metrics like memory-usage. I know PushGateway isn't intended for that use-case (https://prometheus.io/docs/practices/pushing/) but as long as we can't set headers for scraping we're bound to that work-around. |
domq
pushed a commit
to epfl-sti/wordpress.blue-green
that referenced
this issue
Jan 13, 2018
This comment has been minimized.
This comment has been minimized.
eaglerainbow
commented
Mar 20, 2018
|
@thangbn @robachmann As you mention Cloud Foundry in this regard - for some days, there is a new kid on the block (Promregator), which is handling exactly your use case: scraping metrics from Clound Foundry applications using the X-CF-APP-INSTANCE approach. As said it's still quite fresh meat, but I would appreciate if you gave it a try providing your feedback. |
This comment has been minimized.
This comment has been minimized.
fitzoh
commented
Jun 1, 2018
|
Also came here looking for a way to set the @juliusv any chance of reconsidering this one? Cloud foundry has increased in popularity significantly since the issue was initially closed, and that particular use case has brought multiple people to this thread. |
This comment has been minimized.
This comment has been minimized.
|
If you're on Cloud Foundry you should look at something along the lines of https://github.com/promregator/promregator |
uepoch
referenced this issue
Sep 25, 2018
Closed
Support token passed in Authorization Bearer HTTP header #5396
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
jakedt commentedJun 10, 2016
It is currently possible to set the
Authorizationheader when scraping hosts. I would like to extend this functionality to allow any arbitrary headers to be specified and set via config. Our particular use case is to send a signal to some proxy middleware, but there could definitely be other use cases sending information out of band directly to the hosts being scraped.I think the implementation should be pretty simple, and I would take a stab at it if it is likely to get accepted. Thoughts?