-
Notifications
You must be signed in to change notification settings - Fork 181
Expand file tree
/
Copy pathdashboards.libsonnet
More file actions
59 lines (56 loc) · 2.02 KB
/
dashboards.libsonnet
File metadata and controls
59 lines (56 loc) · 2.02 KB
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
local g = import './g.libsonnet';
local commonlib = import 'common-lib/common/main.libsonnet';
local logslib = import 'logs-lib/logs/main.libsonnet';
{
new(this):
{
_common::
g.dashboard.withTags(this.config.dashboardTags)
+ g.dashboard.withTimezone(this.config.dashboardTimezone)
+ g.dashboard.withRefresh(this.config.dashboardRefresh)
+ g.dashboard.timepicker.withTimeOptions(this.config.dashboardPeriod)
+ g.dashboard.withLinks(std.objectValues(this.grafana.links)),
}
+
{
'docker.json':
g.dashboard.new(this.config.dashboardNamePrefix + 'Docker overview')
+ g.dashboard.withUid(this.config.uid + '-overview')
+ self._common
+ g.dashboard.withVariables(
//combine single choice 'instance' with multichoice 'name'
std.setUnion(
this.signals.machine.getVariablesSingleChoice(),
this.signals.container.getVariablesMultiChoice(),
keyF=function(x) x.name
)
)
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
this.grafana.rows.overview
+ this.grafana.rows.compute
+ this.grafana.rows.network
+ this.grafana.rows.disks
)
),
}
+
(if this.config.enableLokiLogs then
{
'docker-logs.json':
logslib.new(
this.config.dashboardNamePrefix + 'Docker logs',
datasourceName='loki_datasource',
datasourceRegex='',
filterSelector=this.config.logsFilteringSelector,
labels=this.config.logsLabels,
formatParser=this.config.logsFormatParser,
showLogsVolume=this.config.showLogsVolume,
logsVolumeGroupBy=this.config.logsVolumeGroupBy,
extraFilters=this.config.logsExtraFilters,
customAllValue=this.config.customAllValue,
).dashboards.logs
+ self._common
+ g.dashboard.withUid(this.config.uid + '-logs'),
} else {}),
}