Skip to content

Commit

Permalink
chore: fix metadata length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Juraj Michalek committed Nov 19, 2023
1 parent c47cea6 commit a05570c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ func OtelMetricsToMetadata(md pmetric.Metrics, addMetricSuffixes bool) []*prompb

metadataLength := 0
for i := 0; i < resourceMetricsSlice.Len(); i++ {
metadataLength += resourceMetricsSlice.At(i).ScopeMetrics().Len()
scopeMetricsSlice := resourceMetricsSlice.At(i).ScopeMetrics()
for j := 0; j < scopeMetricsSlice.Len(); j++ {
metadataLength += scopeMetricsSlice.At(j).Metrics().Len()
}
}

var metadata = make([]*prompb.MetricMetadata, 0, metadataLength)
for i := 0; i < resourceMetricsSlice.Len(); i++ {
resourceMetrics := resourceMetricsSlice.At(i)
Expand Down

0 comments on commit a05570c

Please sign in to comment.