From 8baa474f07650481a633960500902bdd12b57972 Mon Sep 17 00:00:00 2001 From: Shaun Remekie Date: Thu, 11 Jul 2024 14:20:46 +0200 Subject: [PATCH] fixed typos --- .../func_convert_exponential_hist_to_explicit_hist.go | 11 +++++++---- ..._convert_exponential_hist_to_explicit_hist_test.go | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist.go b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist.go index d2b79a499ca9..d010a0be04ba 100644 --- a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist.go +++ b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist.go @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + package metrics import ( @@ -92,23 +95,23 @@ func convertExponentialHistToExplicitHist(explicitBounds []float64) (ottl.ExprFu // - At this point we know that the upper bound represents the highest value that can be in this bucket, so we take the // upper bound and compare it to each of the explicit boundaries provided by the user until we find a boundary // that fits, that is, the first instance where upper bound <= explicit boundary. -func calculateBucketCounts(dp pmetric.ExponentialHistogramDataPoint, bounderies []float64) []uint64 { +func calculateBucketCounts(dp pmetric.ExponentialHistogramDataPoint, boundaries []float64) []uint64 { scale := int(dp.Scale()) factor := math.Ldexp(math.Ln2, -scale) posB := dp.Positive().BucketCounts() - bucketCounts := make([]uint64, len(bounderies)+1) // +1 for the overflow bucket + bucketCounts := make([]uint64, len(boundaries)+1) // +1 for the overflow bucket for pos := 0; pos < posB.Len(); pos++ { index := dp.Positive().Offset() + int32(pos) upper := math.Exp(float64(index+1) * factor) count := posB.At(pos) - for j, boundary := range bounderies { + for j, boundary := range boundaries { if upper <= boundary { bucketCounts[j] += count break } - if j == len(bounderies)-1 { + if j == len(boundaries)-1 { bucketCounts[j+1] += count // Overflow bucket } } diff --git a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go index d14cd761f1cb..ad642dce9542 100644 --- a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go +++ b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_explicit_hist_test.go @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + package metrics import (