atlas overview: fix availability scaling

This commit is contained in:
Brad Stein 2025-12-12 16:36:47 -03:00
parent 87fbba0d3e
commit 0a0966db78
3 changed files with 14 additions and 17 deletions

View File

@ -214,7 +214,7 @@ UPTIME_AVAIL_EXPR = (
f"min(({CONTROL_READY_FRACTION_EXPR}), ({TRAEFIK_READY_EXPR}))" f"min(({CONTROL_READY_FRACTION_EXPR}), ({TRAEFIK_READY_EXPR}))"
) )
UPTIME_AVG_EXPR = f"avg_over_time(({UPTIME_AVAIL_EXPR})[{UPTIME_WINDOW}:5m])" UPTIME_AVG_EXPR = f"avg_over_time(({UPTIME_AVAIL_EXPR})[{UPTIME_WINDOW}:5m])"
UPTIME_PERCENT_EXPR = f"({UPTIME_AVG_EXPR}) * 100" UPTIME_PERCENT_EXPR = UPTIME_AVG_EXPR
UPTIME_NINES_EXPR = f"-log10(1 - clamp_max({UPTIME_AVG_EXPR}, 0.999999999))" UPTIME_NINES_EXPR = f"-log10(1 - clamp_max({UPTIME_AVG_EXPR}, 0.999999999))"
UPTIME_THRESHOLDS = { UPTIME_THRESHOLDS = {
"mode": "absolute", "mode": "absolute",
@ -229,9 +229,9 @@ UPTIME_PERCENT_THRESHOLDS = {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{"color": "red", "value": None}, {"color": "red", "value": None},
{"color": "orange", "value": 99}, {"color": "orange", "value": 0.99},
{"color": "yellow", "value": 99.9}, {"color": "yellow", "value": 0.999},
{"color": "green", "value": 99.99}, {"color": "green", "value": 0.9999},
], ],
} }
PROBLEM_TABLE_EXPR = ( PROBLEM_TABLE_EXPR = (
@ -641,7 +641,6 @@ def build_overview():
"expr": UPTIME_PERCENT_EXPR, "expr": UPTIME_PERCENT_EXPR,
"kind": "stat", "kind": "stat",
"thresholds": UPTIME_PERCENT_THRESHOLDS, "thresholds": UPTIME_PERCENT_THRESHOLDS,
"value_suffix": "%",
"unit": "percentunit", "unit": "percentunit",
"decimals": 3, "decimals": 3,
"text_mode": "value", "text_mode": "value",

View File

@ -226,7 +226,7 @@
}, },
"targets": [ "targets": [
{ {
"expr": "(avg_over_time((min(((sum(kube_node_status_condition{condition=\"Ready\",status=\"true\",node=~\"titan-0a|titan-0b|titan-0c\"}) / 3)), ((sum(kube_deployment_status_replicas_available{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}) / clamp_min(sum(kube_deployment_spec_replicas{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}), 1)))))[30d:5m])) * 100", "expr": "avg_over_time((min(((sum(kube_node_status_condition{condition=\"Ready\",status=\"true\",node=~\"titan-0a|titan-0b|titan-0c\"}) / 3)), ((sum(kube_deployment_status_replicas_available{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}) / clamp_min(sum(kube_deployment_spec_replicas{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}), 1)))))[30d:5m])",
"refId": "A" "refId": "A"
} }
], ],
@ -245,22 +245,21 @@
}, },
{ {
"color": "orange", "color": "orange",
"value": 99 "value": 0.99
}, },
{ {
"color": "yellow", "color": "yellow",
"value": 99.9 "value": 0.999
}, },
{ {
"color": "green", "color": "green",
"value": 99.99 "value": 0.9999
} }
] ]
}, },
"unit": "percentunit", "unit": "percentunit",
"custom": { "custom": {
"displayMode": "auto", "displayMode": "auto"
"valueSuffix": "%"
}, },
"decimals": 3 "decimals": 3
}, },

View File

@ -235,7 +235,7 @@ data:
}, },
"targets": [ "targets": [
{ {
"expr": "(avg_over_time((min(((sum(kube_node_status_condition{condition=\"Ready\",status=\"true\",node=~\"titan-0a|titan-0b|titan-0c\"}) / 3)), ((sum(kube_deployment_status_replicas_available{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}) / clamp_min(sum(kube_deployment_spec_replicas{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}), 1)))))[30d:5m])) * 100", "expr": "avg_over_time((min(((sum(kube_node_status_condition{condition=\"Ready\",status=\"true\",node=~\"titan-0a|titan-0b|titan-0c\"}) / 3)), ((sum(kube_deployment_status_replicas_available{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}) / clamp_min(sum(kube_deployment_spec_replicas{namespace=~\"traefik|kube-system\",deployment=\"traefik\"}), 1)))))[30d:5m])",
"refId": "A" "refId": "A"
} }
], ],
@ -254,22 +254,21 @@ data:
}, },
{ {
"color": "orange", "color": "orange",
"value": 99 "value": 0.99
}, },
{ {
"color": "yellow", "color": "yellow",
"value": 99.9 "value": 0.999
}, },
{ {
"color": "green", "color": "green",
"value": 99.99 "value": 0.9999
} }
] ]
}, },
"unit": "percentunit", "unit": "percentunit",
"custom": { "custom": {
"displayMode": "auto", "displayMode": "auto"
"valueSuffix": "%"
}, },
"decimals": 3 "decimals": 3
}, },