prometheus / prometheus/alertmanager

Feature request: graceful configuration reload

Open
#2,146 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/high availability component/notify stale
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

What did you do?
I have 2 Alertmanagers installed in HA and am using Opsgenie integration. Sometimes the configuration is updated and reloaded automatically on both instances at around same time.

What did you expect to see?
No alerts notifications towards integrations are dropped.

What did you see instead? Under which circumstances?
Sometimes the alert would remain open on Opsgenie, even though it's resolved on Prometheus. After some investigation I pinpointed the issue on config reload.
If one AM reloads configuration slightly before the other, no problems (which happens most of the time). But sometimes, when the configuration reloads align just right, some notifications are dropped due to top level context being canceled on both of them. (Logs attached)
I fixed this for me by setting up different moments in time for config reload, so that at least one AM is "active" at a time, but was wondering if some kind of graceful shutdown of integrations wound be a good idea.

Environment

  • Alertmanager version:
alertmanager, version 0.17.0 (branch: HEAD, revision: c7551cd75c414dc81df027f691e2eb21d4fd85b2)
  build user:       root@932a86a52b76
  build date:       20190503-09:10:07
  go version:       go1.12.4
  • Logs:
level=debug ts=2019-12-17T08:05:00.481869442Z caller=dispatch.go:264 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post https://api.eu.opsgenie.com/v2/alerts: context canceled"
level=debug ts=2019-12-17T08:05:01.504148372Z caller=dispatch.go:264 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post https://api.eu.opsgenie.com/v2/alerts: context canceled"
level=debug ts=2019-12-17T08:05:01.650700099Z caller=dispatch.go:264 component=dispatcher msg="Notify for alerts failed" num_alerts=1 err="Post https://api.eu.opsgenie.com/v2/alerts: context canceled"

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failed notification path shown at dispatch.go:264 and trace how configuration reload cancels integration work. Review the attached context-canceled logs and the reload behavior for both Alertmanager instances. Done should prevent notifications from being dropped when reloads overlap, including the Opsgenie case described.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.