promql

Generate, validate, and optimize PromQL queries for Prometheus and Grafana Cloud Metrics.

5|Updated Apr 29, 2023
One-click install
npx skills add https://github.com/n4vysh/dotfiles --skill promql-n4vysh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: promql
Source: https://github.com/n4vysh/dotfiles/tree/main/home/dot_agents/skills/promql
Command: npx skills add https://github.com/n4vysh/dotfiles --skill promql-n4vysh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write, validate, and optimise PromQL queries for Prometheus and Grafana Cloud Metrics. Users need to craft accurate metrics queries for dashboards, alerts, and ad-hoc analysis, with correct rate/increase semantics, label aggregations, and histogram quantiles.

Core Features & Use Cases

  • Generate instant and range vector queries using PromQL syntax, including rate(), increase(), sum by, and histogram_quantile.
  • Validate syntax and semantics, explain results, and suggest optimizations for long-lived dashboards and high-cardinality label sets.
  • Use cases include building dashboards, alert rules, and performance debugging across multi-service time-series data.

Quick Start

Ask me to generate a PromQL expression for a metric over a specified window, and I will return the corresponding query.

Frequently Asked Questions about promql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a PromQL query to calculate the rate of a Prometheus metric?

To calculate the PromQL rate of a Prometheus metric, you use the rate() function with a range vector selector, specifying the metric name and time window, such as rate(http_requests_total[5m]). This Skill generates and validates the correct syntax for your specific use case.

What is the best way to compute histogram quantiles in PromQL for Grafana dashboards?

Computing histogram quantiles in PromQL requires the histogram_quantile() function applied to the summed bucket boundaries of your metric. This Skill generates optimized histogram_quantile queries and suggests best practices for long-lived Grafana dashboards.

Can I aggregate time-series data across specific labels in a PromQL query?

Yes, you can aggregate time-series data across specific labels in PromQL using the sum by or avg by clauses. This Skill generates label aggregation queries and helps validate syntax to avoid high-cardinality label issues in Prometheus.

Why does my PromQL query return empty results when using the increase function?

A PromQL increase function query returns empty results if the metric name, label matchers, or range vector time window are incorrect. This Skill validates input assumptions and explains semantic errors to debug time-series queries.

Does this Skill work with Grafana Cloud Metrics or only self-hosted Prometheus?

This Skill works with both self-hosted Prometheus and Grafana Cloud Metrics, generating and validating PromQL queries for time-series data. It supports tasks like computing rates, aggregations, and histogram quantiles across multi-service environments.

When should I create recording rules for Prometheus metrics instead of using instant queries?

You should create recording rules for Prometheus metrics when you need to pre-compute heavy or frequently used expressions for dashboards and alerts. This Skill helps generate optimized recording rules to reduce query load and improve dashboard performance.