Unlocking Claude Code Observability: Three Ways to Integrate with groundcover

Unlocking Claude Code Observability: Three Ways to Integrate with groundcover

As more teams use Claude Code on Amazon Bedrock, they need to see how it's being used: token spend, cost per team, and developer adoption. This article walks through three architecture patterns for sending Claude Code telemetry to groundcover.

Sr. Solutions Architect, AWS
This article has been co-authored with Noam Levy, Founding Engineer and Field CTO at Groundcover, Amir Hazoom, Parter Solutions Architect, AWS and Ryan Sachs, Solutions Architect, AWS


Introduction

As organizations scale their AI-assisted development workflows with  Claude Code  on Amazon Bedrock, observability becomes critical. Engineering leaders need visibility into token consumption, cost attribution, developer productivity, and operational health.

 Groundcover  is a cloud native observability platform that combines eBPF-based automatic instrumentation with full OpenTelemetry (OTel) support. It delivers APM, traces, logs, and metrics, all stored in your own cloud, making it an ideal target for Claude Code's native OTLP telemetry, especially when high volumes of data are expected, cost is a concern or sovereignty and data residency is a consideration.

In this three-part guide, we'll walk through three integration patterns, that will help you configure your telemetry pipeline with groundCover:

Pattern
Best For
Infrastructure Required
Part 1: Direct to groundcover Collector
Teams already running groundcover Bring Your Own Cloud
groundcover Collector on Bring Your Own Cloud
Part 2: VPC Endpoint + OTel Collector
Air-gapped / compliance-sensitive environments
VPC Endpoint, OTel Collector on ECS/Fargate (or EKS or EC2), ALB
Part 3: Claude Apps Gateway + groundcover
Enterprise SSO with centralized policy & telemetry
Apps Gateway container + PostgreSQL


What You'll Learn

  • How Claude Code emits OpenTelemetry metrics (tokens, sessions, cost, productivity)
  • Three architectural patterns for routing that telemetry to groundcover
  • Configuration examples you can deploy today


Prerequisites

  • An AWS account with Amazon Bedrock access and Claude models enabled
  • A groundcover account
  • Basic familiarity with OpenTelemetry concepts


Part 1: Integrating Claude Code Directly with groundcover Collector

Overview

If your developers are working on machines that have direct network access to a groundcover managed cluster (e.g., via VPN or the same corporate network), you can skip the intermediate OTel collector. Claude Code sends OTLP metrics directly to the groundcover load balancer.
This is the simplest pattern for teams already running groundcover.



Fig1: Claude Code Telemetry direct to groundcover

Before you begin, follow the steps to  get Ingestion Key  and  Load Balancer url (GROUNDCOVER_COLLECTOR_LB) to be used in settings file.


Step 1: Point Claude Code at the groundcover Collector

Claude Code exports OTLP directly to the groundcover in Cloud collector's load balancer. Set the telemetry environment variables in Claude Code settings file (eg. ~/.claude/settings.json) on each developer machine (or push them through managed settings), pointing the OTLP endpoint at the collector:


{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": <GROUNDCOVER_COLLECTOR_LB>",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer <GROUNDCOVER_INGESTION_KEY>"
}
}



The OTEL_EXPORTER_OTLP_HEADERS value carries the groundcover Data Ingestion key so the collector authenticates the incoming stream. Resource attributes are attached directly by Claude Code, so no collector-side enrichment step is required for basic attribution.


Step 2: Confirm Network Reachability

Developers must be able to reach the groundcover collector's load balancer. This is typically a private load balancer reachable over VPN or VPC peering. Verify connectivity before rolling out widely:
curl -v https://<GROUNDCOVER_COLLECTOR_LB>/v1/metrics \
-H " Authorization: Bearer <GROUNDCOVER_API_KEY>" \
-H "Content-Type: application/json" -d '{}'


Step 3: Verify in groundcover

Run a few Claude Code sessions, then open groundcover Explore → Metric Summary and filter by “claude_code.*”. You should see the Claude Code metric families:
  • claude_code.token.usage — input/output/cache token counts
  • claude_code.cost.usage — estimated spend per developer
  • claude_code.session.count — active sessions
  • claude_code.lines_of_code.count — lines added/removed
  • claude_code.commit.count — commits attributed to Claude Code


