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, klass_name = self.class.name, time_unit = Simple::Metrics::DEFAULT_RATE_UNIT) ⇒ Object

Create a new meter

‘self.class.name` TimeUnit::SECONDS

Parameters:

  • name (String)

    The name of the meter

  • klass_name (String) (defaults to: self.class.name)

    The name of the class, usually the application. Defaults to

  • time_unit (TimeUnit) (defaults to: Simple::Metrics::DEFAULT_RATE_UNIT)

    The rate at which to measure marked data. Defaults to



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

def define_meter(name, klass_name = self.class.name, 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