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
Confusing comments in silence.go #3774
Comments
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this issue
Mar 22, 2024
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this issue
Mar 22, 2024
Signed-off-by: George Robinson <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
I was looking at the code in
silence.go
and – unless I'm being obtuse – I think some of the comments and tests are documented as working the opposite way from how they actually work.For example, the comment for
silenceFilter
is:The important phrase:
And the tests for some of the filters support this:
However, if I look in
query
where these functions are used:it seems that if the filter returns true, then it is instead included in the result set, and removed if it returns false. This is the opposite of what is in the comment:
The tests for querying seem to support this too:
because if "returns true if a silence should be dropped from a result set" were true, then the IDs 1 and 2 would be excluded from the result, rather than expected.
I just wanted to check that I'm not confused before I open a PR to fix this.
The text was updated successfully, but these errors were encountered: