Class: Vitals::Reporters::StatsdReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- Vitals::Reporters::StatsdReporter
- Defined in:
- lib/vitals/reporters/statsd_reporter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#statsd ⇒ Object
readonly
Returns the value of attribute statsd.
Instance Method Summary collapse
- #gauge(m, v) ⇒ Object
- #inc(m) ⇒ Object
-
#initialize(host: 'localhost', port: 8125, format: nil) ⇒ StatsdReporter
constructor
A new instance of StatsdReporter.
- #timing(m, v) ⇒ Object
Methods inherited from BaseReporter
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
#format ⇒ Object
Returns the value of attribute format.
5 6 7 |
# File 'lib/vitals/reporters/statsd_reporter.rb', line 5 def format @format end |
#statsd ⇒ Object (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
#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
21 22 23 |
# File 'lib/vitals/reporters/statsd_reporter.rb', line 21 def timing(m, v) @statsd.timing(format.format(m), v) end |