module DogStatsd::Instrumentation::ClientProvider

Public Class Methods

new() click to toggle source
# File lib/dogstatsd/instrumentation/client_provider.rb, line 24
def self.new
  client = Datadog::Statsd.new(
    configuration.host,
    configuration.port,
    configuration.opts.merge(namespace: configuration.namespace, tags: configuration.tags + tagify(configuration.tags_h)),
    configuration.max_buffer_size
  )

  def client.send_stats(stat, delta, type, opts={})
    super if ClientProvider.configuration.enabled
  end

  client
end
tagify(hash) click to toggle source
# File lib/dogstatsd/instrumentation/client_provider.rb, line 39
def self.tagify(hash)
  hash.select { |_, value| value.present? }.map { |key, value| "#{key}:#{value}" }
end