InfluxDB-自时间序列中的最后一个数据点以来的查询毫秒数 [英] InfluxDB - Query milliseconds since last data point in a time series
问题描述
是否可以编写一个InfluxDB查询,该查询将提供自时间序列中最后一个条目以来的毫秒数?我想在Grafana中添加一个单一状态面板,以显示数据的年代.
Is it possible to write a InfluxDB query that will give me the number of milliseconds since the last entry in a time series? I'd like to add a single-stat panel in Grafana displaying how old the data is.
推荐答案
我认为这是不可能的,因为您无法单独查询时间.一个influxdb查询在查询中至少需要一个非时间字段.您可以通过在可以单独查询的额外字段中节省两次时间来解决此问题.
I don't think it is possible since you are not able to query the time alone. A influxdb query needs at least one non-time field in a query. You could workaround that by double saving the time in a extra field which you are able to query alone.
但是您仍然想使用now() - "the extra time field"
.但是据我发现,您也不能在grafana中使用now()
.
But you still want to use now() - "the extra time field"
. But as far as I found out you also can't use now()
inside grafana.
更新:在grafanas github上现在有一个[Feature-Request].确保对其投票,以便有一天实现: https://github.com/grafana /grafana/issues/6710
Update: there is a [Feature-Request] now on grafanas github. Make sure to vote it up so it gets implemented one day: https://github.com/grafana/grafana/issues/6710
Update 2: The feature got finaly implemented -> See my answer here: How to show "33 minutes ago" on Grafana dashboard with InfluxDB?
这篇关于InfluxDB-自时间序列中的最后一个数据点以来的查询毫秒数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!