Module: Vitals

Defined in:
lib/vitals.rb,
lib/vitals.rb,
lib/vitals/utils.rb,
lib/vitals/version.rb,
lib/vitals/configuration.rb

Defined Under Namespace

Modules: Formats, Integrations, Reporters, Utils Classes: Configuration

Constant Summary collapse

VERSION =
"0.12.0"

Class Method Summary collapse

Class Method Details

.configure! {|@config| ... } ⇒ Object

Yields:

  • (@config)


26
27
28
29
30
31
# 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) ⇒ Object



67
68
69
# File 'lib/vitals.rb', line 67

def self.count(m, val)
  reporter.count(m, val)
end

.gauge(m, val) ⇒ Object



71
72
73
# File 'lib/vitals.rb', line 71

def self.gauge(m, val)
  reporter.gauge(m, val)
end

.inc(m) ⇒ Object

reporter delegators

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



55
56
57
# File 'lib/vitals.rb', line 55

def self.inc(m)
  reporter.inc(m)
end

.reporterObject



37
38
39
# File 'lib/vitals.rb', line 37

def self.reporter
  @reporter
end

.reporter=(r) ⇒ Object



33
34
35
# File 'lib/vitals.rb', line 33

def self.reporter=(r)
  @reporter = r
end

.subscribe!(*modules) ⇒ Object



41
42
43
44
45
46
47
48
# 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) ⇒ Object



63
64
65
# File 'lib/vitals.rb', line 63

def self.time(m, &b)
  reporter.time(m, &b)
end

.timing(m, val) ⇒ Object



59
60
61
# File 'lib/vitals.rb', line 59

def self.timing(m, val)
  reporter.timing(m, val)
end