DataDog / datadogpy

The Datadog Python library
https://datadoghq.com/
Other
609 stars 303 forks source link

Add blocking socket mode and background sender #787

Closed vickenty closed 11 months ago

vickenty commented 1 year ago

What does this PR do?

Add options to improve dogstatsd packet deliverability.

Description of the Change

Allow dogstatsd socket to be used in a blocking mode with a timeout. This improves our chances to send the packet if the socket queue is full (e.g. after a burst in packets).

Add a background thread to handle the writes, with a queue to act as a buffer.

Together, this allows users to reduce dropped packets to zero while maintaining low latency for the user application, at the cost of higher cpu and memory usage.

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)