Skip to content

feat: add indicator when there is an error with per-check alerts #1148

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
merged 7 commits into from
Jun 4, 2025

Conversation

VikaCep
Copy link
Contributor

@VikaCep VikaCep commented May 16, 2025

Closes #1131

With the new per-check alerts, the creation request can be successful but there can still be asynchronous errors that need to be displayed to the user. This PR addresses this requirement.

From https://github.com/grafana/synthetic-monitoring/issues/266:

Alert rules creation process is performed asynchronously from the HTTP request that triggers its creation. This means that the user might have received a successful response (202 HTTP Accepted), but the rule itself might not end up being created (for example due to quota limits or other possible errors).
The backend registers the possible errors returned from Hosted Grafana. We should expose these errors to the plugin, so the plugin can take different actions in order to try to provide feedback to the user on that situation. Possible methods discussed are:

  • Error indication on the check list:
image
  • Error indication in the check form - Alerting section:
image

NOTE: in order to see the error messages, the app can be started using yarn dev:msw where there is a check (Job name for http) that provides an error for the TLSTargetCertificateCloseToExpiring alert

@VikaCep VikaCep self-assigned this May 16, 2025
@VikaCep VikaCep changed the title feat: add indicator when there is an error May 16, 2025
@VikaCep VikaCep marked this pull request as ready for review May 19, 2025 20:39
@VikaCep VikaCep requested a review from a team as a code owner May 19, 2025 20:39
@VikaCep VikaCep requested review from w1kman and ckbedwell and removed request for a team and w1kman May 19, 2025 20:39
@ka3de
Copy link
Contributor

ka3de commented May 20, 2025

I was a little bit confused because I see that we are showing the error next to the alert in the "alerts pop-up". But IIRC, this alerts pop-up is populated from the alerts that are already created, because these are queried through some alerting endpoint.

So how are we doing that for the case on which an alert has been set up for a check, but this one is not created in the stack, for example due to a quota limit error?
The folder name is static for all SM alerts, and the check alerts data provides the alert name and period, but the group name is still missing... I believe we have a mapping for alert name - group name in the plugin which we use, along with the period (if applies), to build the group name and show all that information even if the rule does not exist?

@VikaCep VikaCep force-pushed the feat/errors-per-check-alerts branch from b8bd0e5 to 8c49b21 Compare May 22, 2025 00:38
@VikaCep
Copy link
Contributor Author

VikaCep commented May 22, 2025

You have a good point. I made some changes so now the UI always displays per-check alerts, even if the corresponding alert rule does not exist in the alerting endpoint response.
Basically, for each alert configured on a check, it now attempts to find the matching rule in the alerting response. If it is missing, a local “dummy” group is constructed with the appropriate category and default values, ensuring the alert (and any error/status) is still shown in the alerts pop-up. The folder UID is static for all SM alerts, and the group/category is determined from the predefined alert mapping.

In the screenshot below, the TLSTargetCertificateCloseToExpiring alert is shown from the alerts API response as it's not returned from the alerting endpoint. I just had to hide the "view" icon link as there is no place to link it if it doesn't exist. Does this sound good to you?

image

@VikaCep VikaCep force-pushed the feat/errors-per-check-alerts branch from 09f2538 to 3ec1940 Compare May 22, 2025 01:06
@ka3de
Copy link
Contributor

ka3de commented May 22, 2025

Does this sound good to you?

That looks great! Thanks 🙌

Base automatically changed from feat/show-alerts-on-checks-list to main May 23, 2025 14:03
@VikaCep VikaCep force-pushed the feat/errors-per-check-alerts branch from 3ec1940 to 8522657 Compare May 23, 2025 14:19
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

LGTM

@ckbedwell ckbedwell merged commit f1267e1 into main Jun 4, 2025
12 checks passed
@ckbedwell ckbedwell deleted the feat/errors-per-check-alerts branch June 4, 2025 14:56
@sm-release-app sm-release-app bot mentioned this pull request Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants