DataDog / dogstatsd-csharp-client

A DogStatsD client for C#/.NET
datadoghq.com
Other
94 stars 62 forks source link

How to check if connectivity to Datadog is good #184

Open tjpeel opened 2 years ago

tjpeel commented 2 years ago

Is there a way to check connectivity to Datadog is good based on the configuration settings?

Having something like this would be useful to include in things like health checks so I can determine if things like custom metrics are being sent. Beyond the Configure call, if say the DD port is wrong, I do not know if connectivity is broken.

I see PR https://github.com/DataDog/dogstatsd-csharp-client/pull/183 has been added recently. This goes some of the way to being able to identify problems.

However, does anything exist today other than manually wiring up a UDP connection and testing out of band of the client? Not withstanding UDP being connectionless.

tjpeel commented 2 years ago

Perhaps something using ITelemetryCounters and Environment.TickCount64 would suffice in warning if nothing has been sent.

ogaca-dd commented 2 years ago

Hello @tjpeel,

In case of a network issue, when using UDP, Socket.SendTo doesn't throw an exception and the number of bytes sent to the socket is the same as the number of bytes to send (At least based on my tests). I suggest using unix domain socket if it is possible for you. When a packet cannot be sent, the telemetry datadog.dogstatsd.client.packets_dropped is incremented.