atlas pods: plurality table v10

This commit is contained in:
Brad Stein 2025-12-13 16:36:25 -03:00
parent e87d54f19d
commit 7f67793ee5
3 changed files with 29 additions and 9 deletions

View File

@ -1180,18 +1180,22 @@ def build_pods_dashboard():
) )
) )
share_expr = (
'(sum by (namespace,node) (kube_pod_info{pod=~".+"}) '
'/ on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~".+"}), 1) * 100)'
)
panels.append( panels.append(
table_panel( table_panel(
10, 10,
"Namespace Plurality by Node", "Namespace Plurality by Node v10",
'topk by (namespace) (1, ' f"{share_expr} * on(namespace,node) ("
'(sum by (namespace,node) (kube_pod_info{pod!=""}) ' f"{share_expr} == bool on(namespace) group_left() (max by (namespace) ({share_expr}))"
'/ on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod!=""}), 1) * 100)' ")",
')',
{"h": 8, "w": 24, "x": 0, "y": 42}, {"h": 8, "w": 24, "x": 0, "y": 42},
unit="percent", unit="percent",
transformations=[ transformations=[
{"id": "labelsToFields", "options": {}}, {"id": "labelsToFields", "options": {}},
{"id": "filterByValue", "options": {"match": "Value", "operator": "gt", "value": 0}},
{"id": "sortBy", "options": {"fields": ["node", "Value"], "order": "asc"}}, {"id": "sortBy", "options": {"fields": ["node", "Value"], "order": "asc"}},
], ],
instant=True, instant=True,

View File

@ -495,7 +495,7 @@
{ {
"id": 10, "id": 10,
"type": "table", "type": "table",
"title": "Namespace Plurality by Node", "title": "Namespace Plurality by Node v10",
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "atlas-vm" "uid": "atlas-vm"
@ -508,7 +508,7 @@
}, },
"targets": [ "targets": [
{ {
"expr": "topk by (namespace) (1, (sum by (namespace,node) (kube_pod_info{pod!=\"\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod!=\"\"}), 1) * 100))", "expr": "(sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100) * on(namespace,node) ((sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100) == bool on(namespace) group_left() (max by (namespace) ((sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100))))",
"refId": "A", "refId": "A",
"instant": true "instant": true
} }
@ -527,6 +527,14 @@
"id": "labelsToFields", "id": "labelsToFields",
"options": {} "options": {}
}, },
{
"id": "filterByValue",
"options": {
"match": "Value",
"operator": "gt",
"value": 0
}
},
{ {
"id": "sortBy", "id": "sortBy",
"options": { "options": {

View File

@ -504,7 +504,7 @@ data:
{ {
"id": 10, "id": 10,
"type": "table", "type": "table",
"title": "Namespace Plurality by Node", "title": "Namespace Plurality by Node v10",
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "atlas-vm" "uid": "atlas-vm"
@ -517,7 +517,7 @@ data:
}, },
"targets": [ "targets": [
{ {
"expr": "topk by (namespace) (1, (sum by (namespace,node) (kube_pod_info{pod!=\"\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod!=\"\"}), 1) * 100))", "expr": "(sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100) * on(namespace,node) ((sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100) == bool on(namespace) group_left() (max by (namespace) ((sum by (namespace,node) (kube_pod_info{pod=~\".+\"}) / on(namespace) group_left() clamp_min(sum by (namespace) (kube_pod_info{pod=~\".+\"}), 1) * 100))))",
"refId": "A", "refId": "A",
"instant": true "instant": true
} }
@ -536,6 +536,14 @@ data:
"id": "labelsToFields", "id": "labelsToFields",
"options": {} "options": {}
}, },
{
"id": "filterByValue",
"options": {
"match": "Value",
"operator": "gt",
"value": 0
}
},
{ {
"id": "sortBy", "id": "sortBy",
"options": { "options": {