Skip to content

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

Conversation

grobinson-grafana
Copy link

@grobinson-grafana grobinson-grafana commented Jun 24, 2024

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 just Set(sil *pb.Silence) error as the additional string return value was redundant. The id is assigned to sil, and does not need to be returned. I have updated Upsert to do the same.

  • 700c04e

    Upsert must also 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. The bool to setSilence was removed as validation no longer happens in setSilence.

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.
Copy link

@yuri-tceretian yuri-tceretian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yuri-tceretian yuri-tceretian merged commit 5c35126 into grafana:main Jun 25, 2024
7 checks passed
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants