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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/puma/plugin/statsd.rb +12 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 024db26ca54b74eb4cc86cfbc8aacda5f5b68d25177b007a9050a22545466351
|
4
|
+
data.tar.gz: 1e42d780def66948cd9fd01357b0a424ad04aaac86bfa6f8e5c26de82a430e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c44f94b38dc4c1848827bf20a3503f639be3cd13a0501beb807dd75d092403b229caf0c83c24b57caec9a255a76b2f371ce9b2e2cfa9efabc9e06ba07d9730c
|
7
|
+
data.tar.gz: af204a3591ff96c4bd876d42eec731037236265208abdb58f492145beda7e9124a511317623918bf9ce213c5e76c87307f26659e8cc12feea7a364b31d1a4ad3
|
data/CHANGELOG.md
CHANGED
data/lib/puma/plugin/statsd.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# coding: utf-8
|
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 = "."
|
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
|
-
@
|
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
|
-
@
|
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
|
-
@
|
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.
|
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
|
+
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: '
|
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: '
|
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.
|
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
|