Module: MetricsJ::Meter

Defined in:
lib/metrics-java/meter.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



9
10
11
12
13
14
# File 'lib/metrics-java/meter.rb', line 9

def self.extended(base)
  base.instance_exec {
    extend  MetricsJ::BaseMixin
    include MetricsJ::Meter::InstanceMethods
  }
end

Instance Method Details

#meter(meter_name) ⇒ com.yammer.metrics.core.MetricName

Returns The MetricName that describes where the Metric data lives in JMX.

Parameters:

  • meter_name (Symbol, String)

    The name of the meter

Returns:

  • (com.yammer.metrics.core.MetricName)

    The MetricName that describes where the Metric data lives in JMX

See Also:



19
20
21
22
23
24
25
26
27
28
# File 'lib/metrics-java/meter.rb', line 19

def meter(meter_name)
  scoped_name = "#{meter_name}_meter"
  metric_name = MetricsJ.create_metric_name(metric_group, metric_type, meter_name.to_s)

  new_meter = Metrics.new_meter(metric_name, meter_name.to_s, MetricsJ.time_unit_seconds)

  define_method(scoped_name) { new_meter }

  new_meter
end

#meters(*meter_names) ⇒ Object



30
31
32
# File 'lib/metrics-java/meter.rb', line 30

def meters(*meter_names)
  meter_names.map!{ |meter_name| meter(meter_name) }
end