mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

Fix mixin cluster parameter otherwise generated mixins looks like this: ```json {"type":"prometheus","uid":"${datasource}"},"label":"cluster","name":"job","query":"label_values(etcd_server_has_leader{job=~\".*etcd.*\"}, job)","refresh":2,"type":"query"}]},"time":{"from":"now-15m","to":"now"},"timezone": "`}}{{ .Values.grafana.defaultDashboardsTimezone }}{{`","title":"etcd","uid":"c2f4e12cdf69feb95caa41a5a1b423d9"}`}} ``` where name is job when the variable name used in dashboard queries is cluster. Signed-off-by: QuentinBisson <quentin@giantswarm.io>
22 lines
581 B
Jsonnet
22 lines
581 B
Jsonnet
// variables.libsonnet
|
|
local g = import './g.libsonnet';
|
|
local var = g.dashboard.variable;
|
|
|
|
|
|
function(config) {
|
|
datasource:
|
|
var.datasource.new('datasource', 'prometheus')
|
|
+ var.datasource.generalOptions.withLabel('Data Source'),
|
|
|
|
cluster:
|
|
var.query.new('cluster')
|
|
+ var.query.generalOptions.withLabel('cluster')
|
|
+ var.query.withDatasourceFromVariable(self.datasource)
|
|
+ { refresh: config.dashboard_var_refresh }
|
|
+ var.query.queryTypes.withLabelValues(
|
|
config.clusterLabel,
|
|
'etcd_server_has_leader{%s}' % [config.etcd_selector]
|
|
),
|
|
|
|
}
|