statsd-instrument 2.3.4 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/statsd/instrument/version.rb +1 -1
- data/lib/statsd/instrument.rb +10 -0
- data/test/statsd_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac15b85b9c1c1f3569f3044598719ff8d7ba465a523fd050291b27dc18e7df65
|
4
|
+
data.tar.gz: b3e70fee63bc74df1309d60e5ffb5ec48d773f2f190f45a361df742c65a72e65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/statsd/instrument.rb
CHANGED
@@ -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
|
+
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-
|
13
|
+
date: 2019-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|