PromQL (Prometheus Query Language) is used to query time series data in Prometheus. Here are some common types of PromQL queries:
-
Instant Vector Queries: These queries return the current value of a metric at a specific point in time. For example:
http_requests_total -
Range Vector Queries: These queries return a set of data points over a specified time range. For example:
http_requests_total[5m] -
Aggregation Queries: These queries aggregate data across multiple time series. Common aggregation functions include
sum,avg,max,min, andcount. For example:sum(http_requests_total) by (status) -
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]) -
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]) -
Filtering Queries: You can filter metrics based on labels. For example:
http_requests_total{method="GET"} -
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.
