OpenTelemetry

Status: beta. Tracemason accepts OTLP over HTTP with JSON encoding.

Signal Endpoint Status
Logs POST /api/otlp/v1/logs Ingested and normalized
Metrics POST /api/otlp/v1/metrics Acknowledged, not stored
Traces POST /api/otlp/v1/traces Acknowledged, not stored

Metrics and traces return an OTLP partialSuccess response saying they were not persisted, rather than pretending they were. Protobuf and gRPC are not supported; requests with another content type get 415.

Authenticate with an ingestion key: Authorization: Bearer tm_ing_….

Claude Code

Claude Code can export its own telemetry. The collector sets this up for you:

npx @tracemason/cli init --with-otel

That writes the following to ~/.claude/settings.json (Claude Code ignores OTEL exporter variables in project-level settings):

CLAUDE_CODE_ENABLE_TELEMETRY=1
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://app.tracemason.com/api/otlp/v1/logs
OTEL_EXPORTER_OTLP_LOGS_HEADERS=Authorization=Bearer <ingestion key>

Only the logs signal is configured, since that is what Tracemason stores.

What is read from Claude Code's log events

Claude Code event Becomes Fields read
claude_code.tool_result tool.completed / tool.failed tool_name, tool_use_id, success, duration_ms, error_type, decision type and source, input/result sizes
claude_code.api_request usage.reported model, token counts, cost_usd, duration_ms
claude_code.api_error error.reported error_type, status_code
claude_code.tool_decision custom tool.decision tool_name, decision, source
claude_code.user_prompt custom prompt.submitted prompt_length only
anything else custom otel.<name> event name only

Content attributes — prompt text, tool parameters, response bodies — are ignored even if Claude Code was configured to include them.

Records are attributed by their session.id attribute; a record without one is rejected and counted in partialSuccess.

Cost and tokens

Token counts and cost shown on a trace come from api_request events and are labelled reported by source. Tracemason does not estimate cost.

Hooks and telemetry together

Hooks and telemetry both describe tool calls. Hook events carry file paths, command classification and Git context; telemetry carries token usage. They share the session id, so both appear in the same trace. A tool call may therefore appear once from each source, distinguishable by the event's source.

Other agents

Any OTLP/HTTP JSON log exporter works. Set a service.name resource attribute (used as the agent name) and a session.id attribute on each record.