用普罗米修斯和格拉法纳绘制慢速计数器 [英] Graphing slow counters with prometheus and grafana

查看:105
本文介绍了用普罗米修斯和格拉法纳绘制慢速计数器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们用sum(rate(my_counter_total[1m]))sum(irate(my_counter_total[20s]))绘制快速计数器的图形.如果您总是可以期望在最近几秒钟内发生更改,则最好选择第二个.

We graph fast counters with sum(rate(my_counter_total[1m])) or with sum(irate(my_counter_total[20s])). Where the second one is preferrable if you can always expect changes within the last couple of seconds.

但是您如何绘制慢速计数器的图表,在这种情况下,每两分钟甚至几小时只有一点增量?像0.0013232/s这样的值并不是很友好.

But how do you graph slow counters where you only have some increments every couple of minutes or even hours? Having values like 0.0013232/s is not very human friendly.

比方说,我想显示有多少用户注册我们的服务(我们希望每小时进行两次注册).什么是合理的查询?

Let's say I want to graph how many users sign up to our service (we expect a couple of signups per hour). What's a reasonable query?

我们目前使用以下内容在grafana中绘制图形:

We currently use the following to graph that in grafana:

  • 查询:3600 * sum(rate(signup_total[1h]))
  • 步骤:3600s
  • 分辨率:1/1

这合理吗?

我仍在尝试了解所有这些参数如何共同作用以绘制图形.有人可以解释grafana中的范围选择器([10m]),rate()irate()功能,StepResolution设置如何相互影响吗?

I'm still trying to understand how all those parameters play together to draw a graph. Can someone explain how the range selector ([10m]), the rate() and the irate() functions, the Step and Resolution settings in grafana influence each other?

推荐答案

这是正确的方法.您也可以使用increase()语法糖,以便以这种方式使用rate().

That's a correct way to do it. You can also use increase() which is syntactic sugar for using rate() that way.

有人可以解释范围选择器吗

Can someone explain how the range selector

这仅由Prometheus使用,并指示要处理的数据.

This is only used by Prometheus, and indicates what data to work over.

grafana中的步长"和分辨率"设置会相互影响吗?

the Step and Resolution settings in grafana influence each other?

这是在Grafana上使用的,它会影响从Prometheus请求的时间片.

This is used on the Grafana side, it affects how many time slices it'll request from Prometheus.

这些设置不会直接相互影响.但是,分辨率应该小于范围,否则您将采样不足并错过信息.

These settings do not directly influence each other. However the resolution should work out to be smaller than the range, or you'll be undersampling and miss information.

这篇关于用普罗米修斯和格拉法纳绘制慢速计数器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