From 1d4e10b1e4fc9e3379313a8e87791ccfd4dac149 Mon Sep 17 00:00:00 2001 From: ChristineTChen Date: Sun, 4 Aug 2019 18:50:09 -0400 Subject: [PATCH] Handle timeout backward compatibility default_timeout --- fluentd/datadog_checks/fluentd/fluentd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fluentd/datadog_checks/fluentd/fluentd.py b/fluentd/datadog_checks/fluentd/fluentd.py index 6ef1f62cbbe30..26858b1ce300c 100644 --- a/fluentd/datadog_checks/fluentd/fluentd.py +++ b/fluentd/datadog_checks/fluentd/fluentd.py @@ -18,7 +18,14 @@ class Fluentd(AgentCheck): def __init__(self, name, init_config, instances): super(Fluentd, self).__init__(name, init_config, instances) - self.default_timeout = init_config.get('default_timeout', self.DEFAULT_TIMEOUT) + if not ('read_timeout' in self.instance or 'connect_timeout' in self.instance): + # `default_timeout` config option will be removed with Agent 5 + self.http.options['timeout'] = ( + self.instance.get('timeout') + or self.init_config.get('timeout') + or self.init_config.get('default_timeout') + or self.DEFAULT_TIMEOUT + ) """Tracks basic fluentd metrics via the monitor_agent plugin * number of retry_count