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

Remove .WasInhibited and .WasSilenced fields of Alert type #1026

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

brancz
Copy link
Member

@brancz brancz commented Oct 4, 2017

This fixes the race condition reported in #1013.

As I was fixing this, I noticed, that I couldn't find where or if this is actually used anywhere, as it's not rendered in the json response, and otherwise not used at all either. If we can confirm this we can probably remove it entirely. I know there was some work around this relatively recently, but don't remember exactly anymore what.

Fixes #1013

@stuartnelson3 @fabxc @mxinden

@brancz
Copy link
Member Author

brancz commented Oct 4, 2017

I kept testing this with real life examples, that I missed to check whether the unit tests still like the code, my bad.

But before I fix these issues, I would like to answer the question I wrote in the PR description. Are these fields actually useful for us? They seem to only be used in tests, and from what I can tell we should be able to solve their usage otherwise in the tests.

@fabxc
Copy link
Contributor

fabxc commented Oct 6, 2017

Honestly, I don't quite remember. Maybe we used them in the past. But if they are unused now, we might just want to remove them until we need them again?

@josedonizetti
Copy link
Contributor

+1 to remove until needed

@stuartnelson3
Copy link
Contributor

Seems like it was introduced here: 4ada239#diff-e3c7390fa395ee56af39ca3c727e01b6

The only use of it in this commit is for testing, so it's probably been that way for the lifetime of the struct member. If we're not using it, might as well get rid of it.

@brancz brancz changed the title notify: fix race of writing to Alert.WasSilenced Remove .WasInhibited and .WasSilenced fields of Alert type Oct 10, 2017
@brancz
Copy link
Member Author

brancz commented Oct 10, 2017

I removed the .WasInhibited and .WasSilenced fields of the Alert type. The changes show that they were used nowhere except for the tests, where it was tested, that they were set.

@brancz
Copy link
Member Author

brancz commented Oct 10, 2017

@fabxc @stuartnelson3 @josedonizetti PTAL :)

@brancz brancz merged commit ff9e527 into prometheus:master Oct 10, 2017
@brancz brancz deleted the marker-race branch October 10, 2017 14:49
hh pushed a commit to ii/alertmanager that referenced this pull request Aug 5, 2018
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.

Race in writing to Alert.WasSilenced
4 participants