From 5e47e79cba33028d055fd185a1bc41e0db967e97 Mon Sep 17 00:00:00 2001 From: Dominik Broj Date: Fri, 19 Jan 2024 11:52:20 +0100 Subject: [PATCH] fix queries in insights scenes (#3720) # What this PR does - fix wrongly renamed instance in promql queries ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- .../src/pages/insights/scenes/AlertGroupsByIntegration.tsx | 2 +- grafana-plugin/src/pages/insights/scenes/AlertGroupsByTeam.tsx | 2 +- .../pages/insights/scenes/NewAlertGroupsDuringTimePeriod.tsx | 2 +- .../pages/insights/scenes/NewAlertGroupsForSelectedPeriod.tsx | 2 +- .../scenes/NewAlertGroupsNotificationsDuringTimePeriod.tsx | 2 +- .../scenes/NewAlertGroupsNotificationsForPeriodTable.tsx | 2 +- .../insights/scenes/NewAlertGroupsNotificationsInTotal.tsx | 2 +- grafana-plugin/src/pages/insights/scenes/TotalAlertGroups.tsx | 2 +- .../src/pages/insights/scenes/TotalAlertGroupsByState.tsx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/grafana-plugin/src/pages/insights/scenes/AlertGroupsByIntegration.tsx b/grafana-plugin/src/pages/insights/scenes/AlertGroupsByIntegration.tsx index 2a660c00..46247ba1 100644 --- a/grafana-plugin/src/pages/insights/scenes/AlertGroupsByIntegration.tsx +++ b/grafana-plugin/src/pages/insights/scenes/AlertGroupsByIntegration.tsx @@ -10,7 +10,7 @@ export default function getAlertGroupsByIntegrationScene({ datasource }: Insight { editorMode: 'code', exemplar: false, - expr: 'sort_desc(max_over_time(sum by(integration) (avg without(pod, stack)($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:]))', + expr: 'sort_desc(max_over_time(sum by(integration) (avg without(pod, instance)($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:]))', format: 'table', instant: true, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/AlertGroupsByTeam.tsx b/grafana-plugin/src/pages/insights/scenes/AlertGroupsByTeam.tsx index 808a45b7..07c12692 100644 --- a/grafana-plugin/src/pages/insights/scenes/AlertGroupsByTeam.tsx +++ b/grafana-plugin/src/pages/insights/scenes/AlertGroupsByTeam.tsx @@ -10,7 +10,7 @@ export default function getAlertGroupsByTeamScene({ datasource }: InsightsConfig { editorMode: 'code', exemplar: false, - expr: 'sort_desc(max_over_time(sum by(team) (avg without(pod, stack)($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:]))', + expr: 'sort_desc(max_over_time(sum by(team) (avg without(pod, instance)($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:]))', format: 'table', instant: true, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsDuringTimePeriod.tsx b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsDuringTimePeriod.tsx index 9f5314d8..c4b22fb5 100644 --- a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsDuringTimePeriod.tsx +++ b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsDuringTimePeriod.tsx @@ -12,7 +12,7 @@ export default function getNewAlertGroupsDuringTimePeriodScene({ datasource }: I editorMode: 'code', excludeNullMetadata: false, exemplar: false, - expr: 'increase(max_over_time(sum by (integration) (avg without(pod, stack) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[30m:])[1h:])', + expr: 'increase(max_over_time(sum by (integration) (avg without(pod, instance) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[30m:])[1h:])', fullMetaSearch: false, instant: false, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsForSelectedPeriod.tsx b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsForSelectedPeriod.tsx index 1eadde1d..11edb35b 100644 --- a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsForSelectedPeriod.tsx +++ b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsForSelectedPeriod.tsx @@ -12,7 +12,7 @@ export default function getNewAlertGroupsForSelectedPeriodScene({ datasource }: editorMode: 'code', excludeNullMetadata: false, exemplar: false, - expr: 'increase(max_over_time(sum(avg without(pod, stack) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:])[$__range:])', + expr: 'increase(max_over_time(sum(avg without(pod, instance) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:])[$__range:])', format: 'time_series', fullMetaSearch: false, includeNullMetadata: true, diff --git a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsDuringTimePeriod.tsx b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsDuringTimePeriod.tsx index 20a49c37..e2f65107 100644 --- a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsDuringTimePeriod.tsx +++ b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsDuringTimePeriod.tsx @@ -12,7 +12,7 @@ export default function getNewAlertGroupsNotificationsDuringTimePeriodScene({ da editorMode: 'code', excludeNullMetadata: false, exemplar: false, - expr: 'increase(max_over_time(sum by (username) (avg without(pod, stack) ($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[30m:])[1h:])', + expr: 'increase(max_over_time(sum by (username) (avg without(pod, instance) ($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[30m:])[1h:])', fullMetaSearch: false, instant: false, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsForPeriodTable.tsx b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsForPeriodTable.tsx index 6a0eda34..76f6f3c5 100644 --- a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsForPeriodTable.tsx +++ b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsForPeriodTable.tsx @@ -10,7 +10,7 @@ export default function getNewAlertGroupsNotificationsForPeriodTableScene({ data { editorMode: 'code', exemplar: false, - expr: 'sort_desc(increase(max_over_time(sum by (username) (avg without(pod, stack) ($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[1h:])[$__range:]))', + expr: 'sort_desc(increase(max_over_time(sum by (username) (avg without(pod, instance) ($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[1h:])[$__range:]))', format: 'table', instant: true, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsInTotal.tsx b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsInTotal.tsx index 0b3df846..d757b233 100644 --- a/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsInTotal.tsx +++ b/grafana-plugin/src/pages/insights/scenes/NewAlertGroupsNotificationsInTotal.tsx @@ -10,7 +10,7 @@ export default function getNewAlertGroupsNotificationsInTotalScene({ datasource { editorMode: 'code', exemplar: false, - expr: 'sort_desc(max_over_time(sum by(username) (avg without(pod, stack)($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[1d:]))', + expr: 'sort_desc(max_over_time(sum by(username) (avg without(pod, instance)($user_was_notified_of_alert_groups_total{slug=~"$stack"}))[1d:]))', format: 'table', instant: true, legendFormat: '__auto', diff --git a/grafana-plugin/src/pages/insights/scenes/TotalAlertGroups.tsx b/grafana-plugin/src/pages/insights/scenes/TotalAlertGroups.tsx index fedf39ff..09236080 100644 --- a/grafana-plugin/src/pages/insights/scenes/TotalAlertGroups.tsx +++ b/grafana-plugin/src/pages/insights/scenes/TotalAlertGroups.tsx @@ -12,7 +12,7 @@ export default function getTotalAlertGroupsScene({ datasource }: InsightsConfig) editorMode: 'code', excludeNullMetadata: false, exemplar: false, - expr: 'max_over_time(sum(avg without(pod, stack) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:])', + expr: 'max_over_time(sum(avg without(pod, instance) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))[1d:])', format: 'time_series', fullMetaSearch: false, instant: false, diff --git a/grafana-plugin/src/pages/insights/scenes/TotalAlertGroupsByState.tsx b/grafana-plugin/src/pages/insights/scenes/TotalAlertGroupsByState.tsx index 0af04be8..8b490f10 100644 --- a/grafana-plugin/src/pages/insights/scenes/TotalAlertGroupsByState.tsx +++ b/grafana-plugin/src/pages/insights/scenes/TotalAlertGroupsByState.tsx @@ -11,7 +11,7 @@ export default function getTotalAlertGroupsByStateScene({ datasource }: Insights disableTextWrap: false, editorMode: 'code', excludeNullMetadata: false, - expr: 'sum by (state) (avg without(pod, stack) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))', + expr: 'sum by (state) (avg without(pod, instance) ($alert_groups_total{slug=~"$stack", team=~"$team", integration=~"$integration"}))', fullMetaSearch: false, legendFormat: '__auto', range: true,