MLX proxy: don't count health checks as requests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
This commit is contained in:
parent
9ccd5ffd70
commit
d2ab08a5f5
1 changed files with 8 additions and 5 deletions
|
|
@ -102,6 +102,8 @@ def make_handler(inner_port, served_name, context, key, stats):
|
||||||
self._forward("POST", raw)
|
self._forward("POST", raw)
|
||||||
|
|
||||||
def _forward(self, method, raw):
|
def _forward(self, method, raw):
|
||||||
|
counted = self.path.startswith("/v1/") # health checks aren't requests
|
||||||
|
if counted:
|
||||||
with stats.lock:
|
with stats.lock:
|
||||||
stats.running += 1
|
stats.running += 1
|
||||||
stats.requests_total += 1
|
stats.requests_total += 1
|
||||||
|
|
@ -150,6 +152,7 @@ def make_handler(inner_port, served_name, context, key, stats):
|
||||||
except (BrokenPipeError, ConnectionResetError):
|
except (BrokenPipeError, ConnectionResetError):
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
if counted:
|
||||||
with stats.lock:
|
with stats.lock:
|
||||||
stats.running -= 1
|
stats.running -= 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue