Repository navigation
feat: honor Laminar parent span context - #8
Merged
Merged
Conversation
dinmukhamedm
approved these changes
Jul 14, 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.
Summary
read LMNR_PARENT_SPAN_CONTEXT and use it as the remote parent for Claude Code turn root spans\n- preserve standalone trace behavior when the env var is absent or invalid\n- add OTLP coverage for parented roots\n- document the env var and rebuild dist/hook.cjs\n\n## Testing\n- npm run build\n- npm test\n- npm run typecheck\n\nNote: I attempted an end-to-end Laminar SQL verification with a temporary script, but deleted the script per request before commit. The attempted query used the Codex test project id and returned no rows, likely because the Claude Code plugin config's API key belongs to a different Laminar project.
Note
Low Risk
Observability-only parent-context wiring with validation and unchanged export/auth paths; invalid env values preserve prior standalone-trace behavior.
Overview
Adds optional trace linking so Claude Code sessions can appear under an existing Laminar trace when a caller sets
LMNR_SPAN_CONTEXT(serialized span context fromLaminar.serialize_span_context()or the SDK).TraceEmitterreads and validates that JSON at construction (supportstraceId/trace_id,spanId/span_id, optionaltraceFlags), normalizes hex IDs, and uses the result as the remote parent for turn root spans when no explicit parent is passed. Invalid or missing values are ignored with debug logging and standalone traces behave as before. Child spans (e.g. LLM) still parent under the turn root.Docs (README, CLAUDE.md) describe the env var;
dist/hook.cjsis rebuilt. An OTLP test asserts parent trace/span IDs on roots and on the wire payload.Reviewed by Cursor Bugbot for commit 2d45c51. Bugbot is set up for automated code reviews on this repo. Configure here.