Skip to content

Commit 65b5ec8

Browse files
committed
migrate: global-usage-stats.jsonnet
1 parent 19ac66b commit 65b5ec8

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

global-dashboards/global-usage-stats.jsonnet

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,55 @@
33
// with useful stats about usage across all datasources
44
local grafonnet = import 'grafonnet/main.libsonnet';
55
local dashboard = grafonnet.dashboard;
6-
local barGaugePanel = grafonnet.barGaugePanel;
7-
local prometheus = grafonnet.prometheus;
6+
local barGauge = grafonnet.panel.barGauge;
7+
local prometheus = grafonnet.query.prometheus;
88

99
function(datasources)
10-
local weeklyActiveUsers = barGaugePanel.new(
11-
'Active users (over 7 days)',
12-
datasource='-- Mixed --',
13-
thresholds=[
14-
{
15-
value: 0,
16-
color: 'green',
17-
},
18-
],
19-
).addTargets([
20-
prometheus.target(
21-
// Removes any pods caused by stress testing
22-
|||
23-
count(
24-
sum(
25-
min_over_time(
26-
kube_pod_labels{
27-
label_app="jupyterhub",
28-
label_component="singleuser-server",
29-
label_hub_jupyter_org_username!~"(service|perf|hubtraf)-",
30-
}[7d]
31-
)
32-
) by (pod)
33-
)
34-
|||,
35-
legendFormat=x,
36-
interval='7d',
37-
datasource=x
38-
)
39-
// Create a target for each datasource
40-
for x in datasources
41-
]);
10+
local weeklyActiveUsers =
11+
barGauge.new('Active users (over 7 days)')
12+
//thresholds=[
13+
// {
14+
// value: 0,
15+
// color: 'green',
16+
// },
17+
//],
18+
+ barGauge.queryOptions.withInterval('7d')
19+
+ barGauge.queryOptions.withTargets([
20+
prometheus.new(
21+
x,
22+
// Removes any pods caused by stress testing
23+
|||
24+
count(
25+
sum(
26+
min_over_time(
27+
kube_pod_labels{
28+
label_app="jupyterhub",
29+
label_component="singleuser-server",
30+
label_hub_jupyter_org_username!~"(service|perf|hubtraf)-",
31+
}[7d]
32+
)
33+
) by (pod)
34+
)
35+
|||,
36+
)
37+
+ prometheus.withLegendFormat(x)
38+
// Create a target for each datasource
39+
for x in datasources
40+
]);
4241

43-
dashboard.new(
44-
'Global Usage Dashboard',
45-
uid='global-usage-dashboard',
46-
tags=['jupyterhub', 'global'],
47-
editable=true,
48-
time_from='now-7d',
49-
).addPanel(
50-
weeklyActiveUsers,
51-
gridPos={
52-
x: 0,
53-
y: 0,
54-
w: 25,
55-
h: 10,
56-
},
42+
dashboard.new('Global Usage Dashboard')
43+
+ dashboard.withUid('global-usage-dashboard')
44+
+ dashboard.withTags(['jupyterhub', 'global'])
45+
+ dashboard.withEditable(true)
46+
// time_from='now-7d',
47+
+ dashboard.withPanels(
48+
grafonnet.util.grid.makeGrid([
49+
weeklyActiveUsers,
50+
])
51+
// gridPos={
52+
// x: 0,
53+
// y: 0,
54+
// w: 25,
55+
// h: 10,
56+
// },
5757
)

0 commit comments

Comments
 (0)