From adaa8b38e91a684562496f93a9333e7b1f7bab73 Mon Sep 17 00:00:00 2001 From: mfeix Date: Sat, 11 Jan 2025 00:06:55 +0100 Subject: [PATCH] fix(Mixin): correct missing space --- .../dashboards/dashboard-utils.libsonnet | 2 +- .../dashboards/loki-bloom-build.libsonnet | 2 +- .../loki-canary-dashboard.libsonnet | 42 +++++++++---------- .../loki-mixin/dashboards/loki-logs.libsonnet | 6 +-- .../dashboards/recording-rules.libsonnet | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/production/loki-mixin/dashboards/dashboard-utils.libsonnet b/production/loki-mixin/dashboards/dashboard-utils.libsonnet index 7e35267db26dd..f814214349e1e 100644 --- a/production/loki-mixin/dashboards/dashboard-utils.libsonnet +++ b/production/loki-mixin/dashboards/dashboard-utils.libsonnet @@ -85,7 +85,7 @@ local utils = import 'mixin-utils/utils.libsonnet'; $._config.per_cluster_label + '=~"$cluster", job=~"($namespace)/%s"' % job, namespaceMatcher():: - $._config.per_cluster_label + '=~"$cluster", '+ $._config.per_namespace_label +'=~"$namespace"', + $._config.per_cluster_label + '=~"$cluster", ' + $._config.per_namespace_label + '=~"$namespace"', logPanel(title, selector, datasource='$loki_datasource'):: { title: title, diff --git a/production/loki-mixin/dashboards/loki-bloom-build.libsonnet b/production/loki-mixin/dashboards/loki-bloom-build.libsonnet index 3971f1c816dd1..30bb8566ae880 100644 --- a/production/loki-mixin/dashboards/loki-bloom-build.libsonnet +++ b/production/loki-mixin/dashboards/loki-bloom-build.libsonnet @@ -12,7 +12,7 @@ local template = import 'grafonnet/template.libsonnet'; template.new( 'tenant', '$datasource', - 'label_values(loki_bloomplanner_tenant_tasks_planned{cluster="$cluster", '+ $._config.per_namespace_label +'="$namespace"}, tenant)', + 'label_values(loki_bloomplanner_tenant_tasks_planned{cluster="$cluster", ' + $._config.per_namespace_label + '="$namespace"}, tenant)', label='Tenant', sort=3, // numerical ascending includeAll=true, diff --git a/production/loki-mixin/dashboards/loki-canary-dashboard.libsonnet b/production/loki-mixin/dashboards/loki-canary-dashboard.libsonnet index baee1ebc9d1c8..eb0c1f7a7715d 100644 --- a/production/loki-mixin/dashboards/loki-canary-dashboard.libsonnet +++ b/production/loki-mixin/dashboards/loki-canary-dashboard.libsonnet @@ -49,60 +49,60 @@ local grafana = import 'grafonnet/grafana.libsonnet'; panels: [ // grid row 1 dashboard.panel('Canary Entries Total') + - dashboard.newStatPanel('sum(count(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster", '+ $._config.per_namespace_label +'=~"$namespace"}))', unit='short') + + dashboard.newStatPanel('sum(count(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster", ' + $._config.per_namespace_label + '=~"$namespace"}))', unit='short') + { gridPos: { h: 4, w: 3, x: 0, y: 0 } }, dashboard.panel('Canary Logs Total') + - dashboard.newStatPanel('sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))', unit='short') + + dashboard.newStatPanel('sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))', unit='short') + { gridPos: { h: 4, w: 3, x: 3, y: 0 } }, dashboard.panel('Missing') + - dashboard.newStatPanel('sum(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))', unit='short') + + dashboard.newStatPanel('sum(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))', unit='short') + { gridPos: { h: 4, w: 3, x: 6, y: 0 } }, dashboard.panel('Spotcheck Missing') + - dashboard.newStatPanel('sum(increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))', unit='short') + + dashboard.newStatPanel('sum(increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))', unit='short') + { gridPos: { h: 4, w: 3, x: 9, y: 0 } }, // grid row 2 dashboard.panel('Spotcheck Total') + - dashboard.newStatPanel('sum(increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))', unit='short') + + dashboard.newStatPanel('sum(increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))', unit='short') + { gridPos: { h: 4, w: 3, x: 0, y: 4 } }, dashboard.panel('Metric Test Error %') + - dashboard.newStatPanel('((sum(loki_canary_metric_test_expected{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}) - sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}))/(sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}))) * 100') + + dashboard.newStatPanel('((sum(loki_canary_metric_test_expected{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}) - sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}))/(sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}))) * 100') + { gridPos: { h: 4, w: 3, x: 3, y: 4 } }, dashboard.panel('Missing %') + - dashboard.newStatPanel('(sum(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))/sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range])))*100') + + dashboard.newStatPanel('(sum(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))/sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range])))*100') + { gridPos: { h: 4, w: 3, x: 6, y: 4 } }, dashboard.panel('Spotcheck Missing %') + - dashboard.newStatPanel('(sum(increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))/sum(increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))) * 100') + + dashboard.newStatPanel('(sum(increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))/sum(increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))) * 100') + { gridPos: { h: 4, w: 3, x: 9, y: 4 } }, // grid row 3 dashboard.panel('Metric Test Expected') + - dashboard.newStatPanel('sum(loki_canary_metric_test_expected{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"})', unit='short') + + dashboard.newStatPanel('sum(loki_canary_metric_test_expected{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"})', unit='short') + { gridPos: { h: 4, w: 3, x: 0, y: 8 } }, dashboard.panel('Metric Test Actual') + - dashboard.newStatPanel('sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"})', unit='short') + + dashboard.newStatPanel('sum(loki_canary_metric_test_actual{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"})', unit='short') + { gridPos: { h: 4, w: 3, x: 3, y: 8 } }, dashboard.panel('Websocket Missing') + - dashboard.newStatPanel('sum(increase(loki_canary_websocket_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))', unit='short') + + dashboard.newStatPanel('sum(increase(loki_canary_websocket_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))', unit='short') + { gridPos: { h: 4, w: 3, x: 6, y: 8 } }, dashboard.panel('Websocket Missing %') + - dashboard.newStatPanel('(sum(increase(loki_canary_websocket_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range]))/sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__range])))*100') + + dashboard.newStatPanel('(sum(increase(loki_canary_websocket_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range]))/sum(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__range])))*100') + { gridPos: { h: 4, w: 3, x: 9, y: 8 } }, // end of grid dashboard.panel('Log Write to read Latency Percentiles') + dashboard.queryPanel([ - 'histogram_quantile(0.95, sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) by (le))', - 'histogram_quantile(0.50, sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) by (le))', + 'histogram_quantile(0.95, sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) by (le))', + 'histogram_quantile(0.50, sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) by (le))', ], ['p95', 'p50']) + { gridPos: { h: 6, w: 12, x: 12, y: 0 } }, @@ -115,7 +115,7 @@ local grafana = import 'grafonnet/grafana.libsonnet'; ).addTargets( [ grafana.prometheus.target( - 'sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) by (le)', + 'sum(rate(loki_canary_response_latency_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) by (le)', legendFormat='{{le}}', format='heatmap', ), @@ -125,24 +125,24 @@ local grafana = import 'grafonnet/grafana.libsonnet'; dashboard.panel('Spot Check Query') + dashboard.queryPanel([ - 'histogram_quantile(0.99, sum(rate(loki_canary_spot_check_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) by (le))', - 'histogram_quantile(0.50, sum(rate(loki_canary_spot_check_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) by (le))', + 'histogram_quantile(0.99, sum(rate(loki_canary_spot_check_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) by (le))', + 'histogram_quantile(0.50, sum(rate(loki_canary_spot_check_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) by (le))', ], ['p99', 'p95']) + { gridPos: { h: 6, w: 12, x: 0, y: 14 } }, dashboard.panel('Metric Test Query') + dashboard.queryPanel([ - 'histogram_quantile(0.99, sum(rate(loki_canary_metric_test_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[15m])) by (le))', - 'histogram_quantile(0.50, sum(rate(loki_canary_metric_test_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[15m])) by (le))', + 'histogram_quantile(0.99, sum(rate(loki_canary_metric_test_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[15m])) by (le))', + 'histogram_quantile(0.50, sum(rate(loki_canary_metric_test_request_duration_seconds_bucket{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[15m])) by (le))', ], ['p99', 'p95'],) + { gridPos: { h: 6, w: 12, x: 12, y: 14 } }, dashboard.panel('Spot Check Missing %') + - dashboard.queryPanel('topk(20, (sum by (' + $._config.per_cluster_label + ', pod) (increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval]))/sum by (' + $._config.per_cluster_label + ', pod) (increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])) * 100)) > 0', '') + + dashboard.queryPanel('topk(20, (sum by (' + $._config.per_cluster_label + ', pod) (increase(loki_canary_spot_check_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval]))/sum by (' + $._config.per_cluster_label + ', pod) (increase(loki_canary_spot_check_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])) * 100)) > 0', '') + { gridPos: { h: 6, w: 12, x: 0, y: 20 } }, g.panel('Missing logs') + - g.queryPanel('topk(20,(sum by (' + $._config.per_cluster_label + ', pod)(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval]))/sum by (' + $._config.per_cluster_label + ', pod)(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",'+ $._config.per_namespace_label +'=~"$namespace"}[$__rate_interval])))*100) > 0', 'Missing {{ ' + $._config.per_cluster_label + ' }} {{ pod }}') + + g.queryPanel('topk(20,(sum by (' + $._config.per_cluster_label + ', pod)(increase(loki_canary_missing_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval]))/sum by (' + $._config.per_cluster_label + ', pod)(increase(loki_canary_entries_total{' + $._config.per_cluster_label + '=~"$cluster",' + $._config.per_namespace_label + '=~"$namespace"}[$__rate_interval])))*100) > 0', 'Missing {{ ' + $._config.per_cluster_label + ' }} {{ pod }}') + { gridPos: { h: 6, w: 12, x: 12, y: 20 } }, ], diff --git a/production/loki-mixin/dashboards/loki-logs.libsonnet b/production/loki-mixin/dashboards/loki-logs.libsonnet index c1f93ecad0f89..31c5af5bd6aa8 100644 --- a/production/loki-mixin/dashboards/loki-logs.libsonnet +++ b/production/loki-mixin/dashboards/loki-logs.libsonnet @@ -7,7 +7,7 @@ local template = import 'grafonnet/template.libsonnet'; template.new( 'deployment', '$datasource', - 'label_values(kube_deployment_created{' + $._config.per_cluster_label + '="$cluster", '+ $._config.per_namespace_label +'="$namespace"}, deployment)', + 'label_values(kube_deployment_created{' + $._config.per_cluster_label + '="$cluster", ' + $._config.per_namespace_label + '="$namespace"}, deployment)', sort=1, ), @@ -15,7 +15,7 @@ local template = import 'grafonnet/template.libsonnet'; template.new( 'pod', '$datasource', - 'label_values(kube_pod_container_info{' + $._config.per_cluster_label + '="$cluster", '+ $._config.per_namespace_label +'="$namespace", ' + $._config.per_instance_label + '=~"$deployment.*"}, pod)', + 'label_values(kube_pod_container_info{' + $._config.per_cluster_label + '="$cluster", ' + $._config.per_namespace_label + '="$namespace", ' + $._config.per_instance_label + '=~"$deployment.*"}, pod)', sort=1, ), @@ -23,7 +23,7 @@ local template = import 'grafonnet/template.libsonnet'; template.new( 'container', '$datasource', - 'label_values(kube_pod_container_info{' + $._config.per_cluster_label + '="$cluster", '+ $._config.per_namespace_label +'="$namespace", ' + $._config.per_instance_label + '=~"$pod", ' + $._config.per_instance_label + '=~"$deployment.*"}, container)', + 'label_values(kube_pod_container_info{' + $._config.per_cluster_label + '="$cluster", ' + $._config.per_namespace_label + '="$namespace", ' + $._config.per_instance_label + '=~"$pod", ' + $._config.per_instance_label + '=~"$deployment.*"}, container)', sort=1, ), diff --git a/production/loki-mixin/dashboards/recording-rules.libsonnet b/production/loki-mixin/dashboards/recording-rules.libsonnet index fe24d0d13fcd0..8b47db7dfaaf5 100644 --- a/production/loki-mixin/dashboards/recording-rules.libsonnet +++ b/production/loki-mixin/dashboards/recording-rules.libsonnet @@ -7,7 +7,7 @@ local template = import 'grafonnet/template.libsonnet'; template.new( 'tenant', '$datasource', - 'query_result(sum by (id) (grafanacloud_logs_instance_info) and sum(label_replace(loki_tenant:active_streams{' + $._config.per_cluster_label + '="$cluster",'+ $._config.per_namespace_label +'="$namespace"},"id","$1","tenant","(.*)")) by(id))', + 'query_result(sum by (id) (grafanacloud_logs_instance_info) and sum(label_replace(loki_tenant:active_streams{' + $._config.per_cluster_label + '="$cluster",' + $._config.per_namespace_label + '="$namespace"},"id","$1","tenant","(.*)")) by(id))', regex='/"([^"]+)"/', sort=1, includeAll=true,