From d9f8bcec4b983b2764f5852d8cfb6049ce4c59fd Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Tue, 18 Oct 2022 09:41:59 -0700 Subject: [PATCH] Fix a potential precision loss on integer in ReservoirCellIndexFor (#1696) --- .../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;