statsd-instrument 2.3.0.beta4 → 2.3.0.beta5

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: 3e554f96249614fda4598c73f8a374eb17d53aac
4
- data.tar.gz: 0d2b774c6545501caf5a4e8a2c254a68fea40239
3
+ metadata.gz: 3778ad062c094c39ea30a024aea34b09399966d1
4
+ data.tar.gz: b7f1fa108b6125fb48778520abc947ce149e2317
5
5
  SHA512:
6
- metadata.gz: 35310f0da894755a60b5517d8d555169805eb2e27c789c79d8a36fe8f87a0e7e14183814f6c81d4734338f4384ed329c6a9041df21f573b95e9c1d1e60ec9f55
7
- data.tar.gz: 4c146f7e47bd0b181c3844e126fa8b0760ad6f6dd91f979cf83be422ac58e89bc9cb9e43744aa5a6096e592d5a5b43ed56688bbbf921bd5b80fba06f2dc9029a
6
+ metadata.gz: 143d81f6dfe35e31b3faf1d69007792b2498ef553148ed61e1eb357c170b2990ceba09d27e2b58c078d6cfd0d8c1d78fbc999f377d6142ff2d599f21b44b7058
7
+ data.tar.gz: 03c3d70cae11a1a9f92e6160b09c51fd23e275c485cb37bc468447b9ec4665431f83a1ca96ea5f4fc498ba80891573bc002ddb2a93e81353d92e18c264d95971
@@ -313,7 +313,8 @@ module StatsD
313
313
  result = nil
314
314
  value = 1000 * StatsD::Instrument.duration { result = block.call } if block_given?
315
315
  metric = collect_metric(type, key, value, metric_options)
316
- (result || metric)
316
+ result = metric unless block_given?
317
+ result
317
318
  end
318
319
 
319
320
  # Emits a counter metric.
@@ -375,7 +376,8 @@ module StatsD
375
376
  result = nil
376
377
  value = 1000 * StatsD::Instrument.duration { result = block.call } if block_given?
377
378
  metric = collect_metric(:d, key, value, metric_options)
378
- (result || metric)
379
+ result = metric unless block_given?
380
+ result
379
381
  end
380
382
 
381
383
  # Emits a key/value metric.
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.3.0.beta4"
3
+ VERSION = "2.3.0.beta5"
4
4
  end
5
5
  end
@@ -65,6 +65,11 @@ class StatsDTest < Minitest::Test
65
65
  assert_equal 'sarah', return_value
66
66
  end
67
67
 
68
+ def test_statsd_measure_returns_return_value_of_block_even_if_nil
69
+ return_value = StatsD.measure('values.foobar', as_dist: true) { nil }
70
+ assert_nil return_value
71
+ end
72
+
68
73
  def test_statsd_increment
69
74
  result = nil
70
75
  metric = capture_statsd_call { result = StatsD.increment('values.foobar', 3) }
@@ -168,6 +173,11 @@ class StatsDTest < Minitest::Test
168
173
  assert_equal 'sarah', return_value
169
174
  end
170
175
 
176
+ def test_statsd_measure_returns_return_value_of_block_even_if_nil
177
+ return_value = StatsD.distribution('values.foobar') { nil }
178
+ assert_nil return_value
179
+ end
180
+
171
181
  def test_statsd_key_value
172
182
  result = nil
173
183
  metric = capture_statsd_call { result = StatsD.key_value('values.foobar', 42) }
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.3.0.beta4
4
+ version: 2.3.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer