Class: Kirei::Metrics::StatsdBackend

Inherits:
Backend
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/kirei/metrics/statsd_backend.rb

Instance Method Summary collapse

Constructor Details

#initializeStatsdBackend

Returns a new instance of StatsdBackend.



10
11
12
13
14
15
# File 'lib/kirei/metrics/statsd_backend.rb', line 10

def initialize
  super
  return if defined?(::StatsD)

  raise "statsd-instrument is not loaded. Add `gem 'statsd-instrument'` to your Gemfile to use StatsdBackend."
end

Instance Method Details

#gauge(name, value, tags: {}) ⇒ Object



46
47
48
# File 'lib/kirei/metrics/statsd_backend.rb', line 46

def gauge(name, value, tags: {})
  ::StatsD.gauge(name, value, tags: tags)
end

#increment(name, value = 1, tags: {}) ⇒ Object



24
25
26
# File 'lib/kirei/metrics/statsd_backend.rb', line 24

def increment(name, value = 1, tags: {})
  ::StatsD.increment(name, value, tags: tags)
end

#measure(name, duration_ms, tags: {}) ⇒ Object



35
36
37
# File 'lib/kirei/metrics/statsd_backend.rb', line 35

def measure(name, duration_ms, tags: {})
  ::StatsD.measure(name, duration_ms, tags: tags)
end