Skip to content

Commit

Permalink
Migrate userPods panel
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Oct 7, 2023
1 parent 111a58f commit e957027
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions dashboards/cluster.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,37 @@ local userNodes = ts.new(
) + prometheus.withLegendFormat('{{label_cloud_google_com_gke_nodepool}}')
]);

// local userPods = graphPanel.new(
// 'Running Users',
// description=|||
// Count of running users, grouped by namespace
// |||,
// decimals=0,
// min=0,
// stack=true,
// datasource='$PROMETHEUS_DS'
// ).addTargets([
// prometheus.target(
// |||
// # Sum up all running user pods by namespace
// sum(
// # Grab a list of all running pods.
// # The group aggregator always returns "1" for the number of times each
// # unique label appears in the time series. This is desirable for this
// # use case because we're merely identifying running pods by name,
// # not how many times they might be running.
// group(
// kube_pod_status_phase{phase="Running"}
// ) by (pod)
// * on (pod) group_right() group(
// kube_pod_labels{label_app="jupyterhub", label_component="singleuser-server"}
// ) by (namespace, pod)
// ) by (namespace)
// |||,
// legendFormat='{{namespace}}'
// ),
// ]);
local userPods = ts.new(
'Running Users',
) + ts.panelOptions.withDescription(
|||
Count of running users, grouped by namespace
|||
) + ts.standardOptions.withMin(
0
) + ts.fieldConfig.defaults.custom.withStacking(
true
) + ts.queryOptions.withTargets([
prometheus.new(
'$PROMETHEUS_DS',
|||
# Sum up all running user pods by namespace
sum(
# Grab a list of all running pods.
# The group aggregator always returns "1" for the number of times each
# unique label appears in the time series. This is desirable for this
# use case because we're merely identifying running pods by name,
# not how many times they might be running.
group(
kube_pod_status_phase{phase="Running"}
) by (pod)
* on (pod) group_right() group(
kube_pod_labels{label_app="jupyterhub", label_component="singleuser-server"}
) by (namespace, pod)
) by (namespace)
|||,
) + prometheus.withLegendFormat('{{namespace}}'),
]);

// local clusterMemoryCommitment = graphPanel.new(
// 'Memory commitment %',
Expand Down Expand Up @@ -353,7 +354,7 @@ dashboard.new(
row.new(
'Cluster Stats'
) + row.withPanels([
// userPods,
userPods,
// clusterMemoryCommitment,
// clusterCPUCommitment,
userNodes
Expand Down

0 comments on commit e957027

Please sign in to comment.