module Vitals

Constants

VERSION

Public Class Methods

configure!() { |config| ... } click to toggle source
# File lib/vitals.rb, line 26
def self.configure!
  @config = Configuration.new
  yield(@config) if block_given?
  @reporter = @config.reporter
  @reporter.format = @config.build_format
end
count(m, val) click to toggle source
# File lib/vitals.rb, line 67
def self.count(m, val)
  reporter.count(m, val)
end
gauge(m, val) click to toggle source
# File lib/vitals.rb, line 71
def self.gauge(m, val)
  reporter.gauge(m, val)
end
inc(m) click to toggle source

reporter delegators

hardwired for performance (forwardable delegators go through __send__ and generate gc waste)

# File lib/vitals.rb, line 55
def self.inc(m)
  reporter.inc(m)
end
reporter() click to toggle source
# File lib/vitals.rb, line 37
def self.reporter
  @reporter
end
reporter=(r) click to toggle source
# File lib/vitals.rb, line 33
def self.reporter=(r)
  @reporter = r
end
subscribe!(*modules) click to toggle source
# File lib/vitals.rb, line 41
def self.subscribe!(*modules)
  # give out a list of subscribers too
  modules.map do |mod|
    require "vitals/integrations/notifications/#{ mod }"
    klass = Object.const_get("Vitals::Integrations::Notifications::#{classify(mod)}")
    klass.subscribe!
  end
end
time(m, &b) click to toggle source
# File lib/vitals.rb, line 63
def self.time(m, &b)
  reporter.time(m, &b)
end
timing(m, val) click to toggle source
# File lib/vitals.rb, line 59
def self.timing(m, val)
  reporter.timing(m, val)
end

Private Class Methods

classify(sym) click to toggle source
# File lib/vitals.rb, line 76
def self.classify(sym)
  sym.to_s.split('_').collect!{ |w| w.capitalize }.join
end