Skip to content

OTel nest parents, dims, and attribution docs - #41

Open
susheem-k wants to merge 2 commits into
mainfrom
feat/trace-attribution-dims
Open

OTel nest parents, dims, and attribution docs#41
susheem-k wants to merge 2 commits into
mainfrom
feat/trace-attribution-dims

Conversation

@susheem-k

@susheem-k susheem-k commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • OTel-style nest parents: open a Context span before the boundary body so nested LLM/tool nodes set parent_envelope_id correctly (not last-finished).
  • Flat dims: dict[str, str] on envelopes; pass trace-level dims via chronicle.record(..., dims={...}) for session/message correlation (dashboard owns lookup).
  • Docs: boundaries on decision nodes (not full agent), dims, multi-turn session_id/message_id in README + onboarding.
  • Fixture + tests for a parent calling the same sub-agent twice (each with nested llm + tool). Tree/waterfall kept as debug helpers; shared product viz stays with the control plane / TokenOps (see RFC: Chronicle depends on shared control plane; TokenOps stays above Chronicle #30).

Sample nesting (ASCII waterfall)

Same sub-agent twice under one parent; each researcher has its own llm + tool envelopes (fixtures/traces/parent-calls-subagent-twice):

Trace: trace-parent-calls-subagent-twice
  total: 164.5ms   [0ms ──► 164.5ms]
  resource/dims: message_id=msg_042 session_id=sess_subagent_x2 ...

orchestrator#1   ███████████████████████████████████████████████████████    164.5ms  custom
  researcher#1   █████████████████████████                                   74.8ms  custom
    llm#1         ██████████████                                             42.3ms  llm
    web_search#1                ██████████                                   31.7ms  tool
  researcher#2                                  ████████████████████████     72.3ms  custom
    llm#2                                       █████████████                40.5ms  llm
    web_search#2                                              ██████████     30.9ms  tool

Tree form of the same run:

└─ orchestrator#1 (custom)
   ├─ researcher#1 (custom)
   │  ├─ llm#1 (llm)
   │  └─ web_search#1 (tool)
   └─ researcher#2 (custom)
      ├─ llm#2 (llm)
      └─ web_search#2 (tool)

Decision-nodes-only pattern (no full-agent wrap; sequential siblings):

├─ planner#1 (llm)       parent=—
├─ web_search#1 (tool)   parent=—
└─ summarizer#1 (llm)    parent=—

Relation to #40

Partial fix only — does not fully close #40.

Done here Still open for #40 / follow-ups
Nest parents (parent_span_id from Context stack) Shared product visualization layer (with TokenOps / control plane)
Trace/envelope dims + record(..., dims=) Dashboard/control-plane lookup by session_id / message_id
Docs: nodes, dims, multi-turn attribution Production feedback → MessageID → TraceID end-to-end
Debug ASCII tree/waterfall SQL indexes (explicitly deferred)

Refs #40

Test plan

  • pytest tests/test_nest_attribution.py tests/test_execution_graph.py tests/test_otel.py
  • Full pytest on CI
  • Skim README Quick start + onboarding Step 2/3 for clarity

susheem-k and others added 2 commits August 10, 2026 21:56
Boundaries open a Context stack span before the body so nested LLM/tool
nodes parent correctly; trace-level dims flow via record() for dashboard
correlation. Document nodes-not-full-agent and multi-turn session/message
ids; keep tree/waterfall as debug helpers (#40).

Co-authored-by: Cursor <cursoragent@cursor.com>
Full Phoenix registers a pytest plugin that crashes collection on Python 3.11.
Split an [otel] extra for SDK/OpenInference; [dev] uses that. [phoenix] still
installs the collector/UI on top for users who want it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Trace attribution & lookup — dimensions, Session/Message mapping, nested parent stitching

1 participant