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

Implement quorum reads and merging for /v2/alerts and /v2/alerts/groups. #4127

Merged
merged 2 commits into from
Apr 28, 2021

Conversation

stevesg
Copy link
Contributor

@stevesg stevesg commented Apr 26, 2021

What this PR does:

Reading alert listings via /v2/alerts and /v2/alerts/groups will now
read from a quorum of replicas and return a merged response.

Alerts are merged by returning the union of alerts over all responses.
When multiple responses contain the same alert, the alert with the most
recent "updatedAt" timestamp is chosen. Groups are returned by returning
the union of groups over all responses. When the same group is present in
multiple responses (same receiver and labels fingerprint), the groups are
merged into by merging the sets of alerts in each.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

stevesg added 2 commits April 28, 2021 10:55
Reading alert listings via /v2/alerts and /v2/alerts/groups will now
read from a quorum of replicas and return a merged response.

Alerts are merged by returning the union of alerts over all responses.
When multiple responses contain the same alert, the alert with the most
recent "updatedAt" timestamp is chosen. Groups are returned by returning
the union of groups over all responses. When the same group is present in
multiple responses (same receiver and labels fingerprint), the groups are
merged into by merging the sets of alerts in each.

Signed-off-by: Steve Simpson <[email protected]>
@stevesg stevesg marked this pull request as ready for review April 28, 2021 09:55
Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Nice job, especially the unit tests!

@gouthamve
Copy link
Contributor

Can you please rebase against master to pull in #4137 and move the changelog entry to the top?

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Amazing job! Looks flawless to me 👏

@pstibrany
Copy link
Contributor

Does this (and previous) PR need a changelog entry?

@pracucci
Copy link
Contributor

Does this (and previous) PR need a changelog entry?

Right! The whole alertmanager sharding work is missing a CHANGELOG entry. @stevesg I think it's time to open a PR with that, given the work is getting done.

@pracucci pracucci merged commit ceaefc8 into cortexproject:master Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants