Repository navigation
feat(telemetry): add execution traces and upstream context propagation - #349
Conversation
First step of vllm-project#339 (phase 2 of vllm-project#279): one `agentic.execute` span per request, under the phase 1 `http.server.request` span, for both the Responses and Messages APIs, streaming or not. - `executor::telemetry` holds the span guard and the closed outcome enums. `ExecutionSpan` finalizes exactly once on drop, so a dropped stream or an aborted task is recorded as `cancelled`/`disconnected` rather than lost. `FailureCategory` is derived exhaustively from the `ExecutorError` variant, never from its message, and becomes the bounded `error.type`. Execution and delivery are recorded separately: an SSE `error` frame under HTTP 200 is `failed`/`delivered`; a Messages upstream error body relayed verbatim is `failed`/`upstream_error` even though the handler never sees an `Err`. - `InstrumentedStream` enters the span on every poll, the stream equivalent of `tracing::Instrument`, so work done while streaming (later rounds, persistence) stays attributed to the request. The spawned executor task is instrumented with the same span. - The core library still depends on `tracing` only; a test guards that no SDK, exporter, or subscriber can be added to its normal dependencies. - `ExecuteRequest` moves to `engine/execute.rs` and the buffered-block types to `messages_stream/blocks.rs` to keep both parents inside the file-size policy; pure moves. Tests replay a mock upstream through the real executor into an in-memory exporter. The harness installs one global subscriber per test binary and isolates tests by trace id: `sqlx-sqlite` closes spans on its worker thread, where a scoped `with_subscriber` dispatcher is not in effect, so a scoped harness leaked parent spans. Signed-off-by: Zheng Lu <[email protected]>
Signed-off-by: Zheng Lu <[email protected]>
Signed-off-by: Zheng Lu <[email protected]>
Signed-off-by: Zheng Lu <[email protected]>
Signed-off-by: Zheng Lu <[email protected]>
Enforce shared per-span attribute contracts across executor and transport traces. Cover compaction triggers, restored state, and persistence destinations without exporting request content. Document upstream propagation, WebSocket links, proxy outcomes, and sampling boundaries. Validation: cargo fmt -- --check; cargo clippy --workspace --all-targets -- -D warnings; cargo test -p agentic-server-core; RUST_TEST_THREADS=1 cargo test -p agentic-server; uvx pre-commit run --all-files. The new compaction test fails with source changes stashed, and deliberate attribute-key and sensitive-value probes fail the scanner. Signed-off-by: Zheng Lu <[email protected]>
haoshan98
left a comment
There was a problem hiding this comment.
Thanks for supporting the telemetry tracing, lgtm!
Kindly help to resolve the merge conflict. |
Resolve the compaction overlap while preserving prompt_cache_key forwarding and bounded compaction trigger spans. Update trace test request construction for the new field and keep large integration test futures off the stack. Signed-off-by: Zheng Lu <[email protected]>
|
Conflicts resolved now. About the ci failed job: Its cargo build step failed while Rustup was repairing a partially installed Rust 1.98.0 toolchain (detected conflict: 'bin/cargo-clippy'). The same build passed in the Codex matrix job and locally, so this appears to be runner-specific. I don’t have permission to rerun this single job myself. |
Rerun succeeded, merged. |
## Summary Several user-facing docs had fallen behind `main` or contradicted each other and the code. This PR brings them in line with what has shipped. It changes documentation only. **Corrected claims** - README listed the Messages API as "🚧 Planned" while another README section documents `/v1/messages`. It is now listed as shipped; only stateful Messages stays planned. - README and `docs/index.md` advertised "Background execution" and gateway-executed file search. Neither exists yet: background mode is #357, and `file_search` declarations parse but are dropped before inference (`tool/normalize.rs`). Both claims are removed. - `docs/api/index.md` quoted fixed WebSocket and executor limits (256 KiB SSE lines, 1 MiB events and response budget). These now come from the configurable `[responses]` settings, which default to 16 MiB and 8 MiB. - `docs/api/index.md` listed only some of the conditions that route a Responses request through the executor. The list now also includes non-function tools, `multi_agent.enabled`, and tool-search state, matching `handler/http/responses.rs`. - CHANGELOG listed Tavily under 0.8.0, but it merged on Sep 28, after the Sep 19 release. The two Tavily entries move to `[Unreleased]`. **Newly documented features** - README: a multi-agent Responses section with an example and the gateway's limits (`store: true`, HTTP/SSE only, default of 3 concurrent subagents, no `max_tool_calls` or reasoning summaries). Also new rows in the API table for `/v1/responses/compact`, the full Conversations routes, `/v1/messages` with `/v1/messages/count_tokens`, and Swagger/OpenAPI (`ENABLE_OPENAPI_DOCS`). The features list, diagram, and tool ownership table now include MCP, the code interpreter, Claude Code, compaction, and OpenTelemetry. - `docs/api/index.md`: new sections for `GET /v1/responses/{response_id}`, multi-agent, Conversations, and Messages. - CHANGELOG `[Unreleased]` was empty. It now has entries for #345, #347, #349, #351/#370, #354, #368, #369, #372/#373, #380, and #387. **Roadmap** - ROADMAP.md marks multi-agent HTTP execution as shipped, with WebSocket injection (#300) and stateless requests (#393) still open. It adds a status note for Messages, a code interpreter entry, and a file search item linking #34 and #356. - README "Roadmap at a Glance" checks off Messages and Conversations and adds unchecked items for multi-agent, file search, and stateful Messages. **Smaller fixes** - The repository layout in README and AGENTS.md now lists `agentic-llm-d`, `agentic-cli-docs`, and `python/agentic_api/`. - ARCHITECTURE.md's list of multi-agent rejections now includes `max_tool_calls`, matching `executor/rehydrate.rs`. - `mkdocs.yaml` adds the existing but unlinked `design/shell-tool.md` to the nav. **Not changed:** the README's "Rust 1.85+" badge is wrong (1.85 cannot build the lockfile, see #377), but #379 already updates it to 1.88 along with `rust-version` and a CI check, so this PR leaves it alone to avoid a conflict. Signed-off-by: haoshan98 <[email protected]>
Summary
Closes #339. Implements execution-level tracing for phase 2 of #279 on top of the existing OpenTelemetry bridge.
agentic.executefor Responses and Messages with separate, bounded execution and delivery outcomes, including streaming failures, cancellation, and disconnects.http.client.requestspan in the shared inference transport; record only method, host, port, status, and bounded failure categories.response.create, includinggenerate:false, queue wait, and cancellation of queued work. Design choice: each execution is a new trace linked to the session, not its child.agentic.*namespace, enforce per-span attribute allow-lists and sensitive-value checks, and document propagation, sampling, privacy, and transport boundaries. Core depends only on the OpenTelemetry API/bridge, not SDKs or exporters. Small responsibility-preserving file splits keep the Rust file-size policy satisfied; ingestion, relay semantics, and channel bounds are unchanged.Test Plan
All required gates passed before each step commit. Final validation:
generate:false, invalid frames, active/queued disconnects, and both proxy APIs with raw JSON, declared-length/chunked/empty streams, HTTP rejection, disconnect, and body-read failures. The collector end-to-end test also checks the new proxy execution span.HANDOFF-339.md,pr_info.txt, anddocs/rfcs/are excluded from the commits.