- First steps with Prometheus
- The Beginner’s Handbook to PromQL
1. Aggregation Operators
Function | Description | Example |
---|---|---|
|
Sums values for time series across a dimension. |
|
|
Calculates the average. |
|
|
Finds the minimum value. |
|
|
Finds the maximum value. |
|
|
Counts the number of series. |
|
|
Standard deviation of values. |
|
|
Variance of values. |
|
|
Top |
|
|
Bottom |
|
|
Counts occurrences of values and groups them. |
|
2. Rate & Time Functions
Function | Description | Example |
---|---|---|
|
Calculates per-second average rate of increase for counters over a time window. |
|
|
Instantaneous rate of increase (based on the latest two samples). |
|
|
Total increase of a counter in the specified time range. |
|
|
Calculates difference between first and last value in range. |
|
|
Computes the per-second derivative. |
|
|
Predicts the value of a gauge in the future based on linear regression. |
|
3. Time-Series Transformation
Function | Description | Example |
---|---|---|
|
Returns the absolute value of a series. |
|
|
Limits the maximum value. |
|
|
Limits the minimum value. |
|
|
Rounds values up to the nearest integer. |
|
|
Rounds values down to the nearest integer. |
|
|
Rounds values to the nearest integer or step. |
|
|
Sorts series by value (ascending). |
|
|
Sorts series by value (descending). |
|
4. Time Functions
Function | Description | Example |
---|---|---|
|
Returns the current time as a Unix timestamp (seconds). |
|
|
Returns the timestamp of the sample. |
|
5. Vector Matching & Filtering
Operator | Description | Example |
---|---|---|
|
Shifts the time series in the past by a duration. |
|
|
Ignores certain labels in vector matching. |
|
|
Keeps only specified labels for vector matching. |
|
|
Allows many-to-one matching. |
|
|
Allows one-to-many matching. |
|
6. String and Label Functions
Function | Description | Example |
---|---|---|
|
Replaces or creates a label. |
|
|
Joins label values into a single string. |
|
7. Special Functions
Function | Description | Example |
---|---|---|
|
Converts a scalar into a time series. |
|
|
Converts a time series into a scalar. |
|
|
Compares values as a boolean ( |
|
8. Instant Vectors & Range Vectors
Type | Description | Example |
---|---|---|
Instant Vector |
Single value per time series at a point in time. |
|
Range Vector |
Set of values over time for a series. |
|
9. Scalar Arithmetic
Operator | Description | Example |
---|---|---|
|
Basic arithmetic. |
|
|
Modulo operator. |
|
|
Exponentiation. |
|
10. Comparison Operators
Operator | Description | Example |
---|---|---|
|
Equal to. |
|
|
Not equal to. |
|
|
Greater than. |
|
|
Less than. |
|
|
Greater than or equal. |
|
|
Less than or equal. |
|