Add: Custom tags and prefix in Prometheus Mixin (#8287)

* Add: custom tags and prefix

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>

* Fix: fmt

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
This commit is contained in:
Nicolas Lamirault 2020-12-16 18:49:06 +01:00 committed by GitHub
parent 8dc53c2218
commit aa1ca13025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View File

@ -37,5 +37,12 @@
// expression is matched against the `alertmanager` label.
// Example: @'http://test-alertmanager\..*'
nonNotifyingAlertmanagerRegEx: @'',
grafana: {
prefix: 'Prometheus / ',
tags: ['prometheus-mixin'],
// The default refresh time for all dashboards, default to 60s
refresh: '60s',
},
},
}

View File

@ -10,7 +10,9 @@ local template = grafana.template;
{
grafanaDashboards+:: {
'prometheus.json':
g.dashboard('Prometheus Overview')
g.dashboard(
'%(prefix)sOverview' % $._config.grafana
)
.addMultiTemplate('job', 'prometheus_build_info', 'job')
.addMultiTemplate('instance', 'prometheus_build_info', 'instance')
.addRow(
@ -96,7 +98,10 @@ local template = grafana.template;
{ yaxes: g.yaxes('ms') } +
g.stack,
)
),
) + {
tags: $._config.grafana.tags,
refresh: $._config.grafana.refresh,
},
// Remote write specific dashboard.
'prometheus-remote-write.json':
local timestampComparison =
@ -287,8 +292,10 @@ local template = grafana.template;
legendFormat='{{cluster}}:{{instance}} {{remote_name}}:{{url}}'
));
dashboard.new('Prometheus Remote Write',
editable=true)
dashboard.new(
title='%(prefix)sRemote Write' % $._config.grafana,
editable=true
)
.addTemplate(
{
hide: 0,
@ -372,6 +379,9 @@ local template = grafana.template;
.addPanel(failedSamples)
.addPanel(retriedSamples)
.addPanel(enqueueRetries)
),
) + {
tags: $._config.grafana.tags,
refresh: $._config.grafana.refresh,
},
},
}