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

Alerts might be dropped #1843

Merged
merged 2 commits into from
Apr 20, 2019

Conversation

simonpasquier
Copy link
Member

While investigating a flaky test, I found out that the iterator returned by (*github.com/prometheus/alertmanager/provider/mem.Alerts).Subscribe() might miss alerts that would be added in-between. I've also modified (*github.com/prometheus/alertmanager/storemem.Alerts).List() to return a slice rather than a closed buffered channel which I feel is more idiomatic.

If you run TestAlertsSubscribe several times without the fix, it should exhibit the issue:

$ go test -run TestAlertsSubscribe -count 100 -race  ./provider/mem/.
--- FAIL: TestAlertsSubscribe (5.03s)
    mem_test.go:238: Unexpected number of alerts for iterator 99, got: 2, expected: 3
--- FAIL: TestAlertsSubscribe (5.04s)
    mem_test.go:238: Unexpected number of alerts for iterator 99, got: 2, expected: 3

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@stuartnelson3 stuartnelson3 merged commit 1d9a352 into prometheus:master Apr 20, 2019
@simonpasquier simonpasquier deleted the fix-dropped-alerts branch April 23, 2019 07:57
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.

2 participants