Skip to content

Commit

Permalink
Fix statsd receiver aggregate memtrics in various instruments.
Browse files Browse the repository at this point in the history
The receiver uses each metric's address as the key to create instruments,
but the port in the address of each metric is dynamically assigned.
This results in the StatsD receiver creating numerous instruments and
being unable to aggregate metrics together.

Fixes open-telemetry#29508, fixex open-telemetry#23809
  • Loading branch information
Charles hsu committed Dec 28, 2023
1 parent f714c7c commit 997af76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion receiver/statsdreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ func (r *statsdReceiver) Start(ctx context.Context, host component.Host) error {
}
}
case metric := <-transferChan:
if err := r.parser.Aggregate(metric.Raw, metric.Addr); err != nil {
addr, _ := net.ResolveIPAddr(r.config.NetAddr.Transport, r.config.NetAddr.Endpoint)
if err := r.parser.Aggregate(metric.Raw, addr); err != nil {
r.reporter.OnDebugf("Error aggregating metric", zap.Error(err))
}
case <-ctx.Done():
Expand Down

0 comments on commit 997af76

Please sign in to comment.