statsd-instrument 2.0.9 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d165c7c25a22b4fb7dce6e80dfabb4240c5ae34
4
- data.tar.gz: 4a11c1f89324fc432b89e2dfd306ad9481d23497
3
+ metadata.gz: 46e2e5b04875e5bd0d24688df4592fd7302dd00e
4
+ data.tar.gz: c489f07cdcf8e6bf9e41feb71f9e04fb47f24185
5
5
  SHA512:
6
- metadata.gz: a7e34af97543116bcdc95fd0c1f95fbfbd4db12b30b7e929268f7a1302766f8e9a266b13a01f91892bc5c1d7a3d0bed0ce61e8a951f63f41b21eafa6f2d282ca
7
- data.tar.gz: 66a224d2abaef49ec123db08030dc21cd45fbbbc4e2e6a457c298881109bd5586943272f6f1e8491cd4852249040dbbb880cb54892fbdd685ff75ca287c32449
6
+ metadata.gz: e01b79500359d7279fe7b2922d7264c9ad6852f610dfee06c5a83794673cbe142f98b3201a543695f6b62e26c8d6aeceee1d0e7c491347d81120e19db5dcc578
7
+ data.tar.gz: 0b4b9166b6229e01e601d67c9ef94227c6034b5d83ca4006ea0b5dfffa6788f10eccf1d28ae0f3d3fc5ceef97753117b71f48e8d57f9113c76c1bfda59d70024
@@ -43,7 +43,23 @@ module StatsD::Instrument::Assertions
43
43
 
44
44
  assert_equal options[:sample_rate], metric.sample_rate, "Unexpected value submitted for StatsD metric #{metric_name}" if options[:sample_rate]
45
45
  assert_equal options[:value], metric.value, "Unexpected StatsD sample rate for metric #{metric_name}" if options[:value]
46
- assert_equal Set.new(StatsD::Instrument::Metric.normalize_tags(options[:tags])), Set.new(metric.tags), "Unexpected StatsD tags for metric #{metric_name}" if options[:tags]
46
+
47
+ if options[:tags]
48
+ expected_tags = Set.new(StatsD::Instrument::Metric.normalize_tags(options[:tags]))
49
+ actual_tags = Set.new(metric.tags)
50
+
51
+ if options[:ignore_tags]
52
+ ignored_tags = Set.new(StatsD::Instrument::Metric.normalize_tags(options[:ignore_tags])) - expected_tags
53
+ actual_tags -= ignored_tags
54
+
55
+ if options[:ignore_tags].is_a?(Array)
56
+ actual_tags.delete_if{ |key| options[:ignore_tags].include?(key.split(":").first) }
57
+ end
58
+ end
59
+
60
+ assert_equal expected_tags, actual_tags,
61
+ "Unexpected StatsD tags for metric #{metric_name}. Expected: #{expected_tags.inspect}, actual: #{actual_tags.inspect}"
62
+ end
47
63
 
48
64
  metric
49
65
  end
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.0.9"
3
+ VERSION = "2.0.10"
4
4
  end
5
5
  end
@@ -86,6 +86,48 @@ class AssertionsTest < Minitest::Test
86
86
  end
87
87
  end
88
88
 
89
+ assert_assertion_triggered do
90
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: ['a', 'b'], ignore_tags: ['b']) do
91
+ StatsD.increment('counter', sample_rate: 0.5, tags: ['a'])
92
+ end
93
+ end
94
+
95
+ assert_no_assertion_triggered do
96
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: ['a'], ignore_tags: ['b']) do
97
+ StatsD.increment('counter', sample_rate: 0.5, tags: ['a', 'b'])
98
+ end
99
+ end
100
+
101
+ assert_no_assertion_triggered do
102
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: ['a'], ignore_tags: ['b']) do
103
+ StatsD.increment('counter', sample_rate: 0.5, tags: ['a'])
104
+ end
105
+ end
106
+
107
+ assert_no_assertion_triggered do
108
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: { a: 1 }, ignore_tags: { b: 2 }) do
109
+ StatsD.increment('counter', sample_rate: 0.5, tags: { a: 1, b: 2 })
110
+ end
111
+ end
112
+
113
+ assert_assertion_triggered do
114
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: { a: 1 }, ignore_tags: { b: 2 }) do
115
+ StatsD.increment('counter', sample_rate: 0.5, tags: { a: 1, b: 3 })
116
+ end
117
+ end
118
+
119
+ assert_assertion_triggered do
120
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: { a: 1, b: 3 }, ignore_tags: ['b']) do
121
+ StatsD.increment('counter', sample_rate: 0.5, tags: { a: 1, b: 2 })
122
+ end
123
+ end
124
+
125
+ assert_no_assertion_triggered do
126
+ @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: { a: 1 }, ignore_tags: ['b']) do
127
+ StatsD.increment('counter', sample_rate: 0.5, tags: { a: 1, b: 2 })
128
+ end
129
+ end
130
+
89
131
  assert_assertion_triggered do
90
132
  @test_case.assert_statsd_increment('counter', sample_rate: 0.5, tags: ['a', 'b']) do
91
133
  StatsD.increment('counter', sample_rate: 0.2, tags: ['c'])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsd-instrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -10,90 +10,90 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-27 00:00:00.000000000 Z
13
+ date: 2015-09-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: minitest
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: mocha
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: yard
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: benchmark-ips
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  description: A StatsD client for Ruby apps. Provides metaprogramming methods to inject
@@ -104,8 +104,8 @@ executables: []
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
- - .gitignore
108
- - .travis.yml
107
+ - ".gitignore"
108
+ - ".travis.yml"
109
109
  - CHANGELOG.md
110
110
  - CONTRIBUTING.md
111
111
  - Gemfile
@@ -151,17 +151,17 @@ require_paths:
151
151
  - lib
152
152
  required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - '>='
154
+ - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - '>='
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.0.14
164
+ rubygems_version: 2.2.3
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: A StatsD client for Ruby apps