statsd-instrument 3.9.8 → 3.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aa9b8412d646528092adba3cbfcf173e80c4c9f6a69ce2a49db6c74d74fded6
4
- data.tar.gz: 38aaac366290965b067e2e167bffa030aa90d185e595e7c6ed1d687683607bb0
3
+ metadata.gz: 60ed39eafdc0c0c60e8b39cc40a525990f7a51c8bf0621bf657558f29e6767c4
4
+ data.tar.gz: 6d27813cbc21f7f5327cdc261d1dfd7c874d9c4f0c1fdfb17aee1ee63944ea9c
5
5
  SHA512:
6
- metadata.gz: 32cbfe82af236e100778e9367ed1c7cf5a1b4c2ed4bed6969d1e319738eddfe192c0e521c2917ac4b4af5ac1e4e36f3f551828fa9fc69a06e9009d015726f465
7
- data.tar.gz: 0ac5714732d77dcda2ac89ea92dfd51ae99ed1cc021766eaed26e7b28310181c51c5a095ed545862be513a8b17348811715dff2760f6a9ae58dd431a5337080a
6
+ metadata.gz: 6cafa0a80f7c5d7374d8607698b03fc8eb9fe94cfd7b8a4c6accd1bb9ac4c66a83fea40215df8bcc87c4f729e4379956d2614970539375d13c2cd6d65840a5b9
7
+ data.tar.gz: 7e254ea3318a5fc3d79bcb648c5cc939dbbb1552f942c67c38f06d698f44659e790489b5a720cca815ca6998a59b317399a3a54350dca61defafc27ed2da15f6
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ section below.
6
6
 
7
7
  ## Unreleased changes
8
8
 
9
+ ## Version 3.9.9
10
+
11
+ - [#392](https://github.com/Shopify/statsd-instrument/pull/392) - Prevent ENOBUFS errors when using UDP, by skipping setting socket buffer size.
12
+
9
13
  ## Version 3.9.8
10
14
 
11
15
  - [#390](https://github.com/Shopify/statsd-instrument/pull/391) - Fixing bug in Environment when using UDS. The max packet size option was not being passed to the
data/Gemfile CHANGED
@@ -19,4 +19,9 @@ platform :mri do
19
19
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2")
20
20
  gem "vernier", require: false
21
21
  end
22
+
23
+ # From Ruby >= 3.5, logger is not part of the stdlib anymore
24
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5")
25
+ gem "logger"
26
+ end
22
27
  end
@@ -42,7 +42,7 @@ module StatsD
42
42
  original_socket
43
43
  rescue IOError => e
44
44
  StatsD.logger.debug do
45
- "[#{self.class.name}] Failed to create socket: #{e.class}: #{e.message}"
45
+ "[#{self.class.name}] Failed to setup socket: #{e.class}: #{e.message}"
46
46
  end
47
47
  nil
48
48
  end
@@ -25,11 +25,16 @@ module StatsD
25
25
 
26
26
  private
27
27
 
28
+ def setup_socket(original_socket)
29
+ original_socket
30
+ end
31
+
28
32
  def socket
29
33
  @socket ||= begin
30
- udp_socket = UDPSocket.new
34
+ family = Addrinfo.udp(host, port).afamily
35
+ udp_socket = UDPSocket.new(family)
31
36
  setup_socket(udp_socket)&.tap do |s|
32
- s.connect(@host, @port)
37
+ s.connect(host, port)
33
38
  end
34
39
  end
35
40
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StatsD
4
4
  module Instrument
5
- VERSION = "3.9.8"
5
+ VERSION = "3.9.9"
6
6
  end
7
7
  end
@@ -151,25 +151,11 @@ class UDPSinkTest < Minitest::Test
151
151
  seq = sequence("connect_fail_connect_succeed")
152
152
 
153
153
  # First attempt
154
- socket.expects(:setsockopt)
155
- .with(Socket::SOL_SOCKET, Socket::SO_SNDBUF, StatsD::Instrument::UdpConnection::DEFAULT_MAX_PACKET_SIZE)
156
- .in_sequence(seq)
157
- socket.expects(:getsockopt)
158
- .with(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
159
- .returns(mock(int: StatsD::Instrument::UdpConnection::DEFAULT_MAX_PACKET_SIZE))
160
- .in_sequence(seq)
161
154
  socket.expects(:connect).with("localhost", 8125).in_sequence(seq)
162
155
  socket.expects(:send).raises(Errno::EDESTADDRREQ).in_sequence(seq)
163
156
  socket.expects(:close).in_sequence(seq)
164
157
 
165
158
  # Second attempt after error
166
- socket.expects(:setsockopt)
167
- .with(Socket::SOL_SOCKET, Socket::SO_SNDBUF, StatsD::Instrument::UdpConnection::DEFAULT_MAX_PACKET_SIZE)
168
- .in_sequence(seq)
169
- socket.expects(:getsockopt)
170
- .with(Socket::SOL_SOCKET, Socket::SO_SNDBUF)
171
- .returns(mock(int: StatsD::Instrument::UdpConnection::DEFAULT_MAX_PACKET_SIZE))
172
- .in_sequence(seq)
173
159
  socket.expects(:connect).with("localhost", 8125).in_sequence(seq)
174
160
  socket.expects(:send).twice.returns(1).in_sequence(seq)
175
161
  socket.expects(:close).in_sequence(seq)
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsd-instrument
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.8
4
+ version: 3.9.9
5
5
  platform: ruby
6
- original_platform: ''
7
6
  authors:
8
7
  - Jesse Storimer
9
8
  - Tobias Lutke
10
9
  - Willem van Bergen
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-12-19 00:00:00.000000000 Z
12
+ date: 2025-01-14 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description: A StatsD client for Ruby apps. Provides metaprogramming methods to inject
16
15
  StatsD instrumentation into your code.
@@ -131,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  - !ruby/object:Gem::Version
132
131
  version: '0'
133
132
  requirements: []
134
- rubygems_version: 3.6.1
133
+ rubygems_version: 3.6.2
135
134
  specification_version: 4
136
135
  summary: A StatsD client for Ruby apps
137
136
  test_files: