Plugins 〉Claude Code Stats


Developer

Timur Olzhabayev

Sign up to receive occasional product news and updates:



Application
community

Claude Code Stats

  • Overview
  • Installation
  • Change log
  • Related content

Claude Code Stats

Team usage analytics for Claude Code powered by OpenTelemetry.

Requirements

  • Grafana 12.3.0 or later
  • A Prometheus-compatible data source (Grafana Cloud includes this by default)
  • Claude Code with telemetry enabled

Installation

Install the plugin through the Grafana UI: https://grafana.com/docs/grafana/latest/administration/plugin-management/plugin-install/#install-a-plugin-through-the-grafana-ui

Configuration

Step 1: Get Grafana Cloud OTLP Credentials

  1. Go to your Grafana Cloud Portal
  2. Select your stack and click Configure in the OpenTelemetry tile
  3. Click Generate API Token
  4. Copy the OTLP endpoint and token

Step 2: Configure Environment Variables

Add these to your shell profile (~/.zshrc, ~/.bashrc, or ~/.bash_profile):

# Enable Claude Code telemetry
export CLAUDE_CODE_ENABLE_TELEMETRY=1

Configure OpenTelemetry metrics exporter

export OTEL_METRICS_EXPORTER=otlp export OTEL_EXPORTER_OTLP_PROTOCOL=“http/protobuf”

Grafana Cloud OTLP endpoint

export OTEL_EXPORTER_OTLP_ENDPOINT=“https://otlp-gateway-prod-<region>.grafana.net/otlp” export OTEL_EXPORTER_OTLP_HEADERS=“Authorization=Basic <your-base64-encoded-token>”

IMPORTANT: Use cumulative temporality for Grafana Cloud compatibility

export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative

Optional: Adjust export interval (in milliseconds, default: 60000)

export OTEL_METRIC_EXPORT_INTERVAL=60000

Replace <region> with your Grafana Cloud region and <your-base64-encoded-token> with your API token.

Step 3: Restart Claude Code

# Reload your shell config
source ~/.zshrc  # or ~/.bashrc

Start Claude Code - telemetry will now be enabled

claude

Features

  • Overview: Total cost, tokens, sessions, and active users
  • Costs: Cost breakdown by model, team member, and time
  • Tokens: Token usage by type (input, output, cache)
  • Tools: Tool acceptance rates and usage
  • Productivity: Lines of code, commits, and active time
  • Environment: OS, architecture, and Claude Code version distribution

Team Members

Team members are automatically identified by their email address from the user_email label in the metrics.

Documentation

For full telemetry documentation, see the Claude Code Monitoring Usage Guide.

Installing Claude Code Stats on Grafana Cloud:

For more information, visit the docs on plugin installation.

Changelog

1.0.2

Changed

  • Use user_email label instead of user_account_uuid for team member identification
  • Added OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative to setup guide (required for Grafana Cloud)
  • Improved browser tab titles for better navigation
  • Simplified configuration page (removed Team Members tab, users are now identified by email automatically)

Added

  • End-to-end tests with Playwright
  • .nvmrc file for consistent Node.js version

CI

  • Bump actions/checkout from 5 to 6
  • Bump actions/setup-node from 6.0.0 to 6.1.0
  • Bump actions/upload-artifact from 5 to 6
  • Bump actions/download-artifact from 6 to 7
  • Bump grafana/plugin-actions/bundle-size from 1.0.2 to 1.1.0

1.0.0

Initial release of Claude Stats Grafana app plugin.

Features

  • Overview dashboard with cost, token, and session metrics
  • Cost analytics with breakdown by model and team member
  • Token usage analysis with input/output/cache breakdown
  • Tool usage tracking with accept/reject decisions
  • Productivity metrics (lines of code, commits, PRs)
  • Setup wizard for configuring Claude Code OpenTelemetry export
  • Team member filtering across all dashboards
  • Auto-discovery of Prometheus data sources