forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loki Prometheus mixin: Fix incorrect selectors and simplify mixin usa…
…ge (grafana#6189) * fix(dashboards): fix matchers and selectors Signed-off-by: irizzant <i.rizzante@gmail.com> * doc: add entry in CHANGELOG * feat(dashboards): add kube-prometheus mixin Signed-off-by: irizzant <i.rizzante@gmail.com> * doc: update CHANGELOG * fix(mixins): fix wrong job selectors Signed-off-by: irizzant <i.rizzante@gmail.com> * Revert "fix(mixins): fix wrong job selectors" This reverts commit f819a0b. * fix(dashboards): add ServiceMonitor object Signed-off-by: Ivan Rizzante <i.rizzante@gmail.com> * fix(jsonnet): format jsonnet Signed-off-by: irizzant <i.rizzante@gmail.com> * fix(dashboards): add ServiceMonitor to Loki Simple Scalable Signed-off-by: irizzant <i.rizzante@gmail.com> * Revert "fix(dashboards): add ServiceMonitor to Loki Simple Scalable" This reverts commit ba24006. * doc: add details about create_service_monitor` parameter Signed-off-by: irizzant <i.rizzante@gmail.com>
- Loading branch information
Showing
5 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
local this = self, | ||
|
||
serviceMonitor: if $._config.create_service_monitor then { | ||
apiVersion: 'monitoring.coreos.com/v1', | ||
kind: 'ServiceMonitor', | ||
metadata: { | ||
name: 'loki-servicemonitor', | ||
namespace: $._config.namespace, | ||
}, | ||
spec: { | ||
namespaceSelector: { | ||
matchNames: [$._config.namespace], | ||
}, | ||
servicesToRelabel:: [ | ||
'compactor', | ||
'distributor', | ||
'ingester', | ||
'querier', | ||
'ruler', | ||
], | ||
endpoints: [ | ||
{ | ||
port: port.name, | ||
path: '/metrics', | ||
[if std.member(self.servicesToRelabel, this[name].spec.selector.name) then 'relabelings']: [{ | ||
sourceLabels: ['job'], | ||
action: 'replace', | ||
replacement: $._config.namespace + '/$1', | ||
targetLabel: 'job', | ||
}], | ||
} | ||
for name in std.objectFields(this) | ||
if std.isObject($[name]) && std.objectHas(this[name], 'kind') && this[name].kind == 'Service' | ||
for port in std.filter(function(x) std.length(std.findSubstr('http-metrics', x.name)) > 0, this[name].spec.ports) | ||
], | ||
selector: { | ||
matchExpressions: [{ | ||
key: 'name', | ||
operator: 'In', | ||
values: [ | ||
this[name].spec.selector.name | ||
for name in std.objectFields(this) | ||
if std.isObject(this[name]) && std.objectHas(this[name], 'kind') && this[name].kind == 'Service' | ||
], | ||
}], | ||
}, | ||
}, | ||
} else {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters