Skip to content

Commit

Permalink
Add $cluster variable to controller-manager.libsonnet
Browse files Browse the repository at this point in the history
  • Loading branch information
anfouque committed Mar 15, 2021
1 parent 47cc48f commit 22579c3
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions dashboards/controller-manager.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local singlestat = grafana.singlestat;
span=2,
valueName='min',
)
.addTarget(prometheus.target('sum(up{%(kubeControllerManagerSelector)s})' % $._config));
.addTarget(prometheus.target('sum(up{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s})' % $._config));

local workQueueAddRate =
graphPanel.new(
Expand All @@ -30,7 +30,7 @@ local singlestat = grafana.singlestat;
legend_alignAsTable=true,
legend_rightSide=true,
)
.addTarget(prometheus.target('sum(rate(workqueue_adds_total{%(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name)' % $._config, legendFormat='{{instance}} {{name}}'));
.addTarget(prometheus.target('sum(rate(workqueue_adds_total{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name)' % $._config, legendFormat='{{instance}} {{name}}'));

local workQueueDepth =
graphPanel.new(
Expand All @@ -45,7 +45,7 @@ local singlestat = grafana.singlestat;
legend_alignAsTable=true,
legend_rightSide=true,
)
.addTarget(prometheus.target('sum(rate(workqueue_depth{%(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name)' % $._config, legendFormat='{{instance}} {{name}}'));
.addTarget(prometheus.target('sum(rate(workqueue_depth{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name)' % $._config, legendFormat='{{instance}} {{name}}'));

local workQueueLatency =
graphPanel.new(
Expand All @@ -59,7 +59,7 @@ local singlestat = grafana.singlestat;
legend_alignAsTable=true,
legend_rightSide=true,
)
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(workqueue_queue_duration_seconds_bucket{%(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name, le))' % $._config, legendFormat='{{instance}} {{name}}'));
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(workqueue_queue_duration_seconds_bucket{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s, instance=~"$instance"}[5m])) by (instance, name, le))' % $._config, legendFormat='{{instance}} {{name}}'));

local rpcRate =
graphPanel.new(
Expand All @@ -81,7 +81,7 @@ local singlestat = grafana.singlestat;
format='s',
min=0,
)
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%(kubeControllerManagerSelector)s, instance=~"$instance", verb="POST"}[5m])) by (verb, url, le))' % $._config, legendFormat='{{verb}} {{url}}'));
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s, instance=~"$instance", verb="POST"}[5m])) by (verb, url, le))' % $._config, legendFormat='{{verb}} {{url}}'));

local getRequestLatency =
graphPanel.new(
Expand All @@ -96,7 +96,7 @@ local singlestat = grafana.singlestat;
legend_alignAsTable=true,
legend_rightSide=true,
)
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%(kubeControllerManagerSelector)s, instance=~"$instance", verb="GET"}[5m])) by (verb, url, le))' % $._config, legendFormat='{{verb}} {{url}}'));
.addTarget(prometheus.target('histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s, instance=~"$instance", verb="GET"}[5m])) by (verb, url, le))' % $._config, legendFormat='{{verb}} {{url}}'));

local memory =
graphPanel.new(
Expand All @@ -105,7 +105,7 @@ local singlestat = grafana.singlestat;
span=4,
format='bytes',
)
.addTarget(prometheus.target('process_resident_memory_bytes{%(kubeControllerManagerSelector)s,instance=~"$instance"}' % $._config, legendFormat='{{instance}}'));
.addTarget(prometheus.target('process_resident_memory_bytes{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s,instance=~"$instance"}' % $._config, legendFormat='{{instance}}'));

local cpu =
graphPanel.new(
Expand All @@ -115,7 +115,7 @@ local singlestat = grafana.singlestat;
format='short',
min=0,
)
.addTarget(prometheus.target('rate(process_cpu_seconds_total{%(kubeControllerManagerSelector)s,instance=~"$instance"}[5m])' % $._config, legendFormat='{{instance}}'));
.addTarget(prometheus.target('rate(process_cpu_seconds_total{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s,instance=~"$instance"}[5m])' % $._config, legendFormat='{{instance}}'));

local goroutines =
graphPanel.new(
Expand All @@ -124,7 +124,7 @@ local singlestat = grafana.singlestat;
span=4,
format='short',
)
.addTarget(prometheus.target('go_goroutines{%(kubeControllerManagerSelector)s,instance=~"$instance"}' % $._config, legendFormat='{{instance}}'));
.addTarget(prometheus.target('go_goroutines{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s,instance=~"$instance"}' % $._config, legendFormat='{{instance}}'));


dashboard.new(
Expand All @@ -148,11 +148,22 @@ local singlestat = grafana.singlestat;
type: 'datasource',
},
)
.addTemplate(
template.new(
'cluster',
'$datasource',
'label_values(kube_pod_info, %(clusterLabel)s)' % $._config,
label='cluster',
refresh='time',
hide=if $._config.showMultiCluster then '' else 'variable',
sort=1,
)
)
.addTemplate(
template.new(
'instance',
'$datasource',
'label_values(process_cpu_seconds_total{%(kubeControllerManagerSelector)s}, instance)' % $._config,
'label_values(process_cpu_seconds_total{%(clusterLabel)s="$cluster", %(kubeControllerManagerSelector)s}, instance)' % $._config,
refresh='time',
includeAll=true,
sort=1,
Expand Down Expand Up @@ -182,4 +193,4 @@ local singlestat = grafana.singlestat;
.addPanel(goroutines)
) + { refresh: $._config.grafanaK8s.refresh },
},
}
}

0 comments on commit 22579c3

Please sign in to comment.