站长网 系统 怎样使用 Prometheus 仪表化应用

怎样使用 Prometheus 仪表化应用

我们已经很清楚 Prometheus 是如何抓取监控指标的了,Prometheus 通过一个 HTTP 请求抓取监控目标,默认请求的端点名是 /metrics。监控目标通过发送每个被跟踪的时间序列单个样本,以及样本的指标名称、标签集合和样本值来响应每个指标的当前状态。抓取到数

我们已经很清楚 Prometheus 是如何抓取监控指标的了,Prometheus 通过一个 HTTP 请求抓取监控目标,默认请求的端点名是 /metrics。

 

监控目标通过发送每个被跟踪的时间序列单个样本,以及样本的指标名称、标签集合和样本值来响应每个指标的当前状态。抓取到数据后 Prometheus 会存储每个样本,并为其添加一个服务器端的时间戳,从而从单个抓取构建成一组时间序列。

 

此外我们再回顾下获取的监控指标格式:

 

# HELP http_requests_total The total number of HTTP requests. 

# TYPE http_requests_total counter 

http_requests_total{method="post",code="200"} 1027 

http_requests_total{method="post",code="400"}    3 

 

# HELP process_open_fds Number of open file descriptors. 

# TYPE process_open_fds gauge 

process_open_fds 15 

 

# HELP http_request_duration_seconds A histogram of the request duration. 

# TYPE http_request_duration_seconds histogram 

http_request_duration_seconds_bucket{le="0.05"} 24054 

http_request_duration_seconds_bucket{le="0.1"} 33444 

http_request_duration_seconds_bucket{le="0.2"} 100392 

http_request_duration_seconds_bucket{le="0.5"} 129389 

http_request_duration_seconds_bucket{le="1"} 133988 

http_request_duration_seconds_bucket{le="+Inf"} 144320 

http_request_duration_seconds_sum 53423 

http_request_duration_seconds_count 144320 

 

# HELP rpc_duration_seconds A summary of RPC durations in seconds. 

# TYPE rpc_duration_seconds summary 

rpc_duration_seconds{quantile="0.01"} 3.102 

rpc_duration_seconds{quantile="0.05"} 3.272 

rpc_duration_seconds{quantile="0.5"} 4.773 

rpc_duration_seconds{quantile="0.9"} 9.001 

rpc_duration_seconds{quantile="0.99"} 76.656 

rpc_duration_seconds_sum 5.7560473e+04 

rpc_duration_seconds_count 2693 

抓取目标只会暴露当前访问的值,而不会暴露它所跟踪数据所有的历史指标,指标中的每一行(注释除外)就是一个时间序列的样本,每个序列在同一个抓取中只能出现一次,所以,仪表化应用只需要在内存中跟踪其指标的当前状态即可,不需要跟踪或缓存任何历史指标状态。

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/fuwuqi/xt/2021/1029/16977.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部