feat: add request logging to AI proxy routes
- Log session ID, model, pool size, and active session count on every POST /v1/chat/completions and POST /v1/messages Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -490,6 +490,7 @@ const server: Server<WSRelayData> = Bun.serve<WSRelayData>({
|
|||||||
try {
|
try {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
const sessionId = crypto.randomUUID();
|
const sessionId = crypto.randomUUID();
|
||||||
|
console.log(`[index] POST /v1/chat/completions session=${sessionId.slice(0, 8)} model=${(body as any).model} poolSize=${proxyPool.size} sessionPool.active=${sessionPool.activeSessions}`);
|
||||||
return handleChatCompletion(body, proxyPool, sessionPool, sessionId);
|
return handleChatCompletion(body, proxyPool, sessionPool, sessionId);
|
||||||
} catch {
|
} catch {
|
||||||
return new Response(
|
return new Response(
|
||||||
@@ -512,6 +513,7 @@ const server: Server<WSRelayData> = Bun.serve<WSRelayData>({
|
|||||||
try {
|
try {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
const sessionId = crypto.randomUUID();
|
const sessionId = crypto.randomUUID();
|
||||||
|
console.log(`[index] POST /v1/messages session=${sessionId.slice(0, 8)} model=${(body as any).model} poolSize=${proxyPool.size} sessionPool.active=${sessionPool.activeSessions}`);
|
||||||
return handleAnthropicMessages(body, proxyPool, sessionPool, sessionId);
|
return handleAnthropicMessages(body, proxyPool, sessionPool, sessionId);
|
||||||
} catch {
|
} catch {
|
||||||
return new Response(
|
return new Response(
|
||||||
|
|||||||
Reference in New Issue
Block a user