puma-plugin-statsd 2.3.0 → 2.4.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: 1ae9c9480d1241bd90b7a2b0deb90b48e5effd7c48e85131db1c76b67a58934d
4
- data.tar.gz: 1037c175245a0f94d4c73e8531cf8de04e619840516fc00a910353933bf44172
3
+ metadata.gz: 024db26ca54b74eb4cc86cfbc8aacda5f5b68d25177b007a9050a22545466351
4
+ data.tar.gz: 1e42d780def66948cd9fd01357b0a424ad04aaac86bfa6f8e5c26de82a430e11
5
5
  SHA512:
6
- metadata.gz: 2f69cf9f81b61a53aeb195b8f3706232e2793a0bc365c654b2a8338573c10e6ff0ca7e6ecf39651d128c5929111ef350bd3284c5f22d1d15bf5560d807b90e15
7
- data.tar.gz: 9c5b0671b4c9e62c790b1e534e11990b93542f56e8da9b42ab050bc007c631ac961b2d66d99d05d7ab3a8b7bd2a1113200ec439306e1f937ff8c97c2c3f342e9
6
+ metadata.gz: 6c44f94b38dc4c1848827bf20a3503f639be3cd13a0501beb807dd75d092403b229caf0c83c24b57caec9a255a76b2f371ce9b2e2cfa9efabc9e06ba07d9730c
7
+ data.tar.gz: af204a3591ff96c4bd876d42eec731037236265208abdb58f492145beda7e9124a511317623918bf9ce213c5e76c87307f26659e8cc12feea7a364b31d1a4ad3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.4.0 2022-12-27
4
+
5
+ * Support puma 6 (PR #[46](https://github.com/yob/puma-plugin-statsd/pull/46))
6
+
3
7
  ## 2.3.0 2022-11-26
4
8
 
5
9
  * Support the origin detection over UDP from Datadog via DD_ENTITY_ID env var
@@ -1,4 +1,5 @@
1
- # coding: utf-8, frozen_string_literal: true
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require "puma"
3
4
  require "puma/plugin"
4
5
  require 'socket'
@@ -6,7 +7,7 @@ require 'socket'
6
7
  class StatsdConnector
7
8
  ENV_NAME = "STATSD_HOST"
8
9
  STATSD_TYPES = { count: 'c', gauge: 'g' }
9
- METRIC_DELIMETER = ".".freeze
10
+ METRIC_DELIMETER = "."
10
11
 
11
12
  attr_reader :host, :port
12
13
 
@@ -100,9 +101,15 @@ Puma::Plugin.create do
100
101
  # We can start doing something when we have a launcher:
101
102
  def start(launcher)
102
103
  @launcher = launcher
104
+ @log_writer =
105
+ if Gem::Version.new(Puma::Const::PUMA_VERSION) >= Gem::Version.new(6)
106
+ @launcher.log_writer
107
+ else
108
+ @launcher.events
109
+ end
103
110
 
104
111
  @statsd = ::StatsdConnector.new
105
- @launcher.events.debug "statsd: enabled (host: #{@statsd.host})"
112
+ @log_writer.debug "statsd: enabled (host: #{@statsd.host})"
106
113
 
107
114
  # Fetch global metric prefix from env variable
108
115
  @metric_prefix = ENV.fetch("STATSD_METRIC_PREFIX", nil)
@@ -188,7 +195,7 @@ Puma::Plugin.create do
188
195
 
189
196
  sleep 5
190
197
  loop do
191
- @launcher.events.debug "statsd: notify statsd"
198
+ @log_writer.debug "statsd: notify statsd"
192
199
  begin
193
200
  stats = ::PumaStats.new(Puma.stats_hash)
194
201
  @statsd.send(metric_name: prefixed_metric_name("puma.workers"), value: stats.workers, type: :gauge, tags: tags)
@@ -200,7 +207,7 @@ Puma::Plugin.create do
200
207
  @statsd.send(metric_name: prefixed_metric_name("puma.max_threads"), value: stats.max_threads, type: :gauge, tags: tags)
201
208
  @statsd.send(metric_name: prefixed_metric_name("puma.requests_count"), value: stats.requests_count, type: :gauge, tags: tags)
202
209
  rescue StandardError => e
203
- @launcher.events.unknown_error e, nil, "! statsd: notify stats failed"
210
+ @log_writer.unknown_error e, nil, "! statsd: notify stats failed"
204
211
  ensure
205
212
  sleep 2
206
213
  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.3.0
4
+ version: 2.4.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: 2022-11-26 00:00:00.000000000 Z
11
+ date: 2022-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puma
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -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.3.7
134
+ rubygems_version: 3.3.26
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Send puma metrics to statsd via a background thread