From b06997af5947d9cf185b6f49a5733e02b8e5c451 Mon Sep 17 00:00:00 2001 From: Xavier Vello Date: Wed, 17 May 2017 12:04:32 +0200 Subject: [PATCH] silently drop packets on socket timeout this mimics UDP behaviour for unix socket implementation --- datadog/dogstatsd/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datadog/dogstatsd/base.py b/datadog/dogstatsd/base.py index 1d39b5b99..8c72e089b 100644 --- a/datadog/dogstatsd/base.py +++ b/datadog/dogstatsd/base.py @@ -282,6 +282,9 @@ def _send_to_server(self, packet): try: # If set, use socket directly (self.socket or self.get_socket()).send(packet.encode(self.encoding)) + except socket.timeout: + # dogstatsd is overflowing, drop the packets (mimicks the UDP behaviour) + return except socket.error: log.info("Error submitting packet, will try refreshing the socket")