Tracing: library spans (Anthropic, fastmcp) appear as separate root traces, and tool spans are misplaced
With tracing on (Phoenix, OTel or LangSmith), one agent run shows up as many traces instead of one, and some spans inside the 10xGraph trace are wrong. This issue covers all of the tracing problems found in one test session.
Test setup: a ReactAgent with MCP tools (fastmcp 4.1.8 client), Phoenix tracing, 10xgraph 1.0.0rc6. Seen with both the Anthropic provider (anthropic 1.17.0) and the Google GenAI provider.
Two short sessions (two greetings and one scan that used 22 tool calls) produced 34 traces and 105 spans. Only 3 of those traces are 10xGraph's own.
1. Third-party library spans appear as separate root traces
| Root span | Count | Created by |
|---|---|---|
tenxgraph.graph (graph, node, llm, tool) |
3 | 10xGraph (expected) |
anthropic.messages.create |
9, one per model call | anthropic SDK's built-in tracing (on by default in newer versions) |
tools/call <tool> with a child MCP send tools/call <tool> |
22, one per tool call | fastmcp's built-in tracing |
tools/list, MCP send initialize, MCP send server/discover |
per MCP session | fastmcp's built-in tracing |
The fastmcp spans appear with every provider, which is why Google shows the same problem.
Cause: the 10xGraph tracing exporters register a global tracer provider (trace.set_tracer_provider), and any library that traces on its own picks it up. 10xGraph builds its spans from graph events and never makes them the active OTel context while it calls the model or a tool. Each library span therefore starts a new trace. These spans do not go through 10xGraph's publisher, so filtering events in publish_event does not remove them.
10xGraph already records every model call and tool call (tenxgraph.llm, tenxgraph.tool), so the library spans are duplicates. They double the stored spans and count the cost and latency of each call twice.
Workaround: for Anthropic, set ANTHROPIC_OPEN_TELEMETRY=false. For fastmcp, set fastmcp's telemetry_mode to propagation_only or off.
2. Tool spans are not nested under the tool node
All tenxgraph.tool spans are children of tenxgraph.graph, next to the tenxgraph.node span of the TOOL node instead of inside it.
_on_tool_start in runtime/publisher/otel_publisher.py looks for a parent under the key llm:<node_name>. For a tool event node_name is the tool node (TOOL), so llm:TOOL is never found, the node lookup also misses, and the span falls back to the graph span.
Expected: graph > node TOOL > tool <name>.
3. LLM spans lose model, span kind and session in long conversations
In the 22-tool scan, the last two tenxgraph.llm spans have no llm.model_name, no openinference.span.kind, no session.id and no user.id.
Each input message is flattened into several llm.input_messages.N.* attributes. A long history passes OpenTelemetry's default limit of 128 attributes per span (OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT), and the SDK evicts the oldest attributes, which are the ones set first: model, kind, session and user. In Phoenix those calls lose their model and session, and cost cannot be computed.
4. Empty __start__ node span
Every trace has a tenxgraph.node span for __start__ with 0 ms duration and no content. It adds a row to every trace without information.
Expected
One trace per run:
tenxgraph.graph
tenxgraph.node MAIN
tenxgraph.llm
tenxgraph.node TOOL
tenxgraph.tool browser_navigate
tenxgraph.tool browser_links
...
with model, kind, session and user on every LLM span, and no anthropic.*, tools/* or MCP send * root traces.
Proposed fix
- Turn off the library spans only for the calls 10xGraph makes:
- Anthropic: create the Anthropic, Vertex and Bedrock clients with
open_telemetry={"traces": {"enabled": False}}, only when the installed SDK accepts the option, and keep a developer's ownopen_telemetryfromllm_kwargs. - fastmcp: run the tool node's MCP calls (list tools, call tool) inside
fastmcp.telemetry.suppress_fastmcp_telemetry(). This skips only fastmcp's spans for those calls and leaves the developer's global fastmcp setting alone.
- Anthropic: create the Anthropic, Vertex and Bedrock clients with
- Parent tool spans to the
TOOLnode span. - Set the identifying attributes (kind, model, provider, session, user) so they survive the limit, and cap how many messages are flattened into
llm.input_messages.*so a span stays under the attribute limit. - Drop the
__start__node span.