atlas dashboards: show pod counts with top12 bars

This commit is contained in:
Brad Stein 2025-12-12 20:20:13 -03:00
parent 9e76277c22
commit b770575b42
5 changed files with 52 additions and 14 deletions

View File

@ -558,7 +558,18 @@ def pie_panel(panel_id, title, expr, grid):
}
def bargauge_panel(panel_id, title, expr, grid, *, unit="none", links=None, limit=None):
def bargauge_panel(
panel_id,
title,
expr,
grid,
*,
unit="none",
links=None,
limit=None,
thresholds=None,
decimals=None,
):
"""Return a bar gauge panel with label-aware reduction."""
panel = {
"id": panel_id,
@ -572,7 +583,8 @@ def bargauge_panel(panel_id, title, expr, grid, *, unit="none", links=None, limi
"unit": unit,
"min": 0,
"max": 100 if unit == "percent" else None,
"thresholds": {
"thresholds": thresholds
or {
"mode": "absolute",
"steps": [
{"color": "green", "value": None},
@ -594,6 +606,8 @@ def bargauge_panel(panel_id, title, expr, grid, *, unit="none", links=None, limi
},
},
}
if decimals is not None:
panel["fieldConfig"]["defaults"]["decimals"] = decimals
if links:
panel["links"] = links
# Keep bars ordered by value descending for readability.
@ -893,6 +907,16 @@ def build_overview():
{"h": 10, "w": 12, "x": 12, "y": 54},
unit="none",
limit=12,
decimals=0,
thresholds={
"mode": "absolute",
"steps": [
{"color": "green", "value": None},
{"color": "yellow", "value": 50},
{"color": "orange", "value": 75},
{"color": "red", "value": 100},
],
},
)
)
@ -1091,6 +1115,16 @@ def build_pods_dashboard():
{"h": 8, "w": 12, "x": 0, "y": 34},
unit="none",
limit=12,
decimals=0,
thresholds={
"mode": "absolute",
"steps": [
{"color": "green", "value": None},
{"color": "yellow", "value": 50},
{"color": "orange", "value": 75},
{"color": "red", "value": 100},
],
},
)
)
return {

View File

@ -1469,14 +1469,15 @@
},
{
"color": "orange",
"value": 70
"value": 75
},
{
"color": "red",
"value": 85
"value": 100
}
]
}
},
"decimals": 0
},
"overrides": []
},

View File

@ -452,14 +452,15 @@
},
{
"color": "orange",
"value": 70
"value": 75
},
{
"color": "red",
"value": 85
"value": 100
}
]
}
},
"decimals": 0
},
"overrides": []
},

View File

@ -1478,14 +1478,15 @@ data:
},
{
"color": "orange",
"value": 70
"value": 75
},
{
"color": "red",
"value": 85
"value": 100
}
]
}
},
"decimals": 0
},
"overrides": []
},

View File

@ -461,14 +461,15 @@ data:
},
{
"color": "orange",
"value": 70
"value": 75
},
{
"color": "red",
"value": 85
"value": 100
}
]
}
},
"decimals": 0
},
"overrides": []
},