简单的普罗米修斯计数器查询
Simple Prometheus counters query
我正在尝试实现一些看起来很简单,但我无法实现的东西。
示例代码:
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
一起使用。
sum by (client)(rate(sniffer_requests_total[1m])
我正在尝试实现一些看起来很简单,但我无法实现的东西。
示例代码:
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
一起使用。
sum by (client)(rate(sniffer_requests_total[1m])