diff --git a/operations/mimir-mixin/dashboards/dashboard-queries.libsonnet b/operations/mimir-mixin/dashboards/dashboard-queries.libsonnet index 549d2783875..5ebf1bf8f40 100644 --- a/operations/mimir-mixin/dashboards/dashboard-queries.libsonnet +++ b/operations/mimir-mixin/dashboards/dashboard-queries.libsonnet @@ -77,28 +77,25 @@ // These query routes are used in the overview and other dashboard, everythign else is considered "other" queries. // Has to be a list to keep the same colors as before, see overridesNonErrorColorsPalette. local overviewRoutes = [ - r { routeStr: std.strReplace(r.route, '/', '_') } - for r in [ - { name: 'instantQuery', displayName: 'instant queries', route: '/api/v1/query' }, - { name: 'rangeQuery', displayName: 'range queries', route: '/api/v1/query_range' }, - { name: 'labelNames', displayName: '"label names" queries', route: '/api/v1/labels' }, - { name: 'labelValues', displayName: '"label values" queries', route: '/api/v1/label_name_values' }, - { name: 'series', displayName: 'series queries', route: '/api/v1/series' }, - { name: 'remoteRead', displayName: 'remote read queries', route: '/api/v1/read' }, - { name: 'metadata', displayName: 'metadata queries', route: '/api/v1/metadata' }, - { name: 'exemplars', displayName: 'exemplar queries', route: '/api/v1/query_exemplars' }, - { name: 'activeSeries', displayName: '"active series" queries', route: '/api/v1/cardinality_active_series' }, - { name: 'labelNamesCardinality', displayName: '"label name cardinality" queries', route: '/api/v1/cardinality_label_names' }, - { name: 'labelValuesCardinality', displayName: '"label value cardinality" queries', route: '/api/v1/cardinality_label_values' }, - ] + { name: 'instantQuery', displayName: 'instant queries', route: '/api/v1/query', routeLabel: '_api_v1_query' }, + { name: 'rangeQuery', displayName: 'range queries', route: '/api/v1/query_range', routeLabel: '_api_v1_query_range' }, + { name: 'labelNames', displayName: '"label names" queries', route: '/api/v1/labels', routeLabel: '_api_v1_labels' }, + { name: 'labelValues', displayName: '"label values" queries', route: '/api/v1/label_name_values', routeLabel: '_api_v1_label_name_values' }, + { name: 'series', displayName: 'series queries', route: '/api/v1/series', routeLabel: '_api_v1_series' }, + { name: 'remoteRead', displayName: 'remote read queries', route: '/api/v1/read', routeLabel: '_api_v1_read' }, + { name: 'metadata', displayName: 'metadata queries', route: '/api/v1/metadata', routeLabel: '_api_v1_metadata' }, + { name: 'exemplars', displayName: 'exemplar queries', route: '/api/v1/query_exemplars', routeLabel: '_api_v1_query_exemplars' }, + { name: 'activeSeries', displayName: '"active series" queries', route: '/api/v1/cardinality_active_series', routeLabel: '_api_v1_cardinality_active_series' }, + { name: 'labelNamesCardinality', displayName: '"label name cardinality" queries', route: '/api/v1/cardinality_label_names', routeLabel: '_api_v1_cardinality_label_names' }, + { name: 'labelValuesCardinality', displayName: '"label value cardinality" queries', route: '/api/v1/cardinality_label_values', routeLabel: '_api_v1_cardinality_label_values' }, ], - local overviewRoutesRegex = '(prometheus|api_prom)(%s)' % std.join('|', [r.routeStr for r in overviewRoutes]), + local overviewRoutesRegex = '(prometheus|api_prom)(%s)' % std.join('|', [r.routeLabel for r in overviewRoutes]), overviewRoutesOverrides: [ { matcher: { id: 'byRegexp', // To distinguish between query and query_range, we need to match the route with a negative lookahead. - options: '/.*%s($|[^_])/' % r.routeStr, + options: '/.*%s($|[^_])/' % r.routeLabel, }, properties: [ { @@ -113,7 +110,7 @@ nonOverviewRoutesPerSecond: 'sum(rate(cortex_request_duration_seconds_count{%(queryFrontendMatcher)s,route=~"(prometheus|api_prom)_api_v1_.*",route!~"%(overviewRoutesRegex)s"}[$__rate_interval]))' % (variables { overviewRoutesRegex: overviewRoutesRegex }), local queryPerSecond(name) = 'sum(rate(cortex_request_duration_seconds_count{%(queryFrontendMatcher)s,route=~"(prometheus|api_prom)%(route)s"}[$__rate_interval]))' % - (variables { route: std.filter(function(r) r.name == name, overviewRoutes)[0].routeStr }), + (variables { route: std.filter(function(r) r.name == name, overviewRoutes)[0].routeLabel }), instantQueriesPerSecond: queryPerSecond('instantQuery'), rangeQueriesPerSecond: queryPerSecond('rangeQuery'), labelNamesQueriesPerSecond: queryPerSecond('labelNames'),