v5.0.0 / 2021.04.07
API breaking changes
- This new major version uses automatic buffering with preemptive flushing, there is no need to manually batch the metrics together anymore. The preemptive flushing part means that just before the buffer gets full, a flush is triggered. Manual flush is still possible with the
Statsd#flushmethod. TheStatsd#batchmethod has been removed from the API. What would have been written this way with the v4 API:
require 'datadog/statsd'
statsd = Datadog::Statsd.new('127.0.0.1', 8125)
statsd.batch do |s|
s.increment('example_metric.increment', tags: ['environment:dev'])
s.gauge('example_metric.gauge', 123, tags: ['environment:dev'])
endshould be written this way with the v5 API:
require 'datadog/statsd'
statsd = Datadog::Statsd.new('127.0.0.1', 8125)
statsd.increment('example_metric.increment', tags: ['environment:dev'])
statsd.gauge('example_metric.gauge', 123, tags: ['environment:dev'])
# synchronous flush
statsd.flush(sync: true)Statsd#initializeparametermax_buffer_byteshas been renamed tobuffer_max_payload_sizefor consistency with the new automatic batch strategy. Please note the addition ofbuffer_max_pool_sizeto limit the maximum amount of messages to buffer.