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

vmalert: support configuration file for notifiers #2127

Merged
merged 11 commits into from
Feb 2, 2022
Merged

Conversation

hagen1778
Copy link
Collaborator

Signed-off-by: hagen1778 roman@victoriametrics.com


image

* vmalert notifiers now can be configured via file
see https://docs.victoriametrics.com/vmalert.html#notifier-configuration-file
* add support of Consul service discovery for notifiers config
see #1947
* add UI section for currently loaded/discovered notifiers
* deprecate `-rule.configCheckInterval` in favour of `-configCheckInterval`

Signed-off-by: hagen1778 <roman@victoriametrics.com>
@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #2127 (3c14c39) into master (bd9e30c) will increase coverage by 0.20%.
The diff coverage is 46.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2127      +/-   ##
==========================================
+ Coverage   60.31%   60.51%   +0.20%     
==========================================
  Files         240      239       -1     
  Lines       40269    40279      +10     
==========================================
+ Hits        24288    24375      +87     
+ Misses      14376    14276     -100     
- Partials     1605     1628      +23     
Impacted Files Coverage Δ
app/vmalert/notifier/init.go 0.00% <0.00%> (ø)
app/vmalert/utils/metrics.go 0.00% <0.00%> (ø)
app/vmalert/web.qtpl.go 3.61% <2.43%> (-0.71%) ⬇️
app/vmalert/web.go 51.12% <40.00%> (-0.61%) ⬇️
app/vmalert/main.go 35.21% <53.84%> (+0.72%) ⬆️
app/vmalert/notifier/config.go 62.96% <62.96%> (ø)
app/vmalert/notifier/alertmanager.go 72.97% <71.69%> (-10.37%) ⬇️
app/vmalert/notifier/config_watcher.go 74.55% <74.55%> (ø)
app/vmalert/group.go 73.01% <87.50%> (-0.65%) ⬇️
app/vmalert/alerting.go 76.53% <100.00%> (ø)
... and 38 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd9e30c...3c14c39. Read the comment docs.

vmalert will repeat service discovery calls if on init first attempts
returned nothing.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Copy link
Contributor

@f41gh7 f41gh7 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! have few minor comments

app/vmalert/group.go Outdated Show resolved Hide resolved
app/vmalert/manager.go Show resolved Hide resolved
app/vmalert/notifier/config.go Outdated Show resolved Hide resolved
app/vmalert/notifier/config_watcher.go Show resolved Hide resolved
app/vmalert/notifier/config_watcher.go Outdated Show resolved Hide resolved
app/vmalert/notifier/config_watcher.go Outdated Show resolved Hide resolved
…fiers discovery

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
* move metrics structs used in the main vmalert package to utils
so it can be reused by other subpackages
* move metrics to alertmanager struct because it should handle those
* support metrics registering/unregistering on notifier config changes
* change behaviour of `vmalert_alerts_send_errors_total` - it now accounts
for failed alerts, not HTTP calls.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Such situation is expected when user runs only recording rules

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Copy link
Contributor

@f41gh7 f41gh7 left a comment

Choose a reason for hiding this comment

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

LGTM

@hagen1778 hagen1778 merged commit 5da71eb into master Feb 2, 2022
@hagen1778 hagen1778 deleted the vmalert-sd branch February 2, 2022 12:11
valyala pushed a commit that referenced this pull request Feb 2, 2022
vmalert: support configuration file for notifiers

* vmalert notifiers now can be configured via file
see https://docs.victoriametrics.com/vmalert.html#notifier-configuration-file
* add support of Consul service discovery for notifiers config
see #1947
* add UI section for currently loaded/discovered notifiers
* deprecate `-rule.configCheckInterval` in favour of `-configCheckInterval`
* add ability to suppress logs for duplicated targets for notifiers discovery
* change behaviour of `vmalert_alerts_send_errors_total` - it now accounts
for failed alerts, not HTTP calls.
@valyala
Copy link
Collaborator

valyala commented Feb 14, 2022

FYI, this pull request has been included into v1.73.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants