Agent Skillsgrafana/skills › dpm-finder

dpm-finder

GitHub

Grafana PS CLI工具,按每分钟数据点数(DPM)对Prometheus指标排序,辅助排查高云账单、识别高基数指标及优化成本。

skills/grafana-cloud/dpm-finder/SKILL.md grafana/skills

Trigger Scenarios

Grafana Cloud账单过高 查找最大消耗指标 识别基数异常指标 优化Prometheus成本

Install

npx skills add grafana/skills --skill dpm-finder -g -y
More Options

Non-standard path

npx skills add https://github.com/grafana/skills/tree/main/skills/grafana-cloud/dpm-finder -g -y

Use without installing

npx skills use grafana/skills@dpm-finder

指定 Agent (Claude Code)

npx skills add grafana/skills --skill dpm-finder -a claude-code -g -y

安装 repo 全部 skill

npx skills add grafana/skills --all -g -y

预览 repo 内 skill

npx skills add grafana/skills --list

SKILL.md

Frontmatter
{
    "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)

# 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 is installed it can derive the endpoint + username:

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 — full flag reference, output-format details, exporter mode, Docker invocation, auto-exclusion rules, retry behavior

Resources

Version History

  • b583762 Current 2026-07-06 00:35

Same Skill Collection

skills/grafana-app-sdk/admission-control/SKILL.md
skills/grafana-cloud/loki-label-analyzer/SKILL.md
skills/grafana-cloud/send-data/SKILL.md
skills/grafana-datasources/datasources-provisioning/SKILL.md
skills/grafana-lgtm/loki/SKILL.md
skills/grafana-lgtm/prometheus/SKILL.md
skills/grafana-plugins/audit-and-reduce-dependencies/SKILL.md
skills/grafana-plugins/check-npm/SKILL.md
template/SKILL.md
skills/grafana-app-sdk/app-sdk-concepts/SKILL.md
skills/grafana-app-sdk/cue-kind-definition/SKILL.md
skills/grafana-app-sdk/reconciler-logic/SKILL.md
skills/grafana-cloud/adaptive-metrics/SKILL.md
skills/grafana-cloud/admin/SKILL.md
skills/grafana-cloud/app-observability/SKILL.md
skills/grafana-cloud/assistant-mcp/SKILL.md
skills/grafana-cloud/cloud-integrations/SKILL.md
skills/grafana-cloud/cost-management/SKILL.md
skills/grafana-cloud/database-observability/SKILL.md
skills/grafana-cloud/fleet-management/SKILL.md
skills/grafana-cloud/infrastructure/SKILL.md
skills/grafana-cloud/ml-ai/SKILL.md
skills/grafana-cloud/oncall-irm/SKILL.md
skills/grafana-cloud/private-connectivity/SKILL.md
skills/grafana-cloud/prometheus-cardinality-troubleshooter/SKILL.md
skills/grafana-cloud/prometheus-label-strategy/SKILL.md
skills/grafana-cloud/synthetic-monitoring-checks/SKILL.md
skills/grafana-cloud/testing/SKILL.md
skills/grafana-core/alerting-irm/SKILL.md
skills/grafana-core/alloy/SKILL.md
skills/grafana-core/beyla/SKILL.md
skills/grafana-core/dashboarding/SKILL.md
skills/grafana-core/grafana-oss/SKILL.md
skills/grafana-core/opentelemetry/SKILL.md
skills/grafana-core/promql/SKILL.md
skills/grafana-core/skill-authoring/SKILL.md
skills/grafana-k6/k6-cloud-investigate-test/SKILL.md
skills/grafana-k6/k6-docs/SKILL.md
skills/grafana-k6/k6-manage/SKILL.md
skills/grafana-k6/k6-perf-test-website/SKILL.md
skills/grafana-k6/k6-test-maintenance/SKILL.md
skills/grafana-k6/k6-trend-analysis/SKILL.md
skills/grafana-k6/k6/SKILL.md
skills/grafana-lgtm/mimir/SKILL.md
skills/grafana-lgtm/pyroscope/SKILL.md
skills/grafana-lgtm/tempo/SKILL.md
skills/grafana-plugins/grafana-scenes/SKILL.md
skills/grafana-plugins/plugin-bundle-size/SKILL.md
skills/grafana-plugins/react-19-plugin-migration/SKILL.md

Metadata

Files
0
Version
80bb293
Hash
b7bc79fd
Indexed
2026-07-06 00:35

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-05 02:05
浙ICP备14020137号-1 $bản đồ khách truy cập$