From de9bb0af5b10065ec2e470a333d42f4000ed103d Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Mon, 17 Oct 2022 16:50:32 -0700 Subject: [PATCH] Fix a potential precision loss on integer in ReservoirCellIndexFor --- .../sdk/metrics/exemplar/histogram_exemplar_reservoir.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h index f15665de33..5469bee8da 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h @@ -55,12 +55,12 @@ class HistogramExemplarReservoir : public FixedSizeExemplarReservoir const MetricAttributes & /* attributes */, const opentelemetry::context::Context & /* context */) override { - int max_size = boundaries_.size(); - for (int i = 0; i < max_size; ++i) + size_t max_size = boundaries_.size(); + for (size_t i = 0; i < max_size; ++i) { if (value <= boundaries_[i]) { - return i; + return static_cast(i); } } return -1;