-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
(feat): display unifiedAlerting state #65
base: main
Are you sure you want to change the base?
(feat): display unifiedAlerting state #65
Conversation
Small modification in the API to allow a single or multiple selectors. The final alert state is aggregated at the end in case there are more than 1 alerts for a label
If not set, the .flat() methods where not found properly. And now the pluginApiRef and the types are also exported, in case they are needed by someone else
Where do I set the " set the showState in the EntityGrafanaAlertsCard component to true" . is it is app config.yaml |
Exactly, you should have a block like the following: grafana:
domain: ${GRAFANA_BASE_URL}
unifiedAlerting: true |
If you're using this plugin's last version you won't have that supported unfortunately. In our case, we ended up creating a fork and merging this change and a few others, and in our case, we can see the state properly. |
This was already partially implemented in #54 Problem there was how to exact match rule and alert, which can be solved by using includeInternalLabels=true than you can exact match rules and alerts const matchingAlertInstances = alertInstances.filter(
alertInstance =>
alertInstance.labels.__alert_rule_uid__ === rule.grafana_alert.uid,
); |
can you please provide screenshots about how you are using the alert-label selector in catalog-info |
This is an extension for this PR: #54
And fixes #53
In this PR I'm extending a bit the API call, so that it can fetch not only one labelSelector, but multiple. So now it accepts a string or an array as input. Then, I created an aggregation function to analyze what is the state for each alert and return a final value.
As an example, if there are 3 alerts; 2 of them are
ok
but one isfiring
, then the final state will befiring
.The API extension is meant for some use cases where the API is called from another place in the UI (we are currently doing so, and doing a call per selector is really time consuming, especially when the request is always the same), therefore I also exported a couple types to allow other people to use this API internally.
To try it out, just enable the
unifiedAlerting
in your backstage instance, set the annotation and set theshowState
in theEntityGrafanaAlertsCard
component to true.