Module: Octo::Stats

Included in:
Helpers::ApiHelper
Defined in:
lib/octocore-cassandra/stats.rb

Overview

Instrumentation and Statistical module

Instance Method Summary collapse

Instance Method Details

#instrument(name) ⇒ Object

Instrument a block identified by its name

Parameters:

  • name (Symbol)

    The name by which this would be identified



10
11
12
13
14
15
16
# File 'lib/octocore-cassandra/stats.rb', line 10

def instrument(name)
  if stats
    stats.time(name.to_s, &Proc.new)
  else
    yield
  end
end

#statsObject

Get stats instance



19
20
21
22
23
24
# File 'lib/octocore-cassandra/stats.rb', line 19

def stats
  if statd_config
    @statsd = Statsd.new(*statd_config.values) unless @statsd
    @statsd
  end
end