← back to docs

quickstart

Drop a managed-settings.json into ~/.claude/, restart claude, watch data flow.

1. drop the managed settings file

Place this file at ~/.claude/managed-settings.json on each developer machine. Claude Code reads it on startup and auto-configures the OTLP exporter.

{
  "_doc": "Drop this in ~/.claude/managed-settings.json on each developer machine to send Claude Code telemetry to metric-ai. Restart claude after placing.",
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_TRACES_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otlp.metric-ai.nativekloud.com",
    "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer <YOUR_INGEST_TOKEN_HERE>",
    "OTEL_METRIC_EXPORT_INTERVAL": "30000",
    "OTEL_LOGS_EXPORT_INTERVAL": "5000",
    "OTEL_TRACES_EXPORT_INTERVAL": "5000",
    "OTEL_RESOURCE_ATTRIBUTES": "team=core,deployment.environment=dev"
  }
}

Replace <YOUR_INGEST_TOKEN_HERE> with the bearer token issued for your org. Edit OTEL_RESOURCE_ATTRIBUTES (team=, deployment.environment=) to taste.

2. one-liner install

mkdir -p ~/.claude
curl -L -o ~/.claude/managed-settings.json \
  https://your-bootstrap-url/managed-settings.json

3. restart claude

Quit and re-open Claude Code. The CLI reads managed-settings.json only on startup; running sessions keep the old config.

4. watch data flow

Within 30 seconds of any activity, thin spans land in D1. Within 15 minutes, the cron rolls daily aggregates and your dashboard at app.metric-ai.nativekloud.com lights up.

# tail your most recent activity
curl -H "Authorization: Bearer <YOUR_TOKEN>" \
  https://app.metric-ai.nativekloud.com/api/me

what this captures

  • every claude_code.interaction (one per user prompt)
  • every claude_code.llm_request (model, tokens, cache hit, cost)
  • every claude_code.tool execution (Bash / Read / Edit / etc.)
  • every approval prompt (tool.blocked_on_user)
  • every hook fire
  • the prompt.id resource attribute correlates an entire user turn across CLI, Agent SDK, and Cowork

notes

  • We support OTLP/JSON over HTTP today. Protobuf is in flight; until then keep OTEL_EXPORTER_OTLP_PROTOCOL=http/json.
  • The shared bootstrap token is org-scoped. Per-user tokens are landing in phase 3 — until then, treat the file as a secret.
  • Agent SDK inherits the CLI config automatically (TRACEPARENT propagates to subprocesses).