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
303
304
305
|
# File 'lib/fluent/plugin/out_datadog.rb', line 303
def close
raise NotImplementedError, "Datadog transport client should implement the close method"
end
|
#send(payload) ⇒ Object
299
300
301
|
# File 'lib/fluent/plugin/out_datadog.rb', line 299
def send(payload)
raise NotImplementedError, "Datadog transport client should implement the send method"
end
|
#send_retries(payload, max_retries, max_backoff) ⇒ Object
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
# File 'lib/fluent/plugin/out_datadog.rb', line 283
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
|