Skip to content

Commit

Permalink
Revert using backticks in insights queries (#4488)
Browse files Browse the repository at this point in the history
# What this PR does

Don't use backticks to fix queries that include brackets, more details
here:
https://raintank-corp.slack.com/archives/C0229FD3CE9/p1717667956195839


Closes [issue link here]

<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
  • Loading branch information
brojd authored Jun 7, 2024
1 parent ea8deed commit 7728b15
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
36 changes: 18 additions & 18 deletions grafana-plugin/src/dashboards/oncall_metrics_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"editorMode": "code",
"excludeNullMetadata": false,
"exemplar": false,
"expr": "round(delta(sum($alert_groups_total{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`})[$__range:])) >= 0",
"expr": "round(delta(sum($alert_groups_total{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"})[$__range:])) >= 0",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
Expand Down Expand Up @@ -266,7 +266,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "avg_over_time((sum($alert_groups_response_time_seconds_sum{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}) / sum($alert_groups_response_time_seconds_count{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}))[$__range:])",
"expr": "avg_over_time((sum($alert_groups_response_time_seconds_sum{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}) / sum($alert_groups_response_time_seconds_count{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}))[$__range:])",
"instant": true,
"legendFormat": "__auto",
"range": false,
Expand Down Expand Up @@ -389,7 +389,7 @@
"editorMode": "code",
"excludeNullMetadata": false,
"exemplar": false,
"expr": "round(delta(sum by (integration) ($alert_groups_total{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`})[$__interval:])) >= 0",
"expr": "round(delta(sum by (integration) ($alert_groups_total{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"})[$__interval:])) >= 0",
"fullMetaSearch": false,
"hide": false,
"instant": false,
Expand Down Expand Up @@ -507,7 +507,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "avg(sum($alert_groups_response_time_seconds_sum{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}) / sum($alert_groups_response_time_seconds_count{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}))",
"expr": "avg(sum($alert_groups_response_time_seconds_sum{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}) / sum($alert_groups_response_time_seconds_count{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}))",
"instant": false,
"legendFormat": "__auto",
"range": true,
Expand Down Expand Up @@ -613,7 +613,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort_desc(round(delta(sum by (integration)($alert_groups_total{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`})[$__range:])) >= 0)",
"expr": "sort_desc(round(delta(sum by (integration)($alert_groups_total{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"})[$__range:])) >= 0)",
"format": "table",
"instant": true,
"legendFormat": "__auto",
Expand Down Expand Up @@ -729,7 +729,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort_desc(avg_over_time((sum by (integration)($alert_groups_response_time_seconds_sum{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}) / sum by (integration)($alert_groups_response_time_seconds_count{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}))[$__range:]))",
"expr": "sort_desc(avg_over_time((sum by (integration)($alert_groups_response_time_seconds_sum{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}) / sum by (integration)($alert_groups_response_time_seconds_count{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}))[$__range:]))",
"format": "table",
"instant": true,
"legendFormat": "__auto",
Expand Down Expand Up @@ -862,7 +862,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort_desc(round(delta(sum by (team)($alert_groups_total{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`})[$__range:])) >= 0)",
"expr": "sort_desc(round(delta(sum by (team)($alert_groups_total{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"})[$__range:])) >= 0)",
"format": "table",
"instant": true,
"legendFormat": "__auto",
Expand Down Expand Up @@ -979,7 +979,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort_desc(avg_over_time((sum by(team) ($alert_groups_response_time_seconds_sum{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}) / sum by(team)($alert_groups_response_time_seconds_count{slug=~`$instance`, team=~`$team`, integration=~`$integration`, service_name=~`$service_name`}))[$__range:]))",
"expr": "sort_desc(avg_over_time((sum by(team) ($alert_groups_response_time_seconds_sum{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}) / sum by(team)($alert_groups_response_time_seconds_count{slug=~\"$instance\", team=~\"$team\", integration=~\"$integration\", service_name=~\"$service_name\"}))[$__range:]))",
"format": "table",
"instant": true,
"legendFormat": "__auto",
Expand Down Expand Up @@ -1129,7 +1129,7 @@
"editorMode": "code",
"excludeNullMetadata": false,
"exemplar": false,
"expr": "round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~`$instance`})[$__interval:])) >= 0",
"expr": "round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~\"$instance\"})[$__interval:])) >= 0",
"fullMetaSearch": false,
"instant": false,
"legendFormat": "__auto",
Expand Down Expand Up @@ -1222,7 +1222,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sort_desc(round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~`$instance`})[$__range:])) >= 0)",
"expr": "sort_desc(round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~\"$instance\"})[$__range:])) >= 0)",
"format": "table",
"instant": true,
"legendFormat": "__auto",
Expand Down Expand Up @@ -1430,15 +1430,15 @@
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(${alert_groups_total}{slug=~`$instance`},team)",
"definition": "label_values(${alert_groups_total}{slug=~\"$instance\"},team)",
"hide": 0,
"includeAll": true,
"label": "Team",
"multi": true,
"name": "team",
"options": [],
"query": {
"query": "label_values(${alert_groups_total}{slug=~`$instance`},team)",
"query": "label_values(${alert_groups_total}{slug=~\"$instance\"},team)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
Expand All @@ -1458,15 +1458,15 @@
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(${alert_groups_total}{team=~`$team`,slug=~`$instance`},integration)",
"definition": "label_values(${alert_groups_total}{team=~\"$team\",slug=~\"$instance\"},integration)",
"hide": 0,
"includeAll": true,
"label": "Integration",
"multi": true,
"name": "integration",
"options": [],
"query": {
"query": "label_values(${alert_groups_total}{team=~`$team`,slug=~`$instance`},integration)",
"query": "label_values(${alert_groups_total}{team=~\"$team\",slug=~\"$instance\"},integration)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
Expand All @@ -1486,7 +1486,7 @@
"type": "prometheus",
"uid": "${datasource}"
},
"definition": "label_values(${alert_groups_total}{slug=~`$instance`, team=~`$team`},service_name)",
"definition": "label_values(${alert_groups_total}{slug=~\"$instance\", team=~\"$team\"},service_name)",
"hide": 0,
"includeAll": true,
"label": "Service name",
Expand All @@ -1495,7 +1495,7 @@
"options": [],
"query": {
"qryType": 1,
"query": "label_values(${alert_groups_total}{slug=~`$instance`, team=~`$team`},service_name)",
"query": "label_values(${alert_groups_total}{slug=~\"$instance\", team=~\"$team\"},service_name)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 2,
Expand All @@ -1516,7 +1516,7 @@
},
"timezone": "browser",
"title": "OnCall Insights",
"version": 4,
"revision": 4,
"version": 5,
"revision": 5,
"weekStart": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getAlertGroupsByIntegrationScene({ datasource, stack }: Insights
{
editorMode: 'code',
exemplar: false,
expr: `sort_desc(round(delta(sum by (integration)($alert_groups_total{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`})[$__range:])) >= 0)`,
expr: `sort_desc(round(delta(sum by (integration)($alert_groups_total{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"})[$__range:])) >= 0)`,
format: 'table',
instant: true,
legendFormat: '__auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getAlertGroupsByTeamScene({ datasource, stack }: InsightsConfig)
{
editorMode: 'code',
exemplar: false,
expr: `sort_desc(round(delta(sum by (team)($alert_groups_total{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`})[$__range:])) >= 0)`,
expr: `sort_desc(round(delta(sum by (team)($alert_groups_total{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"})[$__range:])) >= 0)`,
format: 'table',
instant: true,
legendFormat: '__auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getMTTRAverage({ datasource, stack }: InsightsConfig) {
{
editorMode: 'code',
exemplar: false,
expr: `avg_over_time((sum($alert_groups_response_time_seconds_sum{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}) / sum($alert_groups_response_time_seconds_count{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}))[$__range:])`,
expr: `avg_over_time((sum($alert_groups_response_time_seconds_sum{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}) / sum($alert_groups_response_time_seconds_count{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}))[$__range:])`,
instant: true,
legendFormat: '__auto',
range: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getMTTRByIntegrationScene({ datasource, stack }: InsightsConfig)
{
editorMode: 'code',
exemplar: false,
expr: `sort_desc(avg_over_time((sum by (integration)($alert_groups_response_time_seconds_sum{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}) / sum by (integration)($alert_groups_response_time_seconds_count{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}))[$__range:]))`,
expr: `sort_desc(avg_over_time((sum by (integration)($alert_groups_response_time_seconds_sum{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}) / sum by (integration)($alert_groups_response_time_seconds_count{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}))[$__range:]))`,
format: 'table',
instant: true,
legendFormat: '__auto',
Expand Down
2 changes: 1 addition & 1 deletion grafana-plugin/src/pages/insights/scenes/MTTRByTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getMTTRByTeamScene({ datasource, stack }: InsightsConfig) {
{
editorMode: 'code',
exemplar: false,
expr: `sort_desc(avg_over_time((sum by(team) ($alert_groups_response_time_seconds_sum{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}) / sum by(team)($alert_groups_response_time_seconds_count{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}))[$__range:]))`,
expr: `sort_desc(avg_over_time((sum by(team) ($alert_groups_response_time_seconds_sum{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}) / sum by(team)($alert_groups_response_time_seconds_count{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}))[$__range:]))`,
format: 'table',
instant: true,
legendFormat: '__auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getMTTRChangedTimeseriesScene({ datasource, stack }: InsightsCon
{
editorMode: 'code',
exemplar: false,
expr: `avg(sum($alert_groups_response_time_seconds_sum{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}) / sum($alert_groups_response_time_seconds_count{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`}))`,
expr: `avg(sum($alert_groups_response_time_seconds_sum{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}) / sum($alert_groups_response_time_seconds_count{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"}))`,
instant: false,
legendFormat: '__auto',
range: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function getNewAlertGroupsScene({ datasource, stack }: InsightsConfig) {
editorMode: 'code',
excludeNullMetadata: false,
exemplar: false,
expr: `round(delta(sum($alert_groups_total{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`})[$__range:])) >= 0`,
expr: `round(delta(sum($alert_groups_total{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"})[$__range:])) >= 0`,
format: 'time_series',
fullMetaSearch: false,
includeNullMetadata: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getNewAlertGroupsNotificationsTableScene({ datasource, stack }:
{
editorMode: 'code',
exemplar: false,
expr: `sort_desc(round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~\`${stack}\`})[$__range:])) >= 0)`,
expr: `sort_desc(round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~"${stack}"})[$__range:])) >= 0)`,
format: 'table',
instant: true,
legendFormat: '__auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getNewAlertGroupsNotificationsTimeseriesScene({ datasource, stac
editorMode: 'code',
excludeNullMetadata: false,
exemplar: false,
expr: `round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~\`${stack}\`})[$__interval:])) >= 0`,
expr: `round(delta(sum by (username)($user_was_notified_of_alert_groups_total{slug=~"${stack}"})[$__interval:])) >= 0`,
fullMetaSearch: false,
instant: false,
legendFormat: '__auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getNewAlertGroupsTimeseriesScene({ datasource, stack }: Insights
editorMode: 'code',
excludeNullMetadata: false,
exemplar: false,
expr: `round(delta(sum by (integration)($alert_groups_total{slug=~\`${stack}\`, team=~\`$team\`, integration=~\`$integration\`, service_name=~\`$service_name\`})[$__interval:])) >= 0`,
expr: `round(delta(sum by (integration)($alert_groups_total{slug=~"${stack}", team=~"$team", integration=~"$integration", service_name=~"$service_name"})[$__interval:])) >= 0`,
fullMetaSearch: false,
instant: false,
legendFormat: '__auto',
Expand Down
12 changes: 6 additions & 6 deletions grafana-plugin/src/pages/insights/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const getVariables = ({ isOpenSource, datasource, stack }: InsightsConfig) => ({
text: ['All'],
value: ['$__all'],
datasource,
definition: `label_values(\${alert_groups_total}{slug=~\`${stack}\`},team)`,
definition: `label_values(\${alert_groups_total}{slug=~"${stack}"},team)`,
query: {
query: `label_values(\${alert_groups_total}{slug=~\`${stack}\`},team)`,
query: `label_values(\${alert_groups_total}{slug=~"${stack}"},team)`,
refId: 'PrometheusVariableQueryEditor-VariableQuery',
},
refresh: 2,
Expand All @@ -48,9 +48,9 @@ const getVariables = ({ isOpenSource, datasource, stack }: InsightsConfig) => ({
text: ['All'],
value: ['$__all'],
datasource,
definition: `label_values(\${alert_groups_total}{team=~\`$team\`,slug=~\`${stack}\`},integration)`,
definition: `label_values(\${alert_groups_total}{team=~"$team",slug=~"${stack}"},integration)`,
query: {
query: `label_values(\${alert_groups_total}{team=~\`$team\`,slug=~\`${stack}\`},integration)`,
query: `label_values(\${alert_groups_total}{team=~"$team",slug=~"${stack}"},integration)`,
refId: 'PrometheusVariableQueryEditor-VariableQuery',
},
refresh: 2,
Expand All @@ -63,9 +63,9 @@ const getVariables = ({ isOpenSource, datasource, stack }: InsightsConfig) => ({
value: ['$__all'],
allValue: '($^)|(.+)',
datasource,
definition: `label_values(\${alert_groups_total}{slug=~\`${stack}\`,team=~\`$team\`},service_name)`,
definition: `label_values(\${alert_groups_total}{slug=~"${stack}",team=~"$team"},service_name)`,
query: {
query: `label_values(\${alert_groups_total}{slug=~\`${stack}\`,team=~\`$team\`},service_name)`,
query: `label_values(\${alert_groups_total}{slug=~"${stack}",team=~"$team"},service_name)`,
refId: 'PrometheusVariableQueryEditor-VariableQuery',
},
refresh: 2,
Expand Down

0 comments on commit 7728b15

Please sign in to comment.