Skip to content

Commit 8ba9ba8

Browse files
authored
feat(dashboards): standardise network units (#1129)
1 parent dc04755 commit 8ba9ba8

13 files changed

+79
-73
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dev-port-forward:
4343
kubectl --context kind-kubernetes-mixin wait --for=condition=Ready pods -l app=lgtm --timeout=300s
4444
kubectl --context kind-kubernetes-mixin port-forward service/lgtm 3000:3000 4317:4317 4318:4318 9090:9090
4545

46-
dev-reload: generate lint
46+
dev-reload: clean-alerts clean-rules generate lint
4747
@cp -v prometheus_alerts.yaml scripts/provisioning/prometheus/ && \
4848
cp -v prometheus_rules.yaml scripts/provisioning/prometheus/ && \
4949
kubectl --context kind-kubernetes-mixin apply -f scripts/lgtm.yaml && \
@@ -73,7 +73,7 @@ clean-dashboards:
7373
DASHBOARD_SOURCES = $(shell find $(SRC_DIR) -name '*.libsonnet' 2>/dev/null)
7474

7575
.PHONY: generate
76-
generate: clean-alerts clean-rules prometheus_alerts.yaml prometheus_rules.yaml $(OUT_DIR)/.dashboards-generated
76+
generate: prometheus_alerts.yaml prometheus_rules.yaml $(OUT_DIR)/.dashboards-generated
7777

7878
$(JSONNET_VENDOR): $(JB_BIN) jsonnetfile.json
7979
$(JB_BIN) install

config.libsonnet

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
grafanaTimezone: 'UTC',
9191
},
9292

93+
// Units for panels
94+
units: {
95+
// Use 'bps' for bits per second (SI), or 'binBps' for bytes per second (IEC).
96+
network: 'bps',
97+
},
98+
9399
// Opt-in to multiCluster dashboards by overriding this and the clusterLabel.
94100
showMultiCluster: false,
95101
clusterLabel: 'cluster',

dashboards/network-usage/cluster-total.libsonnet

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ local var = g.dashboard.variable;
6363

