Decoders for OTLP/HTTP JSON traces and logs, tested against payloads captured from a real `claude -p` run rather than hand-written fixtures. Correlation is not a span_id join. Claude Code stamps every content log record with the ROOT span's id, so joining on span_id piles the entire transcript onto the root and leaves every interesting span empty -- it fails while looking like it worked. Instead this joins on typed identity keys both sides carry: tool_use_id for tool results, request_id for model responses, falling back to innermost-containing-span by timestamp for records with no key at all. Identity attributes (user.email, user.id, account and org ids) are dropped at ingest by default, before anything reaches disk, with an opt-in to retain them. Also handles base64 trace ids from SDKs that ignore the OTLP/JSON hex mapping, nanosecond timestamps beyond float64's exact integer range, and span cycles from trace id collisions.
564 lines
12 KiB
JSON
564 lines
12 KiB
JSON
{
|
|
"resourceSpans": [
|
|
{
|
|
"resource": {
|
|
"attributes": [
|
|
{
|
|
"key": "service.name",
|
|
"value": {
|
|
"stringValue": "claude-code"
|
|
}
|
|
},
|
|
{
|
|
"key": "host.arch",
|
|
"value": {
|
|
"stringValue": "arm64"
|
|
}
|
|
},
|
|
{
|
|
"key": "os.type",
|
|
"value": {
|
|
"stringValue": "darwin"
|
|
}
|
|
},
|
|
{
|
|
"key": "os.version",
|
|
"value": {
|
|
"stringValue": "25.6.0"
|
|
}
|
|
},
|
|
{
|
|
"key": "service.version",
|
|
"value": {
|
|
"stringValue": "2.1.266"
|
|
}
|
|
}
|
|
],
|
|
"droppedAttributesCount": 0
|
|
},
|
|
"scopeSpans": [
|
|
{
|
|
"scope": {
|
|
"name": "com.anthropic.claude_code.tracing",
|
|
"version": "1.0.0"
|
|
},
|
|
"spans": [
|
|
{
|
|
"traceId": "19f0b758e2c26a0f65e7050c78d30ebe",
|
|
"spanId": "6c76effa0e43d56b",
|
|
"parentSpanId": "23d8202c795dbe14",
|
|
"name": "claude_code.tool.blocked_on_user",
|
|
"kind": 1,
|
|
"startTimeUnixNano": "1789532374678000000",
|
|
"endTimeUnixNano": "1789532374686419625",
|
|
"attributes": [
|
|
{
|
|
"key": "user.id",
|
|
"value": {
|
|
"stringValue": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "session.id",
|
|
"value": {
|
|
"stringValue": "6f57a3e3-2553-4f07-bd2d-4919be9f654d"
|
|
}
|
|
},
|
|
{
|
|
"key": "organization.id",
|
|
"value": {
|
|
"stringValue": "11111111-1111-1111-1111-111111111111"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.email",
|
|
"value": {
|
|
"stringValue": "someone@example.com"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_uuid",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_id",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "terminal.type",
|
|
"value": {
|
|
"stringValue": "tmux"
|
|
}
|
|
},
|
|
{
|
|
"key": "span.type",
|
|
"value": {
|
|
"stringValue": "tool.blocked_on_user"
|
|
}
|
|
},
|
|
{
|
|
"key": "duration_ms",
|
|
"value": {
|
|
"intValue": 8
|
|
}
|
|
},
|
|
{
|
|
"key": "decision",
|
|
"value": {
|
|
"stringValue": "unknown"
|
|
}
|
|
},
|
|
{
|
|
"key": "source",
|
|
"value": {
|
|
"stringValue": "unknown"
|
|
}
|
|
}
|
|
],
|
|
"droppedAttributesCount": 0,
|
|
"events": [],
|
|
"droppedEventsCount": 0,
|
|
"status": {
|
|
"code": 0
|
|
},
|
|
"links": [],
|
|
"droppedLinksCount": 0,
|
|
"flags": 257
|
|
},
|
|
{
|
|
"traceId": "19f0b758e2c26a0f65e7050c78d30ebe",
|
|
"spanId": "9974e5aa6d8af169",
|
|
"parentSpanId": "4028c5170879c65b",
|
|
"name": "claude_code.llm_request",
|
|
"kind": 1,
|
|
"startTimeUnixNano": "1789532371445000000",
|
|
"endTimeUnixNano": "1789532374697939292",
|
|
"attributes": [
|
|
{
|
|
"key": "user.id",
|
|
"value": {
|
|
"stringValue": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "session.id",
|
|
"value": {
|
|
"stringValue": "6f57a3e3-2553-4f07-bd2d-4919be9f654d"
|
|
}
|
|
},
|
|
{
|
|
"key": "organization.id",
|
|
"value": {
|
|
"stringValue": "11111111-1111-1111-1111-111111111111"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.email",
|
|
"value": {
|
|
"stringValue": "someone@example.com"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_uuid",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_id",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "terminal.type",
|
|
"value": {
|
|
"stringValue": "tmux"
|
|
}
|
|
},
|
|
{
|
|
"key": "span.type",
|
|
"value": {
|
|
"stringValue": "llm_request"
|
|
}
|
|
},
|
|
{
|
|
"key": "model",
|
|
"value": {
|
|
"stringValue": "claude-sonnet-5"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.system",
|
|
"value": {
|
|
"stringValue": "anthropic"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.request.model",
|
|
"value": {
|
|
"stringValue": "claude-sonnet-5"
|
|
}
|
|
},
|
|
{
|
|
"key": "llm_request.context",
|
|
"value": {
|
|
"stringValue": "interaction"
|
|
}
|
|
},
|
|
{
|
|
"key": "speed",
|
|
"value": {
|
|
"stringValue": "normal"
|
|
}
|
|
},
|
|
{
|
|
"key": "duration_ms",
|
|
"value": {
|
|
"intValue": 3253
|
|
}
|
|
},
|
|
{
|
|
"key": "input_tokens",
|
|
"value": {
|
|
"intValue": 2
|
|
}
|
|
},
|
|
{
|
|
"key": "output_tokens",
|
|
"value": {
|
|
"intValue": 165
|
|
}
|
|
},
|
|
{
|
|
"key": "cache_read_tokens",
|
|
"value": {
|
|
"intValue": 32682
|
|
}
|
|
},
|
|
{
|
|
"key": "cache_creation_tokens",
|
|
"value": {
|
|
"intValue": 0
|
|
}
|
|
},
|
|
{
|
|
"key": "success",
|
|
"value": {
|
|
"boolValue": true
|
|
}
|
|
},
|
|
{
|
|
"key": "attempt",
|
|
"value": {
|
|
"intValue": 1
|
|
}
|
|
},
|
|
{
|
|
"key": "request_id",
|
|
"value": {
|
|
"stringValue": "req_011Cf6UYEtKdoH9nsMYPNQ4S"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.response.id",
|
|
"value": {
|
|
"stringValue": "req_011Cf6UYEtKdoH9nsMYPNQ4S"
|
|
}
|
|
},
|
|
{
|
|
"key": "client_request_id",
|
|
"value": {
|
|
"stringValue": "6ca8e9ad-82fe-49e0-a82f-3b1e7e9b2fce"
|
|
}
|
|
},
|
|
{
|
|
"key": "ttft_ms",
|
|
"value": {
|
|
"intValue": 1522
|
|
}
|
|
},
|
|
{
|
|
"key": "stop_reason",
|
|
"value": {
|
|
"stringValue": "tool_use"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.response.finish_reasons",
|
|
"value": {
|
|
"arrayValue": {
|
|
"values": [
|
|
{
|
|
"stringValue": "tool_use"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"droppedAttributesCount": 0,
|
|
"events": [
|
|
{
|
|
"attributes": [
|
|
{
|
|
"key": "attempt",
|
|
"value": {
|
|
"intValue": 1
|
|
}
|
|
},
|
|
{
|
|
"key": "client_request_id",
|
|
"value": {
|
|
"stringValue": "6ca8e9ad-82fe-49e0-a82f-3b1e7e9b2fce"
|
|
}
|
|
}
|
|
],
|
|
"name": "gen_ai.request.attempt",
|
|
"timeUnixNano": "1789532371447091125",
|
|
"droppedAttributesCount": 0
|
|
}
|
|
],
|
|
"droppedEventsCount": 0,
|
|
"status": {
|
|
"code": 0
|
|
},
|
|
"links": [
|
|
{
|
|
"attributes": [
|
|
{
|
|
"key": "link.type",
|
|
"value": {
|
|
"stringValue": "parent_of"
|
|
}
|
|
}
|
|
],
|
|
"spanId": "cb73534e63c953db",
|
|
"traceId": "9ef28ed710025d61145793d8d0cb32b8",
|
|
"droppedAttributesCount": 0,
|
|
"flags": 769
|
|
}
|
|
],
|
|
"droppedLinksCount": 0,
|
|
"flags": 257
|
|
},
|
|
{
|
|
"traceId": "19f0b758e2c26a0f65e7050c78d30ebe",
|
|
"spanId": "a2eff0695d0da708",
|
|
"parentSpanId": "23d8202c795dbe14",
|
|
"name": "claude_code.tool.execution",
|
|
"kind": 1,
|
|
"startTimeUnixNano": "1789532374686000000",
|
|
"endTimeUnixNano": "1789532374768769292",
|
|
"attributes": [
|
|
{
|
|
"key": "user.id",
|
|
"value": {
|
|
"stringValue": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "session.id",
|
|
"value": {
|
|
"stringValue": "6f57a3e3-2553-4f07-bd2d-4919be9f654d"
|
|
}
|
|
},
|
|
{
|
|
"key": "organization.id",
|
|
"value": {
|
|
"stringValue": "11111111-1111-1111-1111-111111111111"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.email",
|
|
"value": {
|
|
"stringValue": "someone@example.com"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_uuid",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_id",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "terminal.type",
|
|
"value": {
|
|
"stringValue": "tmux"
|
|
}
|
|
},
|
|
{
|
|
"key": "span.type",
|
|
"value": {
|
|
"stringValue": "tool.execution"
|
|
}
|
|
},
|
|
{
|
|
"key": "tool_use_id",
|
|
"value": {
|
|
"stringValue": "toolu_01TjbRivF1tGcKhTCazBkVUU"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.tool.call.id",
|
|
"value": {
|
|
"stringValue": "toolu_01TjbRivF1tGcKhTCazBkVUU"
|
|
}
|
|
},
|
|
{
|
|
"key": "duration_ms",
|
|
"value": {
|
|
"intValue": 83
|
|
}
|
|
},
|
|
{
|
|
"key": "success",
|
|
"value": {
|
|
"boolValue": true
|
|
}
|
|
}
|
|
],
|
|
"droppedAttributesCount": 0,
|
|
"events": [],
|
|
"droppedEventsCount": 0,
|
|
"status": {
|
|
"code": 0
|
|
},
|
|
"links": [],
|
|
"droppedLinksCount": 0,
|
|
"flags": 257
|
|
},
|
|
{
|
|
"traceId": "19f0b758e2c26a0f65e7050c78d30ebe",
|
|
"spanId": "23d8202c795dbe14",
|
|
"parentSpanId": "4028c5170879c65b",
|
|
"name": "claude_code.tool",
|
|
"kind": 1,
|
|
"startTimeUnixNano": "1789532374678000000",
|
|
"endTimeUnixNano": "1789532374769682709",
|
|
"attributes": [
|
|
{
|
|
"key": "user.id",
|
|
"value": {
|
|
"stringValue": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "session.id",
|
|
"value": {
|
|
"stringValue": "6f57a3e3-2553-4f07-bd2d-4919be9f654d"
|
|
}
|
|
},
|
|
{
|
|
"key": "organization.id",
|
|
"value": {
|
|
"stringValue": "11111111-1111-1111-1111-111111111111"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.email",
|
|
"value": {
|
|
"stringValue": "someone@example.com"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_uuid",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "user.account_id",
|
|
"value": {
|
|
"stringValue": "00000000-0000-0000-0000-000000000000"
|
|
}
|
|
},
|
|
{
|
|
"key": "terminal.type",
|
|
"value": {
|
|
"stringValue": "tmux"
|
|
}
|
|
},
|
|
{
|
|
"key": "span.type",
|
|
"value": {
|
|
"stringValue": "tool"
|
|
}
|
|
},
|
|
{
|
|
"key": "tool_name",
|
|
"value": {
|
|
"stringValue": "Bash"
|
|
}
|
|
},
|
|
{
|
|
"key": "full_command",
|
|
"value": {
|
|
"stringValue": "ls *.txt 2>/dev/null"
|
|
}
|
|
},
|
|
{
|
|
"key": "tool_use_id",
|
|
"value": {
|
|
"stringValue": "toolu_01TjbRivF1tGcKhTCazBkVUU"
|
|
}
|
|
},
|
|
{
|
|
"key": "gen_ai.tool.call.id",
|
|
"value": {
|
|
"stringValue": "toolu_01TjbRivF1tGcKhTCazBkVUU"
|
|
}
|
|
},
|
|
{
|
|
"key": "duration_ms",
|
|
"value": {
|
|
"intValue": 92
|
|
}
|
|
}
|
|
],
|
|
"droppedAttributesCount": 0,
|
|
"events": [
|
|
{
|
|
"attributes": [
|
|
{
|
|
"key": "bash_command",
|
|
"value": {
|
|
"stringValue": "ls *.txt 2>/dev/null"
|
|
}
|
|
},
|
|
{
|
|
"key": "output",
|
|
"value": {
|
|
"stringValue": "a.txt\nb.txt\nc.txt"
|
|
}
|
|
}
|
|
],
|
|
"name": "tool.output",
|
|
"timeUnixNano": "1789532374769645375",
|
|
"droppedAttributesCount": 0
|
|
}
|
|
],
|
|
"droppedEventsCount": 0,
|
|
"status": {
|
|
"code": 0
|
|
},
|
|
"links": [],
|
|
"droppedLinksCount": 0,
|
|
"flags": 257
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |