prometheus_exporter 0.7.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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +298 -35
  3. data/README.md +276 -53
  4. data/{bin → exe}/prometheus_exporter +20 -7
  5. data/lib/prometheus_exporter/client.rb +41 -32
  6. data/lib/prometheus_exporter/instrumentation/active_record.rb +29 -35
  7. data/lib/prometheus_exporter/instrumentation/delayed_job.rb +28 -13
  8. data/lib/prometheus_exporter/instrumentation/good_job.rb +28 -0
  9. data/lib/prometheus_exporter/instrumentation/hutch.rb +1 -1
  10. data/lib/prometheus_exporter/instrumentation/method_profiler.rb +67 -27
  11. data/lib/prometheus_exporter/instrumentation/periodic_stats.rb +54 -0
  12. data/lib/prometheus_exporter/instrumentation/process.rb +25 -27
  13. data/lib/prometheus_exporter/instrumentation/puma.rb +36 -27
  14. data/lib/prometheus_exporter/instrumentation/resque.rb +33 -0
  15. data/lib/prometheus_exporter/instrumentation/shoryuken.rb +6 -7
  16. data/lib/prometheus_exporter/instrumentation/sidekiq.rb +51 -23
  17. data/lib/prometheus_exporter/instrumentation/sidekiq_process.rb +45 -0
  18. data/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb +38 -33
  19. data/lib/prometheus_exporter/instrumentation/sidekiq_stats.rb +32 -0
  20. data/lib/prometheus_exporter/instrumentation/unicorn.rb +12 -17
  21. data/lib/prometheus_exporter/instrumentation.rb +5 -0
  22. data/lib/prometheus_exporter/metric/base.rb +20 -17
  23. data/lib/prometheus_exporter/metric/counter.rb +1 -3
  24. data/lib/prometheus_exporter/metric/gauge.rb +6 -6
  25. data/lib/prometheus_exporter/metric/histogram.rb +15 -5
  26. data/lib/prometheus_exporter/metric/summary.rb +5 -14
  27. data/lib/prometheus_exporter/middleware.rb +72 -38
  28. data/lib/prometheus_exporter/server/active_record_collector.rb +16 -14
  29. data/lib/prometheus_exporter/server/collector.rb +29 -17
  30. data/lib/prometheus_exporter/server/collector_base.rb +0 -2
  31. data/lib/prometheus_exporter/server/delayed_job_collector.rb +76 -33
  32. data/lib/prometheus_exporter/server/good_job_collector.rb +52 -0
  33. data/lib/prometheus_exporter/server/hutch_collector.rb +19 -11
  34. data/lib/prometheus_exporter/server/metrics_container.rb +66 -0
  35. data/lib/prometheus_exporter/server/process_collector.rb +15 -14
  36. data/lib/prometheus_exporter/server/puma_collector.rb +21 -18
  37. data/lib/prometheus_exporter/server/resque_collector.rb +50 -0
  38. data/lib/prometheus_exporter/server/runner.rb +49 -13
  39. data/lib/prometheus_exporter/server/shoryuken_collector.rb +22 -17
  40. data/lib/prometheus_exporter/server/sidekiq_collector.rb +22 -14
  41. data/lib/prometheus_exporter/server/sidekiq_process_collector.rb +47 -0
  42. data/lib/prometheus_exporter/server/sidekiq_queue_collector.rb +12 -12
  43. data/lib/prometheus_exporter/server/sidekiq_stats_collector.rb +49 -0
  44. data/lib/prometheus_exporter/server/type_collector.rb +2 -0
  45. data/lib/prometheus_exporter/server/unicorn_collector.rb +32 -33
  46. data/lib/prometheus_exporter/server/web_collector.rb +48 -31
  47. data/lib/prometheus_exporter/server/web_server.rb +70 -48
  48. data/lib/prometheus_exporter/server.rb +4 -0
  49. data/lib/prometheus_exporter/version.rb +1 -1
  50. data/lib/prometheus_exporter.rb +12 -13
  51. metadata +19 -206
  52. data/.github/workflows/ci.yml +0 -42
  53. data/.gitignore +0 -13
  54. data/.rubocop.yml +0 -7
  55. data/Appraisals +0 -10
  56. data/CODE_OF_CONDUCT.md +0 -74
  57. data/Gemfile +0 -8
  58. data/Guardfile +0 -8
  59. data/Rakefile +0 -12
  60. data/bench/bench.rb +0 -45
  61. data/examples/custom_collector.rb +0 -27
  62. data/gemfiles/.bundle/config +0 -2
  63. data/gemfiles/ar_60.gemfile +0 -5
  64. data/gemfiles/ar_61.gemfile +0 -7
  65. data/prometheus_exporter.gemspec +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f949348bbafc06b8f7a3dd3927693de8fef54090d85a7889afbfbf7dcb167b6
4
- data.tar.gz: adeca8000ebb59c7225c1453135900aeab5c1760902edd5b4fecf9fa4b879a57
3
+ metadata.gz: be510b790b625379993092d05de6b8c7f02e30e74ca0ca630ba5c65ca99385d4
4
+ data.tar.gz: 43d78c0a9ab134b504cc6e4a6f86d799f9650c5b5e7d7b0d62a33afe3e97374f
5
5
  SHA512:
6
- metadata.gz: 7d3829ad57f03a19f6081c3444f9b13906aedd4fa1c5b99237d454096e0d993c27c2df0993482c421b6034a58a55c9603620bcdf7698248e4ac23a5063d63718
7
- data.tar.gz: fb915716acbbb4f24a152c8ebf9eb35bdc97185a7144eb986e50aafad07a36d5cc83cbbbf7c16e8b399207e9c66d90973d2e6f9ddcdc8a17cab797840d13ed8b
6
+ metadata.gz: d71f41661e4af76837dcb7df1cba50b3a6150ffce3dddebb1dc1710bf9a69dafc6a10750955fda8e870ae62a835e2bbcac417c00256285e3fc4266f3e2194e8d
7
+ data.tar.gz: 27cf01bfec436b1d6ece387460beefe35d8cf9146ab1d24d27ffebaeeb306df34d7432a31c307aef26e8b59994796593910f90cfaa9982c00a6344a2601a486d
data/CHANGELOG CHANGED
@@ -1,141 +1,404 @@
1
- 0.7.0 - 29-12-2020
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
21
+
22
+ - Feature: Add Dalli::Client memcache metrics for web_collector
23
+
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
31
+
32
+ - FEATURE: improve good_job instrumentation
33
+ - FEATURE: imstrumentation for malloc / oldmalloc increace in GC stats
34
+
35
+ ### Fixed
36
+
37
+ - FIX: improve Ruby 3.X support
38
+
39
+ ## [2.1.0] - 2024-01-08
40
+
41
+ ### Added
42
+
43
+ - FEATURE: good_job instrumentation
44
+
45
+ ### Changed
46
+
47
+ - PERF: improve performance of histogram
48
+ - DEV: use new metric collector pattern so we reuse code between collectors
49
+
50
+ ## [2.0.8] - 2023-01-20
51
+
52
+ ### Added
53
+
54
+ - FEATURE: attempting to make our first docker release
55
+
56
+ ## [2.0.7] - 2023-01-13
57
+
58
+ ### Added
59
+ - FEATURE: allow binding server to both ipv4 and v6
60
+
61
+ ### Fixed
62
+
63
+ - FIX: expire stale sidekiq metrics
64
+
65
+
66
+ ## [2.0.6] - 2022-11-22
67
+
68
+ ### Fixed
69
+
70
+ - FIX: use user specified labels over default in merge conflict
71
+ - FIX: sidekiq stats collector memory leak
72
+
73
+ ## [2.0.5] - 2022-11-15
74
+
75
+ ### Fixed
76
+
77
+ - FIX: regression :prepend style instrumentation not working correctly
78
+
79
+ ## [2.0.4] - 2022-11-10
80
+
81
+ ### Fixed
82
+
83
+ - FIX support for Redis 5 gem instrumentation
84
+
85
+ ## [2.0.3] - 2022-05-23
86
+
87
+ ### Added
88
+
89
+ - FEATURE: new ping endpoint for keepalive checks
90
+
91
+ ### Fixed
92
+
93
+ - FIX: order histogram correctly for GCP support
94
+ - FIX: improve sidekiq instrumentation
95
+
96
+ ## [2.0.2] - 2022-02-25
97
+
98
+ ### Fixed
99
+
100
+ - FIX: runner was not requiring unicorn integration correctly leading to a crash
101
+
102
+ ## [2.0.1] - 2022-02-24
103
+
104
+ ### Fixed
105
+
106
+ - FIX: ensure threads do not leak when calling #start repeatedly on instrumentation classes, this is an urgent patch for Puma integration
107
+
108
+ ## [2.0.0] - 2022-02-18
109
+
110
+ ### Added
111
+
112
+ - FEATURE: Add per worker custom labels
113
+ - FEATURE: support custom histogram buckets
114
+
115
+ ### Fixed
116
+
117
+ - FIX: all metrics are exposing status label, and not only `http_requests_total`
118
+
119
+ ### Changed
120
+
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).
122
+
123
+ ## [1.0.1] - 2021-12-22
124
+
125
+ ### Added
126
+
127
+ - FEATURE: add labels to preflight requests
128
+ - FEATURE: SidekiqStats metrics
129
+
130
+ ### Fixed
131
+
132
+ - FIX: mintor refactors to Sidekiq metrics
133
+
134
+ ## [1.0.0] - 2021-11-23
135
+
136
+ ### Added
137
+
138
+ - FEATURE: Sidekiq process metrics
139
+ - FEATURE: Allow collecting web metrics as histograms
140
+
141
+ ### Fixed
142
+
143
+ - FIX: logger improved for web server
144
+ - FIX: Remove job labels from DelayedJob queues
145
+
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
154
+
155
+ - FEATURE: swap from hardcoded STDERR to logger pattern (see README for details)
156
+
157
+ ## [0.8.0] - 2021-07-05
158
+
159
+ ### Added
160
+
161
+ - FEATURE: add job_name and queue_name labels to delayed job metrics
162
+ - FEATURE: always scope puma metrics on hostname in collector
163
+ - FEATURE: add customizable labels option to puma collector
164
+ - FEATURE: support for Resque
165
+ - FEATURE: Improve Active Record instrumentation
166
+ - FEATURE: Support HTTP_X_AMZN_TRACE_ID when supplied
167
+
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
2
188
 
3
189
  - Dev: Removed support from EOL rubies, only 2.5, 2.6, 2.7 and 3.0 are supported now.
4
190
  - Dev: Better support for Ruby 3.0, explicitly depending on webrick
5
191
  - Dev: Rails 6.1 instrumentation support
6
- - FEATURE: clean pattern for overriding middleware labels was introduced (in README)
7
- - Fix: Better support for forking
8
192
 
9
- 0.6.0 - 17-11-2020
193
+ ## [0.6.0] - 2020-11-17
194
+
195
+ ### Added
10
196
 
11
197
  - FEATURE: add support for basic-auth in the prometheus_exporter web server
12
198
 
13
- 0.5.3 - 29-07-2020
199
+ ## [0.5.3] - 2020-07-29
200
+
201
+ ### Added
14
202
 
15
203
  - FEATURE: added #remove to all metric types so users can remove specific labels if needed
16
204
 
17
- 0.5.2 - 01-07-2020
205
+ ## [0.5.2] - 2020-07-01
206
+
207
+ ### Added
18
208
 
19
209
  - FEATURE: expanded instrumentation for sidekiq
20
210
  - FEATURE: configurable default labels
21
211
 
22
- 0.5.1 - 25-02-2020
212
+ ## [0.5.1] - 2020-02-25
213
+
214
+ ### Added
23
215
 
24
216
  - FEATURE: Allow configuring the default client's host and port via environment variables
25
217
 
26
- 0.5.0 - 14-02-2020
218
+ ## [0.5.0] - 2020-02-14
219
+
220
+ ### Fixed
27
221
 
28
- - Breaking change: listen only to localhost by default to prevent unintended insecure configuration
29
222
  - FIX: Avoid calling `hostname` aggressively, instead cache it on the exporter instance
30
223
 
31
- 0.4.17 - 13-01-2020
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
32
231
 
33
232
  - FEATURE: add support for `to_h` on all metrics which can be used to query existing key/values
34
233
 
35
- 0.4.16 - 04-11-2019
234
+ ## [0.4.16] - 2019-11-04
235
+
236
+ ### Added
36
237
 
37
238
  - FEATURE: Support #reset! on all metric types to reset a metric to default
38
239
 
39
- 0.4.15 - 04-11-2019
240
+ ## [0.4.15] - 2019-11-04
241
+
242
+ ### Added
40
243
 
41
244
  - FEATURE: Improve delayed job collector, add pending counts
42
245
  - FEATURE: New ActiveRecord collector (documented in readme)
43
246
  - FEATURE: Allow passing in histogram and summary options
44
247
  - FEATURE: Allow custom labels for unicorn collector
45
248
 
46
- 0.4.14 - 10-09-2019
249
+ ## [0.4.14] - 2019-09-10
250
+
251
+ ### Added
47
252
 
48
253
  - FEATURE: allow finding metrics by name RemoteMetric #find_registered_metric
254
+
255
+ ### Fixed
256
+
49
257
  - FIX: guard socket closing
50
258
 
51
- 0.4.13 - 09-07-2019
259
+ ## [0.4.13] - 2019-07-09
260
+
261
+ ### Fixed
52
262
 
53
263
  - Fix: Memory leak in unicorn and puma collectors
54
264
 
55
- 0.4.12 - 30-05-2019
265
+ ## [0.4.12] - 2019-05-30
266
+
267
+ ### Fixed
56
268
 
57
269
  - Fix: unicorn collector reporting incorrect number of unicorn workers
58
270
 
59
- 0.4.11 - 15-05-2019
271
+ ## [0.4.11] - 2019-05-15
272
+
273
+ ### Fixed
60
274
 
61
275
  - Fix: Handle stopping nil worker_threads in Client
276
+
277
+ ### Changed
278
+
62
279
  - Dev: add frozen string literals
