CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P)· Lessons

    Domain 3 · Lesson 15/38

    Monitoring Strategy for Claude Agents: Privacy, Collectors and Reporting APIs

    Analyze observability challenges and select monitoring strategies at scale

    10 min read
    2.38% of exam
    5 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Decide which content gates to enable, weighing diagnostic value against privacy
    • Lock telemetry destinations through managed settings without leaving gaps
    • Match each telemetry signal to a suitable backend type
    • Choose between OpenTelemetry export, the analytics dashboard, the Claude Code Analytics API and the Usage & Cost API

    1.Redacted by default: choosing which content to collect

    Out of the box, Claude telemetry records the shape of activity, not its content. For prompts and assistant responses, only lengths are recorded. Raw file contents and code snippets are not included in metrics or events. MCP tool names are redacted to the literal "mcp_tool" for user-configured servers. Each extra kind of content is behind its own opt-in variable, so the strategic question is which gates your diagnosis actually needs.

    Content gates and what each adds
    VariableAdds
    OTEL_LOG_USER_PROMPTS=1Prompt text on claude_code.user_prompt events and on the claude_code.interaction span
    OTEL_LOG_ASSISTANT_RESPONSES=1Assistant response text on assistant_response events; requires Claude Code v2.1.193 or later
    OTEL_LOG_TOOL_DETAILS=1Tool input arguments such as file paths, shell commands, and search patterns, plus real agent, skill, plugin, and MCP server names on metrics
    OTEL_LOG_TOOL_CONTENT=1A tool.output span event with file contents, Bash output and tool results; requires tracing
    OTEL_LOG_RAW_API_BODIESFull Messages API request and response JSON, including the entire conversation history

    Three details catch people out. First, OTEL_LOG_ASSISTANT_RESPONSES falls back to OTEL_LOG_USER_PROMPTS when unset, so turning on prompts quietly turns on responses as well unless you set the response gate to 0. Second, OTEL_LOG_TOOL_CONTENT writes a span event, so without tracing it collects nothing. Third, raw API bodies imply consent to everything the other gates would reveal. Volume matters too: content attributes are truncated at 60 KB by default, and CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH can be lowered to cut telemetry volume. Under OAuth, user.email is included in attributes. It goes only to your configured endpoint, never to Anthropic.

    Checkpoint 1 of 6· Check yourself

    A team wants prompt text in its telemetry but must keep assistant responses out. They set OTEL_LOG_USER_PROMPTS=1 and nothing else. What happens?

    Sources12

    2.Centralizing collection with managed settings

    Across an organization, telemetry is only useful if every machine sends it to the same place. The variables can live in a settings file's env block, and when an administrator sets them in managed settings, Claude Code actively strips conflicting developer settings. Setting OTEL_EXPORTER_OTLP_ENDPOINT removes every developer-set per-signal endpoint. Setting OTEL_EXPORTER_OTLP_PROTOCOL removes developer per-signal protocols. Setting headers or client certificates removes developer endpoint variables too, so those credentials can't be sent to a collector that the administrator didn't choose.

    Telemetry configuration expressed as a settings env blockjson
    {
      "env": {
        "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
        "OTEL_METRICS_EXPORTER": "otlp",
        "OTEL_LOGS_EXPORTER": "otlp",
        "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
        "OTEL_EXPORTER_OTLP_ENDPOINT": "http://collector.example.com:4317",
        "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer example-token"
      }
    }

    There is one gap. Exporter selectors (OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER and the beta OTEL_TRACES_EXPORTER) follow normal per-key precedence. A developer can still switch a signal off or send it to the console exporter, so if coverage has to be guaranteed, pin the selectors in managed settings as well. Also note that Claude Code has no default OTLP protocol. Every otlp exporter you enable needs a protocol set.

    Checkpoint 2 of 6· Check yourself

    Managed settings pin OTEL_EXPORTER_OTLP_ENDPOINT and headers, but some machines still send no logs. What's the most likely cause?

    Checkpoint 3 of 6· Exam question

    An organization is scaling its Claude Code rollout from 15 developers to roughly 300 developers and wants to set organization-level Tokens-Per-Minute and Requests-Per-Minute allocations. A junior admin proposes simply multiplying the 15-user TPM-per-user figure by 300. Why is this the wrong approach, and what should the admin do instead?

    Sources12

    3.Matching each signal to a backend

    Because each signal can have its own endpoint, you don't have to send everything to one tool. The monitoring docs suggest backend types by signal. A full-featured observability platform works for all three, and its advantage is that it can correlate them.

    Backend types suited to each signal
    SignalBackend typeGood for
    MetricsTime series databasesRate calculations, aggregated metrics
    MetricsColumnar storesComplex queries, unique user analysis
    Events/logsLog aggregation systemsFull-text search, log analysis
    Events/logsColumnar storesStructured event analysis
    TracesDistributed tracing systemsSpan visualization, request waterfalls, latency analysis

    Security auditing is one case for splitting signals. Events such as tool_decision (allowed or denied, and by what), permission_mode_changed, mcp_server_connection and auth can go to a SIEM over the logs endpoint alone. OTEL_LOG_TOOL_DETAILS then records which commands ran and which files were touched.

    Routing log events with tool details to a SIEMjson
    {
      "env": {
        "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
        "OTEL_LOGS_EXPORTER": "otlp",
        "OTEL_LOG_TOOL_DETAILS": "1",
        "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/protobuf",
        "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://siem.example.com:4318/v1/logs",
        "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer your-siem-token"
      }
    }

    Checkpoint 4 of 6· Match them up

    Match each monitoring need to the backend type the docs suggest

    Tap a term, then the definition that fits it.

    Sources1

    4.When OpenTelemetry is more than you need

    OpenTelemetry gives you per-run detail, but you have to run a collector and a backend. If the question is aggregate (who is using Claude Code, what it costs, whether spend matches the bill), Anthropic's reporting surfaces may be enough. The Claude Code Analytics Admin API sits in between: it offers more detail than the dashboard "without the complexity of the OpenTelemetry integration."

    Monitoring approaches compared
    ApproachGives youGranularity / freshness
    OpenTelemetry exportPer-run traces, events and metrics in your own backendExport intervals in milliseconds, e.g. 60000 for metrics by default
    Analytics dashboard (platform.claude.com/claude-code)Usage metrics, spend tracking, team insightsDaily activity and spend charts
    Claude Code Analytics API (/v1/organizations/usage_report/claude_code)Per-user sessions, lines of code, commits, PRs, tool accept/reject rates, estimated costOne day per request; up to 1-hour delay
    Usage & Cost API (/v1/organizations/usage_report/messages, /v1/organizations/cost_report)Organization token usage and USD cost for reconciliation and alertingUsage in 1m, 1h or 1d buckets; cost daily only

    Both Admin APIs authenticate with an Admin API key. Claude Enterprise organizations are the exception: they use an Analytics API key against a different API. Usage-report numbers come from Anthropic's own accounting, which gives precise token counts instead of relying only on counting tokens in responses. That makes them the right source for cost reconciliation, even when OpenTelemetry is already running.

    Checkpoint 5 of 6· Check yourself

    Finance needs to reconcile internal records against Anthropic billing, broken down by workspace. Which source fits best?

    Checkpoint 6 of 6· Exam question

    A company runs Claude Code through Amazon Bedrock and notices that, unlike their Claude Console workspace, no per-developer cost or token metrics appear in any Anthropic-hosted dashboard. Finance still wants per-user spend attribution and enforceable per-user caps. What should the platform team deploy to get this?

    Sources345

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.OTEL_LOG_TOOL_CONTENT=1 puts tool output into log events.Why is that wrong?

      It adds a tool.output span event and requires tracing to be enabled. With metrics and logs alone, it collects nothing.

      Covered in Redacted by default: choosing which content to collect

    2. 2.Pinning the OTLP endpoint in managed settings guarantees every machine exports every signal.Why is that wrong?

      The endpoint pin removes developer endpoint overrides, but exporter selectors follow per-key precedence. A developer can still disable a signal unless the selectors are pinned too.

      Covered in Centralizing collection with managed settings

    3. 3.The OTLP exporter defaults to grpc if no protocol is set.Why is that wrong?

      Claude Code has no default protocol. You must set OTEL_EXPORTER_OTLP_PROTOCOL or a per-signal protocol for each otlp exporter.

      Covered in Centralizing collection with managed settings

    Practise it for real

    Turn on Claude Code telemetry locally, including beta traces, and confirm signals reach an OTLP collector

    1. 1.export CLAUDE_CODE_ENABLE_TELEMETRY=1

      Why: Telemetry collection is off until this is set.

      You should see: No output yet; nothing exports without an exporter.

    2. 2.export OTEL_METRICS_EXPORTER=otlp and OTEL_LOGS_EXPORTER=otlp

      Why: Each signal has its own selector, and you enable only what you need.

      You should see: Metrics and log events are selected for OTLP export.

    3. 3.export CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1 and OTEL_TRACES_EXPORTER=otlp

      Why: Traces are in beta and need both the beta flag and their own exporter selector. Metrics and logs do not need the flag.

      You should see: Traces are selected for OTLP export alongside metrics and logs.

    4. 4.export OTEL_EXPORTER_OTLP_PROTOCOL=grpc and OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

      Why: There is no default protocol, and the endpoint tells the exporter where your collector is. The generic protocol and endpoint apply to all signals.

      You should see: The exporter has a complete destination.

    5. 5.export OTEL_METRIC_EXPORT_INTERVAL=10000, then run claude and send a short prompt

      Why: The default metrics interval is 60000 ms. Shortening it for debugging shows data sooner, but reset it for production.

      You should see: Metrics reach the collector roughly every 10 seconds, log events every 5 seconds by default, and trace spans every 5 seconds by default.

    6. 6.Look in your collector or backend for data from service.name claude-code, including claude_code.interaction, claude_code.llm_request and claude_code.tool spans

      Why: This confirms each of the three signals arrived, not just that the process started.

      You should see: Metrics, log events and a claude_code.interaction span tree with child llm_request and tool spans are visible.

    Stuck? Get a nudge

    If nothing arrives, check the protocol first: Claude Code won't guess one. If only traces are missing, check that the beta flag is set.

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “User prompt content is not collected by default. Only prompt length is recorded.”
      ↩︎ Redacted by default: choosing which content to collect
      “raise it only if your backend accepts larger values, or lower it to cut telemetry volume”
      ↩︎ Redacted by default: choosing which content to collect
      “When authenticated via OAuth, user.email is included in telemetry attributes, sent only to the OTel endpoint you configure, never to Anthropic.”
      ↩︎ Redacted by default: choosing which content to collect
      “Requires Claude Code v2.1.193 or later”
      ↩︎ Redacted by default: choosing which content to collect
      “when you set OTEL_EXPORTER_OTLP_ENDPOINT, Claude Code removes every developer-set per-signal endpoint.”
      ↩︎ Centralizing collection with managed settings
      “Claude Code removes the developer-set per-signal versions of that variable, plus every developer-set endpoint variable, generic or per-signal”
      ↩︎ Centralizing collection with managed settings
      “Full-featured observability platforms: Correlation between metrics and events”
      ↩︎ Matching each signal to a backend
      “Enable logging of tool content in the tool.output span event (default: disabled).”
      ↩︎ Exam trap 1
      “so set the selectors in managed settings too if you need them locked”
      ↩︎ Exam trap 2
      “Claude Code has no default protocol, so set this or the signal-specific protocol variable for each otlp exporter you enable”
      ↩︎ Exam trap 3
      “When this variable is unset, OTEL_LOG_USER_PROMPTS is used as a fallback, so set OTEL_LOG_ASSISTANT_RESPONSES=0 if you want prompt content without response content”
      ↩︎ Checkpoint
      “so set the selectors in managed settings too if you need them locked”
      ↩︎ Checkpoint
      “Distributed tracing systems: Span visualization, request waterfalls, latency analysis”
      ↩︎ Checkpoint
    2. 2.
      “Enabling this implies consent to everything the three variables above would reveal”
      ↩︎ Redacted by default: choosing which content to collect
      “Required for traces, which are in beta. Metrics and log events do not need this.”
      ↩︎ Centralizing collection with managed settings
    3. 3.
      “This API provides more detail than the basic Analytics dashboard without the complexity of the OpenTelemetry integration.”
      ↩︎ When OpenTelemetry is more than you need
    4. 4.
      “Accurate usage tracking: Get precise token counts and usage patterns instead of relying solely on response token counting”
      ↩︎ When OpenTelemetry is more than you need
      “Claude Enterprise organizations use an Analytics API key with a different API instead”
      ↩︎ When OpenTelemetry is more than you need
      “Grouping: Group costs by workspace or description for detailed breakdowns.”
      ↩︎ When OpenTelemetry is more than you need
      “Time buckets: Daily granularity only (1d)”
      ↩︎ When OpenTelemetry is more than you need
      “Cost reconciliation: Match internal records with Anthropic billing for finance and accounting teams”
      ↩︎ Checkpoint
    5. 5.
      “API (Claude Console) | platform.claude.com/claude-code | Usage metrics, spend tracking, team insights”
      ↩︎ When OpenTelemetry is more than you need
      “Spend: daily API costs in dollars alongside user count.”
      ↩︎ When OpenTelemetry is more than you need

    Spotted a mistake, or was something unclear? Tell us.