P1-02: /metrics endpoint always reports decisions_total: 0 — hardcoded, never updated #8

Closed
opened 2026-06-16 13:57:01 +00:00 by Artur · 0 comments
Owner

Severity: P1 (High)
File: decider/server.py line 193

Problem

The /metrics endpoint always returns "decisions_total": 0 because it's hardcoded and never incremented:

elif self.path == "/metrics":
    self._json(200, {
        "decisions_total": 0,  # hardcoded — never changes
        "cache_entries": len(_cache),
        "uptime_seconds": int(time.time() - _start),
    })

No counter is incremented anywhere in do_POST or in Decider.decide(). The entire metrics endpoint is decorative.

Fix

  1. Add a thread-safe counter (threading.Atomic or integer with lock) module-level
  2. Increment it after each successful decision in do_POST
  3. Add more useful metrics: decisions per mode, provider error counts, cache hit ratio
**Severity**: P1 (High) **File**: `decider/server.py` line 193 ## Problem The `/metrics` endpoint always returns `"decisions_total": 0` because it's hardcoded and never incremented: ```python elif self.path == "/metrics": self._json(200, { "decisions_total": 0, # hardcoded — never changes "cache_entries": len(_cache), "uptime_seconds": int(time.time() - _start), }) ``` No counter is incremented anywhere in `do_POST` or in `Decider.decide()`. The entire metrics endpoint is decorative. ## Fix 1. Add a thread-safe counter (`threading.Atomic` or integer with lock) module-level 2. Increment it after each successful decision in `do_POST` 3. Add more useful metrics: decisions per mode, provider error counts, cache hit ratio
Artur closed this issue 2026-06-16 13:57:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
glow-all/decider#8
No description provided.