63
280
 
64
- 0.4.10 - 29-04-2019
281
+ ## [0.4.10] - 2019-04-29
282
+
283
+ ### Fixed
65
284
 
66
285
  - Fix: Custom label support for puma collector
67
286
  - Fix: Raindrops socket collector not working correctly
68
287
 
69
- 0.4.9 - 11-04-2019
288
+ ## [0.4.9] - 2019-04-11
289
+
290
+ ### Fixed
70
291
 
71
292
  - Fix: Gem was not working correctly in Ruby 2.4 and below due to a syntax error
72
293
 
73
- 0.4.8 - 10-04-2019
294
+ ## [0.4.8] - 2019-04-10
295
+
296
+ ### Added
74
297
 
75
298
  - Feature: added helpers for instrumenting unicorn using raindrops
76
299
 
77
- 0.4.7 - 08-04-2019
300
+ ## [0.4.7] - 2019-04-08
301
+
302
+ ### Fixed
78
303
 
79
304
  - Fix: collector was not escaping " \ and \n correctly. This could lead
80
305
  to a corrupt payload in some cases.
81
306
 
82
- 0.4.6 - 02-04-2019
307
+ ## [0.4.6] - 2019-04-02
308
+
309
+ ### Added
83
310
 
84
311
  - Feature: Allow resetting a counter
85
312
  - Feature: Add sidekiq metrics: restarted, dead jobs counters
313
+
314
+ ### Fixed
315
+
86
316
  - Fix: Client shutting down before sending metrics to collector
87
317
 
88
- 0.4.5 - 14-02-2019
318
+ ## [0.4.5] - 2019-02-14
319
+
320
+ ### Added
89
321
 
90
322
  - Feature: Allow process collector to ship custom labels for all process metrics
323
+
324
+ ### Fixed
325
+
91
326
  - Fix: Always scope process metrics on hostname in collector
92
327
 
93
- 0.4.4 - 13-02-2019
328
+ ## [0.4.4] - 2019-02-13
329
+
330
+ ### Added
94
331
 
95
332
  - Feature: add support for local metric collection without using HTTP
96
333
 
97
- 0.4.3 - 11-02-2019
334
+ ## [0.4.3] - 2019-02-11
335
+
336
+ ### Added
98
337
 
99
338
  - Feature: Add alias for Gauge #observe called #set, this makes it a bit easier to migrate from prom
100
339
  - Feature: Add increment and decrement to Counter
101
340
 
102
- 0.4.2 - 30-11-2018
341
+ ## [0.4.2] - 2018-11-30
342
+
343
+ ### Fixed
103
344
 
104
- - Fix/Feature: setting a Gauge to nil will remove Gauge (setting to non numeric will raise)
345
+ - Fix: setting a Gauge to nil will remove Gauge (setting to non numeric will raise)
105
346
 
106
- 0.4.0 - 23-10-2018
347
+ ## [0.4.0] - 2018-10-23
348
+
349
+ ### Added
107
350
 
108
351
  - Feature: histogram support
109
352
  - Feature: custom quantile support for summary
110
353
  - Feature: Puma metrics
354
+
355
+ ### Fixed
356
+
111
357
  - Fix: delayed job metrics
112
358
 
113
- 0.3.4 - 02-10-2018
359
+ ## [0.3.4] - 2018-10-02
360
+
361
+ ### Fixed
114
362
 
115
363
  - Fix: custom collector via CLI was not working correctly
116
364
 
117
- 0.3.3
365
+ ## [0.3.3]
366
+
367
+ ### Added
118
368
 
119
369
  - Feature: Add more metrics to delayed job collector
120
370
 
121
- 0.3.2
371
+ ## [0.3.2]
372
+
373
+ ### Added
122
374
 
123
375
  - Feature: Add posibility to set custom_labels on multi process mode
124
376
 
125
- 0.3.1
377
+ ## [0.3.1]
378
+
379
+ ### Changed
126
380
 
127
381
  - Allow runner to accept a --timeout var
128
382
  - Allow runner to accept a blank prefix
129
383
 
130
- 0.3.0
384
+ ## [0.3.0]
385
+
386
+ ### Changed
131
387
 
132
388
  - Breaking change: Follow Prometheus metric [naming conventions](https://prometheus.io/docs/practices/naming/#metric-names)
133
389
 
134
- 0.1.15 - 2018-02-19
390
+ ## [0.1.15] - 2018-02-19
391
+
392
+ ### Added
135
393
 
136
394
  - Feature: Prefer to use oj if it is loadable
137
395
 
138
- 0.1.14 - 2018-02-17
396
+ ## [0.1.14] - 2018-02-17
397
+
398
+ ### Added
139
399
 
140
- - Fix: error when shipping summary metric with no labels
141
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