What are common PromQL query types?

QuestionsQuestions8 SkillsProPromQL BasicsOct, 10 2025
0147

PromQL (Prometheus Query Language) is used to query time series data in Prometheus. Here are some common types of PromQL queries:

  1. Instant Vector Queries: These queries return the current value of a metric at a specific point in time. For example:

    http_requests_total
  2. Range Vector Queries: These queries return a set of data points over a specified time range. For example:

    http_requests_total[5m]
  3. Aggregation Queries: These queries aggregate data across multiple time series. Common aggregation functions include sum, avg, max, min, and count. For example:

    sum(http_requests_total) by (status)
  4. Rate Queries: These queries calculate the per-second average rate of increase of a counter over a specified time range. For example:

    rate(http_requests_total[5m])
  5. Subquery Queries: These allow you to perform calculations over a range of data points and can be nested. For example:

    sum(rate(http_requests_total[5m])[10m:1m])
  6. Filtering Queries: You can filter metrics based on labels. For example:

    http_requests_total{method="GET"}
  7. Join Queries: These queries can combine metrics with different labels using operations like +, -, *, and /. For example:

    http_requests_total + http_errors_total

These query types allow users to extract meaningful insights from time series data stored in Prometheus.

0 Comments

no data
Be the first to share your comment!