The computation of the utilization is similar to the computation of the time spent by a user but with an expression evaluating to 1 when at least one user is online (using the bool modifier):sum(mc_player_online) > bool 0这变成了(过去一个小时):This become (over the last hour):avg_over_time((sum(mc_player_online) > bool 0)[1h:]) * 86400请注意,此表达式需要支持 subquery 的 Prometheus 版本(version >= 2.7).如果您的 Prometheus 较旧,您可以使用录制规则.Note that this expression requires Prometheus version which supports subquery (version >= 2.7). If your Prometheus is older, you can make do with recording rules. 这篇关于测量时间指标高于阈值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 00:27