instrumental_agent 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/lib/instrumental/agent.rb +7 -4
- data/lib/instrumental/version.rb +1 -1
- data/spec/agent_spec.rb +15 -0
- metadata +86 -120
data/CHANGELOG.md
CHANGED
data/lib/instrumental/agent.rb
CHANGED
@@ -102,10 +102,13 @@ module Instrumental
|
|
102
102
|
# end
|
103
103
|
def time(metric, multiplier = 1)
|
104
104
|
start = Time.now
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
begin
|
106
|
+
result = yield
|
107
|
+
ensure
|
108
|
+
finish = Time.now
|
109
|
+
duration = finish - start
|
110
|
+
gauge(metric, duration * multiplier, start)
|
111
|
+
end
|
109
112
|
result
|
110
113
|
end
|
111
114
|
|
data/lib/instrumental/version.rb
CHANGED
data/spec/agent_spec.rb
CHANGED
@@ -73,6 +73,21 @@ describe Instrumental::Agent, "enabled in test_mode" do
|
|
73
73
|
time.should > 0.1
|
74
74
|
end
|
75
75
|
|
76
|
+
it "should allow a block used in .time to throw an exception and still be timed" do
|
77
|
+
now = Time.now
|
78
|
+
lambda {
|
79
|
+
@agent.time("time_value_test") do
|
80
|
+
sleep 0.1
|
81
|
+
throw :an_exception
|
82
|
+
sleep 1
|
83
|
+
end
|
84
|
+
}.should raise_error
|
85
|
+
wait
|
86
|
+
@server.commands.last.should =~ /gauge time_value_test .* #{now.to_i}/
|
87
|
+
time = @server.commands.last.scan(/gauge time_value_test (.*) #{now.to_i}/)[0][0].to_f
|
88
|
+
time.should > 0.1
|
89
|
+
end
|
90
|
+
|
76
91
|
it "should report a time as a millisecond gauge and return the block result" do
|
77
92
|
now = Time.now
|
78
93
|
@agent.time_ms("time_ms_test") do
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrumental_agent
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 8
|
9
|
-
- 0
|
10
|
-
version: 0.8.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Elijah Miller
|
14
9
|
- Christopher Zelenak
|
15
10
|
- Kristopher Chambers
|
@@ -17,118 +12,92 @@ authors:
|
|
17
12
|
autorequire:
|
18
13
|
bindir: bin
|
19
14
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Dependency
|
24
|
-
type: :development
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
15
|
+
date: 2012-01-13 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
34
18
|
name: rake
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
requirement: &70170253502220 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
38
25
|
type: :development
|
39
|
-
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: *70170253502220
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: &70170253499520 !ruby/object:Gem::Requirement
|
40
31
|
none: false
|
41
|
-
requirements:
|
32
|
+
requirements:
|
42
33
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 0
|
48
|
-
version: "2.0"
|
49
|
-
name: rspec
|
50
|
-
version_requirements: *id002
|
51
|
-
prerelease: false
|
52
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.0'
|
53
36
|
type: :development
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
name: guard
|
64
|
-
version_requirements: *id003
|
65
37
|
prerelease: false
|
66
|
-
|
67
|
-
|
68
|
-
|
38
|
+
version_requirements: *70170253499520
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: guard
|
41
|
+
requirement: &70170253497560 !ruby/object:Gem::Requirement
|
69
42
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
77
|
-
name: guard-rspec
|
78
|
-
version_requirements: *id004
|
79
|
-
prerelease: false
|
80
|
-
- !ruby/object:Gem::Dependency
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
81
47
|
type: :development
|
82
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
hash: 3
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
-
name: growl_notify
|
92
|
-
version_requirements: *id005
|
93
48
|
prerelease: false
|
94
|
-
|
95
|
-
|
96
|
-
|
49
|
+
version_requirements: *70170253497560
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: guard-rspec
|
52
|
+
requirement: &70170253518380 !ruby/object:Gem::Requirement
|
97
53
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
name: rb-fsevent
|
106
|
-
version_requirements: *id006
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
type: :development
|
107
59
|
prerelease: false
|
108
|
-
|
60
|
+
version_requirements: *70170253518380
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: growl_notify
|
63
|
+
requirement: &70170253513400 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
109
69
|
type: :development
|
110
|
-
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: *70170253513400
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: rb-fsevent
|
74
|
+
requirement: &70170253526840 !ruby/object:Gem::Requirement
|
111
75
|
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
type: :development
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: *70170253526840
|
83
|
+
- !ruby/object:Gem::Dependency
|
119
84
|
name: fuubar
|
120
|
-
|
85
|
+
requirement: &70170253541560 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
121
92
|
prerelease: false
|
93
|
+
version_requirements: *70170253541560
|
122
94
|
description: Track anything.
|
123
|
-
email:
|
95
|
+
email:
|
124
96
|
- support@instrumentalapp.com
|
125
97
|
executables: []
|
126
|
-
|
127
98
|
extensions: []
|
128
|
-
|
129
99
|
extra_rdoc_files: []
|
130
|
-
|
131
|
-
files:
|
100
|
+
files:
|
132
101
|
- .gitignore
|
133
102
|
- .rspec
|
134
103
|
- CHANGELOG.md
|
@@ -147,38 +116,35 @@ files:
|
|
147
116
|
- spec/test_server.rb
|
148
117
|
homepage: http://github.com/fastestforward/instrumental_agent
|
149
118
|
licenses: []
|
150
|
-
|
151
119
|
post_install_message:
|
152
120
|
rdoc_options: []
|
153
|
-
|
154
|
-
require_paths:
|
121
|
+
require_paths:
|
155
122
|
- lib
|
156
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
124
|
none: false
|
158
|
-
requirements:
|
159
|
-
- -
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
|
162
|
-
segments:
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
segments:
|
163
130
|
- 0
|
164
|
-
|
165
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
hash: 2243868577827404388
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
133
|
none: false
|
167
|
-
requirements:
|
168
|
-
- -
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
|
171
|
-
segments:
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
segments:
|
172
139
|
- 0
|
173
|
-
|
140
|
+
hash: 2243868577827404388
|
174
141
|
requirements: []
|
175
|
-
|
176
142
|
rubyforge_project:
|
177
143
|
rubygems_version: 1.8.10
|
178
144
|
signing_key:
|
179
145
|
specification_version: 3
|
180
146
|
summary: Agent for reporting data to instrumentalapp.com
|
181
|
-
test_files:
|
147
|
+
test_files:
|
182
148
|
- spec/agent_spec.rb
|
183
149
|
- spec/spec_helper.rb
|
184
150
|
- spec/test_server.rb
|