Class: Nexaas::QueueTime::DogStatsd

Inherits:
Object
  • Object
show all
Defined in:
lib/nexaas/queue_time/dogstatsd.rb

Class Method Summary collapse

Class Method Details

.timing(metric_name, metric, options = {}) ⇒ Object

By default, Datadog::Statsd opens a UDP connection with a given host and port. Instead, we are giving it a socket path so it communicates with the statsd server via UDS.

This approach is easier to setup in containerized environments since all it requires is the path to the socket file instead of the host address.

UDS also performs better than UDP, although the app would need to receive huge traffic to actually feel the difference.



16
17
18
19
20
# File 'lib/nexaas/queue_time/dogstatsd.rb', line 16

def self.timing(metric_name, metric, options = {})
  Datadog::Statsd.open(nil, nil, socket_path: '/var/run/datadog/dsd.socket') do |statsd|
    statsd.timing(metric_name, metric, options)
  end
end