prometheus_exporter 2.2.0 → 2.3.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 +4 -4
- data/CHANGELOG +230 -58
- data/README.md +14 -11
- data/lib/prometheus_exporter/instrumentation/delayed_job.rb +3 -1
- data/lib/prometheus_exporter/instrumentation/process.rb +6 -0
- data/lib/prometheus_exporter/instrumentation/puma.rb +2 -0
- data/lib/prometheus_exporter/middleware.rb +4 -4
- data/lib/prometheus_exporter/server/collector.rb +14 -2
- data/lib/prometheus_exporter/server/process_collector.rb +2 -0
- data/lib/prometheus_exporter/server/puma_collector.rb +7 -0
- data/lib/prometheus_exporter/server/runner.rb +6 -2
- data/lib/prometheus_exporter/server/web_server.rb +2 -1
- data/lib/prometheus_exporter/version.rb +1 -1
- metadata +5 -262
- data/.github/workflows/ci.yml +0 -103
- data/.gitignore +0 -13
- data/.rubocop +0 -1
- data/.rubocop.yml +0 -18
- data/.streerc +0 -2
- data/Appraisals +0 -14
- data/CODE_OF_CONDUCT.md +0 -74
- data/Dockerfile +0 -9
- data/Gemfile +0 -8
- data/Guardfile +0 -8
- data/Rakefile +0 -12
- data/bench/bench.rb +0 -46
- data/examples/custom_collector.rb +0 -25
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/ar_60.gemfile +0 -5
- data/gemfiles/ar_61.gemfile +0 -7
- data/gemfiles/ar_70.gemfile +0 -7
- data/gemfiles/ar_71.gemfile +0 -7
- data/prometheus_exporter.gemspec +0 -44
- /data/{bin → exe}/prometheus_exporter +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be510b790b625379993092d05de6b8c7f02e30e74ca0ca630ba5c65ca99385d4
|
4
|
+
data.tar.gz: 43d78c0a9ab134b504cc6e4a6f86d799f9650c5b5e7d7b0d62a33afe3e97374f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d71f41661e4af76837dcb7df1cba50b3a6150ffce3dddebb1dc1710bf9a69dafc6a10750955fda8e870ae62a835e2bbcac417c00256285e3fc4266f3e2194e8d
|
7
|
+
data.tar.gz: 27cf01bfec436b1d6ece387460beefe35d8cf9146ab1d24d27ffebaeeb306df34d7432a31c307aef26e8b59994796593910f90cfaa9982c00a6344a2601a486d
|
data/CHANGELOG
CHANGED
@@ -1,232 +1,404 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [2.3.0] - 2025-08-01
|
9
|
+
|
10
|
+
- FEATURE: Added puma_busy_threads metric that provides a holistic view of server workload by calculating (active threads - idle threads) + queued requests
|
11
|
+
- FEATURE: adding marking_time and sweeping_time to GC metrics
|
12
|
+
- DEV: bumped up minimum Ruby version to 3.2
|
13
|
+
- FIX: better handling of malformed metrics
|
14
|
+
- FIX: get controller labels from controller, not params
|
15
|
+
- DEV: expose close on runner instance
|
16
|
+
- FEATURE: improved puma metrics
|
17
|
+
|
18
|
+
## [2.2.0] - 2024-12-05
|
19
|
+
|
20
|
+
### Added
|
2
21
|
|
3
|
-
- FIX: Ensure socket is closed when error is raised while opening socket
|
4
22
|
- Feature: Add Dalli::Client memcache metrics for web_collector
|
5
23
|
|
6
|
-
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
- FIX: Ensure socket is closed when error is raised while opening socket
|
27
|
+
|
28
|
+
## [2.1.1] - 2024-06-19
|
29
|
+
|
30
|
+
### Added
|
7
31
|
|
8
32
|
- FEATURE: improve good_job instrumentation
|
9
|
-
- FIX: improve Ruby 3.X support
|
10
33
|
- FEATURE: imstrumentation for malloc / oldmalloc increace in GC stats
|
11
34
|
|
12
|
-
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
- FIX: improve Ruby 3.X support
|
38
|
+
|
39
|
+
## [2.1.0] - 2024-01-08
|
40
|
+
|
41
|
+
### Added
|
13
42
|
|
14
43
|
- FEATURE: good_job instrumentation
|
44
|
+
|
45
|
+
### Changed
|
46
|
+
|
15
47
|
- PERF: improve performance of histogram
|
16
48
|
- DEV: use new metric collector pattern so we reuse code between collectors
|
17
49
|
|
18
|
-
2.0.8 - 2023-01-20
|
50
|
+
## [2.0.8] - 2023-01-20
|
51
|
+
|
52
|
+
### Added
|
19
53
|
|
20
54
|
- FEATURE: attempting to make our first docker release
|
21
55
|
|
22
|
-
2.0.7 - 2023-01-13
|
56
|
+
## [2.0.7] - 2023-01-13
|
23
57
|
|
58
|
+
### Added
|
24
59
|
- FEATURE: allow binding server to both ipv4 and v6
|
60
|
+
|
61
|
+
### Fixed
|
62
|
+
|
25
63
|
- FIX: expire stale sidekiq metrics
|
26
64
|
|
27
65
|
|
28
|
-
2.0.6 - 2022-11-22
|
66
|
+
## [2.0.6] - 2022-11-22
|
67
|
+
|
68
|
+
### Fixed
|
29
69
|
|
30
70
|
- FIX: use user specified labels over default in merge conflict
|
31
71
|
- FIX: sidekiq stats collector memory leak
|
32
72
|
|
33
|
-
2.0.5 - 2022-11-15
|
73
|
+
## [2.0.5] - 2022-11-15
|
74
|
+
|
75
|
+
### Fixed
|
34
76
|
|
35
77
|
- FIX: regression :prepend style instrumentation not working correctly
|
36
78
|
|
37
|
-
2.0.4 - 2022-11-10
|
79
|
+
## [2.0.4] - 2022-11-10
|
80
|
+
|
81
|
+
### Fixed
|
38
82
|
|
39
|
-
- FIX
|
83
|
+
- FIX support for Redis 5 gem instrumentation
|
40
84
|
|
41
|
-
2.0.3 - 2022-05-23
|
85
|
+
## [2.0.3] - 2022-05-23
|
86
|
+
|
87
|
+
### Added
|
42
88
|
|
43
89
|
- FEATURE: new ping endpoint for keepalive checks
|
90
|
+
|
91
|
+
### Fixed
|
92
|
+
|
44
93
|
- FIX: order histogram correctly for GCP support
|
45
94
|
- FIX: improve sidekiq instrumentation
|
46
95
|
|
47
|
-
2.0.2 - 2022-02-25
|
96
|
+
## [2.0.2] - 2022-02-25
|
97
|
+
|
98
|
+
### Fixed
|
48
99
|
|
49
100
|
- FIX: runner was not requiring unicorn integration correctly leading to a crash
|
50
101
|
|
51
|
-
2.0.1 - 2022-02-24
|
102
|
+
## [2.0.1] - 2022-02-24
|
103
|
+
|
104
|
+
### Fixed
|
52
105
|
|
53
106
|
- FIX: ensure threads do not leak when calling #start repeatedly on instrumentation classes, this is an urgent patch for Puma integration
|
54
107
|
|
55
|
-
2.0.0 - 2022-02-18
|
108
|
+
## [2.0.0] - 2022-02-18
|
109
|
+
|
110
|
+
### Added
|
56
111
|
|
57
112
|
- FEATURE: Add per worker custom labels
|
58
113
|
- FEATURE: support custom histogram buckets
|
114
|
+
|
115
|
+
### Fixed
|
116
|
+
|
59
117
|
- FIX: all metrics are exposing status label, and not only `http_requests_total`
|
118
|
+
|
119
|
+
### Changed
|
120
|
+
|
60
121
|
- BREAKING: rename all `http_duration` metrics to `http_request_duration` to match prometheus official naming conventions (See https://prometheus.io/docs/practices/naming/#metric-names).
|
61
122
|
|
62
|
-
1.0.1 - 2021-12-22
|
123
|
+
## [1.0.1] - 2021-12-22
|
124
|
+
|
125
|
+
### Added
|
63
126
|
|
64
127
|
- FEATURE: add labels to preflight requests
|
65
128
|
- FEATURE: SidekiqStats metrics
|
129
|
+
|
130
|
+
### Fixed
|
131
|
+
|
66
132
|
- FIX: mintor refactors to Sidekiq metrics
|
67
133
|
|
68
|
-
1.0.0 - 2021-11-23
|
134
|
+
## [1.0.0] - 2021-11-23
|
135
|
+
|
136
|
+
### Added
|
69
137
|
|
70
|
-
- BREAKING: rename metrics to match prometheus official naming conventions (See https://prometheus.io/docs/practices/naming/#metric-names)
|
71
138
|
- FEATURE: Sidekiq process metrics
|
72
139
|
- FEATURE: Allow collecting web metrics as histograms
|
140
|
+
|
141
|
+
### Fixed
|
142
|
+
|
73
143
|
- FIX: logger improved for web server
|
74
144
|
- FIX: Remove job labels from DelayedJob queues
|
75
145
|
|
76
|
-
|
146
|
+
### Changed
|
147
|
+
|
148
|
+
- BREAKING: rename metrics to match prometheus official naming conventions (See https://prometheus.io/docs/practices/naming/#metric-names)
|
149
|
+
|
150
|
+
|
151
|
+
## [0.8.1] - 2021-08-04
|
152
|
+
|
153
|
+
### Added
|
77
154
|
|
78
155
|
- FEATURE: swap from hardcoded STDERR to logger pattern (see README for details)
|
79
156
|
|
80
|
-
0.8.0 - 2021-07-05
|
157
|
+
## [0.8.0] - 2021-07-05
|
158
|
+
|
159
|
+
### Added
|
81
160
|
|
82
|
-
- FIX: handle ThreadError more gracefully in cases where process shuts down
|
83
161
|
- FEATURE: add job_name and queue_name labels to delayed job metrics
|
84
162
|
- FEATURE: always scope puma metrics on hostname in collector
|
85
163
|
- FEATURE: add customizable labels option to puma collector
|
86
164
|
- FEATURE: support for Resque
|
87
|
-
- DEV: Remove support for EOL ruby 2.5
|
88
|
-
- FIX: Add source location to MethodProfiler patches
|
89
165
|
- FEATURE: Improve Active Record instrumentation
|
90
166
|
- FEATURE: Support HTTP_X_AMZN_TRACE_ID when supplied
|
91
167
|
|
92
|
-
|
168
|
+
### Fixed
|
169
|
+
|
170
|
+
- FIX: handle ThreadError more gracefully in cases where process shuts down
|
171
|
+
- FIX: Add source location to MethodProfiler patches
|
172
|
+
|
173
|
+
### Removed
|
174
|
+
|
175
|
+
- DEV: Remove support for EOL ruby 2.5
|
176
|
+
|
177
|
+
## [0.7.0] - 2020-12-29
|
178
|
+
|
179
|
+
### Added
|
180
|
+
|
181
|
+
- FEATURE: clean pattern for overriding middleware labels was introduced (in README)
|
182
|
+
|
183
|
+
### Fixed
|
184
|
+
|
185
|
+
- Fix: Better support for forking
|
186
|
+
|
187
|
+
### Changed
|
93
188
|
|
94
189
|
- Dev: Removed support from EOL rubies, only 2.5, 2.6, 2.7 and 3.0 are supported now.
|
95
190
|
- Dev: Better support for Ruby 3.0, explicitly depending on webrick
|
96
191
|
- Dev: Rails 6.1 instrumentation support
|
97
|
-
- FEATURE: clean pattern for overriding middleware labels was introduced (in README)
|
98
|
-
- Fix: Better support for forking
|
99
192
|
|
100
|
-
0.6.0 - 2020-11-17
|
193
|
+
## [0.6.0] - 2020-11-17
|
194
|
+
|
195
|
+
### Added
|
101
196
|
|
102
197
|
- FEATURE: add support for basic-auth in the prometheus_exporter web server
|
103
198
|
|
104
|
-
0.5.3 - 2020-07-29
|
199
|
+
## [0.5.3] - 2020-07-29
|
200
|
+
|
201
|
+
### Added
|
105
202
|
|
106
203
|
- FEATURE: added #remove to all metric types so users can remove specific labels if needed
|
107
204
|
|
108
|
-
0.5.2 - 2020-07-01
|
205
|
+
## [0.5.2] - 2020-07-01
|
206
|
+
|
207
|
+
### Added
|
109
208
|
|
110
209
|
- FEATURE: expanded instrumentation for sidekiq
|
111
210
|
- FEATURE: configurable default labels
|
112
211
|
|
113
|
-
0.5.1 - 2020-02-25
|
212
|
+
## [0.5.1] - 2020-02-25
|
213
|
+
|
214
|
+
### Added
|
114
215
|
|
115
216
|
- FEATURE: Allow configuring the default client's host and port via environment variables
|
116
217
|
|
117
|
-
0.5.0 - 2020-02-14
|
218
|
+
## [0.5.0] - 2020-02-14
|
219
|
+
|
220
|
+
### Fixed
|
118
221
|
|
119
|
-
- Breaking change: listen only to localhost by default to prevent unintended insecure configuration
|
120
222
|
- FIX: Avoid calling `hostname` aggressively, instead cache it on the exporter instance
|
121
223
|
|
122
|
-
|
224
|
+
### Changed
|
225
|
+
|
226
|
+
- Breaking change: listen only to localhost by default to prevent unintended insecure configuration
|
227
|
+
|
228
|
+
## [0.4.17] - 2020-01-13
|
229
|
+
|
230
|
+
### Added
|
123
231
|
|
124
232
|
- FEATURE: add support for `to_h` on all metrics which can be used to query existing key/values
|
125
233
|
|
126
|
-
0.4.16 - 2019-11-04
|
234
|
+
## [0.4.16] - 2019-11-04
|
235
|
+
|
236
|
+
### Added
|
127
237
|
|
128
238
|
- FEATURE: Support #reset! on all metric types to reset a metric to default
|
129
239
|
|
130
|
-
0.4.15 - 2019-11-04
|
240
|
+
## [0.4.15] - 2019-11-04
|
241
|
+
|
242
|
+
### Added
|
131
243
|
|
132
244
|
- FEATURE: Improve delayed job collector, add pending counts
|
133
245
|
- FEATURE: New ActiveRecord collector (documented in readme)
|
134
246
|
- FEATURE: Allow passing in histogram and summary options
|
135
247
|
- FEATURE: Allow custom labels for unicorn collector
|
136
248
|
|
137
|
-
0.4.14 - 2019-09-10
|
249
|
+
## [0.4.14] - 2019-09-10
|
250
|
+
|
251
|
+
### Added
|
138
252
|
|
139
253
|
- FEATURE: allow finding metrics by name RemoteMetric #find_registered_metric
|
254
|
+
|
255
|
+
### Fixed
|
256
|
+
|
140
257
|
- FIX: guard socket closing
|
141
258
|
|
142
|
-
0.4.13 - 2019-07-09
|
259
|
+
## [0.4.13] - 2019-07-09
|
260
|
+
|
261
|
+
### Fixed
|
143
262
|
|
144
263
|
- Fix: Memory leak in unicorn and puma collectors
|
145
264
|
|
146
|
-
0.4.12 - 2019-05-30
|
265
|
+
## [0.4.12] - 2019-05-30
|
266
|
+
|
267
|
+
### Fixed
|
147
268
|
|
148
269
|
- Fix: unicorn collector reporting incorrect number of unicorn workers
|
149
270
|
|
150
|
-
0.4.11 - 2019-05-15
|
271
|
+
## [0.4.11] - 2019-05-15
|
272
|
+
|
273
|
+
### Fixed
|
151
274
|
|
152
275
|
- Fix: Handle stopping nil worker_threads in Client
|
276
|
+
|
277
|
+
### Changed
|
278
|
+
|
153
279
|
- Dev: add frozen string literals
|
154
280
|
|
155
|
-
0.4.10 - 2019-04-29
|
281
|
+
## [0.4.10] - 2019-04-29
|
282
|
+
|
283
|
+
### Fixed
|
156
284
|
|
157
285
|
- Fix: Custom label support for puma collector
|
158
286
|
- Fix: Raindrops socket collector not working correctly
|
159
287
|
|
160
|
-
0.4.9 - 2019-04-11
|
288
|
+
## [0.4.9] - 2019-04-11
|
289
|
+
|
290
|
+
### Fixed
|
161
291
|
|
162
292
|
- Fix: Gem was not working correctly in Ruby 2.4 and below due to a syntax error
|
163
293
|
|
164
|
-
0.4.8 - 2019-04-10
|
294
|
+
## [0.4.8] - 2019-04-10
|
295
|
+
|
296
|
+
### Added
|
165
297
|
|
166
298
|
- Feature: added helpers for instrumenting unicorn using raindrops
|
167
299
|
|
168
|
-
0.4.7 - 2019-04-08
|
300
|
+
## [0.4.7] - 2019-04-08
|
301
|
+
|
302
|
+
### Fixed
|
169
303
|
|
170
304
|
- Fix: collector was not escaping " \ and \n correctly. This could lead
|
171
305
|
to a corrupt payload in some cases.
|
172
306
|
|
173
|
-
0.4.6 - 2019-04-02
|
307
|
+
## [0.4.6] - 2019-04-02
|
308
|
+
|
309
|
+
### Added
|
174
310
|
|
175
311
|
- Feature: Allow resetting a counter
|
176
312
|
- Feature: Add sidekiq metrics: restarted, dead jobs counters
|
313
|
+
|
314
|
+
### Fixed
|
315
|
+
|
177
316
|
- Fix: Client shutting down before sending metrics to collector
|
178
317
|
|
179
|
-
0.4.5 - 2019-02-14
|
318
|
+
## [0.4.5] - 2019-02-14
|
319
|
+
|
320
|
+
### Added
|
180
321
|
|
181
322
|
- Feature: Allow process collector to ship custom labels for all process metrics
|
323
|
+
|
324
|
+
### Fixed
|
325
|
+
|
182
326
|
- Fix: Always scope process metrics on hostname in collector
|
183
327
|
|
184
|
-
0.4.4 - 2019-02-13
|
328
|
+
## [0.4.4] - 2019-02-13
|
329
|
+
|
330
|
+
### Added
|
185
331
|
|
186
332
|
- Feature: add support for local metric collection without using HTTP
|
187
333
|
|
188
|
-
0.4.3 - 2019-02-11
|
334
|
+
## [0.4.3] - 2019-02-11
|
335
|
+
|
336
|
+
### Added
|
189
337
|
|
190
338
|
- Feature: Add alias for Gauge #observe called #set, this makes it a bit easier to migrate from prom
|
191
339
|
- Feature: Add increment and decrement to Counter
|
192
340
|
|
193
|
-
0.4.2 - 2018-11-30
|
341
|
+
## [0.4.2] - 2018-11-30
|
342
|
+
|
343
|
+
### Fixed
|
194
344
|
|
195
|
-
- Fix
|
345
|
+
- Fix: setting a Gauge to nil will remove Gauge (setting to non numeric will raise)
|
196
346
|
|
197
|
-
0.4.0 - 2018-10-23
|
347
|
+
## [0.4.0] - 2018-10-23
|
348
|
+
|
349
|
+
### Added
|
198
350
|
|
199
351
|
- Feature: histogram support
|
200
352
|
- Feature: custom quantile support for summary
|
201
353
|
- Feature: Puma metrics
|
354
|
+
|
355
|
+
### Fixed
|
356
|
+
|
202
357
|
- Fix: delayed job metrics
|
203
358
|
|
204
|
-
0.3.4 - 2018-10-02
|
359
|
+
## [0.3.4] - 2018-10-02
|
360
|
+
|
361
|
+
### Fixed
|
205
362
|
|
206
363
|
- Fix: custom collector via CLI was not working correctly
|
207
364
|
|
208
|
-
0.3.3
|
365
|
+
## [0.3.3]
|
366
|
+
|
367
|
+
### Added
|
209
368
|
|
210
369
|
- Feature: Add more metrics to delayed job collector
|
211
370
|
|
212
|
-
0.3.2
|
371
|
+
## [0.3.2]
|
372
|
+
|
373
|
+
### Added
|
213
374
|
|
214
375
|
- Feature: Add posibility to set custom_labels on multi process mode
|
215
376
|
|
216
|
-
0.3.1
|
377
|
+
## [0.3.1]
|
378
|
+
|
379
|
+
### Changed
|
217
380
|
|
218
381
|
- Allow runner to accept a --timeout var
|
219
382
|
- Allow runner to accept a blank prefix
|
220
383
|
|
221
|
-
0.3.0
|
384
|
+
## [0.3.0]
|
385
|
+
|
386
|
+
### Changed
|
222
387
|
|
223
388
|
- Breaking change: Follow Prometheus metric [naming conventions](https://prometheus.io/docs/practices/naming/#metric-names)
|
224
389
|
|
225
|
-
0.1.15 - 2018-02-19
|
390
|
+
## [0.1.15] - 2018-02-19
|
391
|
+
|
392
|
+
### Added
|
226
393
|
|
227
394
|
- Feature: Prefer to use oj if it is loadable
|
228
395
|
|
229
|
-
0.1.14 - 2018-02-17
|
396
|
+
## [0.1.14] - 2018-02-17
|
397
|
+
|
398
|
+
### Added
|
230
399
|
|
231
|
-
- Fix: error when shipping summary metric with no labels
|
232
400
|
- Feature: runner was extracted so it can be reused @304
|
401
|
+
|
402
|
+
### Fixed
|
403
|
+
|
404
|
+
- Fix: error when shipping summary metric with no labels
|
data/README.md
CHANGED
@@ -98,8 +98,8 @@ server.collector.register_metric(counter)
|
|
98
98
|
server.collector.register_metric(summary)
|
99
99
|
server.collector.register_metric(histogram)
|
100
100
|
|
101
|
-
gauge.observe(get_rss)
|
102
|
-
gauge.observe(get_rss)
|
101
|
+
gauge.observe(server.get_rss)
|
102
|
+
gauge.observe(server.get_rss)
|
103
103
|
|
104
104
|
counter.observe(1, route: 'test/route')
|
105
105
|
counter.observe(1, route: 'another/route')
|
@@ -373,6 +373,8 @@ end
|
|
373
373
|
| Counter | `major_gc_ops_total` | Major GC operations by process |
|
374
374
|
| Counter | `minor_gc_ops_total` | Minor GC operations by process |
|
375
375
|
| Counter | `allocated_objects_total` | Total number of allocated objects by process |
|
376
|
+
| Gauge | `marking_time` | Marking time spent (Ruby 3.3 minimum) |
|
377
|
+
| Gauge | `sweeping_time` | Sweeping time spent (Ruby 3.3 minimum) |
|
376
378
|
|
377
379
|
_Metrics marked with * are only collected when `MiniRacer` is defined._
|
378
380
|
|
@@ -609,15 +611,16 @@ end
|
|
609
611
|
|
610
612
|
#### Metrics collected by Puma Instrumentation
|
611
613
|
|
612
|
-
| Type | Name | Description
|
613
|
-
| --- | --- | ---
|
614
|
-
| Gauge | `puma_workers` | Number of puma workers
|
615
|
-
| Gauge | `puma_booted_workers` | Number of puma workers booted
|
616
|
-
| Gauge | `puma_old_workers` | Number of old puma workers
|
617
|
-
| Gauge | `puma_running_threads` |
|
618
|
-
| Gauge | `puma_request_backlog` | Number of requests waiting to be processed by a puma thread
|
619
|
-
| Gauge | `puma_thread_pool_capacity` | Number of puma threads available at current scale
|
620
|
-
| Gauge | `puma_max_threads` | Number of puma threads at available at max scale
|
614
|
+
| Type | Name | Description |
|
615
|
+
| --- | --- | --- |
|
616
|
+
| Gauge | `puma_workers` | Number of puma workers |
|
617
|
+
| Gauge | `puma_booted_workers` | Number of puma workers booted |
|
618
|
+
| Gauge | `puma_old_workers` | Number of old puma workers |
|
619
|
+
| Gauge | `puma_running_threads` | How many threads are spawned. A spawned thread may be busy processing a request or waiting for a new request |
|
620
|
+
| Gauge | `puma_request_backlog` | Number of requests waiting to be processed by a puma thread |
|
621
|
+
| Gauge | `puma_thread_pool_capacity` | Number of puma threads available at current scale |
|
622
|
+
| Gauge | `puma_max_threads` | Number of puma threads at available at max scale |
|
623
|
+
| Gauge | `puma_busy_threads` | Running - how many threads are waiting to receive work + how many requests are waiting for a thread to pick them up |
|
621
624
|
|
622
625
|
All metrics may have a `phase` label and all custom labels provided with the `labels` option.
|
623
626
|
|
@@ -40,6 +40,8 @@ module PrometheusExporter::Instrumentation
|
|
40
40
|
|
41
41
|
def call(job, max_attempts, enqueued_count, pending_count, include_module_name, *args, &block)
|
42
42
|
success = false
|
43
|
+
job_name = job.handler.to_s.match(JOB_CLASS_REGEXP).to_a[include_module_name ? 1 : 2].to_s
|
44
|
+
job_name ||= job.try(:name)
|
43
45
|
start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
44
46
|
latency = Time.current - job.run_at
|
45
47
|
attempts = job.attempts + 1 # Increment because we're adding the current attempt
|
@@ -51,7 +53,7 @@ module PrometheusExporter::Instrumentation
|
|
51
53
|
|
52
54
|
@client.send_json(
|
53
55
|
type: "delayed_job",
|
54
|
-
name:
|
56
|
+
name: job_name,
|
55
57
|
queue_name: job.queue,
|
56
58
|
success: success,
|
57
59
|
duration: duration,
|
@@ -62,6 +62,8 @@ module PrometheusExporter::Instrumentation
|
|
62
62
|
metric[:rss] = rss
|
63
63
|
end
|
64
64
|
|
65
|
+
SWEEPING_AND_MARKING = RUBY_VERSION >= "3.3.0"
|
66
|
+
|
65
67
|
def collect_gc_stats(metric)
|
66
68
|
stat = GC.stat
|
67
69
|
metric[:heap_live_slots] = stat[:heap_live_slots]
|
@@ -71,6 +73,10 @@ module PrometheusExporter::Instrumentation
|
|
71
73
|
metric[:allocated_objects_total] = stat[:total_allocated_objects]
|
72
74
|
metric[:malloc_increase_bytes_limit] = stat[:malloc_increase_bytes_limit]
|
73
75
|
metric[:oldmalloc_increase_bytes_limit] = stat[:oldmalloc_increase_bytes_limit]
|
76
|
+
if SWEEPING_AND_MARKING
|
77
|
+
metric[:marking_time] = stat[:marking_time]
|
78
|
+
metric[:sweeping_time] = stat[:sweeping_time]
|
79
|
+
end
|
74
80
|
end
|
75
81
|
|
76
82
|
def collect_v8_stats(metric)
|
@@ -61,11 +61,13 @@ module PrometheusExporter::Instrumentation
|
|
61
61
|
metric[:running_threads] ||= 0
|
62
62
|
metric[:thread_pool_capacity] ||= 0
|
63
63
|
metric[:max_threads] ||= 0
|
64
|
+
metric[:busy_threads] ||= 0
|
64
65
|
|
65
66
|
metric[:request_backlog] += status["backlog"]
|
66
67
|
metric[:running_threads] += status["running"]
|
67
68
|
metric[:thread_pool_capacity] += status["pool_capacity"]
|
68
69
|
metric[:max_threads] += status["max_threads"]
|
70
|
+
metric[:busy_threads] += status["busy_threads"]
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -74,11 +74,11 @@ class PrometheusExporter::Middleware
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def default_labels(env, result)
|
77
|
-
|
77
|
+
controller_instance = env["action_controller.instance"]
|
78
78
|
action = controller = nil
|
79
|
-
if
|
80
|
-
action =
|
81
|
-
controller =
|
79
|
+
if controller_instance
|
80
|
+
action = controller_instance.action_name
|
81
|
+
controller = controller_instance.controller_name
|
82
82
|
elsif (cors = env["rack.cors"]) && cors.respond_to?(:preflight?) && cors.preflight?
|
83
83
|
# if the Rack CORS Middleware identifies the request as a preflight request,
|
84
84
|
# the stack doesn't get to the point where controllers/actions are defined
|
@@ -1,8 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "logger"
|
4
|
+
|
3
5
|
module PrometheusExporter::Server
|
4
6
|
class Collector < CollectorBase
|
5
|
-
|
7
|
+
attr_reader :logger
|
8
|
+
|
9
|
+
def initialize(json_serializer: nil, logger: Logger.new(STDERR))
|
10
|
+
@logger = logger
|
6
11
|
@process_metrics = []
|
7
12
|
@metrics = {}
|
8
13
|
@mutex = Mutex.new
|
@@ -40,6 +45,8 @@ module PrometheusExporter::Server
|
|
40
45
|
metric = @metrics[obj["name"]]
|
41
46
|
metric = register_metric_unsafe(obj) if !metric
|
42
47
|
|
48
|
+
next unless metric
|
49
|
+
|
43
50
|
keys = obj["keys"] || {}
|
44
51
|
keys = obj["custom_labels"].merge(keys) if obj["custom_labels"]
|
45
52
|
|
@@ -74,6 +81,11 @@ module PrometheusExporter::Server
|
|
74
81
|
help = obj["help"]
|
75
82
|
opts = symbolize_keys(obj["opts"] || {})
|
76
83
|
|
84
|
+
if !name
|
85
|
+
logger.warn "failed to register metric due to empty name #{obj}"
|
86
|
+
return
|
87
|
+
end
|
88
|
+
|
77
89
|
metric =
|
78
90
|
case obj["type"]
|
79
91
|
when "gauge"
|
@@ -89,7 +101,7 @@ module PrometheusExporter::Server
|
|
89
101
|
if metric
|
90
102
|
@metrics[name] = metric
|
91
103
|
else
|
92
|
-
|
104
|
+
logger.warn "failed to register metric #{obj}"
|
93
105
|
end
|
94
106
|
end
|
95
107
|
|
@@ -16,6 +16,8 @@ module PrometheusExporter::Server
|
|
16
16
|
"Limit before Ruby triggers a GC against current objects (bytes).",
|
17
17
|
oldmalloc_increase_bytes_limit:
|
18
18
|
"Limit before Ruby triggers a major GC against old objects (bytes).",
|
19
|
+
marking_time: "Time spent in GC marking.",
|
20
|
+
sweeping_time: "Time spent in GC sweeping.",
|
19
21
|
}
|
20
22
|
|
21
23
|
PROCESS_COUNTERS = {
|
@@ -13,6 +13,13 @@ module PrometheusExporter::Server
|
|
13
13
|
max_threads: "Number of puma threads at available at max scale.",
|
14
14
|
}
|
15
15
|
|
16
|
+
if defined?(::Puma::Const) &&
|
17
|
+
Gem::Version.new(::Puma::Const::VERSION) >= Gem::Version.new("6.6.0")
|
18
|
+
PUMA_GAUGES[
|
19
|
+
:busy_threads
|
20
|
+
] = "Wholistic stat reflecting the overall current state of work to be done and the capacity to do it"
|
21
|
+
end
|
22
|
+
|
16
23
|
def initialize
|
17
24
|
@puma_metrics = MetricsContainer.new(ttl: MAX_PUMA_METRIC_AGE)
|
18
25
|
@puma_metrics.filter = ->(new_metric, old_metric) do
|
@@ -50,7 +50,7 @@ module PrometheusExporter::Server
|
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
53
|
-
server =
|
53
|
+
@server =
|
54
54
|
server_class.new(
|
55
55
|
port: port,
|
56
56
|
bind: bind,
|
@@ -60,7 +60,11 @@ module PrometheusExporter::Server
|
|
60
60
|
auth: auth,
|
61
61
|
realm: realm,
|
62
62
|
)
|
63
|
-
server.start
|
63
|
+
@server.start
|
64
|
+
end
|
65
|
+
|
66
|
+
def stop
|
67
|
+
@server.stop
|
64
68
|
end
|
65
69
|
|
66
70
|
attr_accessor :unicorn_listen_address, :unicorn_pid_file
|