grafana - 在grafan中将图表重置为0
问题描述
下面是我在 grafana 中的图表:
我的问题是,如果我选择的时间范围是 5 分钟,则图表不会仅显示过去 5 分钟内发生的情况。所以在图片中,过去 5 分钟内没有发生任何事情,所以它只是显示了它所拥有的最后一点。如果没有任何变化,我该如何更改它以使其恢复为零?如果相关的话,我正在为此使用 Prometheus 计数器。
解决方案
As explained in the Prometheus documentation, a counter value in itself is not of much use. It depends on when your job was last restarted and everything that happened since.
What's interesting about a counter is how much it changed over some period of time. I.e. either the average rate of change per second (e.g. 3 queries per second) or the increase over some time range (e.g. 10K queries in the last hour).
So instead of graphing something like e.g. http_requests
, you should graph rate(http_requests[1m])
(the averate number of requests over the previous 1 minute) or increase(http_requests[1h])
(the total number of requests over the past hour). You can play with the range size until you get something which makes sense for your data. But make sure to use a range at least 2x your scrape interval (and ideally more, as Prometheus is somewhat daft in the way it computes rates/increases).
推荐阅读
- html - 如何更改整个部分的背景?我应该在哪个班级使用?
- reactjs - 为什么 this.props 在 handleLogin 方法中未定义?
- laravel - 文件上传总是在 laravel 中返回 NULL
- html - 页脚图层不显示
- php - 在 Woocommerce 电子邮件通知中将产品名称替换为 SKU
- javascript - 有没有办法从 StackEdits 工具栏中删除 StackEdit 按钮?
- regex - 在 Go 正则表达式中拆分浮点字符串
- python - 如何在第 1 类中更改第 2 类(Tkinter)中的小部件(标签)的属性?
- python - objects.filter by User 只为一个用户过滤数据
- ios - 为什么安装 Stripe pod 并在代码目标 c 中使用 Stripe 后出现 pod 错误?