Why This Pattern?

Advantage
Detail
Simplicity
No collector to deploy, patch, or scale. Claude Code talks straight to groundcover
Lower latency
One fewer network hop between the developer and the backend
Fast to adopt
Ideal for teams already running groundcover who want Claude Code visibility in minutes



Part 2: Integrating Claude Code via a VPC Endpoint and OTel Collector

Overview

This pattern is ideal for organizations that need centralized data validation and enrichment, key management or require dual data exports. Claude Code metrics flow through a OpenTelemetry Collector running on ECS Fargate in your AWS account, which then exports to groundcover's BYOC (Bring Your Own Cloud) endpoint via VPC Endpoint..



Fig2: Self maintained OTeL Collector - Claude Code Telemetry Export via VPC Endpoint


Step 1: Enable Claude Code Telemetry

Configure the following environment variables on each developer machine (or distribute via managed settings), similar to Part 1:


{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
"OTEL_EXPORTER_OTLP_ENDPOINT": <AWS_ACCOUNT_COLLECTOR_LB>",
}
}




Step 2: Set Up the VPC Interface Endpoint Connectivity with groundcover

2a. Get the groundcover PrivateLink service name for your region. It looks like com.amazonaws.vpce.<region>.vpce-svc-xxxxxxxxxxxxx. Create the endpoint in the same region as the service.

2b. Create a security group for the endpoint.

aws ec2 create-security-group \
--group-name "groundcover-vpce-sg" \
--description "Security group for groundcover VPC endpoint" \
--vpc-id <your-vpc-id> \
--region <region>

2c. Allow HTTPS from your VPC. Use your VPC CIDR, or only the subnets where the collector runs.

aws ec2 authorize-security-group-ingress \
--group-id <your-new-sg-id> \
--protocol tcp \
--port 443 \
--cidr <your-vpc-cidr> \
--region <region>

2d. Create the endpoint. Use two subnets in different Availability Zones.

aws ec2 create-vpc-endpoint \
--vpc-id <your-vpc-id> \
--vpc-endpoint-type Interface \
--service-name <groundcover-service-name> \
--subnet-ids <subnet-1> <subnet-2> \
--security-group-ids <your-new-sg-id> \
--ip-address-type ipv4 \
--no-private-dns-enabled \
--tag-specifications 'ResourceType=vpc-endpoint,Tags=[{Key=Name,Value=groundcover-privatelink}]' \
--region <region>

2e. Accept the connection from groundcover account. Get the endpoint’s DNS name to use in Step 3.


Step 3: Add groundcover as an exporter in your collector

If you already run a collector, make two changes to its configuration.

3a. Add the exporter under exporters:

exporters:
# ...your existing exporter(s) stay as they are...
otlphttp/groundcover:
endpoint: "https://<vpc-endpoint-dns-name>"
headers:
apikey: "${env:GROUNDCOVER_API_KEY}"

3b. Add it to the pipeline next to your existing exporter.

service:
pipelines:
metrics:
receivers: [otlp]
processors: [<your-existing-processors>]
exporters: [<your-existing-exporter>, otlphttp/groundcover]

3c. Supply the key and restart. Store the groundcover ingestion key in AWS Secrets Manager or as a SecureString parameter, and inject it into the collector as GROUNDCOVER_API_KEY. Then redeploy. On ECS, that means forcing a new deployment of the service.


Step 4: Verify in groundcover

After a few Claude Code sessions, navigate to the groundcover Explore → Metric Summary section. Filter by “claude_code.* “ You should see metrics related to Claude Code:
  • claude_code.token.usage — input/output/cache token counts
  • claude_code.cost.usage — estimated spend per developer
  • claude_code.session.count — active sessions
  • claude_code.lines_of_code.count — lines added/removed
  • claude_code.commit.count — commits attributed to Claude Code


Why This Pattern?

Advantage
Detail
Enrichment
The collector can inject AWS account metadata, team tags, and custom attributes before export
Dual-export
Add a second exporter (e.g., CloudWatch OTLP) to send the same data to multiple backends



