---
title: "Claude Code integration | Grafana Cloud documentation"
description: "Learn about Claude Code Grafana Cloud integration."
---

# Claude Code integration for Grafana Cloud

Track Claude Code usage, costs, and tool activity across your organization by exporting telemetry data through OpenTelemetry (OTel). Claude Code exports metrics as time series data via the standard metrics protocol, and events via the logs/events protocol.

## Install Claude Code integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find and select the **Claude Code** tile to open the integration.
3. Follow the steps outlined on the **Configuration** page to set up telemetry and configure credentials.
4. Once configuration is complete, click **Install** to add the prebuilt dashboards to your Grafana Cloud instance.

## Configuration

The Claude Code integration sends metrics and logs to Grafana Cloud via OpenTelemetry (OTLP). You can configure telemetry for an individual developer or deploy organisation-wide via managed settings.

### Configure the integration

Follow these steps to set up Claude Code for Grafana Cloud:

1. **Create Grafana Cloud Token**
   
   - Generate a Grafana Cloud Access Policy Token with `metrics:write` and `logs:write` permissions.
   - Copy the token value and store it securely.
2. **Set Up Claude Code Telemetry**
   
   **Individual — Terminal (Quickstart)**
   
   Add the following to your shell profile (`.bashrc`, `.zshrc`) or paste directly into your terminal:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   export CLAUDE_CODE_ENABLE_TELEMETRY=1
   export OTEL_METRICS_EXPORTER=otlp
   export OTEL_LOGS_EXPORTER=otlp
   export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
   export OTEL_EXPORTER_OTLP_ENDPOINT=<your-grafana-cloud-otlp-endpoint>
   export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <base64-encoded-instanceid:token>"
   export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative
   ```
   
   Restart Claude Code after updating your shell profile for changes to take effect.
   
   **Individual — Config File (Recommended)**
   
   Run `claude settings` or open `~/.claude/settings.json` and add the following:
   
   JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```json
   {
     "env": {
       "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
       "OTEL_METRICS_EXPORTER": "otlp",
       "OTEL_LOGS_EXPORTER": "otlp",
       "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
       "OTEL_EXPORTER_OTLP_ENDPOINT": "<your-grafana-cloud-otlp-endpoint>",
       "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Basic <base64-encoded-instanceid:token>",
       "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE": "cumulative"
     }
   }
   ```
   
   Restart Claude Code after saving the file for changes to take effect.
   
   **Administrator — Managed Settings**
   
   Administrators can configure OpenTelemetry settings for all users through the managed settings file, allowing centralised control of telemetry across an organisation. See [settings precedence](https://docs.anthropic.com/en/docs/claude-code/settings#settings-precedence) for more information.
   
   The managed settings file is located at:
   
   - **macOS:** `/Library/Application Support/ClaudeCode/managed-settings.json`
   - **Linux / WSL:** `/etc/claude-code/managed-settings.json`
   
   Add the following to your managed settings file:
   
   JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```json
   {
     "env": {
       "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
       "OTEL_METRICS_EXPORTER": "otlp",
       "OTEL_LOGS_EXPORTER": "otlp",
       "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
       "OTEL_EXPORTER_OTLP_ENDPOINT": "<your-grafana-cloud-otlp-endpoint>",
       "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Basic <base64-encoded-instanceid:token>",
       "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE": "cumulative"
     }
   }
   ```
   
   Managed settings can be distributed via MDM (Mobile Device Management) or other device management solutions. Environment variables defined in the managed settings file have high precedence and cannot be overridden by users. See the [administrator configuration docs](https://code.claude.com/docs/en/monitoring-usage#administrator-configuration) for deployment options.
3. **Install Dashboards**
   
   - Click **Install** to add the Claude Code dashboards to your Grafana Cloud instance.

### Finding your credentials

- **OTLP Endpoint**: Your endpoint is displayed in the integration configuration page. You can also find it in the Grafana Cloud portal under **My Account → Stack details**.
- **Auth Header**: Use `Authorization=Basic <base64(instanceId:token)>` where `instanceId` is your Hosted Metrics instance ID and `token` is the Grafana Cloud Access Policy token generated above.

## Dashboards

The Claude Code integration installs the following dashboards in your Grafana Cloud instance.

- Claude Code

**Claude Code stats**

**Claude Code usage breakdown**

**Claude Code productivity**

## Changelog

md ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.0.0 - March 2026

* Initial release of Claude Code integration
* OTLP endpoint configuration for metrics and logs
* Setup instructions for individual (quickstart) and team/admin configurations
```
