fozzie 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -0
- data/fozzie.gemspec +0 -1
- data/lib/fozzie/interface.rb +7 -1
- data/lib/fozzie/version.rb +1 -1
- data/spec/lib/fozzie/interface_spec.rb +11 -4
- metadata +4 -20
data/README.md
CHANGED
@@ -38,6 +38,10 @@ Send through statistics depending on the type you want to provide:
|
|
38
38
|
|
39
39
|
Stats.time_for 'wat' { sleep 5 }
|
40
40
|
|
41
|
+
### Gauges - register arbitrary values
|
42
|
+
|
43
|
+
Stats.gauge 'wat', 99
|
44
|
+
|
41
45
|
### Events - register different events
|
42
46
|
|
43
47
|
|
@@ -88,6 +92,23 @@ Each of the above methods accepts a sample rate as the last argument (before any
|
|
88
92
|
Stats.decrement 'wat', 10
|
89
93
|
|
90
94
|
Stats.count 'wat', 5, 10
|
95
|
+
|
96
|
+
## Monitor
|
97
|
+
|
98
|
+
You can monitor methods with the following:
|
99
|
+
|
100
|
+
class FooBar
|
101
|
+
|
102
|
+
_monitor
|
103
|
+
def zar
|
104
|
+
# my code here...
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
This will register the processing time for this method, everytime it is called, under the Graphite bucket `foo_bar.zar`.
|
110
|
+
|
111
|
+
This will work on both Class and Instance methods.
|
91
112
|
|
92
113
|
## Namespaces
|
93
114
|
|
data/fozzie.gemspec
CHANGED
data/lib/fozzie/interface.rb
CHANGED
@@ -112,8 +112,14 @@ module Fozzie
|
|
112
112
|
#
|
113
113
|
# `Stats.event 'wat', 'app'`
|
114
114
|
def event(type, app = nil)
|
115
|
-
|
115
|
+
gauge ["event", type.to_s, app], Time.now.usec
|
116
116
|
end
|
117
117
|
|
118
|
+
# Register an arbitrary value
|
119
|
+
#
|
120
|
+
# `Stats.gauge 'wat', 'app'`
|
121
|
+
def gauge(stat, value, sample_rate = 1)
|
122
|
+
send(stat, value, "g", sample_rate)
|
123
|
+
end
|
118
124
|
end
|
119
125
|
end
|
data/lib/fozzie/version.rb
CHANGED
@@ -43,19 +43,19 @@ describe Fozzie::Interface do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "registers a commit" do
|
46
|
-
subject.expects(:
|
46
|
+
subject.expects(:gauge).with(['event', 'commit', nil], anything).twice
|
47
47
|
subject.commit
|
48
48
|
subject.committed
|
49
49
|
end
|
50
50
|
|
51
51
|
it "registers a build" do
|
52
|
-
subject.expects(:
|
52
|
+
subject.expects(:gauge).with(['event', 'build', nil], anything).twice
|
53
53
|
subject.build
|
54
54
|
subject.built
|
55
55
|
end
|
56
56
|
|
57
57
|
it "registers a deploy" do
|
58
|
-
subject.expects(:
|
58
|
+
subject.expects(:gauge).with(['event', 'deploy', nil], anything).twice
|
59
59
|
subject.deploy
|
60
60
|
subject.deployed
|
61
61
|
end
|
@@ -159,4 +159,11 @@ describe Fozzie::Interface do
|
|
159
159
|
|
160
160
|
end
|
161
161
|
|
162
|
-
|
162
|
+
describe "#gauge" do
|
163
|
+
it "registers a gauge measurement" do
|
164
|
+
subject.expects(:send).with("mystat", 99, "g", 1)
|
165
|
+
subject.gauge("mystat", 99)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fozzie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-07-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sys-uname
|
@@ -204,22 +204,6 @@ dependencies:
|
|
204
204
|
- - ! '>='
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
|
-
- !ruby/object:Gem::Dependency
|
208
|
-
name: ruby_gntp
|
209
|
-
requirement: !ruby/object:Gem::Requirement
|
210
|
-
none: false
|
211
|
-
requirements:
|
212
|
-
- - ! '>='
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '0'
|
215
|
-
type: :development
|
216
|
-
prerelease: false
|
217
|
-
version_requirements: !ruby/object:Gem::Requirement
|
218
|
-
none: false
|
219
|
-
requirements:
|
220
|
-
- - ! '>='
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
207
|
description: ! "\n Gem to make statistics sending to Statsd from Ruby applications
|
224
208
|
simple and efficient as possible.\n Inspired by the original ruby-statsd gem
|
225
209
|
by Etsy, currently used by Lonely Planet Online.\n "
|
@@ -278,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
278
262
|
version: '0'
|
279
263
|
segments:
|
280
264
|
- 0
|
281
|
-
hash: -
|
265
|
+
hash: -3285934498168800248
|
282
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
267
|
none: false
|
284
268
|
requirements:
|
@@ -287,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
271
|
version: '0'
|
288
272
|
segments:
|
289
273
|
- 0
|
290
|
-
hash: -
|
274
|
+
hash: -3285934498168800248
|
291
275
|
requirements: []
|
292
276
|
rubyforge_project: fozzie
|
293
277
|
rubygems_version: 1.8.24
|