From 37dc340371ac8901e3a5fadac441bc0e3c612b37 Mon Sep 17 00:00:00 2001 From: Pat Long Date: Wed, 16 Jun 2021 11:35:43 -0400 Subject: [PATCH] Ensure that all dashboards are using 'defaults.datasource' Some dashboards were still explicitly specifying 'Prometheus' as the datasource, which leads to issues when trying to import the dashboards into a grafana instance where the prometheus datasource has a different name. Change-Id: I13135af32a6f312a4feb32ab828f906f7b13edfe --- dashboards/gerrit/healthcheck/gerrit-healthcheck.jsonnet | 2 +- dashboards/gerrit/latency/gerrit-rest-api-latency.jsonnet | 4 ++-- dashboards/gerrit/latency/gerrit-ui-actions-latency.jsonnet | 2 +- dashboards/gerrit/overview/panels/availability.libsonnet | 4 +++- dashboards/gerrit/overview/panels/cpu-usage.libsonnet | 4 +++- dashboards/gerrit/overview/panels/heap-usage.libsonnet | 4 +++- dashboards/gerrit/overview/panels/request-errors.libsonnet | 4 +++- dashboards/gerrit/overview/panels/rest-latency.libsonnet | 4 +++- dashboards/gerrit/overview/panels/threads.libsonnet | 4 +++- dashboards/gerrit/overview/panels/version-table.libsonnet | 4 +++- dashboards/gerrit/replication/gerrit-replication.jsonnet | 2 +- 11 files changed, 26 insertions(+), 12 deletions(-) diff --git a/dashboards/gerrit/healthcheck/gerrit-healthcheck.jsonnet b/dashboards/gerrit/healthcheck/gerrit-healthcheck.jsonnet index 54678e2..3f8af9b 100644 --- a/dashboards/gerrit/healthcheck/gerrit-healthcheck.jsonnet +++ b/dashboards/gerrit/healthcheck/gerrit-healthcheck.jsonnet @@ -37,7 +37,7 @@ dashboard.new( .addTemplate( template.new( name='check', - datasource='Prometheus', + datasource=defaults.datasource, query='metrics(^plugins_healthcheck_.+_failure_total$)', regex='plugins_healthcheck_(.+)_failure_total', label='Check', diff --git a/dashboards/gerrit/latency/gerrit-rest-api-latency.jsonnet b/dashboards/gerrit/latency/gerrit-rest-api-latency.jsonnet index 6156904..d4811df 100644 --- a/dashboards/gerrit/latency/gerrit-rest-api-latency.jsonnet +++ b/dashboards/gerrit/latency/gerrit-rest-api-latency.jsonnet @@ -27,7 +27,7 @@ dashboard.new( .addTemplate( template.new( name='endpoint', - datasource='Prometheus', + datasource=defaults.datasource, query='metrics(^http_server_rest_api_server_latency_restapi_.+$)', regex='^http_server_rest_api_server_latency_restapi_([^_]+)_.+$', label='Endpoint', @@ -37,7 +37,7 @@ dashboard.new( .addTemplate( template.new( name='action', - datasource='Prometheus', + datasource=defaults.datasource, query='metrics(^http_server_rest_api_server_latency_restapi_$endpoint.+$)', regex='^http_server_rest_api_server_latency_restapi_[^_]+_([^_]+)_.+$', label='Action', diff --git a/dashboards/gerrit/latency/gerrit-ui-actions-latency.jsonnet b/dashboards/gerrit/latency/gerrit-ui-actions-latency.jsonnet index fd102d8..f9d0d40 100644 --- a/dashboards/gerrit/latency/gerrit-ui-actions-latency.jsonnet +++ b/dashboards/gerrit/latency/gerrit-ui-actions-latency.jsonnet @@ -27,7 +27,7 @@ dashboard.new( .addTemplate( template.new( name='action', - datasource='Prometheus', + datasource=defaults.datasource, query='metrics(^http_server_rest_api_ui_actions_latency_[^_]+$)', regex='^http_server_rest_api_ui_actions_latency_(.+)$', label='Action', diff --git a/dashboards/gerrit/overview/panels/availability.libsonnet b/dashboards/gerrit/overview/panels/availability.libsonnet index 58c16a2..d99909b 100644 --- a/dashboards/gerrit/overview/panels/availability.libsonnet +++ b/dashboards/gerrit/overview/panels/availability.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local stat = grafana.singlestat; +local defaults = import '../../../globals/defaults.libsonnet'; + stat.new( title='Gerrit Availability [last 24h]', - datasource='Prometheus', + datasource=defaults.datasource, colorBackground=true, colors=[ "red", diff --git a/dashboards/gerrit/overview/panels/cpu-usage.libsonnet b/dashboards/gerrit/overview/panels/cpu-usage.libsonnet index 5d2efa9..b8d9bc7 100644 --- a/dashboards/gerrit/overview/panels/cpu-usage.libsonnet +++ b/dashboards/gerrit/overview/panels/cpu-usage.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local gauge = grafana.gaugePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + gauge.new( title='CPU Usage', - datasource='Prometheus', + datasource=defaults.datasource, ) .addTarget( target=prometheus.target( diff --git a/dashboards/gerrit/overview/panels/heap-usage.libsonnet b/dashboards/gerrit/overview/panels/heap-usage.libsonnet index 1ec6a64..29f12c3 100644 --- a/dashboards/gerrit/overview/panels/heap-usage.libsonnet +++ b/dashboards/gerrit/overview/panels/heap-usage.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local gauge = grafana.gaugePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + gauge.new( title='Heap Memory Usage', - datasource='Prometheus', + datasource=defaults.datasource, ) .addTarget( target=prometheus.target( diff --git a/dashboards/gerrit/overview/panels/request-errors.libsonnet b/dashboards/gerrit/overview/panels/request-errors.libsonnet index dfef6e3..46d7eab 100644 --- a/dashboards/gerrit/overview/panels/request-errors.libsonnet +++ b/dashboards/gerrit/overview/panels/request-errors.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local gauge = grafana.gaugePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + gauge.new( title='HTTP Request Error Rate (last 5 min)', - datasource='Prometheus', + datasource=defaults.datasource, description='Excludes 404 and 401, since these error codes are caused by client behaviour and are overrepresented in the data.', min=0, max=100, diff --git a/dashboards/gerrit/overview/panels/rest-latency.libsonnet b/dashboards/gerrit/overview/panels/rest-latency.libsonnet index c10caf2..c96e9da 100644 --- a/dashboards/gerrit/overview/panels/rest-latency.libsonnet +++ b/dashboards/gerrit/overview/panels/rest-latency.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local gauge = grafana.gaugePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + gauge.new( title='REST API latency (0.99 quantile)', - datasource='Prometheus', + datasource=defaults.datasource, unit='ms', min=0, max=50, diff --git a/dashboards/gerrit/overview/panels/threads.libsonnet b/dashboards/gerrit/overview/panels/threads.libsonnet index b8671c3..ecd465a 100644 --- a/dashboards/gerrit/overview/panels/threads.libsonnet +++ b/dashboards/gerrit/overview/panels/threads.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local gauge = grafana.barGaugePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + gauge.new( title='Live Threads', - datasource='Prometheus', + datasource=defaults.datasource, thresholds=[{ color: 'green', value: null, diff --git a/dashboards/gerrit/overview/panels/version-table.libsonnet b/dashboards/gerrit/overview/panels/version-table.libsonnet index 4980980..457cbf8 100644 --- a/dashboards/gerrit/overview/panels/version-table.libsonnet +++ b/dashboards/gerrit/overview/panels/version-table.libsonnet @@ -2,9 +2,11 @@ local grafana = import '../../../../vendor/grafonnet/grafana.libsonnet'; local prometheus = grafana.prometheus; local table = grafana.tablePanel; +local defaults = import '../../../globals/defaults.libsonnet'; + table.new( title='Gerrit Version', - datasource='Prometheus', + datasource=defaults.datasource, transform='table', transparent=false, ) diff --git a/dashboards/gerrit/replication/gerrit-replication.jsonnet b/dashboards/gerrit/replication/gerrit-replication.jsonnet index 3e69cc8..83301bf 100644 --- a/dashboards/gerrit/replication/gerrit-replication.jsonnet +++ b/dashboards/gerrit/replication/gerrit-replication.jsonnet @@ -27,7 +27,7 @@ dashboard.new( .addTemplate( template.new( name='target', - datasource='Prometheus', + datasource=defaults.datasource, query='metrics(plugins_replication_replication_latency_.*_count)', regex='^plugins_replication_replication_latency_(.*)_count$', label='Replication Target',