DataDog / datadog-go

go dogstatsd client library for datadog
MIT License
353 stars 132 forks source link

How do I check for errors sending packets? #248

Closed MichaelSnowden closed 2 years ago

MichaelSnowden commented 2 years ago

I see that send errors are stored in the sender.metrics field in a SenderMetrics struct, but I don't know how to access it. I was hoping the FlushTelemetryMetrics would provide something, but it doesn't seem to contain errors sending packets.

MichaelSnowden commented 2 years ago

Basically, I see t hat they're recorded and sent to the server with this format: https://docs.datadoghq.com/developers/dogstatsd/high_throughput/?code-lang=go#client-side-telemetry

But how do I monitor them from within my Go app?

hush-hush commented 2 years ago

Hi @MichaelSnowden,

The GetTelemetry method is there for this https://pkg.go.dev/github.com/DataDog/datadog-go/v5/statsd#Client.GetTelemetry.

It will return this struct, TotalPayloadsDroppedWriter or TotalPayloadsDropped should be what you are looking for.

hush-hush commented 2 years ago

Hi @MichaelSnowden,

I'm going to close this issue. Feel free to reopen it if needed.