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

Alerting: Fix stats that display alert count when using unified alerting #64852

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

gotjosh
Copy link
Contributor

@gotjosh gotjosh commented Mar 15, 2023

These stats are incorrect when using unified alerting as they query the legacy alert rule table. Now, we conditionally query one of the other.

TODO

  • Tests
  • figure out the config nil check - why do we have this in ngalert?

@gotjosh gotjosh requested a review from a team March 15, 2023 19:10
@gotjosh gotjosh requested a review from a team as a code owner March 15, 2023 19:10
@gotjosh gotjosh requested review from papagian, zserge and suntala and removed request for a team March 15, 2023 19:10
@gotjosh gotjosh marked this pull request as draft March 15, 2023 19:10
@gotjosh gotjosh added the backport v9.4.x Mark PR for automatic backport to v9.4.x label Mar 15, 2023
@gotjosh gotjosh changed the title Alerting: Fix stats when using unified alerting Alerting: Fix stats that display alert count when using unified alerting Mar 15, 2023
@grafanabot
Copy link
Contributor

Hello @gotjosh!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

@grafanabot grafanabot removed this from the 9.4.6 milestone Mar 16, 2023
@grafanabot
Copy link
Contributor

This pull request was removed from the 9.4.6 milestone because 9.4.6 is currently being released.

@gotjosh gotjosh marked this pull request as ready for review March 16, 2023 13:48
@gotjosh gotjosh added this to the 9.4.7 milestone Mar 16, 2023
Copy link
Member

@JacobsonMT JacobsonMT left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Copy link
Contributor

@alexweav alexweav left a comment

Choose a reason for hiding this comment

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

LGTM overall.

I guess this view is not per-org? Also, I was originally hesitant to capture the entire setting.Cfg for one field, but this service does span many areas... so that's probably OK.

pkg/tests/api/stats/admin_test.go Outdated Show resolved Hide resolved
Co-authored-by: Alexander Weaver <weaver.alex.d@gmail.com>
@gotjosh
Copy link
Contributor Author

gotjosh commented Mar 16, 2023

I guess this view is not per-org? Also, I was originally hesitant to capture the entire setting.Cfg for one field

Is there a way in which I can import only the boolean? I'd think there isn't given the "settings" struct needs to be provided directly.

@grafanabot grafanabot removed this from the 9.4.7 milestone Mar 16, 2023
@grafanabot
Copy link
Contributor

This pull request was removed from the 9.4.7 milestone because 9.4.7 is currently being released.

@gotjosh gotjosh added this to the 9.3.9 milestone Mar 17, 2023
@gotjosh gotjosh merged commit 02a8f62 into main Mar 17, 2023
@gotjosh gotjosh deleted the fetch-correct-stats-in-unified-alerting branch March 17, 2023 11:19
@gotjosh gotjosh modified the milestones: 9.3.9, 9.4.8 Mar 17, 2023
@grafanabot
Copy link
Contributor

The backport to v9.4.x failed:

Server Error

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-64852-to-v9.4.x origin/v9.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 02a8f62021750b0af6dd8760ca2516e5e285a998
# Push it to GitHub
git push --set-upstream origin backport-64852-to-v9.4.x
git switch main
# Remove the local backport branch
git branch -D backport-64852-to-v9.4.x

Then, create a pull request where the base branch is v9.4.x and the compare/head branch is backport-64852-to-v9.4.x.

@grafanabot grafanabot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label Mar 17, 2023
@gotjosh gotjosh added backport v9.4.x Mark PR for automatic backport to v9.4.x and removed backport v9.4.x Mark PR for automatic backport to v9.4.x labels Mar 17, 2023
@grafanabot
Copy link
Contributor

The backport to v9.4.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-64852-to-v9.4.x origin/v9.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 02a8f62021750b0af6dd8760ca2516e5e285a998
# Push it to GitHub
git push --set-upstream origin backport-64852-to-v9.4.x
git switch main
# Remove the local backport branch
git branch -D backport-64852-to-v9.4.x

Then, create a pull request where the base branch is v9.4.x and the compare/head branch is backport-64852-to-v9.4.x.

gotjosh added a commit that referenced this pull request Mar 17, 2023
…ing (#64852)

* Alerting: Fix stats when using unified alerting

(cherry picked from commit 02a8f62)
gotjosh added a commit that referenced this pull request Mar 27, 2023
…ied alerting (#64951)

* Alerting: Fix stats that display alert count when using unified alerting (#64852)

* Alerting: Fix stats when using unified alerting

(cherry picked from commit 02a8f62)

* bundle services is not needed for 9.4.x

---------

Co-authored-by: gotjosh <josue.abreu@gmail.com>
@zerok zerok modified the milestones: 9.4.x, 9.4.8, 9.5.0 Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/backend backport v9.4.x Mark PR for automatic backport to v9.4.x backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. missing-labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants