Module: UnicornMetrics

Defined in:
lib/unicorn_metrics.rb,
lib/unicorn_metrics/version.rb

Defined Under Namespace

Modules: DefaultHttpMetrics, Registry Classes: Counter, Middleware, RequestCounter, RequestTimer, ResponseCounter, Timer

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.configure {|self| ... } ⇒ Object

Make this class ‘configurable’

Yield Parameters:



14
15
16
# File 'lib/unicorn_metrics.rb', line 14

def configure
  yield self
end

.http_metrics=(boolean = false) ⇒ Object

Enable/disable HTTP metrics. Includes defaults

Parameters:

  • boolean (Boolean) (defaults to: false)

    to enable or disable default HTTP metrics



21
22
23
24
25
26
27
28
29
30
# File 'lib/unicorn_metrics.rb', line 21

def http_metrics=(boolean=false)
  return if @_assigned

  if @http_metrics = boolean
    registry.extend(UnicornMetrics::DefaultHttpMetrics)
    registry.register_default_http_counters
    registry.register_default_http_timers
  end
  @_assigned = true
end

.http_metrics?Boolean

Used by the middleware to determine whether any HTTP metrics have been defined

Returns:

  • (Boolean)

    if HTTP metrics have been defined



35
# File 'lib/unicorn_metrics.rb', line 35

def http_metrics? ; @http_metrics ; end

.registryUnicornMetrics::Registry

Returns the UnicornMetrics::Registry object



7
8
9
# File 'lib/unicorn_metrics.rb', line 7

def registry
  UnicornMetrics::Registry
end