promql🔗
Objects🔗
- AggregationExpr
- AggregationOp
- BinaryExpr
- BinaryOp
- Expr
- FuncCallExpr
- LabelMatchingOperator
- LabelSelector
- NumberLiteralExpr
- StringLiteralExpr
- SubqueryExpr
- UnaryExpr
- UnaryOp
- VectorExpr
Builders🔗
- AggregationExprBuilder
- BinaryExprBuilder
- FuncCallExprBuilder
- LabelSelectorBuilder
- NumberLiteralExprBuilder
- StringLiteralExprBuilder
- SubqueryExprBuilder
- UnaryExprBuilder
- VectorExprBuilder
Functions🔗
n🔗
Shortcut to turn a number into a NumberLiteralExpr expression.
s🔗
Shortcut to turn a string into a StringLiteralExpr expression.
subquery🔗
Creates a subquery.
Subquery allows you to run an instant query for a given range and resolution. The result of a subquery is a range vector.
See https://prometheus.io/docs/prometheus/latest/querying/basics/#subquery
sum🔗
Calculate sum over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
min🔗
Calculate minimum over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
max🔗
Calculate maximum over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
avg🔗
Calculate the average over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
group🔗
All values in the resulting vector are 1.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
stddev🔗
Calculate population standard deviation over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
stdvar🔗
Calculate population standard variance over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
count🔗
Count number of elements in the vector.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
quantile🔗
Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
countValues🔗
Count number of elements with the same value.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
bottomk🔗
Smallest k elements by sample value.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
topk🔗
Largest k elements by sample value.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
limitk🔗
Sample k elements.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
limitRatio🔗
Sample elements with approximately r ratio if r > 0, and the complement of such samples if r = -(1.0 - r).
See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
vector🔗
Returns the scalar s as a vector with no labels.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#vector
add🔗
Addition binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
sub🔗
Subtraction binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
mul🔗
Multiplication binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
div🔗
Division binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
mod🔗
Modulo binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
pow🔗
Power/exponentiation binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#arithmetic-binary-operators
eq🔗
"equal" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
neq🔗
"not-equal" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
gt🔗
"greater-than" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
lt🔗
"less-than" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
gte🔗
"greater-or-equal" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
lte🔗
"less-or-equal" comparison binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators
and🔗
"intersection" logical/set binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#logical-set-binary-operators
or🔗
"union" logical/set binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#logical-set-binary-operators
unless🔗
"complement" logical/set binary operator.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#logical-set-binary-operators
atan2🔗
Arc tangent binary operator. Works in radians.
Trigonometric operators allow trigonometric functions to be executed on two vectors using vector matching, which isn't available with normal functions.
They act in the same manner as arithmetic operators.
See https://prometheus.io/docs/prometheus/latest/querying/operators/#trigonometric-binary-operators
neg🔗
Negation unary operator.
id🔗
Identity unary operator.
abs🔗
Returns the input vector with all sample values converted to their absolute value.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#abs
absent🔗
Returns an empty vector if the vector passed to it has any elements (floats or native histograms) and a 1-element vector with the value 1 if the vector passed to it has no elements.
This is useful for alerting on when no time series exist for a given metric name and label combination.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#absent
absentOverTime🔗
Returns an empty vector if the range vector passed to it has any elements (floats or native histograms) and a 1-element vector with the value 1 if the range vector passed to it has no elements.
This is useful for alerting on when no time series exist for a given metric name and label combination for a certain amount of time.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#absent_over_time
ceil🔗
Rounds the sample values of all elements in v
up to the nearest integer value greater than or equal to v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#ceil
changes🔗
For each input time series, returns the number of times its value has changed within the provided time range as an instant vector.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#changes
clamp🔗
Clamps the sample values of all elements in v
to have a lower limit of min and an upper limit of max.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#clamp
clampMax🔗
Clamps the sample values of all elements in v
to have an upper limit of max
.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#clamp_max
clampMin🔗
Clamps the sample values of all elements in v
to have an lower limit of min
.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#clamp_min
dayOfMonth🔗
Returns the day of the month in UTC. Returned values are from 1 to 31.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_month
dayOfMonthFor🔗
Returns the day of the month for each of the given times in UTC. Returned values are from 1 to 31.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_month
dayOfWeek🔗
Returns the day of the week in UTC. Returned values are from 0 to 6, where 0 means Sunday etc.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_week
dayOfWeekFor🔗
Returns the day of the week for each of the given times in UTC. Returned values are from 0 to 6, where 0 means Sunday etc.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_week
dayOfYear🔗
Returns the day of the year in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_year
dayOfYearFor🔗
Returns the day of the year for each of the given times in UTC. Returned values are from 1 to 365 for non-leap years, and 1 to 366 in leap years.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#day_of_year
daysInMonth🔗
Returns the number of days in the month. Returned values are from 28 to 31.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#days_in_month
dayInMonthFor🔗
Returns the number of days in the month for each of the given times in UTC. Returned values are from 28 to 31.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#days_in_month
delta🔗
Calculates the difference between the first and last value of each time series element in a range vector, returning an instant vector with the given deltas and equivalent labels.
The delta is extrapolated to cover the full time range as specified in the range vector selector, so that it is possible to get a non-integer result even if the sample values are all integers.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#delta
deriv🔗
Calculates the per-second derivative of the time series in a range vector using simple linear regression.
The range vector must have at least two samples in order to perform the calculation. When +Inf or -Inf are found in the range vector, the slope and offset value calculated will be NaN.
deriv should only be used with gauges.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv
exp🔗
Calculates the exponential function for all elements in vector
See https://prometheus.io/docs/prometheus/latest/querying/functions/#exp
floor🔗
Rounds the sample values of all elements in v down to the nearest integer value smaller than or equal to v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#floor
histogramAvg🔗
Returns the arithmetic average of observed values stored in a native histogram. Samples that are not native histograms are ignored and do not show up in the returned vector.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_avg
histogramCount🔗
Returns the count of observations stored in a native histogram. Samples that are not native histograms are ignored and do not show up in the returned vector.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_count-and-histogram_sum
histogramSum🔗
Returns the sum of observations stored in a native histogram.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_count-and-histogram_sum
histogramFraction🔗
Returns the estimated fraction of observations between the provided lower and upper values. Samples that are not native histograms are ignored and do not show up in the returned vector.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_fraction
histogramQuantile🔗
Calculates the φ-quantile (0 ≤ φ ≤ 1) from a classic histogram or from a native histogram.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile
histogramStddev🔗
Returns the estimated standard deviation of observations in a native histogram, based on the geometric mean of the buckets where the observations lie.
Samples that are not native histograms are ignored and do not show up in the returned vector.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_stddev
histogramStdvar🔗
Returns the estimated standard variance of observations in a native histogram.
Samples that are not native histograms are ignored and do not show up in the returned vector.
Note: This function only acts on native histograms.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_stdvar
hour🔗
Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#hour
hourFor🔗
Returns the hour of the day for each of the given times in UTC. Returned values are from 0 to 23.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#hour
idelta🔗
Calculates the difference between the last two samples in the range vector v, returning an instant vector with the given deltas and equivalent labels.
idelta should only be used with gauges.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#idelta
increase🔗
Calculates the increase in the time series in the range vector
See https://prometheus.io/docs/prometheus/latest/querying/functions/#increase
irate🔗
Calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points.
irate should only be used when graphing volatile, fast-moving counters. Use rate for alerts and slow-moving counters, as brief changes in the rate can reset the FOR clause and graphs consisting entirely of rare spikes are hard to read.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#irate
labelReplace🔗
matches the regular expression regex against the value of the label src_label. If it matches, the value of the label dst_label in the returned timeseries will be the expansion of replacement, together with the original labels in the input. Capturing groups in the regular expression can be referenced with $1, $2, etc. Named capturing groups in the regular expression can be referenced with $name (where name is the capturing group name). If the regular expression doesn't match then the timeseries is returned unchanged.
label_replace acts on float and histogram samples in the same way.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#label_replace
labelReplace(v: cog.Builder<promql.Expr>, dst_label: string, replacement: string, src_label: string, regex: string)
ln🔗
Calculates the natural logarithm for all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#ln
log2🔗
Calculates the binary logarithm for all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#log2
log10🔗
Calculates the decimal logarithm for all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#log10
minute🔗
Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#minute
minuteFor🔗
Returns the minute of the hour for each of the given times in UTC. Returned values are from 0 to 59.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#minute
month🔗
Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#month
monthFor🔗
Returns the month of the year for each of the given times in UTC. Returned values are from 1 to 12, where 1 means January etc.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#month
predictLinear🔗
Predicts the value of time series t seconds from now, based on the range vector v, using simple linear regression. The range vector must have at least two samples in order to perform the calculation.
predict_linear should only be used with gauges.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear
rate🔗
Calculates the per-second average rate of increase of the time series in the range vector.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#rate
resets🔗
For each input time series, resets(v range-vector) returns the number of counter resets within the provided time range as an instant vector. Any decrease in the value between two consecutive float samples is interpreted as a counter reset. A reset in a native histogram is detected in a more complex way: Any decrease in any bucket, including the zero bucket, or in the count of observation constitutes a counter reset, but also the disappearance of any previously populated bucket, an increase in bucket resolution, or a decrease of the zero-bucket width.
resets
should only be used with counters and counter-like native histograms.
If the range vector contains a mix of float and histogram samples for the same series, counter resets are detected separately and their numbers added up. The change from a float to a histogram sample is not considered a counter reset. Each float sample is compared to the next float sample, and each histogram is compared to the next histogram.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#resets
round🔗
Rounds the sample values of all elements in v to the nearest integer. Ties are resolved by rounding up.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#round
roundTo🔗
Rounds the sample values of all elements in v to the nearest integer. Ties are resolved by rounding up.
The to_nearest argument allows specifying the nearest multiple to which the sample values should be rounded. This multiple may also be a fraction.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#round
scalar🔗
Given a single-element input vector, scalar() returns the sample value of that single element as a scalar.
If the input vector does not have exactly one element, scalar will return NaN.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#scalar
sgn🔗
Returns a vector with all sample values converted to their sign, defined as this: 1 if v is positive, -1 if v is negative and 0 if v is equal to zero.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#sgn
sort🔗
Returns vector elements sorted by their sample values, in ascending order. Native histograms are sorted by their sum of observations.
Note that sort only affects the results of instant queries, as range query results always have a fixed output ordering.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#sort
sortDesc🔗
Same as sort()
, but sorts in descending order.
Like sort, sort_desc only affects the results of instant queries, as range query results always have a fixed output ordering.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#sort_desc
sqrt🔗
Calculates the square root of all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#sqrt
time🔗
Returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#time
timestamp🔗
Returns the timestamp of each of the samples of the given vector as the number of seconds since January 1, 1970 UTC. It also works with histogram samples.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#timestamp
vect🔗
Returns the scalar s as a vector with no labels.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#vector
year🔗
Returns the year for each of the given times in UTC.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#year
yearFor🔗
Returns the year for each of the given times in UTC.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#year
avgOverTime🔗
Calculates average value of all points in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
minOverTime🔗
Calculates the minimum value of all points in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
maxOverTime🔗
Calculates the maximum value of all points in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
sumOverTime🔗
Calculates the sum of all values in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
countOverTime🔗
Calculates the count of all values in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
quantileOverTime🔗
Calculates the φ-quantile (0 ≤ φ ≤ 1) of the values in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
stddevOverTime🔗
Calculates the population standard deviation of the values in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
stdvarOverTime🔗
Calculates the population standard variance of the values in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
lastOverTime🔗
Returns the most recent point value in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
presentOverTime🔗
Returns the value 1 for any series in the specified interval.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#aggregation_over_time
acos🔗
Calculates the arccosine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
acosh🔗
Calculates the inverse hyperbolic cosine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
asin🔗
Calculates the arcsine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
asinh🔗
Calculates the inverse hyperbolic sine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
atan🔗
Calculates the arctangent of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
atanh🔗
Calculates the inverse hyperbolic tangent of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
cos🔗
Calculates the cosine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
cosh🔗
Calculates the hyperbolic cosine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
sin🔗
Calculates the sine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
sinh🔗
Calculates the hyperbolic sine of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
tan🔗
Calculates the tangent of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
tanh🔗
Calculates the hyperbolic tangent of all elements in v
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
deg🔗
Converts radians to degrees for all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
pi🔗
Returns pi.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions
rad🔗
Converts degrees to radians for all elements in v.
See https://prometheus.io/docs/prometheus/latest/querying/functions/#trigonometric-functions