Repository navigation
feat: correlate telemetry spans with the conversation - #2641
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 30fda80 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Set the root span's conversation ID from the assigned job room, since this span starts before the job context is active. Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
chenghao-mou
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports livekit/agents#7533.
Summary
gen_ai.conversation.idwhen the LiveKit tracer starts any spanTesting
npx -y node@22 /usr/local/lib/node_modules/pnpm/bin/pnpm.cjs test agents(3,097 passed, 5 skipped)pnpm buildpnpm lintpnpm format:checkpnpm --filter @livekit/agents api:checkSource diff coverage
livekit-agents/livekit/agents/telemetry/gen_ai.py: adapted toagents/src/telemetry/gen_ai.ts; removed conversation-ID writes from the four GenAI attribute setters so later setter calls cannot overwrite an explicit or span-start value.livekit-agents/livekit/agents/telemetry/traces.py: adapted toagents/src/telemetry/traces.tsandagents/src/telemetry/utils.ts; injects the current room SID through every JS dynamic-tracer span API, covers the target-only synchronous active-span API, preserves caller-supplied IDs and immutable attributes, and routes the one raw internal tracer call through the wrapper.tests/test_telemetry_conversation_id.py: ported toagents/src/telemetry/conversation_id.test.ts; retains the source matrix for absent/current/explicit IDs, caller-attribute immutability, all target tracer APIs, and repeated GenAI setter calls.tests/test_telemetry_gen_ai.py: not applicable as a deletion;agents/src/telemetry/gen_ai.test.tsdoes not contain the source tool-only conversation-ID test that the source PR removes. The new cross-setter test supersedes that behavior.tests/test_telemetry_metadata.py: adapted intoagents/src/telemetry/conversation_id.test.ts; JS has a different job-metadata processor lifecycle, so the changed assertion is tested directly by verifying the room SID inside job context and omission outside it.Ported from livekit/agents#7533
Original PR description
Spans from speech processing and tools need the same conversation ID for session grouping. Attach the room SID through the LiveKit tracer, preserve explicit IDs, and omit the field outside a job.
Adapts @SanjuMLGeek’s proposal in #7396 and handles positional attributes without mutating caller mappings.
Stacked on livekit/agents#7532.
Addresses AGT-3603
Request summary and agent context
Model: GPT-6-Astra
Split the proposed telemetry improvements into focused PRs that are easy to review and revert. Use general problem summaries and omit customer details.