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"})
本文暂时没有评论,来添加一个吧(●'◡'●)