Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: configure http client from config #930

Closed
wants to merge 1 commit into from

Conversation

brancz
Copy link
Member

@brancz brancz commented Jul 27, 2017

It seems that many people are interested in configuring the HTTP client used to perform requests to the notification providers. As @Conorbro recently added support for this in the common/config package, I made use of it here.

Closes #853

@stuartnelson3 @fabxc @mxinden @gouthamve @brian-brazil

@@ -176,6 +178,8 @@ func (c *EmailConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
type PagerdutyConfig struct {
NotifierConfig `yaml:",inline" json:",inline"`

HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go in NotifierConfig considering we use it everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have it everywhere except email configs, it would be odd to be able to have it there, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true.

notify/impl.go Outdated
@@ -141,13 +142,13 @@ var userAgentHeader = fmt.Sprintf("Alertmanager/%s", version.Version)
// Webhook implements a Notifier for generic webhooks.
type Webhook struct {
// The URL to which notifications are sent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment needs an update

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why the URL was exported before, I moved the Config -> conf to be consistent with all the other implementations.

@brancz
Copy link
Member Author

brancz commented Jul 27, 2017

If there are no general concerns anymore I'll start working on docs.

@stuartnelson3
Copy link
Contributor

No concerns from me, looks cool

@brancz
Copy link
Member Author

brancz commented Jul 27, 2017

I just talked to @fabxc, he has some comments on the general topic of the common package. I'll hold off on merging util he has a look.

@fabxc
Copy link
Contributor

fabxc commented Jul 31, 2017

I've plenty of concerns on this – but that's a longer discussion I hope to find time for soonish.

Where else is this struct being used outside of AM?

@brian-brazil
Copy link
Contributor

Right now the blackbox exporter. We likely also need it in the consul exporter.

@brancz
Copy link
Member Author

brancz commented Dec 14, 2017

@fabxc @brian-brazil how should we continue on this, as it should be possible for people to configure this somehow.

@brian-brazil
Copy link
Contributor

I've been proposing code in common for this for 18 months now, which is what the blackbox exporter uses. @fabxc is against us having common packages for this, while I strongly believe code like this (particularly security related) must come from a common library.

@brancz
Copy link
Member Author

brancz commented Dec 18, 2017

I've plenty of concerns on this – but that's a longer discussion I hope to find time for soonish.

I guess this would be the start of having this discussion, so we can come to an agreement of how to proceed. I personally don't object to having this particular piece in common, but am open to hearing counter arguments.

@simonpasquier
Copy link
Member

To set the discussion, here is a recap of the concrete use cases that call for more flexibility on the HTTP client configuration:

  • Use bearer tokens for web-hook services running behind proxies like kube-rbac-proxy and oauth-proxy.
  • Override TLS parameter (skip certificate verification, custom CA, ...).
  • Use HTTP proxies.

@brian-brazil
Copy link
Contributor

We're all good with the use cases, it's exactly how we share the common code that there is disagreement on.

@ddewar2k
Copy link

Moving my question to this more recent thread. I still don't see code that supports http proxy for receivers and it looks like all the threads on this closed. Is my understanding correct?

@simonpasquier
Copy link
Member

@brancz @brian-brazil @fabxc Now that Prometheus itself uses http client from the common library (see prometheus/prometheus#3674), can we reconsider this PR?
FWIW I've rebased the PR on the master branch in my local fork and after resolving the conflicts, it seems to be working fine.

@brancz
Copy link
Member Author

brancz commented Feb 1, 2018

I'm happy with going forward with this.

@simonpasquier
Copy link
Member

@brancz, cool! This is your PR rebased on master: master...simonpasquier:httpcfg
If you don"t have time, I can carry on the work.

@brancz
Copy link
Member Author

brancz commented Feb 1, 2018

@simonpasquier I don't know when I would get to it, so if you can, go for it!

@simonpasquier
Copy link
Member

@brancz I've created #1222.

hh pushed a commit to ii/alertmanager that referenced this pull request May 8, 2018
Signed-off-by: Steve Kotsopoulos <sk@fywss.com>
hh pushed a commit to ii/alertmanager that referenced this pull request May 8, 2018
Changes since 0.16.0-rc.3

* [CHANGE] align Darwin disk stat names with Linux prometheus#930

Signed-off-by: Ben Kochie <superq@gmail.com>
hh pushed a commit to ii/alertmanager that referenced this pull request May 15, 2018
Changes since 0.16.0-rc.3

* [CHANGE] align Darwin disk stat names with Linux prometheus#930

Signed-off-by: Ben Kochie <superq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants