statsd-instrument 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/statsd/instrument.rb +1 -1
- data/statsd-instrument.gemspec +2 -2
- data/test/statsd-instrument_test.rb +3 -3
- metadata +11 -5
data/lib/statsd/instrument.rb
CHANGED
@@ -129,7 +129,7 @@ module StatsD
|
|
129
129
|
|
130
130
|
def self.write(k,v,op, sample_rate = default_sample_rate)
|
131
131
|
return unless enabled
|
132
|
-
return if sample_rate < 1 && rand
|
132
|
+
return if sample_rate < 1 && rand < sample_rate
|
133
133
|
|
134
134
|
command = "#{self.prefix + '.' if self.prefix}#{k}:#{v}"
|
135
135
|
case op
|
data/statsd-instrument.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "statsd-instrument"
|
3
|
-
s.version = '1.3.
|
4
|
-
s.authors = ["Jesse Storimer"]
|
3
|
+
s.version = '1.3.2'
|
4
|
+
s.authors = ["Jesse Storimer", "Tobias Lutke"]
|
5
5
|
s.email = ["jesse@shopify.com"]
|
6
6
|
s.homepage = "http://github.com/shopify/statsd-instrument"
|
7
7
|
|
@@ -161,15 +161,15 @@ class StatsDTest < Test::Unit::TestCase
|
|
161
161
|
|
162
162
|
def test_count_with_sampling
|
163
163
|
StatsD.unstub(:increment)
|
164
|
-
StatsD.stubs(:rand).returns(0.
|
164
|
+
StatsD.stubs(:rand).returns(0.1)
|
165
165
|
StatsD.logger.expects(:info).never
|
166
166
|
|
167
|
-
StatsD.increment('sampling.foo.bar', 1, 0.
|
167
|
+
StatsD.increment('sampling.foo.bar', 1, 0.6)
|
168
168
|
end
|
169
169
|
|
170
170
|
def test_count_with_successful_sample
|
171
171
|
StatsD.unstub(:increment)
|
172
|
-
StatsD.stubs(:rand).returns(0.
|
172
|
+
StatsD.stubs(:rand).returns(0.2)
|
173
173
|
StatsD.logger.expects(:info).once.with do |string|
|
174
174
|
string.include?('@0.1')
|
175
175
|
end
|
metadata
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd-instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jesse Storimer
|
9
|
+
- Tobias Lutke
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: mocha
|
16
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,7 +22,12 @@ dependencies:
|
|
21
22
|
version: '0'
|
22
23
|
type: :development
|
23
24
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
25
31
|
description: A StatsD client for Ruby apps. Provides metaprogramming methods to inject
|
26
32
|
StatsD instrumentation into your code.
|
27
33
|
email:
|
@@ -60,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
66
|
version: '0'
|
61
67
|
requirements: []
|
62
68
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.8.
|
69
|
+
rubygems_version: 1.8.23
|
64
70
|
signing_key:
|
65
71
|
specification_version: 3
|
66
72
|
summary: A StatsD client for Ruby apps
|