'Prometheus unit test histogram
Hi I'm trying to write an alert and some unit tests for a histogram with response times. However I am not able to pass the test. Not sure if the expr is incorrect or the way I generate the data for the test.
I have the following alert exp:
- alert: InstanceDown
expr: histogram_quantile(0.5 sum(rate(http_latency_bucket[5m])) by(le)) > 1000
for: 5m
labels:
severity: page
annotations:
summary: "Instance {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
And the following test:
evaluation_interval: 1m
tests:
# Test 1.
- interval: 1m
# Series data.
input_series:
- series: 'http_latency_bucket{le="100"}'
values: '0+0x15'
- series: 'http_latency_bucket{le="1200"}'
values: '1+0x15'
- series: 'http_latency_bucket{le="+Inf"}'
values: '1+0x15'
I would expect the mean latency to be higher than 1000 with the input series. However, the test fails.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
