Skip to content

Commit

Permalink
Fix issues found in code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vastin committed Jun 7, 2023
1 parent a68897a commit c9d2821
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions exporter/awsemfexporter/datapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,11 @@ func (dps histogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentati
}

// CalculateDeltaDatapoints retrieves the ExponentialHistogramDataPoint at the given index.
func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(i int, instrumentationScopeName string, detailedMetrics bool) ([]dataPoint, bool) {
metric := dps.ExponentialHistogramDataPointSlice.At(i)
func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(idx int, instrumentationScopeName string, detailedMetrics bool) ([]dataPoint, bool) {
metric := dps.ExponentialHistogramDataPointSlice.At(idx)

scale := metric.Scale()
base := math.Pow(2, math.Pow(2, float64(-scale)))
datapoints := []dataPoint{}
arrayValues := []float64{}
arrayCounts := []float64{}
var bucketBegin float64
Expand Down Expand Up @@ -232,9 +231,8 @@ func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(i int, in
}
}

MetricName := dps.metricName
datapoints = append(datapoints, dataPoint{
name: MetricName,
return []dataPoint{{
name: dps.metricName,
value: &cWMetricHistogram{
Values: arrayValues,
Counts: arrayCounts,
Expand All @@ -245,9 +243,7 @@ func (dps exponentialHistogramDataPointSlice) CalculateDeltaDatapoints(i int, in
},
labels: createLabels(metric.Attributes(), instrumentationScopeName),
timestampMs: unixNanoToMilliseconds(metric.Timestamp()),
})

return datapoints, true
}}, true
}

// CalculateDeltaDatapoints retrieves the SummaryDataPoint at the given index and perform calculation with sum and count while retain the quantile value.
Expand Down

0 comments on commit c9d2821

Please sign in to comment.