-
Notifications
You must be signed in to change notification settings - Fork 163
/
dashboards.libsonnet
53 lines (51 loc) · 1.72 KB
/
dashboards.libsonnet
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
local g = import './g.libsonnet';
{
local root = self,
new(this):
local prefix = this.config.dashboardNamePrefix;
local links = this.grafana.links;
local tags = this.config.dashboardTags;
local uid = g.util.string.slugify(this.config.uid);
local signals = this.grafana.signals;
local annotations = this.grafana.annotations;
local refresh = this.config.dashboardRefresh;
local period = this.config.dashboardPeriod;
local timezone = this.config.dashboardTimezone;
local panels = this.grafana.panels;
local stat = g.panel.stat;
local type = this.config.metricSource;
{
'golangruntime.json':
g.dashboard.new(prefix + 'Golang runtime')
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
g.util.panel.resolveCollapsedFlagOnRows(
[
this.grafana.rows.golangRuntime,
this.grafana.rows.golangMemory,
],
)
)
)
+ root.applyCommon(
this.signals.getVariablesMultiChoice(),
uid + '-golangruntime',
tags,
links { backToOverview+:: {} },
annotations,
timezone,
refresh,
period
),
},
//Apply common options(uids, tags, annotations etc..) to all dashboards above
applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period):
g.dashboard.withTags(tags)
+ g.dashboard.withUid(uid)
+ g.dashboard.withLinks(std.objectValues(links))
+ g.dashboard.withTimezone(timezone)
+ g.dashboard.withRefresh(refresh)
+ g.dashboard.time.withFrom(period)
+ g.dashboard.withVariables(vars)
+ g.dashboard.withAnnotations(std.objectValues(annotations)),
}