Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions dashboards/resources/workload.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,45 @@ local var = g.dashboard.variable;
];

local panels = [
tsPanel.new('Pod Count per Workload')
+ tsPanel.gridPos.withW(24)
+ tsPanel.queryOptions.withTargets([
prometheus.new(
'${datasource}',
'sum by (cluster, namespace, deployment) (kube_deployment_spec_replicas{%(clusterLabel)s="$cluster", namespace="$namespace", deployment="$workload"})' % $._config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all of these queries, the labels cluster should be %(clusterLabel)s and namespace should be %(namespaceLabel)s, e.g.:

Suggested change
'sum by (cluster, namespace, deployment) (kube_deployment_spec_replicas{%(clusterLabel)s="$cluster", namespace="$namespace", deployment="$workload"})' % $._config
'sum by (%(clusterLabel)s, %(namespaceLabel)s, deployment) (kube_deployment_spec_replicas{%(clusterLabel)s="$cluster", %(namespaceLabel)s="$namespace", deployment="$workload"})' % $._config

) + prometheus.withLegendFormat('{{deployment}} desired')
+ prometheus.withRefId('D'),

prometheus.new(
'${datasource}',
'sum by (cluster, namespace, deployment) (kube_deployment_status_replicas_available{%(clusterLabel)s="$cluster", namespace="$namespace", deployment="$workload"})' % $._config
) + prometheus.withLegendFormat('{{deployment}} available')
+ prometheus.withRefId('E'),

prometheus.new(
'${datasource}',
'sum by (cluster, namespace, statefulset) (kube_statefulset_replicas{%(clusterLabel)s="$cluster", namespace="$namespace", statefulset="$workload"})' % $._config
) + prometheus.withLegendFormat('{{statefulset}} desired')
+ prometheus.withRefId('F'),

prometheus.new(
'${datasource}',
'sum by (cluster, namespace, statefulset) (kube_statefulset_status_replicas_ready{%(clusterLabel)s="$cluster", namespace="$namespace", statefulset="$workload"})' % $._config
) + prometheus.withLegendFormat('{{statefulset}} available')
+ prometheus.withRefId('G'),

prometheus.new(
'${datasource}',
'sum by (cluster, namespace, daemonset) (kube_daemonset_status_desired_number_scheduled{%(clusterLabel)s="$cluster", namespace="$namespace", daemonset="$workload"})' % $._config
) + prometheus.withLegendFormat('{{daemonset}} desired')
+ prometheus.withRefId('H'),

prometheus.new(
'${datasource}',
'sum by (cluster, namespace, daemonset) (kube_daemonset_status_number_available{%(clusterLabel)s="$cluster", namespace="$namespace", daemonset="$workload"})' % $._config
) + prometheus.withLegendFormat('{{daemonset}} available')
+ prometheus.withRefId('I'),
]),
tsPanel.new('CPU Usage')
+ tsPanel.gridPos.withW(24)
+ tsPanel.queryOptions.withTargets([
Expand Down
Loading