harness 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ce1e490c4891059a1b56b87897eab66b3af6501
4
- data.tar.gz: a01208397209914e96d60a78bf5e0ac3b0c51966
3
+ metadata.gz: 9a97408f57ca2028c1d20abddc3a872c2f8ba25c
4
+ data.tar.gz: bc43e4e4c660b7d30b79b9b8b0de1f3c0e1130f7
5
5
  SHA512:
6
- metadata.gz: 2ba6e9a709903995bbdf185cd223f330f7952bddf776bdd522cd819c3193a40b624488e405357de8a46f07fe244fcb2b2ac701efcecaed57baad6dc0f0d80e66
7
- data.tar.gz: e28b206b2fa1681023a0b792a068bef2f0cad1936a5f2eae141d89e58cffd1cb2e2ce28fba45710b67c69b14309f54c32062fabb9f8702f207134edaffb72187
6
+ metadata.gz: 2ddbc2a211b2fc8d676b2600e0c03b87e81bec9dc7fdb9f2c74dcb4e4a53587888238ca492e873eae0d91a72d361e1fefac2b5a652eaaa07df6912b60afa7e3e
7
+ data.tar.gz: c488a588b16d8cf9507faa1cb9163bad3811ed786eeb267934d7a15ac31cf43b133ab92e91b82bd34581892352d63cecd1b15d893b740d04b782767ced458ebf
@@ -1,6 +1,6 @@
1
1
  ActiveSupport::Notifications.subscribe %r{.+} do |*args|
2
2
  event = ActiveSupport::Notifications::Event.new(*args)
3
-
3
+
4
4
  unless event.payload[:exception]
5
5
  Harness::Gauge.from_event(event).log if event.payload[:gauge]
6
6
  Harness::Counter.from_event(event).log if event.payload[:counter]
@@ -1,6 +1,6 @@
1
1
  module Harness
2
2
  class Measurement
3
- attr_accessor :id, :name, :source, :time, :value, :units
3
+ attr_accessor :id, :name, :source, :time, :value, :units, :period
4
4
 
5
5
  def initialize(attributes = {})
6
6
  attributes.each_pair do |name, value|
@@ -35,7 +35,8 @@ module Harness
35
35
  :source => source,
36
36
  :time => time,
37
37
  :units => units,
38
- :value => value
38
+ :value => value,
39
+ :period => period
39
40
  }
40
41
  end
41
42
  end
@@ -1,3 +1,3 @@
1
1
  module Harness
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -71,4 +71,14 @@ class CounterTest < MiniTest::Unit::TestCase
71
71
 
72
72
  assert_equal 'foo', counter.id
73
73
  end
74
+
75
+ def test_sets_the_period_from_the_event
76
+ base = Time.now
77
+
78
+ event = ActiveSupport::Notifications::Event.new "name", base - 1, Time.now, nil, :counter => {period: 30}
79
+
80
+ counter = Harness::Counter.from_event event
81
+
82
+ assert_equal 30, counter.period
83
+ end
74
84
  end
@@ -75,6 +75,16 @@ class GaugeTest < MiniTest::Unit::TestCase
75
75
  assert_equal 42, gauge.value
76
76
  end
77
77
 
78
+ def test_sets_the_period_from_the_event
79
+ base = Time.now
80
+
81
+ event = ActiveSupport::Notifications::Event.new "name", base - 1, Time.now, nil, :gauge => {period: 30}
82
+
83
+ gauge = Harness::Gauge.from_event event
84
+
85
+ assert_equal 30, gauge.period
86
+ end
87
+
78
88
  def test_initializes_time_if_not_set
79
89
  gauge = Harness::Gauge.new
80
90
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ahawkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport