我正在尝试实现一些看起来很简单的事情,但我无法使其发挥作用。
示例代码:
static final Counter requests = Counter.build()
.namespace("sniffer")
.name("requests_total")
.labelNames("device","method","client","path","status")
.help("Total Requests.")
.register();
public void process(){
//... some code
requests.labels(device,httpMethod, client, path, status).inc();
}
我需要绘制一个图表,其中包含按客户端分组的一段时间内的总请求数。
那么,我有指标 sniffer_requests_total
,我必须构建哪个查询才能实现我需要的图表?
我在 /graph
控制台上尝试了各种查询,我想我需要这样的东西:
rate(sniffer_requests_total[1m]) by (client)
-> 但这是一个无效的查询,因为我不能将 by
与 rate< 一起使用
.
最佳答案
按(客户端)求和(速率(sniffer_requests_total[1m])
关于java - 简单的 Prometheus 计数器查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46919757/