Skip to content

Commit

Permalink
otlp: Fix bug where resource attributes were added to wrong dps (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
benkeith-splunk authored Apr 27, 2023
1 parent 7c02344 commit e51069e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions protocol/otlp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ func SignalFxMetricsFromOTLPResourceMetrics(rms []*metricsv1.ResourceMetrics) []
var sfxDps []SignalFxMetric

for _, rm := range rms {
resourceAttrs := stringifyAttributes(rm.GetResource().GetAttributes())
for _, ilm := range rm.GetScopeMetrics() {
for _, m := range ilm.GetMetrics() {
sfxDps = append(sfxDps, SignalFxMetricsFromOTLPMetric(m)...)
newDps := SignalFxMetricsFromOTLPMetric(m)
for i := range newDps {
newDps[i].DP.Attributes = append(newDps[i].DP.Attributes, resourceAttrs...)
}
sfxDps = append(sfxDps, newDps...)
}
}

resourceAttrs := stringifyAttributes(rm.GetResource().GetAttributes())
for i := range sfxDps {
sfxDps[i].DP.Attributes = append(sfxDps[i].DP.Attributes, resourceAttrs...)
}
}

return sfxDps
Expand Down

0 comments on commit e51069e

Please sign in to comment.