statsd-instrument 2.9.1 → 2.9.2

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
  SHA256:
3
- metadata.gz: ae7293e6877b2d74f238585a71aa2becf142dbd29541141d9571633e817a3003
4
- data.tar.gz: 7b2414d09b941a107d86d7855325092e258b3032ffa1784e91ab716c3688d2c9
3
+ metadata.gz: 50951cc1d5be4659f87b7a6b4b2b820250b768a8a888bad19f85beb30cf77acd
4
+ data.tar.gz: 2dc9c84774e437ba6e64b221197b228d36ece95c42428f70eb43262028cca2b5
5
5
  SHA512:
6
- metadata.gz: 2edbb8ce7c75358a9e5b06b7f3af777aacb54f8ce8d2793dcaa4ddb80c8a8117e17113e7304c63ed075e7c8f66e69abf004e3bccdd26ef31b6a295c55fbbebe6
7
- data.tar.gz: a041d91c4ae37ffdfe06447614b73b9ea2a46e1a10ad3a37a72e1b38c49a037b5d501790385a5ea05c209b9f6e81597e00b4bf13c82d095fc2ffad9dbca54f47
6
+ metadata.gz: eabe89b8d4184ade826b5e68bb3fcf27a10330a454cefb4b9ecbb7583d4e5ab919878e7faa6e8a8e702bdcbe09c35fa4a4b6b37048f52f8970753c6225830632
7
+ data.tar.gz: a0a3f0a646c9669918faf6e4f5f6a0b8a0cfeb9db6128cb0350bafbd9f78ab778add4fe01cbab6a43bccc2ad91eac93721b9bd46cfe8d877cff43e5bec762e67
data/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@ section below.
8
8
 
9
9
  _Nothing yet_
10
10
 
11
+ ## Version 2.9.2
12
+
13
+ - Allow providing a value as second positional argument to `assert_statsd_*`
14
+ methods, rather than as keyword argument. This matches the arguments to the
15
+ StatsD metric call.
16
+ ``` ruby
17
+ assert_statsd_increment('batch_size', 10) do
18
+ StatsD.increment('batch_size', 10)
19
+ end
20
+ ```
21
+
11
22
  ## Version 2.9.1
12
23
 
13
24
  - The `VOID` object being returned by metric methods (e.g. `StatsD.increment`)
@@ -71,8 +71,8 @@ module StatsD::Instrument::Assertions
71
71
  # @return [void]
72
72
  # @raise [Minitest::Assertion] If an exception occurs, or if the metric did
73
73
  # not occur as specified during the execution the block.
74
- def assert_statsd_increment(metric_name, datagrams: nil, client: nil, **options, &block)
75
- expectation = StatsD::Instrument::Expectation.increment(metric_name, **options)
74
+ def assert_statsd_increment(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
75
+ expectation = StatsD::Instrument::Expectation.increment(metric_name, value, **options)
76
76
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
77
77
  end
78
78
 
@@ -83,8 +83,8 @@ module StatsD::Instrument::Assertions
83
83
  # @yield (see #assert_statsd_increment)
84
84
  # @return [void]
85
85
  # @raise (see #assert_statsd_increment)
86
- def assert_statsd_measure(metric_name, datagrams: nil, client: nil, **options, &block)
87
- expectation = StatsD::Instrument::Expectation.measure(metric_name, **options)
86
+ def assert_statsd_measure(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
87
+ expectation = StatsD::Instrument::Expectation.measure(metric_name, value, **options)
88
88
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
89
89
  end
90
90
 
@@ -95,8 +95,8 @@ module StatsD::Instrument::Assertions
95
95
  # @yield (see #assert_statsd_increment)
96
96
  # @return [void]
97
97
  # @raise (see #assert_statsd_increment)
98
- def assert_statsd_gauge(metric_name, datagrams: nil, client: nil, **options, &block)
99
- expectation = StatsD::Instrument::Expectation.gauge(metric_name, **options)
98
+ def assert_statsd_gauge(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
99
+ expectation = StatsD::Instrument::Expectation.gauge(metric_name, value, **options)
100
100
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
101
101
  end
102
102
 
@@ -107,8 +107,8 @@ module StatsD::Instrument::Assertions
107
107
  # @yield (see #assert_statsd_increment)
108
108
  # @return [void]
109
109
  # @raise (see #assert_statsd_increment)
110
- def assert_statsd_histogram(metric_name, datagrams: nil, client: nil, **options, &block)
111
- expectation = StatsD::Instrument::Expectation.histogram(metric_name, **options)
110
+ def assert_statsd_histogram(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
111
+ expectation = StatsD::Instrument::Expectation.histogram(metric_name, value, **options)
112
112
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
113
113
  end
114
114
 
@@ -119,8 +119,8 @@ module StatsD::Instrument::Assertions
119
119
  # @yield (see #assert_statsd_increment)
120
120
  # @return [void]
121
121
  # @raise (see #assert_statsd_increment)
122
- def assert_statsd_distribution(metric_name, datagrams: nil, client: nil, **options, &block)
123
- expectation = StatsD::Instrument::Expectation.distribution(metric_name, **options)
122
+ def assert_statsd_distribution(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
123
+ expectation = StatsD::Instrument::Expectation.distribution(metric_name, value, **options)
124
124
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
125
125
  end
126
126
 
@@ -131,8 +131,8 @@ module StatsD::Instrument::Assertions
131
131
  # @yield (see #assert_statsd_increment)
132
132
  # @return [void]
133
133
  # @raise (see #assert_statsd_increment)
134
- def assert_statsd_set(metric_name, datagrams: nil, client: nil, **options, &block)
135
- expectation = StatsD::Instrument::Expectation.set(metric_name, **options)
134
+ def assert_statsd_set(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
135
+ expectation = StatsD::Instrument::Expectation.set(metric_name, value, **options)
136
136
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
137
137
  end
138
138
 
@@ -143,8 +143,8 @@ module StatsD::Instrument::Assertions
143
143
  # @yield (see #assert_statsd_increment)
144
144
  # @return [void]
145
145
  # @raise (see #assert_statsd_increment)
146
- def assert_statsd_key_value(metric_name, datagrams: nil, client: nil, **options, &block)
147
- expectation = StatsD::Instrument::Expectation.key_value(metric_name, **options)
146
+ def assert_statsd_key_value(metric_name, value = nil, datagrams: nil, client: nil, **options, &block)
147
+ expectation = StatsD::Instrument::Expectation.key_value(metric_name, value, **options)
148
148
  assert_statsd_expectation(expectation, datagrams: datagrams, client: client, &block)
149
149
  end
150
150
 
@@ -3,32 +3,32 @@
3
3
  # @private
4
4
  class StatsD::Instrument::Expectation
5
5
  class << self
6
- def increment(name, **options)
7
- new(type: :c, name: name, **options)
6
+ def increment(name, value = nil, **options)
7
+ new(type: :c, name: name, value: value, **options)
8
8
  end
9
9
 
10
- def measure(name, **options)
11
- new(type: :ms, name: name, **options)
10
+ def measure(name, value = nil, **options)
11
+ new(type: :ms, name: name, value: value, **options)
12
12
  end
13
13
 
14
- def gauge(name, **options)
15
- new(type: :g, name: name, **options)
14
+ def gauge(name, value = nil, **options)
15
+ new(type: :g, name: name, value: value, **options)
16
16
  end
17
17
 
18
- def set(name, **options)
19
- new(type: :s, name: name, **options)
18
+ def set(name, value = nil, **options)
19
+ new(type: :s, name: name, value: value, **options)
20
20
  end
21
21
 
22
- def key_value(name, **options)
23
- new(type: :kv, name: name, **options)
22
+ def key_value(name, value = nil, **options)
23
+ new(type: :kv, name: name, value: value, **options)
24
24
  end
25
25
 
26
- def distribution(name, **options)
27
- new(type: :d, name: name, **options)
26
+ def distribution(name, value = nil, **options)
27
+ new(type: :d, name: name, value: value, **options)
28
28
  end
29
29
 
30
- def histogram(name, **options)
31
- new(type: :h, name: name, **options)
30
+ def histogram(name, value = nil, **options)
31
+ new(type: :h, name: name, value: value, **options)
32
32
  end
33
33
  end
34
34
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StatsD
4
4
  module Instrument
5
- VERSION = "2.9.1"
5
+ VERSION = "2.9.2"
6
6
  end
7
7
  end
@@ -132,43 +132,55 @@ class AssertionsTest < Minitest::Test
132
132
  end
133
133
 
134
134
  def test_assert_statsd_gauge_call_with_numeric_value
135
- @test_case.assert_statsd_gauge('gauge', value: 42) do
135
+ @test_case.assert_statsd_gauge('gauge', 42) do
136
136
  StatsD.gauge('gauge', 42)
137
137
  end
138
138
 
139
- @test_case.assert_statsd_gauge('gauge', value: '42') do
139
+ @test_case.assert_statsd_gauge('gauge', '42') do
140
140
  StatsD.gauge('gauge', 42)
141
141
  end
142
142
 
143
143
  assert_raises(Minitest::Assertion) do
144
- @test_case.assert_statsd_gauge('gauge', value: 42) do
144
+ @test_case.assert_statsd_gauge('gauge', 42) do
145
145
  StatsD.gauge('gauge', 45)
146
146
  end
147
147
  end
148
+
149
+ @test_case.assert_statsd_gauge('gauge', value: 42) do
150
+ StatsD.gauge('gauge', 42)
151
+ end
148
152
  end
149
153
 
150
154
  def test_assert_statsd_set_call_with_string_value
151
- @test_case.assert_statsd_set('set', value: 12345) do
155
+ @test_case.assert_statsd_set('set', 12345) do
152
156
  StatsD.set('set', '12345')
153
157
  end
154
158
 
155
- @test_case.assert_statsd_set('set', value: '12345') do
159
+ @test_case.assert_statsd_set('set', '12345') do
156
160
  StatsD.set('set', '12345')
157
161
  end
158
162
 
159
- @test_case.assert_statsd_set('set', value: 12345) do
163
+ @test_case.assert_statsd_set('set', 12345) do
160
164
  StatsD.set('set', 12345)
161
165
  end
162
166
 
163
- @test_case.assert_statsd_set('set', value: '12345') do
167
+ @test_case.assert_statsd_set('set', '12345') do
164
168
  StatsD.set('set', 12345)
165
169
  end
166
170
 
167
171
  assert_raises(Minitest::Assertion) do
168
- @test_case.assert_statsd_set('set', value: '42') do
172
+ @test_case.assert_statsd_set('set', '42') do
169
173
  StatsD.set('set', 45)
170
174
  end
171
175
  end
176
+
177
+ @test_case.assert_statsd_set('set', value: 12345) do
178
+ StatsD.set('set', '12345')
179
+ end
180
+
181
+ @test_case.assert_statsd_set('set', 'wrong_value', value: 12345) do
182
+ StatsD.set('set', '12345')
183
+ end
172
184
  end
173
185
 
174
186
  def test_tags_will_match_subsets
@@ -285,7 +297,7 @@ class AssertionsTest < Minitest::Test
285
297
  end
286
298
 
287
299
  foo_1_metric = StatsD::Instrument::Expectation.increment('counter', times: 2, tags: ['foo:1'])
288
- foo_2_metric = StatsD::Instrument::Expectation.increment('counter', tags: ['foo:2'])
300
+ foo_2_metric = StatsD::Instrument::Expectation.increment('counter', 1, tags: ['foo:2'])
289
301
  @test_case.assert_statsd_expectations([foo_1_metric, foo_2_metric]) do
290
302
  StatsD.increment('counter', tags: { foo: 1 })
291
303
  StatsD.increment('counter', tags: { foo: 1 })
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.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-10-31 00:00:00.000000000 Z
13
+ date: 2019-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake