13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/krane/statsd.rb', line 13
def self.client
@client ||= begin
sink = if ::StatsD::Instrument::Environment.current.env.fetch('STATSD_ENV', nil) == 'development'
::StatsD::Instrument::LogSink.new(Logger.new($stderr))
elsif (addr = ::StatsD::Instrument::Environment.current.env.fetch('STATSD_ADDR', nil))
::StatsD::Instrument::UDPSink.for_addr(addr)
else
::StatsD::Instrument::NullSink.new
end
::StatsD::Instrument::Client.new(prefix: PREFIX, sink: sink, default_sample_rate: 1.0)
end
end
|