-
Notifications
You must be signed in to change notification settings - Fork 68
/
grafana-obs-logs.jsonnet
74 lines (70 loc) · 2.32 KB
/
grafana-obs-logs.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
local cfg = (import 'config.libsonnet');
local loki = (import 'github.com/grafana/loki/production/loki-mixin/mixin.libsonnet') + cfg.loki;
local dashboards = {
['grafana-dashboard-observatorium-logs-%s.configmap' % std.split(name, '.')[0]]: {
apiVersion: 'v1',
kind: 'ConfigMap',
metadata: {
name: 'grafana-dashboard-observatorium-logs-%s' % std.split(name, '.')[0],
},
data: {
[name]: std.manifestJsonEx(loki.grafanaDashboards[name], ' '),
},
}
for name in std.objectFields(loki.grafanaDashboards)
if name != 'loki-logs.json'
} + {
'grafana-dashboard-observatorium-api-logs.configmap': (import 'dashboards/observatorium-api-logs.libsonnet')('${OBSERVATORIUM_API_DATASOURCE}', '${OBSERVATORIUM_API_NAMESPACE}'),
'grafana-dashboard-observatorium-logs-loki-overview.configmap': (import 'observatorium-logs/loki-overview.libsonnet')('${OBSERVATORIUM_API_DATASOURCE}', '${OBSERVATORIUM_API_NAMESPACE}'),
};
local dashboardsTemplate = {
apiVersion: 'template.openshift.io/v1',
kind: 'Template',
metadata: {
name: 'observatorium-logs-dahboards-templates',
},
objects: [
dashboards[name] {
metadata+: {
labels+: {
grafana_dashboard: 'true',
},
annotations+: {
'grafana-folder': '/grafana-dashboard-definitions/Observatorium',
},
},
}
for name in std.objectFields(dashboards)
],
parameters: [
{ name: 'OBSERVATORIUM_API_DATASOURCE', value: 'telemeter-prod-01-prometheus' },
{ name: 'OBSERVATORIUM_API_NAMESPACE', value: 'observatorium-mst-production' },
{ name: 'OBSERVATORIUM_DATASOURCE_REGEX', value: '(app-sre-stage-01|rhobs-testing|rhobsp02ue1|telemeter-prod-01)-prometheus' },
],
};
local recordingRulesTemplate = {
apiVersion: 'template.openshift.io/v1',
kind: 'Template',
metadata: {
name: 'observatorium-logs-dahboards-rules-templates',
},
objects: [
{
apiVersion: 'monitoring.coreos.com/v1',
kind: 'PrometheusRule',
metadata: {
name: 'observatorium-logs-recording-rules',
labels: {
prometheus: 'app-sre',
role: 'recording-rules',
},
},
spec: loki.prometheusRules,
},
],
parameters: [],
};
{
'grafana-dashboards-template': dashboardsTemplate,
'grafana-dashboards-rules-template': recordingRulesTemplate,
}