Tuesday, 3 June 2025

Arithmetic Operations on Vectors in Prometheus

In Prometheus, when you apply an arithmetic operator (such as +, -, *, /) to a vector, the operation is applied to each time series within that vector individually.

For example, the metric node_cpu_seconds_total return the seconds the CPUs spent in each mode.

 


node_cpu_seconds_total + 10000

In this example, node_cpu_seconds_total is a vector that may contain multiple time series (one for each CPU core, mode, instance, etc.). When you add 10000 to this vector, Prometheus adds 10000 to each time series value independently.


 

Here, Arithmetic operations with a scalar (like 10000) apply the operation element-wise to all series in the vector.


Previous                                                    Next                                                    Home

No comments:

Post a Comment