statsd-instrument 2.3.4 → 2.3.5

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: a8076b4d86af6ed043e664abf288c4d33a89d324017eeb1a8ae230266352cb9c
4
- data.tar.gz: a56269d70cbca5d0788838f96e9515f92cf93b1330d3ef826620c1af5ae0ba72
3
+ metadata.gz: ac15b85b9c1c1f3569f3044598719ff8d7ba465a523fd050291b27dc18e7df65
4
+ data.tar.gz: b3e70fee63bc74df1309d60e5ffb5ec48d773f2f190f45a361df742c65a72e65
5
5
  SHA512:
6
- metadata.gz: 9e922ee94f9bcbf22390cc9ac2e740a539fb63b162d77529d4a32bb058de5e047de8519808457d86f744519fccd9ae639a6c20d022d67f6845add5769af10356
7
- data.tar.gz: 50f3c7a81c69d5b26196f38d4716d03b24dbc52147c6c2894edf41dd4e7d7efa7fdc725d4f669213327121eca9d0e771469d3aa4d6b20bb86252d30b5a5b57e9
6
+ metadata.gz: b5865fae3e078e35a4cee446012cd92a0c26c32855686b5bf021a629e010832e710749f4232f10d715d1c662739065db9466842aa5bf03f640efa5064354e1f9
7
+ data.tar.gz: 000dcfed38ea683b08773a894aa0b1445a59f942c4c3cef74fc38d88efb1d388bc080cd44855b6dd799c0dd293055bb6deb3de40bacb5f04367817227cd6c190
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ please at an entry to the "unreleased changes" section below.
5
5
 
6
6
  ### Unreleased changes
7
7
 
8
+ ## Version 2.3.5
9
+
10
+ - Re-add `StatsD::Instrument.duration`, which was accidentally removed since verison 2.5.3 (#157)
11
+
8
12
  ## Version 2.3.4
9
13
 
10
14
  - Improve performance of `Metric#to_s` (#152)
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.3.4"
3
+ VERSION = "2.3.5"
4
4
  end
5
5
  end
@@ -68,6 +68,16 @@ module StatsD
68
68
  end
69
69
  end
70
70
 
71
+ # Even though this method is considered private, and is no longer used internally,
72
+ # applications in the wild rely on it. As a result, we cannot remove this method
73
+ # until the next major version.
74
+ # @private
75
+ def self.duration
76
+ start = current_timestamp
77
+ yield
78
+ current_timestamp - start
79
+ end
80
+
71
81
  # Adds execution duration instrumentation to a method as a timing.
72
82
  #
73
83
  # @param method [Symbol] The name of the method to instrument.
data/test/statsd_test.rb CHANGED
@@ -257,6 +257,17 @@ class StatsDTest < Minitest::Test
257
257
  assert_equal 42, metric.value
258
258
  end
259
259
 
260
+ def test_statsd_durarion_returns_time_in_seconds
261
+ duration = StatsD::Instrument.duration {}
262
+ assert_kind_of Float, duration
263
+ end
264
+
265
+ def test_statsd_durarion_does_not_swallow_exceptions
266
+ assert_raises(RuntimeError) do
267
+ StatsD::Instrument.duration { raise "Foo" }
268
+ end
269
+ end
270
+
260
271
  protected
261
272
 
262
273
  def capture_statsd_call(&block)
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.4
4
+ version: 2.3.5
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-09-06 00:00:00.000000000 Z
13
+ date: 2019-09-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake