Bugfixes
--------
- /options/query-case-randomization: respect this even on TCP issues (!1732)
+- prometheus metrics: make the latency histogram cumulative (!1731, GH#117)
Knot Resolver 6.0.15 (2025-07-17)
# response latency histogram
bucket_names_in_resolver = ("1ms", "10ms", "50ms", "100ms", "250ms", "500ms", "1000ms", "1500ms", "slow")
bucket_names_in_prometheus = ("0.001", "0.01", "0.05", "0.1", "0.25", "0.5", "1.0", "1.5", "+Inf")
+
+ # add smaller bucket counts
+ def _bucket_count(answer: Dict[str, int], duration: str) -> int:
+ index = bucket_names_in_resolver.index(duration)
+ return sum([int(answer[bucket_names_in_resolver[i]]) for i in range(index + 1)])
+
yield _histogram(
"resolver_response_latency",
"Time it takes to respond to queries in seconds",
label=("instance_id", sid),
buckets=[
- (bnp, metrics["answer"][f"{duration}"])
+ (bnp, _bucket_count(metrics["answer"], duration))
for bnp, duration in zip(bucket_names_in_prometheus, bucket_names_in_resolver)
],
sum_value=metrics["answer"]["sum_ms"] / 1_000,