puma-plugin-statsd 2.5.0 → 2.6.0

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: 15aae3abb8fd429c80e9f80235278b5e4d3d98f9b00efd72e369f40f01c36b03
4
- data.tar.gz: 61fbb46bd7c5845228daf85f293c3a672133378c7e9374c1e15bfb45f6ae4dfe
3
+ metadata.gz: 1d758cafa62bb07175a7c0a21a78e55414bfbb03b619fd5aad6bc311ccbbfaef
4
+ data.tar.gz: 6fd5c3b92fff9fe73305e7bc41149804765363d6cf0d108f7076325a75a4c57e
5
5
  SHA512:
6
- metadata.gz: c96b8f351feac2013070964b5b281156b5a1d46b2d3e14ce74e4459b8bbacde741aae9a4df0f3ce7b1939ad2cb6e3428dc636fd87f2cfad851abad8b7d6f1a36
7
- data.tar.gz: 8918fdb4bb3020661b9f935e1562870e7c67777404fa2bf2cda33fea6539a62aca1e117155c22c5c8fed034865724a56746129be739d3bfd6e469bd7c99d05c5
6
+ metadata.gz: 8a86c803e4ae70ed64335db450a7965f928abcea69dee6cfdf9fcc0b733526f166fe17eefde8aac8db3f90b631c783ce13d437c7458c09729859c8b489d4cc20
7
+ data.tar.gz: dd6b1cf13cdbcc419b7e50b82dc2d1932904132dec9511be84fb2f8e321d6e9db900c823115f7154d7c1a13d24dad0e7efa9c25b5ee6e3bc944a1eee430121be
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.6.0 2023-12-11
4
+
5
+ * New metric: `puma.percent_busy` - The percentage of busy threads calculated as pool capacity relative to max threads (PR #[58](https://github.com/yob/puma-plugin-statsd/pull/58))
6
+
3
7
  ## 2.5.0 2023-08-27
4
8
 
5
9
  * Support adjusting the default reporting interval of 2s (set STATSD_INTERVAL_SECONDS env var) (PR #[54](https://github.com/yob/puma-plugin-statsd/pull/54))
@@ -12,7 +16,7 @@
12
16
 
13
17
  ## 2.3.0 2022-11-26
14
18
 
15
- * Support the origin detection over UDP from Datadog via DD_ENTITY_ID env var
19
+ * Support the origin detection over UDP from Datadog via DD_ENTITY_ID env var (PR #[42](https://github.com/yob/puma-plugin-statsd/pull/42))
16
20
 
17
21
  ## 2.2.0 2022-07-31
18
22
 
data/README.md CHANGED
@@ -12,6 +12,7 @@ Gauges:
12
12
  * puma.backlog - The number of requests that have made it to a worker but are yet to be processed. This will normally be zero, as requests queue on the tcp/unix socket in front of the master puma process, not in the worker thread pool
13
13
  * puma.pool_capacity - The number of idle and unused worker threads. When this is low/zero, puma is running at full capacity and might need scaling up
14
14
  * puma.max_threads - The maximum number of worker threads that might run at one time
15
+ * puma.percent_busy - The percentage of busy threads calculated as pool capacity relative to max threads
15
16
  * puma.requests_count - Total number of requests served by this puma since it started
16
17
 
17
18
  Counters:
@@ -97,6 +97,10 @@ class PumaStats
97
97
  end
98
98
  end
99
99
 
100
+ def percent_busy
101
+ (1 - (pool_capacity / max_threads.to_f)) * 100
102
+ end
103
+
100
104
  def requests_delta
101
105
  requests_count - @previous_requests_count
102
106
  end
@@ -213,6 +217,7 @@ Puma::Plugin.create do
213
217
  @statsd.send(metric_name: prefixed_metric_name("puma.backlog"), value: stats.backlog, type: :gauge, tags: tags)
214
218
  @statsd.send(metric_name: prefixed_metric_name("puma.pool_capacity"), value: stats.pool_capacity, type: :gauge, tags: tags)
215
219
  @statsd.send(metric_name: prefixed_metric_name("puma.max_threads"), value: stats.max_threads, type: :gauge, tags: tags)
220
+ @statsd.send(metric_name: prefixed_metric_name("puma.percent_busy"), value: stats.percent_busy, type: :gauge, tags: tags)
216
221
  @statsd.send(metric_name: prefixed_metric_name("puma.requests_count"), value: stats.requests_count, type: :gauge, tags: tags)
217
222
  @statsd.send(metric_name: prefixed_metric_name("puma.requests"), value: stats.requests_delta, type: :count, tags: tags)
218
223
  rescue StandardError => e
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.5.0
4
+ version: 2.6.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: 2023-08-27 00:00:00.000000000 Z
11
+ date: 2023-12-11 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.3.26
134
+ rubygems_version: 3.4.10
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Send puma metrics to statsd via a background thread