Skip to content

Commit 5ff8daf

Browse files
LloydLloyd
authored andcommitted
feat(nginx): emit JSON access logs with request_id, org_id, workspace_id
Add a json_combined log_format to all CVM nginx configs so every inference request is logged with the fields needed to join cloud-api spans in Datadog: request_id – X-Request-Id header (set by cloud-api, part of e2e tracing) org_id – X-Org-Id header (set by cloud-api PR #624) workspace_id – X-Workspace-Id header (set by cloud-api PR #624) host – SNI hostname (identifies the model/CVM) method/uri – request path status – HTTP response code request_length / bytes_sent / request_time – cost/volume metrics upstream_addr – which inference-proxy instance handled the request Datadog Agent already collects CVM logs with source:nginx; JSON escape=json means fields are auto-parsed as @request_id, @org_id etc in Log Analytics without any additional pipeline configuration. Three files updated: - GLM-5.1.yaml (per-server access_log directives, :80 + :443) - Qwen3.5-122B.yaml (http-context access_log, flat config style) - small-models.yaml (http-context access_log, flat config style) Part of org-id e2e tracing plan (cloud-api#625). Depends on: cloud-api#624 (MERGED), inference-proxy#130 (MERGED)
1 parent 016aac9 commit 5ff8daf

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

GLM-5.1.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,25 @@ configs:
269269
done
270270
nginx_conf:
271271
content: |
272+
log_format json_combined escape=json
273+
'{' '"time":"$$time_iso8601"'
274+
',"request_id":"$$http_x_request_id"'
275+
',"org_id":"$$http_x_org_id"'
276+
',"workspace_id":"$$http_x_workspace_id"'
277+
',"host":"$$host"'
278+
',"method":"$$request_method"'
279+
',"uri":"$$uri"'
280+
',"status":$$status'
281+
',"request_length":$$request_length'
282+
',"bytes_sent":$$bytes_sent'
283+
',"request_time":$$request_time'
284+
',"upstream_addr":"$$upstream_addr"'
285+
'}';
286+
272287
server {
273288
listen 80 default_server;
274289
290+
access_log /var/log/nginx/access.log json_combined;
275291
client_max_body_size 100m;
276292
client_body_buffer_size 1m;
277293
@@ -306,6 +322,7 @@ configs:
306322
keepalive_timeout 1h;
307323
keepalive_requests 1000000;
308324
325+
access_log /var/log/nginx/access.log json_combined;
309326
client_max_body_size 100m;
310327
client_body_buffer_size 1m;
311328

Qwen3.5-122B.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,23 @@ configs:
301301
done
302302
nginx_conf:
303303
content: |
304+
log_format json_combined escape=json
305+
'{' '"time":"$$time_iso8601"'
306+
',"request_id":"$$http_x_request_id"'
307+
',"org_id":"$$http_x_org_id"'
308+
',"workspace_id":"$$http_x_workspace_id"'
309+
',"host":"$$host"'
310+
',"method":"$$request_method"'
311+
',"uri":"$$uri"'
312+
',"status":$$status'
313+
',"request_length":$$request_length'
314+
',"bytes_sent":$$bytes_sent'
315+
',"request_time":$$request_time'
316+
',"upstream_addr":"$$upstream_addr"'
317+
'}';
318+
319+
access_log /var/log/nginx/access.log json_combined;
320+
304321
proxy_http_version 1.1;
305322
proxy_set_header Host $$host;
306323
proxy_set_header X-Real-IP $$remote_addr;

small-models.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,23 @@ configs:
910910
done
911911
nginx_conf:
912912
content: |
913+
log_format json_combined escape=json
914+
'{' '"time":"$$time_iso8601"'
915+
',"request_id":"$$http_x_request_id"'
916+
',"org_id":"$$http_x_org_id"'
917+
',"workspace_id":"$$http_x_workspace_id"'
918+
',"host":"$$host"'
919+
',"method":"$$request_method"'
920+
',"uri":"$$uri"'
921+
',"status":$$status'
922+
',"request_length":$$request_length'
923+
',"bytes_sent":$$bytes_sent'
924+
',"request_time":$$request_time'
925+
',"upstream_addr":"$$upstream_addr"'
926+
'}';
927+
928+
access_log /var/log/nginx/access.log json_combined;
929+
913930
# Common proxy settings
914931
proxy_http_version 1.1;
915932
proxy_set_header Host $$host;

0 commit comments

Comments
 (0)