kb-simple-metrics 0.0.12-java → 0.0.13-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,11 +6,11 @@ module Simple
6
6
  # Create a new meter
7
7
  #
8
8
  # @param [String] name The name of the meter
9
- # @param [String] klass_name The name of the class, usually the application. Defaults to
10
- # `self.class.name`
11
- # @param [TimeUnit] time_unit The rate at which to measure marked data. Defaults to
12
- # TimeUnit::SECONDS
13
- def define_meter(name, klass_name = self.class.name, time_unit = Simple::Metrics::DEFAULT_RATE_UNIT)
9
+ # @param [Hash] options A hash containing keys/value pairs to override defaults. Defaults to
10
+ # `{}`
11
+ def define_meter(name, options={})
12
+ klass_name = options[:name] || self.class.name
13
+ time_unit = options[:time_unit] || Simple::Metrics::DEFAULT_RATE_UNIT
14
14
  type = "meter"
15
15
  metric_name = new_metric_name(klass_name, name, type)
16
16
  meter = Java::ComYammerMetrics::Metrics.new_meter(metric_name, name.to_s, time_unit)
@@ -5,13 +5,14 @@ module Simple
5
5
  # yields the timer to the block and stops it when the block returns.
6
6
  #
7
7
  # @param [String] name The name of the timer
8
- # @param [String] klass_name The name of the class, usually the application. Defaults to
9
- # `self.class.name`
10
- # @param [TimeUnit] time_unit The rate at which to measure timed data. Defaults to
11
- # TimeUnit::SECONDS
12
- def timer(name, klass_name = self.class.name, time_unit = Simple::Metrics::DEFAULT_RATE_UNIT)
8
+ # @param [Hash] options A hash containing keys/value pairs to override defaults. Defaults to
9
+ # `{}`
10
+ def timer(name, options={})
11
+ klass_name = options[:name] || self.class.name
12
+ duration_unit = options[:duration_unit] || Simple::Metrics::DEFAULT_DURATION_UNIT
13
+ time_unit = options[:time_unit] || Simple::Metrics::DEFAULT_RATE_UNIT
13
14
  metric_name = new_metric_name(sanitize_classname(klass_name), name, 'timer')
14
- new_timer = metrics_registry.newTimer(metric_name, DEFAULT_DURATION_UNIT, time_unit)
15
+ new_timer = metrics_registry.newTimer(metric_name, duration_unit, time_unit)
15
16
  captured_timer = new_timer.time
16
17
  begin
17
18
  yield new_timer
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module Metrics
3
- VERSION = "0.0.12"
3
+ VERSION = '0.0.13'
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kb-simple-metrics
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.12
5
+ version: 0.0.13
6
6
  platform: java
7
7
  authors:
8
8
  - dan herrera
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-14 00:00:00.000000000 Z
13
+ date: 2013-06-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec