statsd-instrument 3.5.10 → 3.5.12
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/benchmark.yml +5 -5
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/tests.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +2 -2
- data/benchmark/README.md +2 -2
- data/benchmark/send-metrics-to-dev-null-log +3 -3
- data/benchmark/send-metrics-to-local-udp-receiver +3 -3
- 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: 41254f0057c645926c54b36ec4bf937352444740f0cae248b1feed1f35ce4044
|
4
|
+
data.tar.gz: 3d2131889385d2755a738d735ca9a20dba0342e645d58312c4007b7a1835b249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46a4f427f2e298c242a84c7f90a715a7d4397c28ad5db8f89f8b669e3867c7b253a5858a61e35768fada113b56202dc43d91cffb68b9626ea79c26fd15d10a67
|
7
|
+
data.tar.gz: 99b1979f9b3b9a4e502c78a42bfa48348600eece64646ddfdd2470ae1d3b4cc52123e3edaef539886c667ff2e9eca98051c55c5fec7c6ccc76e1404e2f5f2800
|
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
10
|
steps:
|
11
|
-
- uses: actions/checkout@
|
11
|
+
- uses: actions/checkout@v3
|
12
12
|
|
13
13
|
- name: Set up Ruby
|
14
14
|
uses: ruby/setup-ruby@v1
|
@@ -22,15 +22,15 @@ jobs:
|
|
22
22
|
- name: Run throughput benchmark on branch
|
23
23
|
run: benchmark/local-udp-throughput
|
24
24
|
|
25
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v3
|
26
26
|
with:
|
27
|
-
ref: '
|
27
|
+
ref: 'main'
|
28
28
|
|
29
29
|
- name: Install dependencies if needed
|
30
30
|
run: bundle check || bundle install --jobs 4 --retry 3
|
31
31
|
|
32
|
-
- name: Run benchmark on
|
32
|
+
- name: Run benchmark on main
|
33
33
|
run: benchmark/send-metrics-to-local-udp-receiver
|
34
34
|
|
35
|
-
- name: Run throughput benchmark on
|
35
|
+
- name: Run throughput benchmark on main
|
36
36
|
run: benchmark/local-udp-throughput
|
data/.github/workflows/lint.yml
CHANGED
data/.github/workflows/tests.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ section below.
|
|
6
6
|
|
7
7
|
## Unreleased changes
|
8
8
|
|
9
|
+
## Version 3.5.12
|
10
|
+
|
11
|
+
- Update CONTRIBUTING docs about release process
|
12
|
+
- Rename branch `master` to `main`.
|
13
|
+
|
14
|
+
## Version 3.5.11
|
15
|
+
|
16
|
+
- Fix a bug where passing `nil` to `clone_with_options` did not overwrite existing values
|
17
|
+
|
9
18
|
## Version 3.5.10
|
10
19
|
|
11
20
|
- Fix rubocop 1.30 compatibilitty
|
data/CONTRIBUTING.md
CHANGED
@@ -59,5 +59,5 @@ we are depending on the current behavior of the library.
|
|
59
59
|
|
60
60
|
1. Update the version number in `lib/statsd/instrument/version.rb`.
|
61
61
|
2. Move the "Unreleased changes" items in [CHANGELOG.md](./CHANGELOG.md) to a new section for the release.
|
62
|
-
3.
|
63
|
-
4.
|
62
|
+
3. Open a PR with these changes, have it reviewed and merged.
|
63
|
+
4. The new version will be automatically uploaded by our deployment pipeline.
|
data/benchmark/README.md
CHANGED
@@ -23,7 +23,7 @@ To benchmark your changes:
|
|
23
23
|
be available if you check out another branch.
|
24
24
|
2. Run these scripts on your pull request branch. The results will be stored in
|
25
25
|
a temporary file.
|
26
|
-
3. Checkout the latest version of `
|
26
|
+
3. Checkout the latest version of `main`.
|
27
27
|
4. Run the benchmark again. The benchmark script will now print a comparison
|
28
|
-
between your branch and
|
28
|
+
between your branch and main.
|
29
29
|
5. Include the output in your pull request description.
|
@@ -6,9 +6,9 @@ require "tmpdir"
|
|
6
6
|
require "benchmark/ips"
|
7
7
|
|
8
8
|
revision = %x(git rev-parse HEAD).rstrip
|
9
|
-
base_revision = %x(git rev-parse origin/
|
9
|
+
base_revision = %x(git rev-parse origin/main).rstrip
|
10
10
|
branch = if revision == base_revision
|
11
|
-
"
|
11
|
+
"main"
|
12
12
|
else
|
13
13
|
%x(git rev-parse --abbrev-ref HEAD).rstrip
|
14
14
|
end
|
@@ -39,7 +39,7 @@ end
|
|
39
39
|
|
40
40
|
if report.entries.length == 1
|
41
41
|
puts
|
42
|
-
puts "To compare the performance of this revision against another revision (e.g.
|
42
|
+
puts "To compare the performance of this revision against another revision (e.g. main),"
|
43
43
|
puts "check out a different branch and run this benchmark script again."
|
44
44
|
elsif ENV["KEEP_RESULTS"]
|
45
45
|
puts
|
@@ -20,9 +20,9 @@ end
|
|
20
20
|
|
21
21
|
def benchmark_implementation(name, env = {})
|
22
22
|
revision = %x(git rev-parse HEAD).rstrip
|
23
|
-
base_revision = %x(git rev-parse origin/
|
23
|
+
base_revision = %x(git rev-parse origin/main).rstrip
|
24
24
|
branch = if revision == base_revision
|
25
|
-
"
|
25
|
+
"main"
|
26
26
|
else
|
27
27
|
%x(git rev-parse --abbrev-ref HEAD).rstrip
|
28
28
|
end
|
@@ -60,7 +60,7 @@ def benchmark_implementation(name, env = {})
|
|
60
60
|
|
61
61
|
if report.entries.length == 1
|
62
62
|
puts
|
63
|
-
puts "To compare the performance of this revision against another revision (e.g.
|
63
|
+
puts "To compare the performance of this revision against another revision (e.g. main),"
|
64
64
|
puts "check out a different branch and run this benchmark script again."
|
65
65
|
elsif ENV["KEEP_RESULTS"]
|
66
66
|
puts
|
@@ -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.12
|
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-25 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.18
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: A StatsD client for Ruby apps
|