Repository navigation
feat: OTel GenAI trace chain (P1.3) - #247
Merged
Merged
Conversation
Minimal OTel/JSON exporter with zero new dependencies: turn span (QueryEngine), tool span (runToolUse), LLM span (streamViaSeam seam chokepoint + createMessage with token usage), budget funnel span (checkBudget). GenAI semconv attributes; child spans inherit fusion.turn.id from the active turn. Default-off via FUSION_CODE_OTEL_ENDPOINT (localhost-only, no default remote endpoint); flush per span end so headless runs that process.exit don't lose the batch; export failures fail-open. Off = byte-identical. Verified end-to-end: one headless run against a mock Anthropic endpoint emits fusion.turn + gen_ai.tool + gen_ai.llm (input/output token attrs) + fusion.budget.check all sharing one fusion.turn.id. Co-Authored-By: Claude Code <[email protected]>
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
Evolution plan P1.3 (docs/evolution-plan-2026-11.md, C9): OTel GenAI trace chain — the missing observability link.
src/utils/telemetry/otelTracing.ts) — no exporter dependency, single-binary distribution intact.fusion.turn(QueryEngine turn boundary),gen_ai.tool(tool execution),gen_ai.llm(streaming via thestreamViaSeamchokepoint + non-streamingcreateMessagewith token usage),fusion.budget.check(budget funnel).gen_ai.request.model,gen_ai.usage.input_tokens/output_tokens,gen_ai.tool.name; child spans inheritfusion.turn.id.FUSION_CODE_OTEL_ENDPOINT, localhost-only, no default remote endpoint — no-telemetry-egress defense line intact); flush per span end (headlessprocess.exitoutruns timers); export failures fail-open. Off = byte-identical.Test plan
bun run typecheckcleanbun run checkgreen (lint / layers / flags / build)bun test src/__tests__/1265 pass (incl. 8 new otelTracing tests)bun test ./tests/347 passfusion.turn+gen_ai.tool+gen_ai.llm(42/7 token attrs) +fusion.budget.checkall sharing onefusion.turn.idCloses evolution plan item P1.3 (Phase 1 exit: v0.6.0 after merge).
🤖 Generated with Claude Code