stats icon indicating copy to clipboard operation
stats copied to clipboard

Add Datadog UDS support

Open sebcante opened this issue 5 years ago • 2 comments

Goal

Adds Support for connecting to datadog via Unix Domain socket (UDS) instead of UDP

Why

UDS could be useful :

* Bypassing the networking stack brings a significant performance improvement for high traffic.
* While UDP has no error handling, UDS allows the Agent to detect dropped packets and connection errors, while still allowing a non-blocking use.
* DogStatsD can detect the container from which metrics originated and tag those metrics accordingly.

Taken from https://docs.datadoghq.com/developers/dogstatsd/unix_socket/?tab=host ^

Usage to connect to unixgram socket instead of udp

client := NewClient("unixgram:///dir/filename.sock") // unixgram

instead of

client := NewClient("localhost:8125") // udp

What

I hope this PR could be useful, completely open for feedbacks to align this PR to the conventions/style of this library. I gave it a first shot. I inlined comments/questions

Credit

Datadog official client lib , i inspired a lot the code from it.

sebcante avatar Sep 14 '20 07:09 sebcante

is it possible to get someone to review this at all?

tony-assembly avatar May 06 '21 03:05 tony-assembly

We have been using UDS support in production (this PR) for more than 6 months at mx51 it definitely helped us to better manage datadog agent maintenance and go apps reconnecting automatically to it. Something that UDP caused us trouble in the past. @achille-roussel any thoughts if this contribution could be merged ?

sebcante avatar May 06 '21 06:05 sebcante