Prometheus度量中的吞吐量计算来自post_seconds_count、post_seconds_sum和pos



我试图在Grafana中为不同的API(java应用程序(构建仪表板。我们开始使用这些依赖关系将度量导出到Prometheus。

val prometheus_scdw = "io.prometheus" % "simpleclient_dropwizard" % "0.0.23"
val prometheus_schs = "io.prometheus" % "simpleclient_hotspot" % "0.9.0"
val prometheus_scg = "io.prometheus" % "simpleclient_guava" % "0.9.0"
Metrics which we can see in exporter is like this( just for example): 
# HELP controllers_autouserprofilecontroller_autologin_post_seconds_max  
# TYPE controllers_autouserprofilecontroller_autologin_post_seconds_max gauge
controllers_autouserprofilecontroller_autologin_post_seconds_max 0.075604753
# HELP controllers_autouserprofilecontroller_autologin_post_seconds  
# TYPE controllers_autouserprofilecontroller_autologin_post_seconds summary
controllers_autouserprofilecontroller_autologin_post_seconds_count 2529959.0
controllers_autouserprofilecontroller_autologin_post_seconds_sum 80214.121718928

我试着在GitHub中查看,以了解他们说count、sum或max的确切含义,但我没有找到任何解释。按照这些词的标准定义,比如count是请求中断,sum是服务请求所花费的时间,max是服务请求的最高时间。

仍然想问是否有更好的方法或媒介来理解这些指标。

我还使用http_request_total的吞吐量查询来匹配ALB监控中不匹配的请求计数。使用的查询:sum(increase(http_request_total[1m]))

这里有我遗漏的东西吗?或者小比例的不匹配是可以接受的。

我的目标是为API性能构建一种仪表板,因为目前我们正在为所有API导出提到的度量类型。

controllers_autouserprofilecontroller_autologin_post_seconds_count度量是一个计数器,用于统计一段时间内的请求数。因此,可以通过将rate((应用于controllers_autouserprofilecontroller_autologin_post_seconds_count:来计算平均RPS

rate(controllers_autouserprofilecontroller_autologin_post_seconds_count[5m])

[5m]是一个查找窗口,在这种情况下为5分钟,用于计算平均RPS。请参阅这些文档中允许的持续时间。

过去5分钟的平均请求持续时间可以通过以下查询计算:

increase(controllers_autouserprofilecontroller_autologin_post_seconds_sum[5m])
/
increase(controllers_autouserprofilecontroller_autologin_post_seconds_count[5m])

它使用increase((函数来计算过去5分钟内的计数器增量。

最新更新