prometheus-engine icon indicating copy to clipboard operation
prometheus-engine copied to clipboard

Support of sending custom header in Alertmanagers in operatorconfig

Open kartik7153 opened this issue 2 years ago • 10 comments

Hi, We are running our cortex and want to use alertmanager for cortex for routing the alerts. I couldn't see support for adding headers in alertmanagers

kartik7153 avatar Aug 18 '22 12:08 kartik7153

Sorry, I don't understand... GMP has nothing to do with Cortex. What are you trying to accomplish?

lyanco avatar Aug 18 '22 19:08 lyanco

I am trying to use cortex's alertmanager to push alert to respective channels.

kartik7153 avatar Aug 19 '22 04:08 kartik7153

OK, I'm not familiar with that. Why do you need headers to be able to communicate with it?

lyanco avatar Aug 19 '22 13:08 lyanco

So cortex's alert-manager needs X-Scope-OrgID to be able to authenticate the request and to be able to figure out the tenant. more on this here.

kartik7153 avatar Aug 25 '22 06:08 kartik7153

Hi any updates on this?

kartik7153 avatar Sep 16 '22 05:09 kartik7153

Hi @kartik7153 - IIUC you want the ability to add a custom header to the alert HTTP request going to the configured alertmanager endpoint?

pintohutch avatar Sep 23 '22 16:09 pintohutch

Yes right.

kartik7153 avatar Oct 04 '22 08:10 kartik7153

At this point in time, Prometheus does not support custom HTTP headers in its config. The idea has been discussed from the scrape side, but was decided against.

However, this should be possible through a forwarding proxy in the proxy_url section of alertmanager_config. In fact, someone on that thread suggested a solution using an nginx container that works for scraping. I wonder if the same thing can work from the alerting side.

pintohutch avatar Oct 12 '22 03:10 pintohutch

Note - this soon may be possible with https://github.com/prometheus/common/pull/416..

pintohutch avatar Jan 10 '23 13:01 pintohutch

At this point in time, Prometheus does not support custom HTTP headers in its config. The idea has been discussed from the scrape side, but was decided against.

However, this should be possible through a forwarding proxy in the proxy_url section of alertmanager_config. In fact, someone on that thread suggested a solution using an nginx container that works for scraping. I wonder if the same thing can work from the alerting side.

I have some issues about this "use a proxy" workaround as the "official solution". Also the "decided against" is actually a very short conversation, not a real discussion with arguments and counter-arguments, just an "I don't think this is the responsibility of the scraper." statement. I have a counter-argument however, I think it IS the responsibility of the scraper to set headers required by the exporter. No third-party man-in-the-middle service should be required just for doing that. Details in https://github.com/prometheus/prometheus/issues/13098.

gviczai avatar Nov 05 '23 02:11 gviczai