waterdrop 2.8.14 → 2.8.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57d1e899a312c47c5101a9029914468881e0ebb9437926767078c37f1ce1b4d1
4
- data.tar.gz: 1767c8a557324bb5bccf93d79847705ecdbe1587d5ff97210597c41ee9cfa0d4
3
+ metadata.gz: 5e65e5de3fde4fee519f6c7313c832e13deffbaf745e7fa934d419db1d4cd050
4
+ data.tar.gz: de1eeaefdff74ce517e15607d7015886211d831d8a2045d40b782edc1d68fe8b
5
5
  SHA512:
6
- metadata.gz: 5286d33cd2bf81f947ddb8c08c77b580aba8ff818f1e01431df36ae31dfbaf7984d3720e4463e1e9551379630fcfc6bcff161e5502d4b9bfa583c913ca050f7c
7
- data.tar.gz: 7365a54e15b397d1c108db6949c6048c3c7e125b2063f2483e13c4ed6d38f961faaeed101a280cb5b9ef4c8d21335fb429e764c5939dbcf558eebc35aa21f3db
6
+ metadata.gz: 9f25c8a5468682bd6bb90ea342557fe1671831598ffa8761af34abbbc58f4cecf682ad682fb2395125e524a571e32802ed16d01139651e3e7584fd3fa671c67a
7
+ data.tar.gz: 863a9b02697708b8aadf52cd86fcee2b42ea1ca4c9c44ab7a2468e2ca0e1c5c76b391ae6d4e2eea63a77d67dd0ed33fc10d3d097b27f73cb47d174f3b93becd7
@@ -23,7 +23,7 @@ jobs:
23
23
  fail-fast: false
24
24
  matrix:
25
25
  ruby:
26
- - '3.5.0-preview1'
26
+ - '4.0.0-preview2'
27
27
  - '3.4'
28
28
  - '3.3'
29
29
  - '3.2'
@@ -42,12 +42,12 @@ jobs:
42
42
  run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
43
43
 
44
44
  - name: Remove platform-specific ffi entries for Ruby previews
45
- if: contains(matrix.ruby, '3.5')
45
+ if: contains(matrix.ruby, 'preview')
46
46
  run: |
47
47
  sed -i '/^\s*ffi (.*-.*)$/d' Gemfile.lock
48
48
 
49
49
  - name: Set up Ruby
50
- uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
50
+ uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
51
51
  with:
52
52
  ruby-version: ${{matrix.ruby}}
53
53
  bundler-cache: true
@@ -118,7 +118,7 @@ jobs:
118
118
  with:
119
119
  fetch-depth: 0
120
120
  - name: Set up Ruby
121
- uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
121
+ uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
122
122
  with:
123
123
  ruby-version: '3.4'
124
124
  bundler-cache: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.8.15 (2025-11-24)
4
+ - [Enhancement] Skip statistics decoration and emission when no listeners are subscribed to `statistics.emitted` events to reduce overhead.
5
+ - [Enhancement] Support late subscription to `statistics.emitted` by checking for listeners on each emission (every 5 seconds).
6
+
3
7
  ## 2.8.14 (2025-11-14)
4
8
  - [Fix] Fatal error replacement not working without exact error unwind from the fatal envelope
5
9
  - [Testing] Add `WaterDrop::Producer::Testing` module for injecting and querying librdkafka fatal errors in tests.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.8.14)
4
+ waterdrop (2.8.15)
5
5
  karafka-core (>= 2.4.9, < 3.0.0)
6
6
  karafka-rdkafka (>= 0.23.1)
7
7
  zeitwerk (~> 2.3)
@@ -29,6 +29,10 @@ module WaterDrop
29
29
  # all the time.
30
30
  return unless @client_name == statistics['name']
31
31
 
32
+ # Skip if no one is listening. We check on each emission to support late subscribers
33
+ # since statistics are emitted every 5 seconds, this check is cheap enough
34
+ return unless listening?
35
+
32
36
  @monitor.instrument(
33
37
  'statistics.emitted',
34
38
  producer_id: @producer_id,
@@ -46,6 +50,15 @@ module WaterDrop
46
50
  type: 'callbacks.statistics.error'
47
51
  )
48
52
  end
53
+
54
+ private
55
+
56
+ # Check if anyone is listening to statistics events
57
+ # @return [Boolean] true if there are listeners
58
+ def listening?
59
+ listeners = @monitor.listeners['statistics.emitted']
60
+ listeners && !listeners.empty?
61
+ end
49
62
  end
50
63
  end
51
64
  end
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.8.14'
6
+ VERSION = '2.8.15'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waterdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.14
4
+ version: 2.8.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld