litellm/tests/integration/observability/lens_claude_code_direct_trace.json
Kerry Lu bd1c3968f4
feat(proxy): send gateway model calls to Lens as traces when the Lens store is connected (#53042)
* Send gateway model calls to Lens as traces when the Lens store is connected

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Sort the tracing runtime imports

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Compare the old Lens probe status against HTTPStatus so the type gate holds

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Parked: drop caller IP, isolate Lens config from OTEL env, shut down exporter, delivery test

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(proxy): group gateway traces in Lens by session, name the agent and report tool calls as steps

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): keep metadata inherited from request baggage off Lens traces

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Revert "fix(proxy): keep metadata inherited from request baggage off Lens traces"

This reverts commit d23f0e628e.

* fix(proxy): send the caller IP to Lens as the OTel callback does, and satisfy the type discipline gate

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(proxy): deliver Lens traces in process instead of over a socket

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(proxy): compare the gateway Lens trace with a recorded Claude Code trace

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(proxy): check the tool results the provider receives in the Lens parity replay

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(proxy): keep one for clause per comprehension in the Lens delivery tests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(proxy): send Lens traces to its trace route from one adapter module under integrations/lens

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(lens): move the gateway's Lens package from litellm/tracing to litellm/integrations/lens

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(clickhouse): keep the cost row types with the ClickHouse cost logger

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* refactor(lens): move the gateway's Lens routes and startup from litellm/proxy to litellm/integrations/lens/proxy

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(lens): keep one for clause per comprehension in the parity test

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-20 10:12:08 -08:00

120 lines
4.1 KiB
JSON

{
"resource": {
"service.name": "claude-code",
"service.version": "2.1.329"
},
"spans": [
{
"name": "claude_code.interaction",
"attributes": {
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.operation.name": "invoke_agent",
"gen_ai.provider.name": "anthropic",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "interaction"
}
},
{
"name": "claude_code.llm_request",
"attributes": {
"cache_creation_tokens": "0",
"cache_read_tokens": "21986",
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"gen_ai.request.model": "claude-haiku-4-5",
"gen_ai.response.finish_reasons": "[\"tool_use\"]",
"gen_ai.response.id": "req_011ChDrjf5wZ4KJBrzt7aFGd",
"gen_ai.system": "anthropic",
"input_tokens": "10",
"model": "claude-haiku-4-5",
"output_tokens": "200",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "llm_request",
"stop_reason": "tool_use"
}
},
{
"name": "claude_code.tool.blocked_on_user",
"attributes": {
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool.blocked_on_user"
}
},
{
"name": "Bash",
"attributes": {
"full_command": "ls",
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.operation.name": "execute_tool",
"gen_ai.provider.name": "anthropic",
"gen_ai.tool.call.id": "toolu_01RbazrpFqHYpGFinx1ZvgtL",
"gen_ai.tool.name": "Bash",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool"
}
},
{
"name": "claude_code.tool.execution",
"attributes": {
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"gen_ai.tool.call.id": "toolu_01RbazrpFqHYpGFinx1ZvgtL",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool.execution"
}
},
{
"name": "claude_code.tool.blocked_on_user",
"attributes": {
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool.blocked_on_user"
}
},
{
"name": "Bash",
"attributes": {
"full_command": "pwd",
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.operation.name": "execute_tool",
"gen_ai.provider.name": "anthropic",
"gen_ai.tool.call.id": "toolu_012vgFEMTLWwRaLKkm165rWB",
"gen_ai.tool.name": "Bash",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool"
}
},
{
"name": "claude_code.tool.execution",
"attributes": {
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"gen_ai.tool.call.id": "toolu_012vgFEMTLWwRaLKkm165rWB",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "tool.execution"
}
},
{
"name": "claude_code.llm_request",
"attributes": {
"cache_creation_tokens": "285",
"cache_read_tokens": "21986",
"gen_ai.conversation.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"gen_ai.provider.name": "anthropic",
"gen_ai.request.model": "claude-haiku-4-5",
"gen_ai.response.finish_reasons": "[\"end_turn\"]",
"gen_ai.response.id": "req_011ChDrjozULNzDEK7gHTL3Z",
"gen_ai.system": "anthropic",
"input_tokens": "8",
"model": "claude-haiku-4-5",
"output_tokens": "83",
"session.id": "0e47a9b8-a68f-4636-8956-823c0f4e0e40",
"span.type": "llm_request",
"stop_reason": "end_turn"
}
}
]
}