BentoML
BentoML copied to clipboard
fix: order Prometheus histogram metrics correctly
What does this PR address?
Prometheus histograms must list every _bucket before their _count and _sum.
Out-of-order output breaks parsers like fluent-bit.
This patch guarantees the correct order for all BentoML histogram metrics.
Changes
-
PrometheusClient- Add
_fix_histogram_ordering()- Sorts buckets by
le, then appends_count,_sum. - Transparent in single- and multi-process modes..
- Sorts buckets by
- Add
Checklist
- [x] Conventional commit title.
- [x]
pre-commit run -apasses. - [x] No doc updates needed.
- [x] Tests run.
Fixes #5386
What caused us to have to use this dirty method to fix it? How does it produce output in wrong order?