Skip to content

Commit

Permalink
Fixes issue #887: Sort histogram bounds before validation (#888)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Turchenko <aleksandr.turchenko@lightspeedhq.com>
  • Loading branch information
turchenkoalex authored Nov 2, 2023
1 parent e9a0468 commit c4dc833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ private Unit convertUnit(Collector.MetricFamilySamples samples) {

private ClassicHistogramBuckets makeBuckets(Map<Double, Long> cumulativeBuckets) {
List<Double> upperBounds = new ArrayList<>(cumulativeBuckets.size());
Collections.sort(upperBounds);
upperBounds.addAll(cumulativeBuckets.keySet());
Collections.sort(upperBounds);
ClassicHistogramBuckets.Builder result = ClassicHistogramBuckets.builder();
long previousCount = 0L;
for (Double upperBound : upperBounds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testHistogramComplete() throws IOException, InterruptedException {
.name("response_size_bytes")
.help("response size in Bytes")
.labelNames("status")
.buckets(64, 256)
.buckets(64, 256, 512.1)
.register(origRegistry);
histogram.labels("200").observeWithExemplar(38, "trace_id", "1", "span_id", "2");
histogram.labels("200").observeWithExemplar(127, "trace_id", "3", "span_id", "4");
Expand Down

0 comments on commit c4dc833

Please sign in to comment.