Repository navigation
fix(logs): correlate V2 log records with their span context - #137
Open
pedropombeiro wants to merge 2 commits into
Open
pedropombeiro wants to merge 2 commits into
pedropombeiro wants to merge 2 commits into
Conversation
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.
Description
V2 event logs omit native trace/span IDs because event dispatch has no active OTel context. Capture the matching
LLM, tool, or execution context before cleanup and pass it explicitly to the log SDK. Logs without a matching
span stay uncorrelated, and disabled-log policies remain unchanged.
Type of change
Checklist
bun run lintpasses with no errorsbun run check:jsdoc-coveragepasses with no errorsbun run typecheckpasses with no errorsbun testpasses with no errorsRelated issues
Related: #121 and #129 address the same problem using the previous V1 handlers. This change targets the current
V2 implementation.
Additional context
Validated commit
6cafc37: 213 tests pass, including real OpenCode OTLP/JSON assertions for LLM and tool log IDs.Type-checking, linting, and JSDoc coverage pass. Regression cases cover overlapping calls, separate sessions,
failed executions, disabled signals, and missing start events.
On the QTS test host, Bun runs with a compatible userspace loader and a test-only subprocess-launch adapter.
The adapter does not change the plugin or OTLP assertions and is not included in this PR.