我有以下查询,返回最后一个(2m)值
SELECT last("value") FROM "ROB" WHERE ("resource" = 'MY-SYS' AND "desc" = 'total-physical-utilization') AND $timeFilter GROUP BY time(2m), "label" fill(0) ORDER BY time DESC LIMIT 1
当前由24个序列组成,是否有可能仅返回按降序排列的前10个最后一个(2m)值?
数据组成如下:
值是时间和价值 标签是resource,desc和label
我认为可以使用辅食来做到这一点?所以我尝试过:
SELECT top("value",label,5) FROM (SELECT last("value") FROM "ROB" WHERE ("resource" = 'MY-SYS' AND "desc" = 'total-physical-utilization') AND $timeFilter GROUP BY time(2m), "label" fill(0) ORDER BY time DESC LIMIT 1)
但是此子查询错误必须按与查询本身相同的方向排序-再次卡住:(
谢谢
答案 0 :(得分:1)
这实际上是使用Flux解决的完美方法-Flux是InlfuxDB的新查询语言。您可以下载/安装InfluxDB,Chronograf和Flux的夜间版本,并进行尝试。
dg