Skip to main content

Claude Code Integration (Telemetry Setup)

This document describes the architecture for collecting telemetry from Claude Code using OpenTelemetry and storing it directly in Amazon S3 or Google Cloud Storage. This approach allows for the inclu…

This document describes the architecture for collecting telemetry from Claude Code using OpenTelemetry and storing it directly in Amazon S3 or Google Cloud Storage. This approach allows for the inclusion of additional data, such as cost and usage metrics, which are not included if using the standard analytics APIs.

Claude Code versions supported: Console, Teams, Enterprise, Vertex, AWS Bedrock and self-hosted.

Once you've completed the setup as described below, send the path for your S3/GCS bucket to your Customer Success Manager.

This solution uses:

- Claude Code telemetry support

- OpenTelemetry Collector Contrib

- Amazon S3 OR Google Cloud Storage as storage backends

Architecture (AWS Option):

Claude Code
              ↓ OTLP
          OpenTelemetry Collector
              ↓ awss3exporter
          Amazon S3

Architecture (GCP Option):

Claude Code
              ↓ OTLP
          OpenTelemetry Collector
              ↓ googlecloudstorageexporter
          Google Cloud Storage
There is no need to run a local OpenTelemetry Collector Docker container on every developer machine.
Only a single, centrally managed OTEL Collector is required. Then, by configuring a set of environment variables on each developer machine, Claude Code can be directed to that collector endpoint. All developer machines will send their telemetry data to the same collector. These environment variables can be distributed and managed through your MDM solution

Components

Claude Code Telemetry

Follow Claude Code recommended monitoring and telemetry documentation:

These are the recommended minimal configuration requirements:

# Events/logs only (no metrics)
          export CLAUDE_CODE_ENABLE_TELEMETRY=1
          export OTEL_METRICS_EXPORTER=otlp
          #optional - enable logs and traces as well
          export OTEL_LOGS_EXPORTER=otlp
          export OTEL_TRACES_EXPORTER=otlp
          
          export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
          export OTEL_EXPORTER_OTLP_ENDPOINT=http://<your otel collector address>:4317

OpenTelemetry Collector

Any OpenTelemetry Collector distribution that can export telemetry data to Amazon S3/Google GCS in formats such as Parquet or CSV is suitable for this architecture.

In this document, the focus is on the OpenTelemetry Collector Contrib distribution together with AWS S3 exporter (awss3exporter) or Google GCS exporter (googlecloudstorageexporter) as these provides a simple and direct integration path.

Documentation Links:

The OpenTelemetry Collector acts as the telemetry gateway which recieves OTLP telemetry, batch processes data and exports telemetry to S3/GCS.

Different IT departments and infrastructure teams may choose different deployment approaches for the OpenTelemetry Collector depending on their internal standards, cloud providers, orchestration platforms, networking requirements, and operational preferences.

It is recommended to review the deployment options documented in the OpenTelemetry Collector Contrib documentation and choose the approach that best fits your organization’s operational model and security requirements.

Storage & Access Configuration

Both Amazon S3 and Google Could Storage store the telemetry data as objects.

Targetboard uses Airbyte to connect to your storage to extract the data to TargetBoard servers.

In order to collect telemetry data from your object storage through Airbyte, appropriate IAM permissions must be configured.

Follow the relevant guidance for either S3 or GCS to connect to Airbyte for data collection.


Sample Installation (Using S3 Storage)

The steps below demonstrate a sample installation and may need to be adjusted according to your organizational security and best practices requirements.

  1. Login to your AWS account and create an S3 bucket.
    1. Recommended settings: Block public access, Enable server-side encryption, Enable lifecycle policies.
    2. Example lifecycle policy: Retain raw telemetry for 90 days; transition older data to Glacier.

Example:

aws s3 mb s3://claude-code-otel-prod
  1. Configure IAM permissions. This is required to upload objects.

Example:

{
            "Version": "2012-10-17",
            "Statement": [
              {
                "Effect": "Allow",
                "Action": [
                  "s3:PutObject",
                  "s3:AbortMultipartUpload"
                ],
                "Resource": "arn:aws:s3:::claude-code-otel-prod/*"
              }
            ]
          }

  1. Configure IAM permissions for Airbyte to read and extract data from the S3 bucket.

Example:

{
            "Version": "2012-10-17",
            "Statement": [
              {
                "Effect": "Allow",
                "Action": [
                  "s3:GetObject",
                  "s3:ListBucket"
                ],
                "Resource": [
                  "arn:aws:s3:::claude-code-otel-prod",
                  "arn:aws:s3:::claude-code-otel-prod/*"
                ]
              }
            ]
          }

For security best practices, attach this policy to an IAM role specifically for Airbyte/TargetBoard’s access. Refer to the Airbyte S3 connector documentation for full setup instructions.

  1. Pull the OpenTelemetry Collector Contrib Docker image:
docker pull otel/opentelemetry-collector-contrib:latest
  1. Then create otel-collector-config.yaml, for example:
receivers:
            otlp:
              protocols:
                grpc:
                  endpoint: 0.0.0.0:4317
                http:
                  endpoint: 0.0.0.0:4318
          
          processors:
            batch: {}
          
          exporters:
            awss3:
              s3uploader:
                region: us-east-1
                s3_bucket: claude-code-otel-prod
                s3_prefix: claude-code/
              marshaler: otlp_json
          
          service:
            pipelines:
              traces:
                receivers: [otlp]
                processors: [batch]
                exporters: [awss3]
          
              metrics:
                receivers: [otlp]
                processors: [batch]
                exporters: [awss3]
          
              logs:
                receivers: [otlp]
                processors: [batch]
                exporters: [awss3]
  1. Run the collector.

Example:

docker run --rm \
            -p 4317:4317 \
            -p 4318:4318 \
            -v $(pwd)/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml \
            otel/opentelemetry-collector-contrib:latest

The collector now accepts OTLP telemetry on:

  • 4317 (gRPC)
  • 4318 (HTTP)
  1. Configure Claude Code to export telemetry to the collector.

Example environment variables:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
          
          export OTEL_SERVICE_NAME=claude-code
          
          export OTEL_TRACES_EXPORTER=otlp
          export OTEL_METRICS_EXPORTER=otlp
          export OTEL_LOGS_EXPORTER=otlp
          
          export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
          export OTEL_EXPORTER_OTLP_ENDPOINT=http://<the address of your otel collector>:4317
  1. Verify that the telemetry data is successfully exported to your S3 bucket. This can be done by checking the designated S3 prefix (e.g., claude-code/) for new files created by the OpenTelemetry Collector.
  2. Securely send the path for your S3 bucket to your TargetBoard Customer Success Manager.

How did we do?

BitBucket Integration

Claude Code Integration

Contact