Class: Vitals::Reporters::StatsdReporter

Inherits:
BaseReporter show all
Defined in:
lib/vitals/reporters/statsd_reporter.rb

Direct Known Subclasses

DnsResolvingStatsdReporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseReporter

#time

Constructor Details

#initialize(host: 'localhost', port: 8125, format: nil) ⇒ StatsdReporter

Returns a new instance of StatsdReporter.



8
9
10
11
# File 'lib/vitals/reporters/statsd_reporter.rb', line 8

def initialize(host:'localhost', port:8125, format:nil)
  @statsd = Statsd.new(host, port)
  @format = format
end

Instance Attribute Details

#formatObject

Returns the value of attribute format.



5
6
7
# File 'lib/vitals/reporters/statsd_reporter.rb', line 5

def format
  @format
end

#statsdObject (readonly)

Returns the value of attribute statsd.



6
7
8
# File 'lib/vitals/reporters/statsd_reporter.rb', line 6

def statsd
  @statsd
end

Instance Method Details

#count(m, v) ⇒ Object



21
22
23
# File 'lib/vitals/reporters/statsd_reporter.rb', line 21

def count(m, v)
  @statsd.count(format.format(m), v)
end

#gauge(m, v) ⇒ Object



17
18
19
# File 'lib/vitals/reporters/statsd_reporter.rb', line 17

def gauge(m, v)
  @statsd.gauge(format.format(m), v)
end

#inc(m) ⇒ Object



13
14
15
# File 'lib/vitals/reporters/statsd_reporter.rb', line 13

def inc(m)
  @statsd.increment(format.format(m))
end

#timing(m, v) ⇒ Object



25
26
27
# File 'lib/vitals/reporters/statsd_reporter.rb', line 25

def timing(m, v)
  @statsd.timing(format.format(m), v)
end