monitoring(climate): drop zero samples to unlock dynamic history scaling

This commit is contained in:
Brad Stein 2026-04-12 23:02:03 -03:00
parent 00fe5e8a0f
commit 41a5add906
5 changed files with 37 additions and 37 deletions

View File

@ -638,14 +638,14 @@ ANANKE_UPS_TRIGGER_BY_SOURCE = f"ananke_ups_trigger_active{{{ANANKE_SELECTOR}}}"
CLIMATE_SENSOR_COUNT = "count(typhon_temperature_celsius) or on() vector(0)"
CLIMATE_DEDUP_LABELS = "job,instance,pod,service,endpoint,namespace"
CLIMATE_TEMP_SERIES = (
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_temperature_celsius)"
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_temperature_celsius != 0)"
)
CLIMATE_TEMP_FAHRENHEIT_SERIES = f"({CLIMATE_TEMP_SERIES}) * 9 / 5 + 32"
CLIMATE_PRESSURE_SERIES = (
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_vpd_kpa)"
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_vpd_kpa != 0)"
)
CLIMATE_HUMIDITY_SERIES = (
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_relative_humidity_percent)"
f"max without ({CLIMATE_DEDUP_LABELS}) (typhon_relative_humidity_percent != 0)"
)
CLIMATE_TEMP_MAX = f"max({CLIMATE_TEMP_SERIES}) or on() vector(0)"
CLIMATE_TEMP_FAHRENHEIT_MAX = f"max({CLIMATE_TEMP_FAHRENHEIT_SERIES}) or on() vector(0)"
@ -1479,7 +1479,7 @@ def build_overview():
40,
"UPS Current Load",
UPS_CURRENT_ROW_EXPR,
{"h": 5, "w": 4, "x": 0, "y": 7},
{"h": 5, "w": 6, "x": 0, "y": 7},
unit="none",
decimals=1,
text_mode="name_and_value",
@ -1502,7 +1502,7 @@ def build_overview():
41,
"UPS History (Power Draw)",
None,
{"h": 5, "w": 8, "x": 4, "y": 7},
{"h": 5, "w": 6, "x": 6, "y": 7},
unit="watt",
targets=[
{"refId": "A", "expr": ANANKE_UPS_DRAW_WATTS_DB_SERIES, "legendFormat": ANANKE_UPS_DB_NAME},
@ -1519,7 +1519,7 @@ def build_overview():
42,
"Current Climate",
CLIMATE_CURRENT_ROW_EXPR,
{"h": 6, "w": 4, "x": 0, "y": 12},
{"h": 6, "w": 6, "x": 0, "y": 12},
unit="none",
decimals=2,
text_mode="name_and_value",
@ -1544,7 +1544,7 @@ def build_overview():
43,
"Climate History",
None,
{"h": 6, "w": 8, "x": 4, "y": 12},
{"h": 6, "w": 6, "x": 6, "y": 12},
unit="none",
targets=[
{"refId": "A", "expr": CLIMATE_TEMP_SERIES, "legendFormat": "C"},

View File

@ -1080,7 +1080,7 @@
},
"gridPos": {
"h": 5,
"w": 4,
"w": 6,
"x": 0,
"y": 7
},
@ -1182,8 +1182,8 @@
},
"gridPos": {
"h": 5,
"w": 8,
"x": 4,
"w": 6,
"x": 6,
"y": 7
},
"targets": [
@ -1236,13 +1236,13 @@
},
"gridPos": {
"h": 6,
"w": 4,
"w": 6,
"x": 0,
"y": 12
},
"targets": [
{
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"refId": "A",
"legendFormat": "{{metric}}",
"instant": true
@ -1362,24 +1362,24 @@
},
"gridPos": {
"h": 6,
"w": 8,
"x": 4,
"w": 6,
"x": 6,
"y": 12
},
"targets": [
{
"refId": "A",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)",
"legendFormat": "C"
},
{
"refId": "B",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)",
"legendFormat": "RH"
},
{
"refId": "C",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)",
"legendFormat": "P"
}
],

View File

@ -163,7 +163,7 @@
},
"targets": [
{
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"refId": "A",
"legendFormat": "{{metric}}",
"instant": true
@ -283,22 +283,22 @@
"targets": [
{
"refId": "A",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)",
"legendFormat": "Temperature (\u00b0C)"
},
{
"refId": "B",
"expr": "(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32",
"expr": "(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32",
"legendFormat": "Temperature (\u00b0F)"
},
{
"refId": "C",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)",
"legendFormat": "Humidity (%)"
},
{
"refId": "D",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)",
"legendFormat": "Pressure (VPD kPa)"
}
],

View File

@ -1089,7 +1089,7 @@ data:
},
"gridPos": {
"h": 5,
"w": 4,
"w": 6,
"x": 0,
"y": 7
},
@ -1191,8 +1191,8 @@ data:
},
"gridPos": {
"h": 5,
"w": 8,
"x": 4,
"w": 6,
"x": 6,
"y": 7
},
"targets": [
@ -1245,13 +1245,13 @@ data:
},
"gridPos": {
"h": 6,
"w": 4,
"w": 6,
"x": 0,
"y": 12
},
"targets": [
{
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"refId": "A",
"legendFormat": "{{metric}}",
"instant": true
@ -1371,24 +1371,24 @@ data:
},
"gridPos": {
"h": 6,
"w": 8,
"x": 4,
"w": 6,
"x": 6,
"y": 12
},
"targets": [
{
"refId": "A",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)",
"legendFormat": "C"
},
{
"refId": "B",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)",
"legendFormat": "RH"
},
{
"refId": "C",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)",
"legendFormat": "P"
}
],

View File

@ -172,7 +172,7 @@ data:
},
"targets": [
{
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"expr": "label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) or on() vector(0)), \"metric\", \"Temp \u00b0C\", \"__name__\", \".*\") or label_replace((max((max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32) or on() vector(0)), \"metric\", \"Temp \u00b0F\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)) or on() vector(0)), \"metric\", \"Humidity\", \"__name__\", \".*\") or label_replace((max(max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)) or on() vector(0)), \"metric\", \"Pressure\", \"__name__\", \".*\")",
"refId": "A",
"legendFormat": "{{metric}}",
"instant": true
@ -292,22 +292,22 @@ data:
"targets": [
{
"refId": "A",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)",
"legendFormat": "Temperature (\u00b0C)"
},
{
"refId": "B",
"expr": "(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius)) * 9 / 5 + 32",
"expr": "(max without (job,instance,pod,service,endpoint,namespace) (typhon_temperature_celsius != 0)) * 9 / 5 + 32",
"legendFormat": "Temperature (\u00b0F)"
},
{
"refId": "C",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_relative_humidity_percent != 0)",
"legendFormat": "Humidity (%)"
},
{
"refId": "D",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa)",
"expr": "max without (job,instance,pod,service,endpoint,namespace) (typhon_vpd_kpa != 0)",
"legendFormat": "Pressure (VPD kPa)"
}
],