Part 3: Integrating Claude Code via the Claude Apps Gateway and groundcover


Overview
For enterprises that need centralized authentication, per-team quota enforcement, and tamper-resistant identity, the Claude Apps Gateway sits in front of Amazon Bedrock as a single, policy-enforcing entry point and emits OpenTelemetry that groundcover ingests.

In this pattern every Claude Code request authenticates to the gateway through an OIDC/SSO flow. The gateway mints a short-lived token, maps the caller to an IAM role via managed policies, applies spend limits, and proxies the request to Bedrock in your chosen Region.



Fig3: Claude Apps Gateway fronts Bedrock, SSO-authenticated requests, server-side attribution, and OTel export to groundcover


Architecture

The gateway runs as a container (ECS/Fargate, EKS, or EC2) backed by a PostgreSQL database that stores configuration, per-group policy, quota counters, and spend state. Its main components are:
  • OIDC/SSO front door, developers log in via your IdP (e.g. Okta, Cognito, Entra ID) using a device-authorization flow; the gateway validates the IdP token and mints a short-lived JWT for the session.
  • Policy & identity mapping, group claims from the JWT map to per-group managed IAM policies, which scope which models and Regions each team may call.
  • Spend & quota enforcement, admin write/read keys configure per-group spend limits; the gateway checks counters in PostgreSQL before forwarding a request and rejects calls that exceed the budget.
  • Bedrock upstream, the gateway calls Amazon Bedrock (e.g. in us-west-2) using the mapped role via STS AssumeRole, keeping long-lived credentials off developer machines entirely.
  • Telemetry emitter, the gateway emits OTel metrics and attribution headers (user, team, cost center, model, token counts) which flow to groundcover.


Step 1: Deploy the Gateway

Deploy the Claude Apps Gateway container with its PostgreSQL backend. Configure the gateway.yaml with your OIDC issuer, the Bedrock upstream Region, and the admin read/write keys used to manage spend limits. A minimal configuration defines the OIDC provider, the Bedrock upstream, and the OTLP export target:
auth:
oidc:
issuer: "https://<your-idp>/oauth2/default"
client_id: "<CLIENT_ID>"
upstream:
bedrock:
region: "us-west-2"
telemetry:
otlp:
endpoint: "<GROUNDCOVER_OTLP_ENDPOINT>"
headers:
apikey: "<GROUNDCOVER_API_KEY>"


Step 2: Point Claude Code at the Gateway

Developers don't hold AWS keys or tokens. Distribute these keys in a managed settings file (or have developers add the first two to claude settings file eg. ~/.claude/settings.json).

"forceLoginMethod": "gateway",
"forceLoginGatewayUrl": "https://<GATEWAY_PRIVATE_URL>",
"parentSettingsBehavior": "merge"



Step 3: Verify Attribution and Spend in groundcover

After a few Claude Code sessions, navigate to the groundcover Explore → Metric Summary section. Filter by “claude_code.* “ You should see metrics related to Claude Code:

  • claude_code.token.usage — input/output/cache token counts
  • claude_code.cost.usage — estimated spend per developer
  • claude_code.session.count — active sessions
  • claude_code.lines_of_code.count — lines added/removed
  • claude_code.commit.count — commits attributed to Claude Code


Why This Pattern?

Advantage
Detail
Tamper-proof attribution
Identity comes from the validated SSO token, not a client-set variable
Centralized policy
Per-group managed IAM policies control which models and Regions each team may use
Spend governance
Per-group spend limits are enforced at the gateway before a request reaches Bedrock
No credentials on laptops
The gateway assumes roles via STS; developers never hold long-lived AWS keys


Conclusion

Claude Code's native OpenTelemetry support makes AI-assisted development observable rather than opaque. By routing that telemetry into groundcover, whether through a self-managed VPC collector, directly to the groundcover collector, or through the Claude Apps Gateway, engineering leaders gain the token, cost, productivity, and operational signals they need to run Claude Code at scale. Pick the pattern that matches your security posture and governance needs today; because all three emit the same metric schema, you can evolve from one to the next without losing historical visibility.


References:

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article