lookout-rack-utils 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/lookout/rack/utils/graphite.rb +4 -1
- data/lib/lookout/rack/utils/version.rb +1 -1
- data/spec/graphite_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDJhNTNhZTU4NzEzNGQ1NDJkOTJhZmUwOGNjMDNiMDFkMDhjMjliMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTdiNjFlODYzZjljNWYyYjI2NmExNGY4ZjViMjE1YzRkZjM2ZTU0OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTkxNWQ5MDQ5MThjNmI5ZTE3YmRhNjYyYmRlMDk1ZmFjZTI4MTdkYTRmZmJl
|
10
|
+
NjI0Y2U1NmI4YWQzMDFhNzlmYzUzYzcwNzJmNTcyNDBkNDEyN2RhODIxMTk5
|
11
|
+
N2Y1Y2RkYjRlMGIxMjkyYTkxNDgyYmIzZjI5ZDc5NmVjYjE1ZmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzY3N2M3MDY5NDRmMmVhOTlkZjlkOWRmMDlkMDA3ZTdlNDUzNjNhODE1M2Zj
|
14
|
+
YWYzOGI5YzBjNTZkYTAwYzNhYTQyZGFmNTQxMjFmNDBiYmYxNGQwYjU1YTFj
|
15
|
+
NWVmMTI4ZDhmMWJjNGM2YmQwMzgxNDAxMmQ5Yjg3MGJlYjMzYjA=
|
@@ -9,6 +9,9 @@ module Lookout::Rack::Utils
|
|
9
9
|
# Use as:
|
10
10
|
# Lookout::Rack::Utils::Graphite.increment('device.associated')
|
11
11
|
# Lookout::Rack::Utils::Graphite.update_counter('device.associated', 5)
|
12
|
+
# Lookout::Rack::Utils::Graphite.timing('device.associated') do
|
13
|
+
# # work
|
14
|
+
# end
|
12
15
|
#
|
13
16
|
class Graphite
|
14
17
|
include Singleton
|
@@ -25,7 +28,7 @@ module Lookout::Rack::Utils
|
|
25
28
|
end
|
26
29
|
|
27
30
|
def self.method_missing(meth, *args, &block)
|
28
|
-
self.instance && Statsd.instance.send(meth, *args)
|
31
|
+
self.instance && Statsd.instance.send(meth, *args, &block)
|
29
32
|
end
|
30
33
|
|
31
34
|
def self.respond_to?(method, include_private = false)
|
data/spec/graphite_spec.rb
CHANGED
@@ -20,4 +20,20 @@ describe Lookout::Rack::Utils::Graphite do
|
|
20
20
|
Statsd.instance.should_receive(:increment).once.with('device.associated')
|
21
21
|
Lookout::Rack::Utils::Graphite.increment('device.associated')
|
22
22
|
end
|
23
|
+
|
24
|
+
describe '#timing' do
|
25
|
+
it 'should delegate the block to statsd' do
|
26
|
+
expect { |block|
|
27
|
+
Statsd.instance.should_receive(:timing).once.with('device.became_aware', &block)
|
28
|
+
Lookout::Rack::Utils::Graphite.timing('device.became_aware', &block)
|
29
|
+
}.to yield_control
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should delegate the sample rate and block to statsd' do
|
33
|
+
expect { |block|
|
34
|
+
Statsd.instance.should_receive(:timing).once.with('device.became_aware', 0.05, &block)
|
35
|
+
Lookout::Rack::Utils::Graphite.timing('device.became_aware', 0.05, &block)
|
36
|
+
}.to yield_control
|
37
|
+
end
|
38
|
+
end
|
23
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookout-rack-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|