open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.92k stars 2.28k forks source link

[receiver/statsd] Improve logging for better troubleshooting #23570

Closed marcsanmi closed 1 year ago

marcsanmi commented 1 year ago

Component(s)

receiver/statsd

Is your feature request related to a problem? Please describe.

The receiver's main aggregating process is failing silently. Was this a design choice? While troubleshooting why a metric wasn't being processed by the receiver, I had to manually modify the receiver to log the error in the collector. Here's the main culprit:

for {
  select {
  case <-ticker.C:
  // ...
  case metric := <-transferChan:
     _ = r.parser.Aggregate(metric.Raw, metric.Addr)
  case <-ctx.Done():
  // ...
  }
}

Describe the solution you'd like

Exposing these errors and making them accessible in the collector logs would be beneficial. For example, this could be accomplished by including them as a debug log.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 1 year ago

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

paologallinaharbur commented 1 year ago

Also r.Flush(batchCtx, batch.Metrics, r.nextConsumer) few lines above is failing silently

afzal442 commented 1 year ago

Look like good first issue, how I can approach this. thanks

marcsanmi commented 1 year ago

Sure, @afzal442, feel free to take this on.

If any aggregation or flushing error occurs, I would log the error using the OnDebugf function from the already defined Reporter interface. It might also be worth considering whether logging it as a warning would be more appropriate.

alexandreliberato commented 1 year ago

@afzal442 are you still working on this? If not I can tackle this issue. Thanks

afzal442 commented 1 year ago

Sorry @alexandreliberato! You can go ahead. I've got something else to cook off.

dmitryax commented 1 year ago

Closed by https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/24282