Skip to content

Commit abf0830

Browse files
authored
Caddy server add 'service label to matcher (#1176)
* Add service matcher to caddy service looks up 'server' label of caddy * Fix mixin format
1 parent d92c7be commit abf0830

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

caddy-mixin/dashboards/caddy-overview.jsonnet

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
local matcher = 'job=~"$job", instance=~"$instance"',
2+
local matcher = 'job=~"$job", server=~"$service", instance=~"$instance"',
33
annotations: {
44
list: [
55
{
@@ -714,14 +714,50 @@
714714
datasource: {
715715
uid: '$datasource',
716716
},
717-
definition: '',
717+
definition: "label_values(caddy_http_requests_total{job=~\"'$job'\"} server)",
718+
hide: 0,
719+
includeAll: true,
720+
label: 'service',
721+
multi: true,
722+
name: 'service',
723+
options: [],
724+
query: {
725+
qryType: 1,
726+
query: "label_values(caddy_http_requests_total{job=~\"'$job'\"}, server)",
727+
refId: 'PrometheusVariableQueryEditor-VariableQuery',
728+
},
729+
refresh: 2,
730+
regex: '',
731+
skipUrlSync: false,
732+
sort: 1,
733+
tagValuesQuery: '',
734+
tags: [],
735+
tagsQuery: '',
736+
type: 'query',
737+
useTags: false,
738+
},
739+
{
740+
allValue: '.+',
741+
current: {
742+
selected: false,
743+
text: 'All',
744+
value: '$__all',
745+
},
746+
datasource: {
747+
uid: '$datasource',
748+
},
749+
definition: "label_values(caddy_http_requests_total{job=~\"'$job'\", server=~\"$service\"}, instance)",
718750
hide: 0,
719751
includeAll: true,
720752
label: 'Instance',
721753
multi: true,
722754
name: 'instance',
723755
options: [],
724-
query: "label_values(caddy_http_requests_total{job=~'$job'}, instance)",
756+
query: {
757+
qryType: 1,
758+
query: "label_values(caddy_http_requests_total{job=~\"'$job'\", server=~\"$service\"}, instance)",
759+
refId: 'PrometheusVariableQueryEditor-VariableQuery',
760+
},
725761
refresh: 2,
726762
regex: '',
727763
skipUrlSync: false,

caddy-mixin/mixin.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
grafanaDashboards: {
2+
grafanaDashboards+:: {
33
'caddy-overview.json': (import 'dashboards/caddy-overview.jsonnet'),
44
},
55
}

0 commit comments

Comments
 (0)