fix: add expected/unexpected error metrics to agent handlers
CI / CI (pull_request) Failing after 21m56s

Expected errors (4xx): bad_request, not_found, auth_failure
Unexpected errors (5xx): DB failures, internal errors

Also fixed deprecated base64::encode/decode API (0.22)
This commit is contained in:
2026-09-15 09:11:54 +09:00
parent b36327948d
commit 40371fd99c
3 changed files with 197 additions and 35 deletions
+14
View File
@@ -381,6 +381,16 @@ pub static ERROR_UNEXPECTED_QUERY: Counter = Counter::new(
pub static ERROR_UNEXPECTED_CONTEXT: Counter = Counter::new(
"memory_error_unexpected_context_total", "Unexpected errors during context");
// Agent endpoint error counters
pub static ERROR_AUTH_FAILURE_AGENT: Counter = Counter::new(
"memory_error_auth_failure_agent_total", "Auth failures on agent endpoints");
pub static ERROR_BAD_REQUEST_AGENT: Counter = Counter::new(
"memory_error_bad_request_agent_total", "Bad request errors on agent endpoints (expected)");
pub static ERROR_NOT_FOUND_AGENT: Counter = Counter::new(
"memory_error_not_found_agent_total", "Not found errors on agent endpoints (expected)");
pub static ERROR_UNEXPECTED_AGENT: Counter = Counter::new(
"memory_error_unexpected_agent_total", "Unexpected errors on agent endpoints (DB failures, 500s)");
// Last error info (most recent error for debugging)
pub static LAST_ERROR_TIMESTAMP: Gauge = Gauge::new(
"memory_last_error_timestamp_seconds", "Unix timestamp of most recent error");
@@ -593,6 +603,10 @@ pub fn render_metrics() -> String {
counter!(ERROR_UNEXPECTED_INGEST);
counter!(ERROR_UNEXPECTED_QUERY);
counter!(ERROR_UNEXPECTED_CONTEXT);
counter!(ERROR_AUTH_FAILURE_AGENT);
counter!(ERROR_BAD_REQUEST_AGENT);
counter!(ERROR_NOT_FOUND_AGENT);
counter!(ERROR_UNEXPECTED_AGENT);
gauge!(LAST_ERROR_TIMESTAMP);
out