dpm-finder — скилл для Claude Code: что делает и как установить
Скилл помогает найти метрики Prometheus с наибольшим числом точек в минуту в Grafana Cloud и выявить причины растущих расходов на мониторинг.
npx skills add grafana/skills --skill dpm-finder -a claude-codeЧто делает dpm-finder
Скилл обучает агента работе с CLI-утилитой dpm-finder от команды Grafana Professional Services. Инструмент ранжирует метрики Prometheus по показателю Data Points per Minute (DPM) и показывает разбивку по комбинациям лейблов. Это позволяет отследить источники высокой кардинальности и рассчитать затраты через флаг --cost-per-1000-series.
Для запуска требуются Python 3.9+ и API-токен с областью доступа metrics:read. В качестве имени пользователя Prometheus обязательно передаётся числовой идентификатор стека Grafana Cloud. Без него авторизация завершится с ошибкой 401. Утилита поддерживает выгрузку отчёта в JSON и умеет отдавать данные в режиме Prometheus-экспортёра. При сканировании нескольких стеков автор рекомендует ограничиться тремя одновременными процессами, чтобы не вызвать блокировку по лимитам запросов.
Какие задачи решает
- найти метрики с наибольшим расходом DPM в Grafana Cloud
- локализовать связки лейблов с высокой кардинальностью
- рассчитать расходы на серии метрик через параметры тарификации
- сравнить кардинальность до и после внедрения правил агрегации
Примеры запросов агенту
- Найди метрики, которые создают больше всего DPM в моём стеке Grafana Cloud.
- Запусти dpm-finder и покажи топ-10 самых дорогих метрик с разбивкой по лейблам.
- Просканируй Prometheus эндпоинт и выгрузи метрики с DPM выше 2.0 в JSON.
Как установить dpm-finder
1Через Skills CLI (Vercel)
npx skills add grafana/skills --skill dpm-finder -a claude-code2Вручную: положить файлы
~/.claude/skills/dpm-finder/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/dpm-finder/
1Через Skills CLI (Vercel)
npx skills add grafana/skills --skill dpm-finder -a codex2Вручную: положить файлы
.agents/skills/dpm-finder/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add grafana/skills --skill dpm-finder -a cursor2Вручную: положить файлы
.cursor/skills/dpm-finder/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install grafana/skills dpm-finder2Вручную: положить файлы
.github/skills/dpm-finder/SKILL.md1Через Skills CLI (Vercel)
npx skills add grafana/skills --skill dpm-finder -a gemini-cli2Командой платформы
gemini skills install https://github.com/grafana/skills --path skills/grafana-cloud/dpm-finderВручную: положить файлы
.devin/skills/dpm-finder/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add grafana/skills --skill dpm-finder -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о dpm-finder
Как установить dpm-finder в Claude Code?
Выполните команду npx skills add grafana/skills --skill dpm-finder -a claude-code.
Что делает скилл dpm-finder?
Он направляет агента при анализе метрик Prometheus в Grafana Cloud, ранжируя их по числу точек данных в минуту (DPM) и комбинациям лейблов.
Что делать при ошибках 401 или 403 при сканировании?
Проверьте права API-ключа: для него требуется скоуп metrics:read. Также убедитесь, что в качестве логина указан именно числовой ID стека.
Исходный текст
SKILL.md · Apache-2.0
---
name: dpm-finder
license: Apache-2.0
description: Find the Prometheus metrics that drive your Grafana Cloud bill. `dpm-finder` is a Grafana Professional Services CLI that ranks metrics by Data Points per Minute (DPM) with per-label-set breakdown, optional `--cost-per-1000-series` pricing, and a Prometheus-exporter mode. Use when investigating high Grafana Cloud spend, hunting noisy / high-cardinality metrics, comparing pre/post recording-rule cardinality, or feeding cost data into dashboards — even when the user says "why is my Mimir bill so high?", "find the biggest metrics", "cardinality offenders", or "optimize Prometheus cost" without naming dpm-finder.
---
# dpm-finder
Grafana PS tool ranking Prometheus metrics by DPM with per-series breakdown. Source: https://github.com/grafana-ps/dpm-finder
## Prerequisites
- Python 3.9+
- A Grafana Cloud Prometheus endpoint URL + numeric stack ID + API key (`glc_…`, `metrics:read` scope)
## Common Workflows
### One-shot analysis (most common)
```bash
# 1. Clone + venv + install
git clone https://github.com/grafana-ps/dpm-finder.git
cd dpm-finder
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# 2. Configure creds — copy .env_example → .env and fill in:
# PROMETHEUS_ENDPOINT https://prometheus-<cluster_slug>.grafana.net (NOTHING after .net)
# PROMETHEUS_USERNAME <numeric stack id>
# PROMETHEUS_API_KEY glc_…
# 3. Verify creds before scanning — should return >0 series count
curl -s -u "$PROMETHEUS_USERNAME:$PROMETHEUS_API_KEY" \
"$PROMETHEUS_ENDPOINT/api/v1/label/__name__/values" | jq '.data | length'
# 4. Run the scan (10-min lookback, 2.0 DPM minimum, top output)
./dpm-finder.py -f json -m 2.0 -t 8 --timeout 120 -l 10
# 5. Read the result — top 10 metrics by DPM
jq -r '.metrics | sort_by(-.dpm) | .[:10][] | "\(.dpm)\t\(.series_count)\t\(.metric_name)"' metric_rates.json
```
If step 5 is empty, lower `-m` or confirm the endpoint URL has no trailing path after `.net`.
### Discover stack details with `gcx`
If [gcx](https://github.com/grafana/gcx) is installed it can derive the endpoint + username:
```bash
gcx config check # active stack context
gcx config list-contexts # all configured stacks
gcx config view # full config with endpoints
```
The Prometheus endpoint pattern is `https://prometheus-{cluster_slug}.grafana.net`. Username is the numeric stack ID.
Without gcx: look up in the Grafana Cloud portal, or query `grafanacloud_instance_info{name=~"STACK_NAME.*"}` on the usage datasource.
### Multi-stack runs
Limit to **max 3 concurrent** runs to avoid GCloud rate limits. Batch the stacks and wait for each batch before the next.
## Interpreting results
- **DPM** = max data points per minute across that metric's series
- **series_count** = active time-series count for that metric
- **series_detail[]** (JSON / text only) = per-label-combination DPM breakdown — use this to spot the offending label
- Sort by DPM descending → noisiest metrics; combine with `--cost-per-1000-series` to prioritize by spend
## Troubleshooting
- **401 / 403** — API key invalid or missing `metrics:read`; confirm `PROMETHEUS_USERNAME` is the numeric stack ID
- **Timeouts** — bump `--timeout` to 120+ for stacks with thousands of metrics
- **HTTP 422** — metric has aggregation rules; tool warns + skips automatically
- **Empty results** — lower `-m`; verify endpoint has no trailing path
- **Connection errors** — exponential backoff retries up to 10 times; persistent failure usually = network/firewall
## References
- [`references/cli.md`](references/cli.md) — full flag reference, output-format details, exporter mode, Docker invocation, auto-exclusion rules, retry behavior
## Resources
- [dpm-finder GitHub](https://github.com/grafana-ps/dpm-finder)
- [gcx](https://github.com/grafana/gcx)
© grafana · Apache-2.0 · grafana/skills