forked from prometheus/alertmanager
-
Notifications
You must be signed in to change notification settings - Fork 10
Bring in upstream fixes to silences #88
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
Merged
yuri-tceretian
merged 8 commits into
grafana:main
from
grobinson-grafana:grobinson/pick-silence-fixes
Jun 25, 2024
Merged
Bring in upstream fixes to silences #88
yuri-tceretian
merged 8 commits into
grafana:main
from
grobinson-grafana:grobinson/pick-silence-fixes
Jun 25, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit removes the Id from the method silences.Set(*pb.Silence) as it is redundant. The Id is still set even when creating a silence fails. This will be fixed in a later change. Signed-off-by: George Robinson <[email protected]>
…rometheus#3877) * Fix MaxSilences limit causes incomplete updates of existing silences This commit fixes a bug where the MaxSilences limit can cause an incomplete update of existing silences, where the old silence can be expired but the new silence cannot be created because it would exceeded the maximum number of silences. Signed-off-by: George Robinson <[email protected]> --------- Signed-off-by: George Robinson <[email protected]>
This commit improves the existing test coverage for silences to cover a number of additional cases, and also improve the comments of existing cases. Signed-off-by: George Robinson <[email protected]>
This commit updates the Upsert method to return just an error instead of the previous (string, error). This brings it up to date with changes upstream (prometheus#3881) where we removed the string return value because it was redundant. If error is non-nil, then the id is assigned to the *pb.Silence and does not need to be returned.
This commit adds a unit test for the postSilencesHandler to create and then update a silence. It shows that changing the ID of an existing silence returns 404 Not Found, and removing the ID of an existing silence re-creates that silence with a different ID. Signed-off-by: George Robinson <[email protected]>
This commit fixes a bug where an invalid silence causes incomplete updates of existing silences. This is fixed moving validation out of the setSilence method and putting it at the start of the Set method instead. Signed-off-by: George Robinson <[email protected]>
…ilences (prometheus#3897) This commit fixes a bug where the MaxSilenceSizeBytes limit can cause an incomplete update of existing silences, where the old silence can be expired but the new silence cannot be created because it would exceed the maximum size limit. Signed-off-by: George Robinson <[email protected]>
This commit updates the Upsert method to use the latest fixes from upstream. It must set the UpdatedAt timestamp before calling setSilence as this code was removed from setSilence, and it must also change the silence into a *pb.MeshSilence before calling setSilence as it now expects a *pb.MeshSilence instead of *pb.Silence.
grobinson-grafana
added a commit
to grafana/alerting
that referenced
this pull request
Jun 25, 2024
This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
grobinson-grafana
added a commit
to grafana/alerting
that referenced
this pull request
Jun 25, 2024
This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
grobinson-grafana
added a commit
to grafana/alerting
that referenced
this pull request
Jun 25, 2024
This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
yuri-tceretian
approved these changes
Jun 25, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
grobinson-grafana
added a commit
to grafana/alerting
that referenced
this pull request
Jun 25, 2024
This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
yuri-tceretian
pushed a commit
to grafana/alerting
that referenced
this pull request
Jun 25, 2024
Bump Alertmanager This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
grobinson-grafana
added a commit
to grafana/alerting
that referenced
this pull request
Jun 26, 2024
Bump Alertmanager This commit updates Alertmanager to the include the fixes to silences in grafana/prometheus-alertmanager#88. Upsert no longer returns the id of the upserted silence as it is redundant. The id is stored in the silence and can be accessed via sil.Id. This brings the behaviour of Upsert inline with Set, which also removed the id from its return values.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request brings in a number of upstream fixes to silences:
There are two commits which are not picked from upstream, these are:
b43b86c
We changed the behavior of
Set(sil *pb.Silence) (string, error)
to justSet(sil *pb.Silence) error
as the additional string return value was redundant. The id is assigned tosil
, and does not need to be returned. I have updatedUpsert
to do the same.700c04e
Upsert
must also set theUpdatedAt
timestamp before callingsetSilence
as this code was removed fromsetSilence
, and it must also change the silence into a*pb.MeshSilence
before callingsetSilence
as it now expects a*pb.MeshSilence
instead of*pb.Silence
. The bool tosetSilence
was removed as validation no longer happens insetSilence
.