From edcaa144f8982b63f7c378a5ead8345f1c841ede Mon Sep 17 00:00:00 2001 From: Shaun Remekie Date: Sun, 30 Jun 2024 12:37:04 +0100 Subject: [PATCH] removed commented code --- ...nvert_exponential_hist_to_bucketed_hist.go | 42 +------------------ 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_bucketed_hist.go b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_bucketed_hist.go index b9d96b63dda8..f3463e707dfd 100644 --- a/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_bucketed_hist.go +++ b/processor/transformprocessor/internal/metrics/func_convert_exponential_hist_to_bucketed_hist.go @@ -37,6 +37,8 @@ func convertExponentialHistToBucketedHist(explicitBounds []float64) (ottl.ExprFu return func(_ context.Context, tCtx ottlmetric.TransformContext) (any, error) { metric := tCtx.GetMetric() + + // only execute on exponential histograms if metric.Type() != pmetric.MetricTypeExponentialHistogram { return nil, nil } @@ -73,46 +75,6 @@ func convertExponentialHistToBucketedHist(explicitBounds []float64) (ottl.ExprFu }, nil } -// calculateBucketCounts calculates the bucket counts for the given exponential histogram data point -// func calculateBucketCounts(dp pmetric.ExponentialHistogramDataPoint, boundaries []float64) []uint64 { -// t := time.Now() -// fmt.Println("calculateBucketCounts called!", t) -// defer func() { fmt.Println("calculateBucketCounts returned!", time.Since(t)) }() -// bucketCounts := make([]uint64, len(boundaries)+1) // +1 for the overflow bucket -// scale := dp.Scale() -// currentValue := 1 << scale // 2^scale - -// fmt.Println("scale:", scale) -// fmt.Println("currentValue:", currentValue) -// fmt.Println("len of positive buckets:", dp.Positive().BucketCounts().Len()) - -// // Positive buckets -// for i := 0; i < int(dp.Positive().BucketCounts().Len()); i++ { -// // for _, count := range dataPoint.Positive().BucketCounts() { -// lowerBound := currentValue -// upperBound := currentValue*2 - 1 -// count := dp.Positive().BucketCounts().At(i) - -// fmt.Println(lowerBound, upperBound, count) - -// for value := lowerBound; value <= upperBound; value++ { -// for i, bound := range boundaries { -// if float64(value) <= bound { -// bucketCounts[i] += count -// break -// } -// if i == len(boundaries)-1 { -// bucketCounts[i+1] += count // Overflow bucket -// } -// } -// } - -// currentValue <<= 1 // Multiply by 2 for the next range -// } - -// return bucketCounts -// } - func calculateBucketCounts(dp pmetric.ExponentialHistogramDataPoint, boundaries []float64) []uint64 { bucketCounts := make([]uint64, len(boundaries)+1) // +1 for the overflow bucket scale := dp.Scale()