Previously, prometheus-adapter configuration wasn't taking into account the scrape interval of kubelet, node-exporter and windows-exporter leading to getting non fresh results, and even negative results from the CPU queries when the irate() function was extrapolating data. To fix that, we want to set the interval used in the irate() function in the CPU queries to 4x scrape interval in order to extrapolate data between the last two scrapes. This will improve the freshness of the cpu usage exposed and prevent incorrect extrapolations. Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
8 lines
285 B
Jsonnet
8 lines
285 B
Jsonnet
{
|
|
// rangeInterval takes a scrape interval and convert its to a range interval
|
|
// following Prometheus rule of thumb for rate() and irate().
|
|
rangeInterval(i='1m'):
|
|
local interval = std.parseInt(std.substr(i, 0, std.length(i) - 1));
|
|
interval * 4 + i[std.length(i) - 1],
|
|
}
|