Make namespace plurality table non-filterable

This commit is contained in:
Brad Stein 2025-12-13 17:55:52 -03:00
parent a4b3273bab
commit 4fcc7c84f2
3 changed files with 39 additions and 12 deletions

View File

@ -527,12 +527,14 @@ def table_panel(
transformations=None, transformations=None,
instant=False, instant=False,
options=None, options=None,
filterable=True,
): ):
"""Return a Grafana table panel definition.""" """Return a Grafana table panel definition."""
# Optional PromQL subquery helpers in expr: share(), etc. # Optional PromQL subquery helpers in expr: share(), etc.
panel_options = {"showHeader": True, "columnFilters": False} panel_options = {"showHeader": True, "columnFilters": False}
if options: if options:
panel_options.update(options) panel_options.update(options)
field_defaults = {"unit": unit, "custom": {"filterable": filterable}}
panel = { panel = {
"id": panel_id, "id": panel_id,
"type": "table", "type": "table",
@ -540,7 +542,7 @@ def table_panel(
"datasource": PROM_DS, "datasource": PROM_DS,
"gridPos": grid, "gridPos": grid,
"targets": [{"expr": expr, "refId": "A", **({"instant": True} if instant else {})}], "targets": [{"expr": expr, "refId": "A", **({"instant": True} if instant else {})}],
"fieldConfig": {"defaults": {"unit": unit}, "overrides": []}, "fieldConfig": {"defaults": field_defaults, "overrides": []},
"options": panel_options, "options": panel_options,
} }
if transformations: if transformations:
@ -1196,7 +1198,7 @@ def build_pods_dashboard():
panels.append( panels.append(
table_panel( table_panel(
10, 10,
"Namespace Plurality by Node v19", "Namespace Plurality by Node v20",
( (
f"{share_expr} * on(namespace,node) group_left() " f"{share_expr} * on(namespace,node) group_left() "
f"({mask_expr}) * on(namespace,node) group_left() ({nonzero_expr})" f"({mask_expr}) * on(namespace,node) group_left() ({nonzero_expr})"
@ -1210,6 +1212,7 @@ def build_pods_dashboard():
], ],
instant=True, instant=True,
options={"showColumnFilters": False}, options={"showColumnFilters": False},
filterable=False,
) )
) )

View File

@ -266,7 +266,10 @@
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -303,7 +306,10 @@
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -340,7 +346,10 @@
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -498,7 +507,7 @@
{ {
"id": 10, "id": 10,
"type": "table", "type": "table",
"title": "Namespace Plurality by Node v19", "title": "Namespace Plurality by Node v20",
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "atlas-vm" "uid": "atlas-vm"
@ -518,7 +527,10 @@
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "percent" "unit": "percent",
"custom": {
"filterable": false
}
}, },
"overrides": [] "overrides": []
}, },

View File

@ -275,7 +275,10 @@ data:
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -312,7 +315,10 @@ data:
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -349,7 +355,10 @@ data:
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "s" "unit": "s",
"custom": {
"filterable": true
}
}, },
"overrides": [] "overrides": []
}, },
@ -507,7 +516,7 @@ data:
{ {
"id": 10, "id": 10,
"type": "table", "type": "table",
"title": "Namespace Plurality by Node v19", "title": "Namespace Plurality by Node v20",
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "atlas-vm" "uid": "atlas-vm"
@ -527,7 +536,10 @@ data:
], ],
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"unit": "percent" "unit": "percent",
"custom": {
"filterable": false
}
}, },
"overrides": [] "overrides": []
}, },