alonw0

Cc Metrics — Development skill for Claude Code

Development community

A Grafana dashboard for Claude Code otel metrics (dockerized).

How to install Cc Metrics

This entry records only its repository, not the path inside it, so there is no exact command to give. Open alonw0/cc-metrics and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Cc Metrics does

A Grafana dashboard for Claude Code otel metrics (dockerized).

Alternatives in Development

  • HTML Report — /html-report - Generate Application Tracker Dashboard 36.6k ★
  • Triage PRs — Classify all open PRs by module, review state, scope, and architectural impact — produces a prioritized triage 12.6k ★
  • Metrics Dashboard — Define product metrics dashboard with sources and alert thresholds 7.8k ★

README

Claude Code Metrics Dashboard

A comprehensive monitoring stack for tracking Claude Code usage metrics, costs, and performance using OpenTelemetry, Prometheus, and Grafana.

Based on the [Sealos blog post](https://sealos.io/blog/claude-code-metrics).

Features

  • Real-time Metrics Tracking: Monitor Claude Code sessions, token usage, costs, commits, and more
  • Comprehensive Dashboard: 20+ panels showing key metrics, efficiency gauges, trends, and distributions
  • Cost Analysis: Track costs by model, session, and time period
  • Cache Efficiency Monitoring: Visualize prompt caching effectiveness
  • Productivity Insights: Measure CLI vs user active time ratios
  • Auto-provisioning: Dashboard and datasources automatically configured on startup

Architecture

Claude Code
    ↓ (OTLP HTTP/gRPC - metrics + logs)
OpenTelemetry Collector (:4318/:4317)
    ├─→ Prometheus metrics (:8889)
    │       ↓
    │   Prometheus (:9090)
    └─→ JSON logs (file)
            ↓
        Promtail
            ↓
        Loki (:3100)
            ↓ (PromQL + LogQL queries)
        Grafana (:3000)
            ↓ (Dashboard visualization)
        Your Browser

Metrics Tracked

  • Sessions: Total Claude Code session starts
  • Tokens: Usage by type (input, output, cache_read, cache_creation) and model
  • Costs: Estimated USD costs with per-model breakdown
  • Code Changes: Lines added/removed from accepted edits
  • Git Activity: Commits and pull requests created
  • Edit Decisions: Accept/reject choices on code suggestions
  • Active Time: User input time vs CLI processing time
  • Prompt Length: Average character count of user prompts (via Loki logs)

Prerequisites

  • Docker and Docker Compose
  • Claude Code CLI

Quick Start

1. Clone or Download This Repository

cd cc-metrics

2. Set Up Data Directories

make setup

Or manually:

mkdir -p data/prometheus data/grafana data/loki data/otel-logs
chmod