如何从Prometheus查询API延迟错误预算
我有一个普罗米修斯柱状图,如何从Prometheus查询API延迟错误预算,prometheus,Prometheus,我有一个普罗米修斯柱状图,api\u response\u duration\u seconds,其中的SLO定义为 histogram_quantile(0.95, sum(increase(api_response_duration_seconds_bucket[1m])) by (le)) <= 0.5 histogram\u quantile(0.95,sum(增加(api\u response\u duration\u seconds\u bucket[1m])到(le))所以
api\u response\u duration\u seconds
,其中的SLO定义为
histogram_quantile(0.95, sum(increase(api_response_duration_seconds_bucket[1m])) by (le)) <= 0.5
histogram\u quantile(0.95,sum(增加(api\u response\u duration\u seconds\u bucket[1m])到(le))所以这里的秘密是我想把一个范围向量转换成一个范围向量。这个
因此,需要做的是:
groups:
- name: SLOs
- rules:
- record: slo:api_response_duration_seconds:failing
expr: histogram_quantile(0.95, sum(increase(api_response_duration_seconds_bucket[1m])) by (le)) > 0.5
- record: slo:api_response_duration_seconds:all
expr: histogram_quantile(0.95, sum(increase(api_response_duration_seconds_bucket[1m])) by (le))
然后按如下方式查询错误预算:
count_over_time(slo:api_response_duration_seconds:failing[28d])
/
count_over_time(slo:api_response_duration_seconds:all[28d])