statsd-instrument 3.5.10 → 3.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/statsd/instrument/client.rb +18 -15
- data/lib/statsd/instrument/rubocop.rb +1 -1
- data/lib/statsd/instrument/version.rb +1 -1
- data/test/client_test.rb +14 -0
- 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: c9124bb941a7f03e9d64ea7969fb4b2f47b44bae2ca4ec56fe3f0653bb3df8a4
|
4
|
+
data.tar.gz: a70c8e54c4cbd9e5b24981c613ca674d89deb2ba8b7087447ee0cc56faf4d5d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a8b1a8308e5dd2862b367e0e3321b9255039c1887d9830a608812eadc2f29e4b6f916b3245293b7d200ac148f89179712492a024fb2bedd3e36887eb20c0bb
|
7
|
+
data.tar.gz: 797ca0e4d0f22ed3cbe87acae0fba3a434c36b8b5059bfb7808c93498c0e028ee9b64af1f4b3e06e796e36ba8053109c66ed4c619de7fb672107818bda7024b5
|
data/CHANGELOG.md
CHANGED
@@ -378,6 +378,8 @@ module StatsD
|
|
378
378
|
))
|
379
379
|
end
|
380
380
|
|
381
|
+
NO_CHANGE = Object.new
|
382
|
+
|
381
383
|
# Instantiates a new StatsD client that uses the settings of the current client,
|
382
384
|
# except for the provided overrides.
|
383
385
|
#
|
@@ -386,11 +388,11 @@ module StatsD
|
|
386
388
|
# will be disposed after the block returns
|
387
389
|
# @return The return value of the block will be passed on as return value.
|
388
390
|
def with_options(
|
389
|
-
sink:
|
390
|
-
prefix:
|
391
|
-
default_sample_rate:
|
392
|
-
default_tags:
|
393
|
-
datagram_builder_class:
|
391
|
+
sink: NO_CHANGE,
|
392
|
+
prefix: NO_CHANGE,
|
393
|
+
default_sample_rate: NO_CHANGE,
|
394
|
+
default_tags: NO_CHANGE,
|
395
|
+
datagram_builder_class: NO_CHANGE
|
394
396
|
)
|
395
397
|
client = clone_with_options(
|
396
398
|
sink: sink,
|
@@ -404,18 +406,19 @@ module StatsD
|
|
404
406
|
end
|
405
407
|
|
406
408
|
def clone_with_options(
|
407
|
-
sink:
|
408
|
-
prefix:
|
409
|
-
default_sample_rate:
|
410
|
-
default_tags:
|
411
|
-
datagram_builder_class:
|
409
|
+
sink: NO_CHANGE,
|
410
|
+
prefix: NO_CHANGE,
|
411
|
+
default_sample_rate: NO_CHANGE,
|
412
|
+
default_tags: NO_CHANGE,
|
413
|
+
datagram_builder_class: NO_CHANGE
|
412
414
|
)
|
413
415
|
self.class.new(
|
414
|
-
sink: sink
|
415
|
-
prefix: prefix
|
416
|
-
default_sample_rate: default_sample_rate
|
417
|
-
default_tags: default_tags
|
418
|
-
datagram_builder_class:
|
416
|
+
sink: sink == NO_CHANGE ? @sink : sink,
|
417
|
+
prefix: prefix == NO_CHANGE ? @prefix : prefix,
|
418
|
+
default_sample_rate: default_sample_rate == NO_CHANGE ? @default_sample_rate : default_sample_rate,
|
419
|
+
default_tags: default_tags == NO_CHANGE ? @default_tags : default_tags,
|
420
|
+
datagram_builder_class:
|
421
|
+
datagram_builder_class == NO_CHANGE ? @datagram_builder_class : datagram_builder_class,
|
419
422
|
)
|
420
423
|
end
|
421
424
|
|
data/test/client_test.rb
CHANGED
@@ -223,4 +223,18 @@ class ClientTest < Minitest::Test
|
|
223
223
|
original_client.increment("metric")
|
224
224
|
client_with_other_options.increment("metric")
|
225
225
|
end
|
226
|
+
|
227
|
+
def test_clone_can_remove_prefix
|
228
|
+
# Both clients will use the same sink.
|
229
|
+
mock_sink = mock("sink")
|
230
|
+
mock_sink.stubs(:sample?).returns(true)
|
231
|
+
mock_sink.expects(:<<).with("foo.metric:1|c").returns(mock_sink)
|
232
|
+
mock_sink.expects(:<<).with("metric:1|c").returns(mock_sink)
|
233
|
+
|
234
|
+
original_client = StatsD::Instrument::Client.new(sink: mock_sink, prefix: "foo")
|
235
|
+
client_with_other_options = original_client.clone_with_options(prefix: nil)
|
236
|
+
|
237
|
+
original_client.increment("metric")
|
238
|
+
client_with_other_options.increment("metric")
|
239
|
+
end
|
226
240
|
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.11
|
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-08-02 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.4.
|
125
|
+
rubygems_version: 3.4.17
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: A StatsD client for Ruby apps
|