-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from GeorgianaElena/all-datasources
Add support for global dashboards
- Loading branch information
Showing
4 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Dashboards across all datasources | ||
|
||
Contains "global" dashboards with useful stats computed across all datasources. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Deploys one dashboard - "Global usage dashboard", | ||
// with useful stats about usage across all datasources | ||
local grafana = import '../vendor/grafonnet/grafana.libsonnet'; | ||
local dashboard = grafana.dashboard; | ||
local barGaugePanel = grafana.barGaugePanel; | ||
local prometheus = grafana.prometheus; | ||
|
||
function(datasources) | ||
local weeklyActiveUsers = barGaugePanel.new( | ||
'Active users (over 7 days)', | ||
datasource='-- Mixed --', | ||
thresholds=[ | ||
{ | ||
value: 0, | ||
color: 'green', | ||
}, | ||
], | ||
).addTargets([ | ||
prometheus.target( | ||
// Removes any pods caused by stress testing | ||
||| | ||
count( | ||
sum( | ||
min_over_time( | ||
kube_pod_labels{ | ||
label_app="jupyterhub", | ||
label_component="singleuser-server", | ||
label_hub_jupyter_org_username!~"(service|perf|hubtraf)-", | ||
}[7d] | ||
) | ||
) by (pod) | ||
) | ||
|||, | ||
legendFormat=x, | ||
interval='7d', | ||
datasource=x | ||
) | ||
// Create a target for each datasource | ||
for x in datasources | ||
]); | ||
|
||
dashboard.new( | ||
'Global Usage Dashboard', | ||
uid='global-usage-dashboard', | ||
tags=['jupyterhub', 'global'], | ||
editable=true, | ||
time_from='now-7d', | ||
).addPanel( | ||
weeklyActiveUsers, | ||
gridPos={ | ||
x: 0, | ||
y: 0, | ||
w: 25, | ||
h: 10, | ||
}, | ||
) |