{"id":51611228,"url":"https://github.com/kuberocketci/claude-code-telemetry","last_synced_at":"2026-07-12T08:01:51.305Z","repository":{"id":370743880,"uuid":"1296454762","full_name":"KubeRocketCI/claude-code-telemetry","owner":"KubeRocketCI","description":"Self-hosted usage analytics for Claude Code via OpenTelemetry: tokens \u0026 cost by model, agent, skill, tool, and command — attributed to project, Jira epic, and story — on a Prometheus + Loki + Grafana stack. Ships a local Docker Compose testbed and a self-contained Kubernetes Helm bundle.","archived":false,"fork":false,"pushed_at":"2026-07-10T17:45:59.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-10T18:10:34.316Z","etag":null,"topics":["claude-code","cost-tracking","devops","grafana","helm","kubernetes","kuberocketai","kuberocketci","loki","observability","opentelemetry","otel","prometheus","telemetry","usage-analytics"],"latest_commit_sha":null,"homepage":"https://docs.kuberocketci.io","language":"Go Template","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KubeRocketCI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-10T12:01:17.000Z","updated_at":"2026-07-10T17:46:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/KubeRocketCI/claude-code-telemetry","commit_stats":null,"previous_names":["kuberocketci/claude-code-telemetry"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/KubeRocketCI/claude-code-telemetry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KubeRocketCI%2Fclaude-code-telemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KubeRocketCI%2Fclaude-code-telemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KubeRocketCI%2Fclaude-code-telemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KubeRocketCI%2Fclaude-code-telemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KubeRocketCI","download_url":"https://codeload.github.com/KubeRocketCI/claude-code-telemetry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KubeRocketCI%2Fclaude-code-telemetry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35385772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","cost-tracking","devops","grafana","helm","kubernetes","kuberocketai","kuberocketci","loki","observability","opentelemetry","otel","prometheus","telemetry","usage-analytics"],"created_at":"2026-07-12T08:01:45.865Z","updated_at":"2026-07-12T08:01:51.296Z","avatar_url":"https://github.com/KubeRocketCI.png","language":"Go Template","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude Code Telemetry\n\n![OpenTelemetry](https://img.shields.io/badge/OpenTelemetry-Collector-425CC7?logo=opentelemetry\u0026logoColor=white)\n![Prometheus](https://img.shields.io/badge/Prometheus-metrics-E6522C?logo=prometheus\u0026logoColor=white)\n![Loki](https://img.shields.io/badge/Loki-events-F5A800?logo=grafana\u0026logoColor=white)\n![Grafana](https://img.shields.io/badge/Grafana-dashboards-F46800?logo=grafana\u0026logoColor=white)\n![Helm](https://img.shields.io/badge/Helm-bundle-0F1689?logo=helm\u0026logoColor=white)\n![Docker Compose](https://img.shields.io/badge/Docker%20Compose-testbed-2496ED?logo=docker\u0026logoColor=white)\n\nSelf-hosted usage analytics for [Claude Code](https://code.claude.com), via OpenTelemetry.\n\n## Why this exists\n\nClaude Code emits rich OpenTelemetry metrics and events, but nothing to look at them with. This\nrepo is the missing back end: a small observability stack that answers **how many tokens and how\nmuch cost** — broken down by model, agent, skill, tool, command, and bash usage — and attributes\nit to business dimensions like `organization`, `project`, `jira.epic`, and `jira.story`.\n\nIt does this **without** capturing prompts, assistant responses, file contents, or raw API bodies.\nOnly aggregate counters and structured events cross the wire.\n\n## What's in the box\n\nA single pipeline — **OTel Collector → Prometheus (metrics) + Loki (events) → Grafana\n(dashboards)** — packaged two ways so the same config runs on a laptop and in a cluster.\n\n| Layer      | Role                                         |\n|------------|----------------------------------------------|\n| Collector  | OTLP ingest, attribution enrichment, fan-out |\n| Prometheus | token/cost metrics, low-cardinality labels   |\n| Loki       | high-cardinality events                      |\n| Grafana    | pre-built usage \u0026 cost dashboards            |\n\nEvery datapoint carries a `collector.env` attribute (`local-poc` vs `k8s`), so both flavors can\nsafely feed shared dashboards without mixing sources.\n\n## Use cases\n\n**1 · Local development** — run the docker-compose testbed on your machine, point Claude Code at\nit, and iterate on the collector pipeline and dashboards against real traffic.\n\n```bash\ncd local\ndocker compose up -d\n# merge local/claude-settings.snippet.json into ~/.claude/settings.json, restart Claude Code\n# open Grafana → \"Claude Code — Usage Audit\"\n```\n\n**2 · Team / Kubernetes** — deploy the Helm bundle to a cluster and let everyone push metrics and\nevents to one centralized stack.\n\n```bash\nhelm dependency update deploy-templates\nhelm install claude-code-telemetry deploy-templates \\\n  -n claude-code-telemetry --create-namespace\n```\n\nThe bundle is **deliberately isolated**: its Prometheus scrapes only this bundle's collector — no\ncluster-wide discovery, no cluster-monitoring extras (node-exporter, kube-state-metrics,\nalertmanager, pushgateway), namespace-scoped RBAC. Any component can be toggled off\n(`grafana.enabled`, `prometheus.enabled`, …) to wire parts into an existing observability stack.\n\n## Working on it\n\n`local/` is the **source of truth** you iterate on; `deploy-templates/` is the replication target.\nValidate a change locally, then port it to the Helm bundle and `helm lint` / `helm template`\nbefore releasing.\n\n| Artifact           | Iterate here (source of truth)    | Replicate to                                        |\n|--------------------|-----------------------------------|-----------------------------------------------------|\n| Collector pipeline | `local/otel-collector.yaml`       | `deploy-templates/values.yaml` → `alternateConfig`  |\n| Dashboards         | `local/grafana/dashboards/*.json` | `deploy-templates/config/grafana/dashboards/*.json` |\n\nSee [`docs/analytics.md`](docs/analytics.md) for the attribution model, cardinality guidance, and\nrollout plan, and [`spec/`](spec/) for the full Claude Code OTEL vocabulary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuberocketci%2Fclaude-code-telemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuberocketci%2Fclaude-code-telemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuberocketci%2Fclaude-code-telemetry/lists"}