Module: Simple::Metrics::Meter

Includes:
Simple::Metrics
Included in:
RackMetrics
Defined in:
lib/simple/metrics/meter.rb

Constant Summary

Constants included from Simple::Metrics

DEFAULT_DURATION_UNIT, DEFAULT_RATE_UNIT, DEFAULT_TIMING_UNIT, VERSION

Instance Method Summary collapse

Methods included from Simple::Metrics

#metrics_registry, #new_metric_name, #sanitize_classname

Methods included from Timer

#timer

Instance Method Details

#define_meter(name, options = {}) ⇒ Object

Create a new meter

‘{}`

Parameters:

  • name (String)

    The name of the meter

  • options (Hash) (defaults to: {})

    A hash containing keys/value pairs to override defaults. Defaults to



11
12
13
14
15
16
17
18
19
20
# File 'lib/simple/metrics/meter.rb', line 11

def define_meter(name, options={})
  klass_name = options[:name] || self.class.name 
  time_unit = options[:time_unit] || Simple::Metrics::DEFAULT_RATE_UNIT
  type = "meter"
  metric_name = new_metric_name(klass_name, name, type)
  meter = Java::ComYammerMetrics::Metrics.new_meter(metric_name, name.to_s, time_unit)
  define_method("#{name}") do
    meter
  end
end