Files
litellm/tests/test_litellm/integrations
b98a656254 Add MCP semantic conventions to otelv2 (#29468)
* Add MCP semantic conventions to otelv2

Emit OpenTelemetry GenAI MCP tool-call spans from the v2 logger. A closed
call_mcp_tool request now produces a CLIENT span named "tools/call {tool}"
carrying mcp.method.name, gen_ai.operation.name=execute_tool, gen_ai.tool.name,
the upstream server name, and (opt-in, content-gated) tool arguments/result.

Adds the MCP and JSON-RPC attribute vocabulary to the semconv module, an
MCPToolCallSpanData payload built from StandardLoggingMCPToolCall, an
MCP_TOOL_CALL span role, and mapper support.

* Complete the MCP span-attribute vocabulary in otelv2 semconv

Add the remaining OTel GenAI MCP semconv attribute keys: gen_ai.prompt.name,
the network.* transport keys with their well-known NetworkTransport values, and
the client.* peer keys for MCP server spans. A test pins the full vocabulary so
a dropped or renamed key fails loudly.

* Populate mcp.session.id on MCP tool-call spans

Capture the mcp-session-id header (case-insensitively) at the tool-call entry
point and thread it through StandardLoggingMCPToolCall into the span, so spans
for stateful MCP sessions carry mcp.session.id. Stateless calls have no such
header and the attribute is simply absent.

* Test that stateless MCP calls omit mcp.session.id

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-02 11:45:36 -07:00
..
2026-05-26 11:57:39 -07:00
2026-06-01 21:42:51 -07:00
2026-05-01 15:34:11 -07:00