Skip to content

feat(gateway): debug-level request/response logging for TITO verification#18

Open
DavidBellamy wants to merge 19 commits intomainfrom
feat/gateway-tito-debug-logging-llm360-fork
Open

feat(gateway): debug-level request/response logging for TITO verification#18
DavidBellamy wants to merge 19 commits intomainfrom
feat/gateway-tito-debug-logging-llm360-fork

Conversation

@DavidBellamy
Copy link
Copy Markdown
Collaborator

Summary

Add two debug-level log calls in `sgl-model-gateway/src/routers/http/router.rs` that dump the request body forwarded to a worker and the response body received back, gated behind the `smg::tito_debug` tracing target.

Why

Tokens-in tokens-out (TITO) mode requires the agent's `extra_body["input_ids"]` to land at the worker exactly as sent, and the worker's `completion_token_ids` to ride back unchanged. When that round-trip breaks, we want to see the actual bytes on the wire without rebuilding the gateway with extra prints.

Gating behind a custom tracing target (`smg::tito_debug`) lets operators flip TITO logs on with a single env var without enabling all of `smg`.

Activation

```
RUST_LOG=info,smg::tito_debug=debug
```

Behavior

  • Logs only fire at DEBUG level; gated by `tracing::enabled!`. Zero overhead at INFO / WARN.
  • No request/response behavior change.
  • Logs may be verbose under high QPS — operators turn them on only when investigating a TITO regression.

Future

Additional debug points (e.g. inside the chat-completion-aware path that parses the response choices) can be added under the same `smg::tito_debug` target as needed. This PR is the first installment of living TITO instrumentation.

Provenance

One of five focused PRs that supersede #3.

mickqian and others added 19 commits April 4, 2026 23:37
…alistic perf and auto-discover ut (sgl-project#22086)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
…gl-project#21649)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
…tion

Add two debug-level log calls in sgl-model-gateway/src/routers/http/router.rs
that dump the request body forwarded to a worker and the response body
received back, gated behind the smg::tito_debug tracing target.

Tokens-in tokens-out (TITO) mode requires the agent's extra_body["input_ids"]
to land at the worker exactly as sent, and the worker's completion_token_ids
to ride back unchanged. When that round-trip breaks, we want to see the actual
bytes on the wire without rebuilding the gateway with extra prints.

Activation:
  RUST_LOG=info,smg::tito_debug=debug

Logs only fire at DEBUG level; gated by tracing::enabled!. Zero overhead at
INFO/WARN. Operators turn them on only when investigating a TITO regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants