Skip to content

Observability for Claude Code & Anthropic Agents

Gain complete visibility into your Claude Code sessions and Anthropic-powered agentic workflows. Anosys offers two integration methods — a rich SDK hook (recommended) and a lightweight OTEL-only configuration — so you can choose the approach that fits your needs.


The AnoSys SDK integrates directly into Claude Code's native hook mechanism to capture 150+ data fields per session, including accurate cost estimates, subagent tracing, and optional content redaction.

Install in one command:

pip install anosys-sdk-claude-code
anosys-claude-code install
npx anosys-sdk-claude-code install

The installer configures everything automatically — no manual editing of settings.json required.

→ Full guide: Claude Code Observability


Alternative: OTEL-Only Configuration

For a lighter-weight integration, configure Claude Code to export standard OpenTelemetry traces directly — no SDK required.

Step 1 — Create Your Ingestion Channel

Log in to the Anosys Console and create a new ingestion channel. Go to the OTEL tab and copy the endpoint URL.

Step 2 — Configure Claude Code

Create or edit ~/.claude/settings.json and add the following:

{
    "env": {
        "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
        "OTEL_SERVICE_NAME": "claude-code",
        "OTEL_TRACES_EXPORTER": "otlp",
        "OTEL_METRICS_EXPORTER": "otlp",
        "OTEL_LOGS_EXPORTER": "otlp",
        "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
        "OTEL_EXPORTER_OTLP_ENDPOINT": "YOUR_ANOSYS_OTLP_ENDPOINT"
    }
}

Replace YOUR_ANOSYS_OTLP_ENDPOINT with the OTEL endpoint URL from your Anosys Console (e.g. https://api.anosys.ai/{workspace_id}/cc/{channel_id}).

Custom service name

You can change the OTEL_SERVICE_NAME value to any label you prefer (e.g. claude-code-backend, my-team-agent). This name is used to group and filter traces in the Anosys dashboards.

Step 3 — Restart Claude Code

After saving settings.json, restart Claude Code. Telemetry will begin flowing immediately.


What You'll See in Anosys

Once telemetry is active, the Anosys Platform automatically processes your Claude Code data and surfaces:

  • Session traces — End-to-end visibility into every Claude Code session, including tool calls, file reads/writes, and command executions.
  • Token usage metrics — Input and output token counts per session, per project, and over time.
  • Latency analysis — Identify slow model calls and bottlenecks across your agent's workflow.
  • Error tracking — Structured error logs with automatic classification to help you root-cause failures fast.
  • Cost insights — Per-session cost estimates to keep your AI spend under control.
  • Anomaly detection — ML-powered baselines that alert on unusual session lengths, token spikes, and unexpected error patterns without manual threshold configuration.
  • Root cause analysis — Causal graphs that connect failures to upstream triggers — trace a broken build back through file edits, command executions, and model decisions.
  • Alerts — Context-aware notifications via Slack, email, or webhooks when Claude Code sessions hit errors, cost overruns, or performance regressions.
  • Custom dashboards — Build your own views or start with auto-generated dashboards for session health, cost trends, and project-level usage.
  • Automated metric generation — Anosys automatically generates key metrics from your traces and logs so you get dashboards in minutes, not days.
  • Custom pipelines — Enrich, route, and transform your Claude Code telemetry with automated remediation workflows.
  • Labeling — Tag and annotate sessions, projects, or teams with custom labels for segmentation and drill-down analysis.
  • AI Copilot — Ask questions about your Claude Code sessions in plain English and get answers backed by your telemetry.

Configuration Reference

Below is a summary of the environment variables used for the OTEL-only method:

Variable Description
CLAUDE_CODE_ENABLE_TELEMETRY Set to 1 to enable telemetry export
OTEL_SERVICE_NAME Logical name for your service in traces and dashboards
OTEL_TRACES_EXPORTER Exporter type for traces (use otlp)
OTEL_METRICS_EXPORTER Exporter type for metrics (use otlp)
OTEL_LOGS_EXPORTER Exporter type for logs (use otlp)
OTEL_EXPORTER_OTLP_PROTOCOL Transport protocol (use http/protobuf)
OTEL_EXPORTER_OTLP_ENDPOINT Your Anosys OTEL ingestion endpoint URL

For the full SDK hook configuration reference, see Claude Code Observability.


Troubleshooting

I don't see any data in the Anosys Console
  • SDK hook: Run anosys-claude-code status to verify the hook is installed and API keys are valid.
  • OTEL-only: Verify that ~/.claude/settings.json is valid JSON (no trailing commas).
  • Confirm that CLAUDE_CODE_ENABLE_TELEMETRY is set to "1" (string, not integer).
  • Double-check that your endpoint matches the URL shown in your Anosys Console.
  • Make sure you restarted Claude Code after saving the file.
Can I use this alongside other OTLP collectors?

Yes. You can point OTEL_EXPORTER_OTLP_ENDPOINT at any OTLP-compatible collector or gateway. If you need to fan out to multiple backends, place an OpenTelemetry Collector in between and configure multiple exporters there.

Does this work with Claude Code on remote servers or containers?

Yes — as long as ~/.claude/settings.json is present in the home directory of the user running Claude Code, telemetry will be exported regardless of environment.

Can I monitor the Claude Code Desktop App?

Yes — configure the Desktop App to run the claude CLI over SSH, and install the AnoSys SDK on the CLI host. See the SSH integration guide.


Next Steps