专业的编程技术博客社区

网站首页 > 博客文章 正文

Prometheus指标收集方式(prometheus value)

baijin 2024-08-17 10:42:23 博客文章 3 ℃ 0 评论

1. 两个URL:

http://localhost:9090/api/v1/query?query=<指标名字>

http://localhost:9090/metrics

2. 方法:参考https://istio.io/latest/zh/docs/tasks/observability/metrics/querying-metrics/

指标名字可以相当灵活,如:

请求productpage总次数:

istio_requests_total{destination_service="productpage.default.svc.cluster.local"}

请求reviews服务v3版本的次数:

istio_requests_total{destination_service="reviews.default.svc.cluster.local", destination_version="v3"}

过去5分钟请求productpage服务的总次数

istio_requests_total{destination_service=~"productpage.*", response_code="200"}[5m]

过去5分钟请求productpage服务的速率

rate(istio_requests_total{destination_service=~"productpage.*", response_code="200"}[5m])

上面的这些,都可以作为指标名字传给query参数


3. 支持的语法:Prometheus查询语法

https://prometheus.io/docs/prometheus/latest/querying/basics/

Prometheus查询过去一段时间的数据,间隔是15s

返回向量个数: count(istio_requests_total{destination_app="productpage", response_code="200"})

返回向量中value字段的和: sum(istio_requests_total{destination_app="productpage", response_code="200"})


4. 更多指标:node_exporter可以收集更多机器指标

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表