server: a request log at the info level

docker logs answered nothing about traffic: the only lines the server
wrote on a request were the kernel recordings, and a refusal left no
trace at all, so a client reporting "rejected" could not be matched to
anything. Two lines per request now, at info: one when it is admitted
(id, endpoint, peer, model, message and tool counts, prompt tokens, n,
max_tokens) and one from record() when it ends (finish reason, prompt
tokens and what the prefix cache spared, generated and reasoning
tokens, time to first token, decode rate, wall). Every refusal logs its
status, type and message with the peer -- 4xx at info, 5xx as a
warning. The debug level adds the last user message's opening, one
bounded line, so a log line can be matched to what was typed; the
daily's info level never prints prompt text.

HttpRequest carries the peer (httplib's remote_addr:port; empty
in-process), OaiRequest carries what the parse already walked past
(message and tool counts, the last user message) and the peer.

(cherry picked from commit 067facd47e2b0c0afeefe79166e77f01c33d588f)
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-05 19:30:45 +02:00
1 parent a4845834ea
commit ee65352d7d
6 files changed
+96 -10

No files matched your search

+5 -1
View File
@@ -189,7 +189,11 @@ private:
HttpResponse handle_stats(const HttpRequest& req);
HttpResponse handle_graph(const HttpRequest& req);
HttpResponse error_response(const ApiError& e);
HttpResponse error_response(const ApiError& e, const std::string& peer = std::string());
/* THE REQUEST LOG. One line when a request is admitted and one from record() when it ends,
* at the info level, so `docker logs` answers "who asked what, how long, how did it end"
* without the engine's own levels. The debug level adds the last user message's opening. */
void log_admitted(const OaiRequest& r) const;
/* Admission. Returns false when the queue is full; the caller answers 429. */
bool admit(int64_t n);