简体   繁体   English

两个数据点之间的Grafana差异

[英]Grafana difference between two datapoints

In a Graphana dashboard with several datapoints, how can I get the difference between the last value and the previouse one for the same metric? 在具有多个数据点的Graphana仪表板中,如何获得同一度量的最后一个值和上一个值之间的差异? Perhaps the tricky part is that the tiem between 2 datapoins for the same metric is not know. 可能最棘手的部分是,对于同一度量标准,两个数据点之间的关系是未知的。

so the desired result is the <metric>.$current_value - <metric>.$previouse_value for each point in the metricstring. 因此所需的结果是metricstring中每个点的<metric>.$current_value - <metric>.$previouse_value

Edit: The metrics are stored in graphite/Carbon DB. 编辑:度量标准存储在石墨/碳DB中。

thanks 谢谢

You need to use the derivative function 您需要使用导数函数

This is the opposite of the integral function. 这与积分功能相反。 This is useful for taking a running total metric and calculating the delta between subsequent data points. 这对于获取运行中的总指标并计算后续数据点之间的增量很有用。

This function does not normalize for periods of time, as a true derivative would. 该函数不会像真正的导数那样在一段时间内进行标准化。 Instead see the perSecond() function to calculate a rate of change over time. 相反,请查看perSecond()函数以计算随时间的变化率。

Together with the keepLastValue 连同keepLastValue

Takes one metric or a wildcard seriesList, and optionally a limit to the number of 'None' values to skip over. 接受一个指标或通配符seriesList,并可选地限制“ None”值的数量以跳过。

Continues the line with the last received value when gaps ('None' values) appear in your data, rather than breaking your line. 当数据中出现间隔(“无”值)时,以上一个接收到的值继续行,而不是中断行。

Like this 像这样

derivative(keepLastValue(your_mteric))

A good example can be found here http://www.perehospital.cat/blog/graphite-getting-derivative-to-work-with-empty-data-points 一个很好的例子可以在这里找到http://www.perehospital.cat/blog/graphite-getting-derivative-to-work-with-empty-data-points

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM