Class: Fluent::DatadogOutput::DatadogClient
- Inherits:
-
Object
- Object
- Fluent::DatadogOutput::DatadogClient
show all
- Defined in:
- lib/fluent/plugin/out_datadog.rb
Overview
Top level class for datadog transport clients, managing retries and backoff
Instance Method Summary
collapse
Instance Method Details
#close ⇒ Object
311
312
313
|
# File 'lib/fluent/plugin/out_datadog.rb', line 311
def close
raise NotImplementedError, "Datadog transport client should implement the close method"
end
|
#send(payload) ⇒ Object
307
308
309
|
# File 'lib/fluent/plugin/out_datadog.rb', line 307
def send(payload)
raise NotImplementedError, "Datadog transport client should implement the send method"
end
|
#send_retries(payload, max_retries, max_backoff) ⇒ Object
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
# File 'lib/fluent/plugin/out_datadog.rb', line 291
def send_retries(payload, max_retries, max_backoff)
backoff = 1
retries = 0
begin
send(payload)
rescue RetryableError => e
if retries < max_retries || max_retries < 0
@logger.warn("Retrying ", :exception => e, :backtrace => e.backtrace)
sleep backoff
backoff = 2 * backoff unless backoff > max_backoff
retries += 1
retry
end
end
end
|