cabin 0.3.2 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cabin/metrics.rb CHANGED
@@ -67,10 +67,10 @@ class Cabin::Metrics
67
67
  return create(instance, name, Cabin::Metrics::Meter.new)
68
68
  end # def meter
69
69
 
70
- #public
71
- #def histogram(instance, name)
72
- #return create(instance, name, Cabin::Metrics::Histogram.new)
73
- #end # def histogram
70
+ public
71
+ def histogram(instance, name=nil)
72
+ return create(instance, name, Cabin::Metrics::Histogram.new)
73
+ end # def histogram
74
74
 
75
75
  public
76
76
  def timer(instance, name=nil)
data/test/test_metrics.rb CHANGED
@@ -56,9 +56,18 @@ describe Cabin::Metrics do
56
56
  end
57
57
  end
58
58
 
59
+ test "metrics from Cabin::Metrics" do
60
+ # Verify the Metrics api for creating new metrics.
61
+ metrics = Cabin::Metrics.new
62
+ assert(metrics.timer(self).is_a?(Cabin::Metrics::Timer))
63
+ assert(metrics.counter(self).is_a?(Cabin::Metrics::Counter))
64
+ assert(metrics.histogram(self).is_a?(Cabin::Metrics::Histogram))
65
+ assert(metrics.meter(self).is_a?(Cabin::Metrics::Meter))
66
+ end
67
+
59
68
  test "metrics from logger" do
60
- @logger = Cabin::Channel.new
61
- meter = @logger.metrics.meter(self)
69
+ logger = Cabin::Channel.new
70
+ meter = logger.metrics.meter(self)
62
71
  assert_equal(0, meter.value)
63
72
  end
64
73
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cabin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &9557240 !ruby/object:Gem::Requirement
16
+ requirement: &15419600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9557240
24
+ version_requirements: *15419600
25
25
  description: This is an experiment to try and make logging more flexible and more
26
26
  consumable. Plain text logs are bullshit, let's emit structured and contextual logs.
27
27
  Metrics, too!