statsd-instrument 3.5.6 → 3.5.7
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/.github/workflows/tests.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/statsd/instrument/client.rb +3 -3
- data/lib/statsd/instrument/version.rb +1 -1
- data/test/client_test.rb +4 -4
- data/test/statsd_test.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b7e23789eaa2e8f4589989b748c3bd60b31b6916b58f92a845e96c4876fb6ff
|
4
|
+
data.tar.gz: d19bcff247d6b3dcabbb9142955c8f1781fd54a7b235ffcae41fb59643babbe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd9c53e5050773c076b08219965d4c25f509989b3c00ff8fe16c0299e01135b4ca19a02fb7617a5d55737cc776529e865be9f17340f9f8ac406a28562e37f82
|
7
|
+
data.tar.gz: 9a5edafd0f72d4da58ca5ce1783c36755e99d458aff9d338af1abc583e9d23b1ccc825b192ef9f97b5f519b41d576755e3e797892f55483e3154795089618612
|
data/.github/workflows/tests.yml
CHANGED
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
strategy:
|
10
10
|
fail-fast: false
|
11
11
|
matrix:
|
12
|
-
ruby: ['2.6', '2.7', '3.0', '3.1', 'ruby-head', 'jruby-9.3.7.0', 'truffleruby-22.2.0']
|
12
|
+
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'jruby-9.3.7.0', 'truffleruby-22.2.0']
|
13
13
|
# Windows on macOS builds started failing, so they are disabled for now
|
14
14
|
# platform: [windows-2019, macOS-10.14, ubuntu-18.04]
|
15
15
|
# exclude:
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ section below.
|
|
6
6
|
|
7
7
|
## Unreleased changes
|
8
8
|
|
9
|
+
## Version 3.5.7
|
10
|
+
|
11
|
+
- Improve time measurement to avoid seconds to milliseconds conversions.
|
12
|
+
|
9
13
|
## Version 3.5.6
|
10
14
|
|
11
15
|
- Fix issue from 3.5.5 where tests using RSpec matcher for tag assertion would fail, because the matcher as being
|
@@ -310,16 +310,16 @@ module StatsD
|
|
310
310
|
# @yield The latency (execution time) of the block
|
311
311
|
# @return The return value of the provided block will be passed through.
|
312
312
|
def latency(name, sample_rate: nil, tags: nil, metric_type: nil, no_prefix: false)
|
313
|
-
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
313
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
314
314
|
begin
|
315
315
|
yield
|
316
316
|
ensure
|
317
|
-
stop = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
317
|
+
stop = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
318
318
|
|
319
319
|
sample_rate ||= @default_sample_rate
|
320
320
|
if sample?(sample_rate)
|
321
321
|
metric_type ||= datagram_builder(no_prefix: no_prefix).latency_metric_type
|
322
|
-
latency_in_ms =
|
322
|
+
latency_in_ms = stop - start
|
323
323
|
emit(datagram_builder(no_prefix: no_prefix).send(metric_type, name, latency_in_ms, sample_rate, tags))
|
324
324
|
end
|
325
325
|
end
|
data/test/client_test.rb
CHANGED
@@ -95,7 +95,7 @@ class ClientTest < Minitest::Test
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_measure_with_block
|
98
|
-
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC).returns(0
|
98
|
+
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC, :float_millisecond).returns(100.0, 200.0)
|
99
99
|
datagrams = @client.capture do
|
100
100
|
@client.measure("foo") {}
|
101
101
|
end
|
@@ -128,7 +128,7 @@ class ClientTest < Minitest::Test
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def test_distribution_with_block
|
131
|
-
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC).returns(0
|
131
|
+
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC, :float_millisecond).returns(100.0, 200.0)
|
132
132
|
datagrams = @dogstatsd_client.capture do
|
133
133
|
@dogstatsd_client.distribution("foo") {}
|
134
134
|
end
|
@@ -137,7 +137,7 @@ class ClientTest < Minitest::Test
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def test_latency_emits_ms_metric
|
140
|
-
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC).returns(0
|
140
|
+
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC, :float_millisecond).returns(100.0, 200.0)
|
141
141
|
datagrams = @client.capture do
|
142
142
|
@client.latency("foo") {}
|
143
143
|
end
|
@@ -146,7 +146,7 @@ class ClientTest < Minitest::Test
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def test_latency_on_dogstatsd_prefers_distribution_metric_type
|
149
|
-
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC).returns(0
|
149
|
+
Process.stubs(:clock_gettime).with(Process::CLOCK_MONOTONIC, :float_millisecond).returns(100.0, 200.0)
|
150
150
|
datagrams = @dogstatsd_client.capture do
|
151
151
|
@dogstatsd_client.latency("foo") {}
|
152
152
|
end
|
data/test/statsd_test.rb
CHANGED
@@ -18,7 +18,7 @@ class StatsDTest < Minitest::Test
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_statsd_measure_with_benchmarked_block_duration
|
21
|
-
Process.stubs(:clock_gettime).returns(
|
21
|
+
Process.stubs(:clock_gettime).returns(5000.0, 5000.0 + 1120.0)
|
22
22
|
metric = capture_statsd_call do
|
23
23
|
StatsD.measure("values.foobar") { "foo" }
|
24
24
|
end
|
@@ -31,7 +31,7 @@ class StatsDTest < Minitest::Test
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_statsd_measure_with_return_in_block_still_captures
|
34
|
-
Process.stubs(:clock_gettime).returns(
|
34
|
+
Process.stubs(:clock_gettime).returns(5000.0, 6120.0)
|
35
35
|
result = nil
|
36
36
|
metric = capture_statsd_call do
|
37
37
|
lambda = -> do
|
@@ -46,7 +46,7 @@ class StatsDTest < Minitest::Test
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_statsd_measure_with_exception_in_block_still_captures
|
49
|
-
Process.stubs(:clock_gettime).returns(
|
49
|
+
Process.stubs(:clock_gettime).returns(5000.0, 6120.0)
|
50
50
|
result = nil
|
51
51
|
metric = capture_statsd_call do
|
52
52
|
lambda = -> do
|
@@ -111,7 +111,7 @@ class StatsDTest < Minitest::Test
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_statsd_distribution_with_benchmarked_block_duration
|
114
|
-
Process.stubs(:clock_gettime).returns(
|
114
|
+
Process.stubs(:clock_gettime).returns(5000.0, 5000.0 + 1120.0)
|
115
115
|
metric = capture_statsd_call do
|
116
116
|
result = StatsD.distribution("values.foobar") { "foo" }
|
117
117
|
assert_equal("foo", result)
|
@@ -121,7 +121,7 @@ class StatsDTest < Minitest::Test
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def test_statsd_distribution_with_return_in_block_still_captures
|
124
|
-
Process.stubs(:clock_gettime).returns(
|
124
|
+
Process.stubs(:clock_gettime).returns(5000.0, 5000.0 + 1120.0)
|
125
125
|
result = nil
|
126
126
|
metric = capture_statsd_call do
|
127
127
|
lambda = -> do
|
@@ -138,7 +138,7 @@ class StatsDTest < Minitest::Test
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def test_statsd_distribution_with_exception_in_block_still_captures
|
141
|
-
Process.stubs(:clock_gettime).returns(
|
141
|
+
Process.stubs(:clock_gettime).returns(5000.0, 5000.0 + 1120.0)
|
142
142
|
result = nil
|
143
143
|
metric = capture_statsd_call do
|
144
144
|
lambda = -> do
|
@@ -158,7 +158,7 @@ class StatsDTest < Minitest::Test
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def test_statsd_distribution_with_block_and_options
|
161
|
-
Process.stubs(:clock_gettime).returns(
|
161
|
+
Process.stubs(:clock_gettime).returns(5000.0, 5000.0 + 1120.0)
|
162
162
|
metric = capture_statsd_call do
|
163
163
|
StatsD.distribution("values.foobar", tags: ["test"], sample_rate: 0.9) { "foo" }
|
164
164
|
end
|
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: 3.5.
|
4
|
+
version: 3.5.7
|
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: 2023-
|
13
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: A StatsD client for Ruby apps. Provides metaprogramming methods to inject
|
16
16
|
StatsD instrumentation into your code.
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.4.10
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: A StatsD client for Ruby apps
|