[v11.3.x] Alerting: Force refetch prom rules when refreshing panel (#96125)

Alerting: Force refetch prom rules when refreshing panel (#96120)

Force refetch prom rules when refreshing panel

(cherry picked from commit ea0a6a1f7f)

Co-authored-by: Sonia Aguilar <33540275+soniaAguilarPeiron@users.noreply.github.com>
pull/96135/head
grafana-delivery-bot[bot] 8 months ago committed by GitHub
parent 3704073e6f
commit 546e0e214b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      public/app/features/dashboard-scene/scene/AlertStatesDataLayer.ts
  2. 11
      public/app/features/query/state/DashboardQueryRunner/UnifiedAlertStatesWorker.ts

@ -73,10 +73,13 @@ export class AlertStatesDataLayer
}
const fetchData: () => Promise<RuleNamespace[]> = async () => {
const promRules = await dispatch(
alertRuleApi.endpoints.prometheusRuleNamespaces.initiate({
ruleSourceName: GRAFANA_RULES_SOURCE_NAME,
dashboardUid: uid,
})
alertRuleApi.endpoints.prometheusRuleNamespaces.initiate(
{
ruleSourceName: GRAFANA_RULES_SOURCE_NAME,
dashboardUid: uid,
},
{ forceRefetch: true }
)
);
if (promRules.error) {
throw new Error(`Unexpected alert rules response.`);

@ -61,10 +61,13 @@ export class UnifiedAlertStatesWorker implements DashboardQueryRunnerWorker {
const { dashboard } = options;
const fetchData: () => Promise<RuleNamespace[]> = async () => {
const promRules = await dispatch(
alertRuleApi.endpoints.prometheusRuleNamespaces.initiate({
ruleSourceName: GRAFANA_RULES_SOURCE_NAME,
dashboardUid: dashboard.uid,
})
alertRuleApi.endpoints.prometheusRuleNamespaces.initiate(
{
ruleSourceName: GRAFANA_RULES_SOURCE_NAME,
dashboardUid: dashboard.uid,
},
{ forceRefetch: true }
)
);
return promRules.data;
};

Loading…
Cancel
Save