Alerting: Fix firing alerts title when showing active in Insights panel (#80414)

* Fix firing alerts title when showing active alerts in Insights panel

* Update red to green and change the component name to Active.tsx instead of Firing.tsx
pull/80466/head
Sonia Aguilar 1 year ago committed by GitHub
parent cb419e799b
commit 4ea997b595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      public/app/features/alerting/unified/home/Insights.tsx
  2. 8
      public/app/features/alerting/unified/insights/grafana/Active.tsx

@ -20,9 +20,9 @@ import {
import { config } from '../../../../core/config'; import { config } from '../../../../core/config';
import { SectionFooter } from '../insights/SectionFooter'; import { SectionFooter } from '../insights/SectionFooter';
import { SectionSubheader } from '../insights/SectionSubheader'; import { SectionSubheader } from '../insights/SectionSubheader';
import { getActiveGrafanaAlertsScene } from '../insights/grafana/Active';
import { getGrafanaInstancesByStateScene } from '../insights/grafana/AlertsByStateScene'; import { getGrafanaInstancesByStateScene } from '../insights/grafana/AlertsByStateScene';
import { getGrafanaEvalSuccessVsFailuresScene } from '../insights/grafana/EvalSuccessVsFailuresScene'; import { getGrafanaEvalSuccessVsFailuresScene } from '../insights/grafana/EvalSuccessVsFailuresScene';
import { getFiringGrafanaAlertsScene } from '../insights/grafana/Firing';
import { getInstanceStatByStatusScene } from '../insights/grafana/InstanceStatusScene'; import { getInstanceStatByStatusScene } from '../insights/grafana/InstanceStatusScene';
import { getGrafanaMissedIterationsScene } from '../insights/grafana/MissedIterationsScene'; import { getGrafanaMissedIterationsScene } from '../insights/grafana/MissedIterationsScene';
import { getMostFiredInstancesScene } from '../insights/grafana/MostFiredInstancesTable'; import { getMostFiredInstancesScene } from '../insights/grafana/MostFiredInstancesTable';
@ -192,7 +192,7 @@ function getGrafanaManagedScenes() {
new SceneFlexLayout({ new SceneFlexLayout({
children: [ children: [
getMostFiredInstancesScene(ashDs, 'Top 10 firing instances'), getMostFiredInstancesScene(ashDs, 'Top 10 firing instances'),
getFiringGrafanaAlertsScene(cloudUsageDs, 'Firing rules'), getActiveGrafanaAlertsScene(cloudUsageDs, 'Active rules'),
getPausedGrafanaAlertsScene(cloudUsageDs, 'Paused rules'), getPausedGrafanaAlertsScene(cloudUsageDs, 'Paused rules'),
], ],
}), }),

@ -7,7 +7,7 @@ import { DataSourceRef } from '@grafana/schema';
import { INSTANCE_ID, PANEL_STYLES } from '../../home/Insights'; import { INSTANCE_ID, PANEL_STYLES } from '../../home/Insights';
import { InsightsRatingModal } from '../RatingModal'; import { InsightsRatingModal } from '../RatingModal';
export function getFiringGrafanaAlertsScene(datasource: DataSourceRef, panelTitle: string) { export function getActiveGrafanaAlertsScene(datasource: DataSourceRef, panelTitle: string) {
const expr = INSTANCE_ID const expr = INSTANCE_ID
? `sum by (state) (grafanacloud_grafana_instance_alerting_rule_group_rules{state="active", id="${INSTANCE_ID}"})` ? `sum by (state) (grafanacloud_grafana_instance_alerting_rule_group_rules{state="active", id="${INSTANCE_ID}"})`
: `sum by (state) (grafanacloud_grafana_instance_alerting_rule_group_rules{state="active"})`; : `sum by (state) (grafanacloud_grafana_instance_alerting_rule_group_rules{state="active"})`;
@ -27,17 +27,17 @@ export function getFiringGrafanaAlertsScene(datasource: DataSourceRef, panelTitl
...PANEL_STYLES, ...PANEL_STYLES,
body: PanelBuilders.stat() body: PanelBuilders.stat()
.setTitle(panelTitle) .setTitle(panelTitle)
.setDescription('The number of currently firing alert rules') .setDescription('The number of currently active alert rules')
.setData(query) .setData(query)
.setThresholds({ .setThresholds({
mode: ThresholdsMode.Absolute, mode: ThresholdsMode.Absolute,
steps: [ steps: [
{ {
color: 'red', color: 'green',
value: 0, value: 0,
}, },
{ {
color: 'red', color: 'green',
value: 80, value: 80,
}, },
], ],
Loading…
Cancel
Save