temperature is a gauge that returns some unique values {10,23,50...} for labels node_id,system_id with values {"1","1"},{"2","1"},{"1","2"},{"2","2"}.
I am trying to get top 100 node_id and system_id with highest temperature and per-second derivative over the 5m lookbehind window.
topk(100, temperature)[5m] , on(node_id, system_id) group_left() deriv(temperature[5m])
Sample Output
| node_id | system_id| temperature| rate of change|
+---------+----------+------------+---------------+
| 1 | 1 | 40 | 0.2 |
+---------+----------+------------+---------------+
| 2 | 2 | 30 | 0 |
+---------+----------+------------+---------------+
| 3 | 3 | 20 | 0 |
+---------+----------+------------+---------------+
| 4 | 4 | 10 | 1 |
+---------+----------+------------+---------------+
.....
Not exactly what I want to get but I tried this
with (
top_nodes = topk(100, temperature[5m]) by (node_id)
)
(
label_set(label_del(top_nodes,"__name__"),"metric","top-100")
)
or
(
label_set(deriv(temperature[5m]),"metric", "deriv") and on(node_id) top_nodes
)
any suggestions ?
temperature is a gauge that returns some unique values {10,23,50...} for labels node_id,system_id with values {"1","1"},{"2","1"},{"1","2"},{"2","2"}.
I am trying to get top 100 node_id and system_id with highest temperature and per-second derivative over the 5m lookbehind window.
topk(100, temperature)[5m] , on(node_id, system_id) group_left() deriv(temperature[5m])
Sample Output
| node_id | system_id| temperature| rate of change|
+---------+----------+------------+---------------+
| 1 | 1 | 40 | 0.2 |
+---------+----------+------------+---------------+
| 2 | 2 | 30 | 0 |
+---------+----------+------------+---------------+
| 3 | 3 | 20 | 0 |
+---------+----------+------------+---------------+
| 4 | 4 | 10 | 1 |
+---------+----------+------------+---------------+
.....
Not exactly what I want to get but I tried this
with (
top_nodes = topk(100, temperature[5m]) by (node_id)
)
(
label_set(label_del(top_nodes,"__name__"),"metric","top-100")
)
or
(
label_set(deriv(temperature[5m]),"metric", "deriv") and on(node_id) top_nodes
)
any suggestions ?
VictoriaMetrics querying API could return only one value per time series, so you can't have highest temperature and its derivative within one query. It should be two separate queries.