6464
local panels = [
6565
tsPanel.new('Current Rate of Bytes Received')
66-
+ tsPanel.standardOptions.withUnit('binBps')
66+
+ tsPanel.standardOptions.withUnit($._config.units.network)
6767
+ tsPanel.queryOptions.withTargets([
6868
prometheus.new(
6969
'${datasource}', |||
@@ -81,7 +81,7 @@ local var = g.dashboard.variable;
8181
]),
8282

8383
tsPanel.new('Current Rate of Bytes Transmitted')
84-
+ tsPanel.standardOptions.withUnit('binBps')
84+
+ tsPanel.standardOptions.withUnit($._config.units.network)
8585
+ tsPanel.queryOptions.withTargets([
8686
prometheus.new(
8787
'${datasource}', |||
@@ -267,7 +267,7 @@ local var = g.dashboard.variable;
267267
properties: [
268268
{
269269
id: 'unit',
270-
value: 'binBps',
270+
value: $._config.units.network,
271271
},
272272
],
273273
},
@@ -298,7 +298,7 @@ local var = g.dashboard.variable;
298298
]),
299299

300300
tsPanel.new('Average Rate of Bytes Received')
301-
+ tsPanel.standardOptions.withUnit('binBps')
301+
+ tsPanel.standardOptions.withUnit($._config.units.network)
302302
+ tsPanel.queryOptions.withTargets([
303303
prometheus.new(
304304
'${datasource}', |||
@@ -316,7 +316,7 @@ local var = g.dashboard.variable;
316316
]),
317317

318318
tsPanel.new('Average Rate of Bytes Transmitted')
319-
+ tsPanel.standardOptions.withUnit('binBps')
319+
+ tsPanel.standardOptions.withUnit($._config.units.network)
320320
+ tsPanel.queryOptions.withTargets([
321321
prometheus.new(
322322
'${datasource}', |||
@@ -334,7 +334,7 @@ local var = g.dashboard.variable;
334334
]),
335335

336336
tsPanel.new('Receive Bandwidth')
337-
+ tsPanel.standardOptions.withUnit('binBps')
337+
+ tsPanel.standardOptions.withUnit($._config.units.network)
338338
+ tsPanel.queryOptions.withTargets([
339339
prometheus.new(
340340
'${datasource}', |||
@@ -352,7 +352,7 @@ local var = g.dashboard.variable;
352352
]),
353353

354354
tsPanel.new('Transmit Bandwidth')
355-
+ tsPanel.standardOptions.withUnit('binBps')
355+
+ tsPanel.standardOptions.withUnit($._config.units.network)
356356
+ tsPanel.queryOptions.withTargets([
357357
prometheus.new(
358358
'${datasource}', |||

dashboards/network-usage/namespace-by-pod.libsonnet

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,24 @@ local var = g.dashboard.variable;
8080
local panels = [
8181
gauge.new('Current Rate of Bytes Received')
8282
+ gauge.standardOptions.withDisplayName('$namespace')
83-
+ gauge.standardOptions.withUnit('Bps')
83+
+ gauge.standardOptions.withUnit($._config.units.network)
8484
+ gauge.standardOptions.withMin(0)
85-
+ gauge.standardOptions.withMax(10000000000) // 10GBs
85+
+ gauge.standardOptions.withMax(10000000000) // 10Gbps
8686
+ gauge.standardOptions.thresholds.withSteps([
8787
{
8888
color: 'dark-green',
8989
index: 0,
90-
value: null, // 0GBs
90+
value: null, // 0Gbps
9191
},
9292
{
9393
color: 'dark-yellow',
9494
index: 1,
95-
value: 5000000000, // 5GBs
95+
value: 5000000000, // 5Gbps
9696
},
9797
{
9898
color: 'dark-red',
9999
index: 2,
100-
value: 7000000000, // 7GBs
100+
value: 7000000000, // 7Gbps
101101
},
102102
])
103103
+ gauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -119,25 +119,25 @@ local var = g.dashboard.variable;
119119

120120
gauge.new('Current Rate of Bytes Transmitted')
121121
+ gauge.standardOptions.withDisplayName('$namespace')
122-
+ gauge.standardOptions.withUnit('Bps')
122+
+ gauge.standardOptions.withUnit($._config.units.network)
123123
+ gauge.standardOptions.withMin(0)
124-
+ gauge.standardOptions.withMax(10000000000) // 10GBs
124+
+ gauge.standardOptions.withMax(10000000000) // 10Gbps
125125
+ gauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
126126
+ gauge.standardOptions.thresholds.withSteps([
127127
{
128128
color: 'dark-green',
129129
index: 0,
130-
value: null, // 0GBs
130+
value: null, // 0Gbps
131131
},
132132
{
133133
color: 'dark-yellow',
134134
index: 1,
135-
value: 5000000000, // 5GBs
135+
value: 5000000000, // 5Gbps
136136
},
137137
{
138138
color: 'dark-red',
139139
index: 2,
140-
value: 7000000000, // 7GBs
140+
value: 7000000000, // 7Gbps
141141
},
142142
])
143143
+ gauge.queryOptions.withTargets([
@@ -304,7 +304,7 @@ local var = g.dashboard.variable;
304304
properties: [
305305
{
306306
id: 'unit',
307-
value: 'Bps',
307+
value: $._config.units.network,
308308
},
309309
],
310310
},
@@ -335,7 +335,7 @@ local var = g.dashboard.variable;
335335
]),
336336

337337
tsPanel.new('Receive Bandwidth')
338-
+ tsPanel.standardOptions.withUnit('binBps')
338+
+ tsPanel.standardOptions.withUnit($._config.units.network)
339339
+ tsPanel.queryOptions.withTargets([
340340
prometheus.new(
341341
'${datasource}', |||
@@ -353,7 +353,7 @@ local var = g.dashboard.variable;
353353
]),
354354

355355
tsPanel.new('Transmit Bandwidth')
356-
+ tsPanel.standardOptions.withUnit('binBps')
356+
+ tsPanel.standardOptions.withUnit($._config.units.network)
357357
+ tsPanel.queryOptions.withTargets([
358358
prometheus.new(
359359
'${datasource}', |||

dashboards/network-usage/namespace-by-workload.libsonnet

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ local var = g.dashboard.variable;
120120
barGauge.new('Current Rate of Bytes Received')
121121
+ barGauge.options.withDisplayMode('basic')
122122
+ barGauge.options.withShowUnfilled(false)
123-
+ barGauge.standardOptions.withUnit('Bps')
123+
+ barGauge.standardOptions.withUnit($._config.units.network)
124124
+ barGauge.standardOptions.color.withMode('fixed')
125125
+ barGauge.standardOptions.color.withFixedColor('green')
126126
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -144,7 +144,7 @@ local var = g.dashboard.variable;
144144
barGauge.new('Current Rate of Bytes Transmitted')
145145
+ barGauge.options.withDisplayMode('basic')
146146
+ barGauge.options.withShowUnfilled(false)
147-
+ barGauge.standardOptions.withUnit('Bps')
147+
+ barGauge.standardOptions.withUnit($._config.units.network)
148148
+ barGauge.standardOptions.color.withMode('fixed')
149149
+ barGauge.standardOptions.color.withFixedColor('green')
150150
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -271,7 +271,7 @@ local var = g.dashboard.variable;
271271
properties: [
272272
{
273273
id: 'unit',
274-
value: 'binBps',
274+
value: $._config.units.network,
275275
},
276276
],
277277
},
@@ -302,7 +302,7 @@ local var = g.dashboard.variable;
302302
]),
303303

304304
tsPanel.new('Receive Bandwidth')
305-
+ tsPanel.standardOptions.withUnit('Bps')
305+
+ tsPanel.standardOptions.withUnit($._config.units.network)
306306
+ tsPanel.queryOptions.withTargets([
307307
prometheus.new(
308308
'${datasource}',
@@ -321,7 +321,7 @@ local var = g.dashboard.variable;
321321
]),
322322

323323
tsPanel.new('Transmit Bandwidth')
324-
+ tsPanel.standardOptions.withUnit('Bps')
324+
+ tsPanel.standardOptions.withUnit($._config.units.network)
325325
+ tsPanel.queryOptions.withTargets([
326326
prometheus.new(
327327
'${datasource}',
@@ -340,7 +340,7 @@ local var = g.dashboard.variable;
340340
]),
341341

342342
tsPanel.new('Average Container Bandwidth by Workload: Received')
343-
+ tsPanel.standardOptions.withUnit('Bps')
343+
+ tsPanel.standardOptions.withUnit($._config.units.network)
344344
+ tsPanel.queryOptions.withTargets([
345345
prometheus.new(
346346
'${datasource}',
@@ -359,7 +359,7 @@ local var = g.dashboard.variable;
359359
]),
360360

361361
tsPanel.new('Average Container Bandwidth by Workload: Transmitted')
362-
+ tsPanel.standardOptions.withUnit('Bps')
362+
+ tsPanel.standardOptions.withUnit($._config.units.network)
363363
+ tsPanel.queryOptions.withTargets([
364364
prometheus.new(
365365
'${datasource}',

dashboards/network-usage/pod-total.libsonnet

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ local var = g.dashboard.variable;
8181
local panels = [
8282
gauge.new('Current Rate of Bytes Received')
8383
+ gauge.standardOptions.withDisplayName('$pod')
84-
+ gauge.standardOptions.withUnit('Bps')
84+
+ gauge.standardOptions.withUnit($._config.units.network)
8585
+ gauge.standardOptions.withMin(0)
86-
+ gauge.standardOptions.withMax(10000000000) // 10GBs
86+
+ gauge.standardOptions.withMax(10000000000) // 10Gbps
8787
+ gauge.standardOptions.thresholds.withSteps([
8888
{
8989
color: 'dark-green',
9090
index: 0,
91-
value: null, // 0GBs
91+
value: null, // 0Gbps
9292
},
9393
{
9494
color: 'dark-yellow',
9595
index: 1,
96-
value: 5000000000, // 5GBs
96+
value: 5000000000, // 5Gbps
9797
},
9898
{
9999
color: 'dark-red',
100100
index: 2,
101-
value: 7000000000, // 7GBs
101+
value: 7000000000, // 7Gbps
102102
},
103103
])
104104
+ gauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -112,24 +112,24 @@ local var = g.dashboard.variable;
112112

113113
gauge.new('Current Rate of Bytes Transmitted')
114114
+ gauge.standardOptions.withDisplayName('$pod')
115-
+ gauge.standardOptions.withUnit('Bps')
115+
+ gauge.standardOptions.withUnit($._config.units.network)
116116
+ gauge.standardOptions.withMin(0)
117-
+ gauge.standardOptions.withMax(10000000000) // 10GBs
117+
+ gauge.standardOptions.withMax(10000000000) // 10Gbps
118118
+ gauge.standardOptions.thresholds.withSteps([
119119
{
120120
color: 'dark-green',
121121
index: 0,
122-
value: null, // 0GBs
122+
value: null, // 0Gbps
123123
},
124124
{
125125
color: 'dark-yellow',
126126
index: 1,
127-
value: 5000000000, // 5GBs
127+
value: 5000000000, // 5Gbps
128128
},
129129
{
130130
color: 'dark-red',
131131
index: 2,
132-
value: 7000000000, // 7GBs
132+
value: 7000000000, // 7Gbps
133133
},
134134
])
135135
+ gauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -142,7 +142,7 @@ local var = g.dashboard.variable;
142142
]),
143143

144144
tsPanel.new('Receive Bandwidth')
145-
+ tsPanel.standardOptions.withUnit('binBps')
145+
+ tsPanel.standardOptions.withUnit($._config.units.network)
146146
+ tsPanel.queryOptions.withTargets([
147147
prometheus.new(
148148
'${datasource}',
@@ -152,7 +152,7 @@ local var = g.dashboard.variable;
152152
]),
153153

154154
tsPanel.new('Transmit Bandwidth')
155-
+ tsPanel.standardOptions.withUnit('binBps')
155+
+ tsPanel.standardOptions.withUnit($._config.units.network)
156156
+ tsPanel.queryOptions.withTargets([
157157
prometheus.new(
158158
'${datasource}',

dashboards/network-usage/workload-total.libsonnet

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ local var = g.dashboard.variable;
9797
barGauge.new('Current Rate of Bytes Received')
9898
+ barGauge.options.withDisplayMode('basic')
9999
+ barGauge.options.withShowUnfilled(false)
100-
+ barGauge.standardOptions.withUnit('Bps')
100+
+ barGauge.standardOptions.withUnit($._config.units.network)
101101
+ barGauge.standardOptions.color.withMode('fixed')
102102
+ barGauge.standardOptions.color.withFixedColor('green')
103103
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -116,7 +116,7 @@ local var = g.dashboard.variable;
116116
barGauge.new('Current Rate of Bytes Transmitted')
117117
+ barGauge.options.withDisplayMode('basic')
118118
+ barGauge.options.withShowUnfilled(false)
119-
+ barGauge.standardOptions.withUnit('Bps')
119+
+ barGauge.standardOptions.withUnit($._config.units.network)
120120
+ barGauge.standardOptions.color.withMode('fixed')
121121
+ barGauge.standardOptions.color.withFixedColor('green')
122122
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -135,7 +135,7 @@ local var = g.dashboard.variable;
135135
barGauge.new('Average Rate of Bytes Received')
136136
+ barGauge.options.withDisplayMode('basic')
137137
+ barGauge.options.withShowUnfilled(false)
138-
+ barGauge.standardOptions.withUnit('Bps')
138+
+ barGauge.standardOptions.withUnit($._config.units.network)
139139
+ barGauge.standardOptions.color.withMode('fixed')
140140
+ barGauge.standardOptions.color.withFixedColor('green')
141141
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -154,7 +154,7 @@ local var = g.dashboard.variable;
154154
barGauge.new('Average Rate of Bytes Transmitted')
155155
+ barGauge.options.withDisplayMode('basic')
156156
+ barGauge.options.withShowUnfilled(false)
157-
+ barGauge.standardOptions.withUnit('Bps')
157+
+ barGauge.standardOptions.withUnit($._config.units.network)
158158
+ barGauge.standardOptions.color.withMode('fixed')
159159
+ barGauge.standardOptions.color.withFixedColor('green')
160160
+ barGauge.queryOptions.withInterval($._config.grafanaK8s.minimumTimeInterval)
@@ -171,7 +171,7 @@ local var = g.dashboard.variable;
171171
]),
172172

173173
tsPanel.new('Receive Bandwidth')
174-
+ tsPanel.standardOptions.withUnit('binBps')
174+
+ tsPanel.standardOptions.withUnit($._config.units.network)
175175
+ tsPanel.queryOptions.withTargets([
176176
prometheus.new(
177177
'${datasource}',
@@ -185,7 +185,7 @@ local var = g.dashboard.variable;
185185
]),
186186

187187
tsPanel.new('Transmit Bandwidth')
188-
+ tsPanel.standardOptions.withUnit('binBps')
188+
+ tsPanel.standardOptions.withUnit($._config.units.network)
189189
+ tsPanel.queryOptions.withTargets([
190190
prometheus.new(
191191
'${datasource}',

0 commit comments

Comments
 (0)