Agent skill
grafana-billing
Query Prometheus and Loki billing metrics from Grafana. Use when discussing observability costs, active series, ingestion rates, storage usage, or cardinality analysis.
Install this agent skill to your Project
npx add-skill https://github.com/nodnarbnitram/claude-code-extensions/tree/main/.claude/skills/grafana-billing
SKILL.md
Grafana Billing Metrics Skill
Query key billing metrics from Prometheus and Loki through Grafana's data source proxy API.
Quick Start
# Query both staging and prod (default)
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py
# Query specific environment
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py --env staging
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py --env prod
# JSON output for automation
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py --json
# Filter to specific service
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py --service prometheus
uv run .claude/skills/grafana-billing/scripts/billing_metrics.py --service loki
Environment Variables Required
GRAFANA_STAGING_API_KEY- API key for staging Grafana workspaceGRAFANA_PROD_API_KEY- API key for prod Grafana workspace
Key Metrics Captured
Prometheus
| Metric | Description |
|---|---|
| Active Time Series | Current count of active series (billing dimension) |
| Samples/sec | Ingestion rate (DPM = samples/sec * 60) |
| TSDB Storage | On-disk storage bytes |
| Top Cardinality | Top 10 metrics by series count |
Loki
| Metric | Description |
|---|---|
| Ingestion Rate | GB/day being ingested |
| Total Bytes | Cumulative bytes received |
| Active Streams | Number of active log streams |
| Memory Chunks | Chunks held in memory |
When to Use
Use this skill when the user asks about:
- Observability billing or costs
- Active time series counts
- Prometheus cardinality analysis
- Loki ingestion rates
- Storage usage for metrics or logs
- Comparing staging vs production usage
Instructions for Claude
- Run the billing metrics script to gather current data
- Present the results in a clear, formatted way
- Highlight any concerning metrics (high cardinality, rapid growth)
- Compare staging vs prod if both are queried
- Suggest cost optimization if metrics are unusually high
Critical Rules
- Always check that API keys are set before running
- Use
--jsonflag when you need to process the output programmatically - Default to querying both environments for comparison
- Handle errors gracefully - missing data sources should not crash the script
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
skill-skeleton
ha-automation
Create and debug Home Assistant automations, scripts, blueprints, and Jinja2 templates. Use when working with triggers, conditions, actions, automation YAML, scripts, blueprints, or template expressions. Activates on keywords: automation, trigger, condition, action, blueprint, script, template, jinja2.
ha-addon
Develop Home Assistant add-ons with Docker, Supervisor API, and multi-arch builds. Use when creating add-ons, configuring Dockerfiles, setting up ingress, or publishing to repositories. Activates on keywords: add-on, addon, supervisor, hassio, ingress, bashio, docker.
cloudflare-vpc-services
Diagnose and create Cloudflare VPC Services for Workers to access private APIs in AWS, Azure, GCP, or on-premise networks. Use when troubleshooting dns_error, configuring cloudflared tunnels, setting up VPC service bindings, or routing Workers to internal services.
code-reviewer
Review code for best practices, security issues, and potential bugs. Use when reviewing code changes, checking PRs, analyzing code quality, or performing security audits.
ha-energy
Set up Home Assistant energy monitoring with dashboards, solar, grid, and device tracking. Use when configuring energy sensors, utility meters, statistics, or analyzing consumption. Activates on keywords: energy dashboard, solar, grid, consumption, kWh, utility meter, power monitoring, state_class, device_class: energy.
Didn't find tool you were looking for?