puma-plugin-statsd 2.1.0 → 2.2.0

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: 4794cf011c7fa906180ab8dfa2b0d89a0a1c942cbfbce0725d72facb68804a32
4
- data.tar.gz: 65b939ecf211d9fb4749d67e03b273524ad61794758f5f6a89a6a6023e66c870
3
+ metadata.gz: 359b3281a2ce1173373bba01c4ca0981772d63af2719daead709efb87b0f19bd
4
+ data.tar.gz: 2b11561ad00b73a80c8cea674fad5bce390a9e384169f68bb77f0445b006d8b0
5
5
  SHA512:
6
- metadata.gz: 8de8010e2f5716873518f03ebf3534ae2f4059423d825c2cd1da728fa8cf4511b3220abe661d8ab1d12f945f954934d4e6361b936ced61310162fa33440b014e
7
- data.tar.gz: dbb9a2486a4b1f01a69de349286c280897ab243fbab47507c695b6eaeda38ca91e4a9780d8d874b48a06411261c1b6ebdc1c71343048ac06c2ee842114e68428
6
+ metadata.gz: 8c5da2367dfa0d796258d9d8ecda4a70d4225946669e4ad30aefd4196c86f3b03f3fd99894dc5cbc55afede49b2559bbaac5217f4b9b97622ab0c4105dd0d5f5
7
+ data.tar.gz: be824e394c2b04ad4f6e80a32db242e2a3e74db512b8ec3720a41a1e3ba1ca45dd2e0221a951b71f8c6e2c8a90e2fc03b63dd865e0f63978c5f1b4eb9ff816b1
data/CHANGELOG.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.2.0 2022-07-31
4
+
5
+ * Support communicating with the Datadog agent via a UNIX socket (set STATSD_SOCKET_PATH env var) (PR #[38](https://github.com/yob/puma-plugin-statsd/pull/38))
6
+
3
7
  ## 2.1.0 2021-12-04
4
8
 
5
- * Adds support for Datadog unified service tagging (env, service, version) (PR #[31](https://github.com/yob/puma-plugin-statsd/pull/37))
9
+ * Adds support for Datadog unified service tagging (env, service, version) (PR #[37](https://github.com/yob/puma-plugin-statsd/pull/37))
6
10
 
7
11
  ## 2.0.0 2021-07-27
8
12
 
9
13
  * Require puma 5 or better
10
14
  * Split DD_TAGS environment variable by commas or spaces (PR #[31](https://github.com/yob/puma-plugin-statsd/pull/31))
11
- * Gracefully handle unexpecte errors when submitting to statsd (like DNS resolution failures) (PR #[35](https://github.com/yob/puma-plugin-statsd/pull/35))
15
+ * Gracefully handle unexpected errors when submitting to statsd (like DNS resolution failures) (PR #[35](https://github.com/yob/puma-plugin-statsd/pull/35))
12
16
 
13
17
  ## 1.2.1 2021-01-11
14
18
 
@@ -13,14 +13,21 @@ class StatsdConnector
13
13
  def initialize
14
14
  @host = ENV.fetch(ENV_NAME, "127.0.0.1")
15
15
  @port = ENV.fetch("STATSD_PORT", 8125)
16
+ @socket_path = ENV.fetch("STATSD_SOCKET_PATH", nil)
16
17
  end
17
18
 
18
19
  def send(metric_name:, value:, type:, tags: nil)
19
20
  data = "#{metric_name}:#{value}|#{STATSD_TYPES.fetch(type)}"
20
21
  data = "#{data}|##{tags}" unless tags.nil?
21
22
 
22
- socket = UDPSocket.new
23
- socket.send(data, 0, host, port)
23
+ if @socket_path
24
+ socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM)
25
+ socket.connect(Socket.pack_sockaddr_un(@socket_path))
26
+ socket.sendmsg_nonblock(data)
27
+ else
28
+ socket = UDPSocket.new
29
+ socket.send(data, 0, host, port)
30
+ end
24
31
  ensure
25
32
  socket.close
26
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-plugin-statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-04 00:00:00.000000000 Z
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puma
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.2.3
134
+ rubygems_version: 3.3.7
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Send puma metrics to statsd via a background thread