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 +4 -4
- data/lib/harness/instrumentation.rb +1 -1
- data/lib/harness/measurement.rb +3 -2
- data/lib/harness/version.rb +1 -1
- data/test/unit/counter_test.rb +10 -0
- data/test/unit/gauge_test.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a97408f57ca2028c1d20abddc3a872c2f8ba25c
|
4
|
+
data.tar.gz: bc43e4e4c660b7d30b79b9b8b0de1f3c0e1130f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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]
|
data/lib/harness/measurement.rb
CHANGED
@@ -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
|
data/lib/harness/version.rb
CHANGED
data/test/unit/counter_test.rb
CHANGED
@@ -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
|
data/test/unit/gauge_test.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|