The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(monitoring): register the cron store gauges so OTLP exports them
kshitijk4poor7d8ce0d89833
diff --git a/agent/monitoring/gateway_health_export.py b/agent/monitoring/gateway_health_export.pyindex e5f9451833a..4beda037fc0 100644--- a/agent/monitoring/gateway_health_export.py+++ b/agent/monitoring/gateway_health_export.py@@ -50,7 +50,7 @@ _OBSERVABLE_METRIC_NAMES = ("hermes.gateway.background_delegations", "hermes.platform.up", "hermes.platform.degraded","hermes.cron.scheduler.heartbeat_age_seconds", "hermes.cron.scheduler.last_success_age_seconds","hermes.cron.scheduler.catch_up_occurrences", "hermes.cron.jobs.enabled", "hermes.cron.jobs.running",- "hermes.cron.jobs.overdue",+ "hermes.cron.jobs.overdue", "hermes.cron.store.writable", "hermes.cron.store.skipped_runs",)diff --git a/tests/monitoring/test_cron_health_export.py b/tests/monitoring/test_cron_health_export.pyindex 33e2159333e..1442513e5ad 100644--- a/tests/monitoring/test_cron_health_export.py+++ b/tests/monitoring/test_cron_health_export.py@@ -34,6 +34,27 @@ def test_execution_projection_is_opaque_bounded_and_content_free():assert "[email protected]" not in str(event)assert "top-secret-token" not in str(event)+def test_cron_store_writability_is_exported_and_registered(monkeypatch):+ """A degraded store exports writable=0 with its skipped runs, a cleared one writable=1, and+ both gauges are registered for OTLP (an unregistered gauge is silently dropped)."""+ import errno+ from agent.monitoring import gateway_health_export+ from agent.monitoring.cron_health import build_cron_health_snapshot+ from cron import store_health+ from cron.jobs import _current_cron_store++ monkeypatch.setattr(store_health, "_degraded", {})+ monkeypatch.setattr(store_health, "_listener", None)+ store_health.note_unwritable(_current_cron_store().cron_dir, OSError(errno.ENOSPC, "full"), "x", "advance",+ [{"id": "job", "next_run_at": "2026-06-22T12:00:00+00:00"}])+ degraded = build_cron_health_snapshot()+ assert (_metric(degraded, "hermes.cron.store.writable").value,+ _metric(degraded, "hermes.cron.store.skipped_runs").value) == (0, 1)+ store_health._degraded.clear()+ assert _metric(build_cron_health_snapshot(), "hermes.cron.store.writable").value == 1+ assert {"hermes.cron.store.writable", "hermes.cron.store.skipped_runs"} <= set(+ gateway_health_export._OBSERVABLE_METRIC_NAMES)+@pytest.mark.parametrize("message", ["oauth refresh failed", "tokenizer crashed", "HTTP 4015"])def test_error_classification_avoids_auth_substring_false_positives(message):from agent.monitoring.cron_health import classify_cron_error