diff --git a/ext/test/zpages/tracez_data_aggregator_test.cc b/ext/test/zpages/tracez_data_aggregator_test.cc index 1a1cc92dcc5..78812e22b34 100644 --- a/ext/test/zpages/tracez_data_aggregator_test.cc +++ b/ext/test/zpages/tracez_data_aggregator_test.cc @@ -60,14 +60,14 @@ void VerifySpanCountsInTracezData( << " Count of running spans incorrect for " << span_name << "\n"; EXPECT_EQ(aggregated_data.sample_running_spans.size(), - std::min(running_span_count, kMaxNumberOfSampleSpans)) + std::min(running_span_count, kMaxNumberOfSampleSpans)) << " Size of sample running spans incorrect for " << span_name << "\n"; EXPECT_EQ(aggregated_data.error_span_count, error_span_count) << " Count of error spans incorrect for " << span_name << "\n"; EXPECT_EQ(aggregated_data.sample_error_spans.size(), - std::min(error_span_count, kMaxNumberOfSampleSpans)) + std::min(error_span_count, kMaxNumberOfSampleSpans)) << " Count of running spans incorrect for " << span_name << "\n"; for (unsigned int boundary = 0; boundary < kLatencyBoundaries.size(); boundary++) @@ -77,8 +77,8 @@ void VerifySpanCountsInTracezData( << " Count of completed spans in latency boundary " << boundary << " incorrect for " << span_name << "\n"; EXPECT_EQ(aggregated_data.sample_latency_spans[boundary].size(), - std::min(completed_span_count_per_latency_bucket[boundary], - kMaxNumberOfSampleSpans)) + std::min(completed_span_count_per_latency_bucket[boundary], + kMaxNumberOfSampleSpans)) << " Count of sample completed spans in latency boundary " << boundary << " incorrect for " << span_name << "\n"; } diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h b/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h index 617d320570a..9f0545d9936 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregator/sketch_aggregator.h @@ -72,7 +72,7 @@ class SketchAggregator final : public Aggregator } else { - idx = ceil(log(val) / log(gamma)); + idx = static_cast(ceil(log(val) / log(gamma))); } if (raw_.find(idx) != raw_.end()) { diff --git a/sdk/test/trace/probability_sampler_test.cc b/sdk/test/trace/probability_sampler_test.cc index 5062fb3b3a1..f7afd573986 100644 --- a/sdk/test/trace/probability_sampler_test.cc +++ b/sdk/test/trace/probability_sampler_test.cc @@ -138,7 +138,9 @@ TEST(ProbabilitySampler, ShouldSampleWithContext) TEST(ProbabilitySampler, ProbabilitySamplerHalf) { double probability = 0.5; - int iterations = 100000, expected_count = iterations * probability, variance = iterations * 0.01; + int iterations = 100000; + int expected_count = static_cast(iterations * probability); + int variance = static_cast(iterations * 0.01); SpanContext c(true, true); ProbabilitySampler s(probability); @@ -152,7 +154,9 @@ TEST(ProbabilitySampler, ProbabilitySamplerHalf) TEST(ProbabilitySampler, ProbabilitySamplerOnePercent) { double probability = 0.01; - int iterations = 100000, expected_count = iterations * probability, variance = iterations * 0.01; + int iterations = 100000; + int expected_count = static_cast(iterations * probability); + int variance = static_cast(iterations * 0.01); SpanContext c(true, true); ProbabilitySampler s(probability); @@ -166,7 +170,8 @@ TEST(ProbabilitySampler, ProbabilitySamplerOnePercent) TEST(ProbabilitySampler, ProbabilitySamplerAll) { double probability = 1.0; - int iterations = 100000, expected_count = iterations * probability; + int iterations = 100000; + int expected_count = static_cast(iterations * probability); SpanContext c(true, true); ProbabilitySampler s(probability); @@ -179,7 +184,8 @@ TEST(ProbabilitySampler, ProbabilitySamplerAll) TEST(ProbabilitySampler, ProbabilitySamplerNone) { double probability = 0.0; - int iterations = 100000, expected_count = iterations * probability; + int iterations = 100000; + int expected_count = static_cast(iterations * probability); SpanContext c(true, true); ProbabilitySampler s(probability);