prometheus_exporter 2.1.1 → 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 +233 -56
- data/README.md +23 -18
- data/lib/prometheus_exporter/client.rb +16 -32
- data/lib/prometheus_exporter/instrumentation/active_record.rb +20 -8
- data/lib/prometheus_exporter/instrumentation/delayed_job.rb +23 -12
- data/lib/prometheus_exporter/instrumentation/good_job.rb +2 -4
- data/lib/prometheus_exporter/instrumentation/hutch.rb +1 -1
- data/lib/prometheus_exporter/instrumentation/method_profiler.rb +12 -12
- data/lib/prometheus_exporter/instrumentation/periodic_stats.rb +13 -21
- data/lib/prometheus_exporter/instrumentation/process.rb +18 -6
- data/lib/prometheus_exporter/instrumentation/puma.rb +3 -1
- data/lib/prometheus_exporter/instrumentation/resque.rb +1 -3
- data/lib/prometheus_exporter/instrumentation/shoryuken.rb +6 -7
- data/lib/prometheus_exporter/instrumentation/sidekiq.rb +4 -6
- data/lib/prometheus_exporter/instrumentation/sidekiq_process.rb +12 -19
- data/lib/prometheus_exporter/instrumentation/sidekiq_queue.rb +15 -18
- data/lib/prometheus_exporter/instrumentation/sidekiq_stats.rb +10 -15
- data/lib/prometheus_exporter/instrumentation/unicorn.rb +2 -2
- data/lib/prometheus_exporter/metric/base.rb +8 -7
- data/lib/prometheus_exporter/metric/counter.rb +1 -3
- data/lib/prometheus_exporter/metric/gauge.rb +2 -6
- data/lib/prometheus_exporter/metric/histogram.rb +0 -2
- data/lib/prometheus_exporter/metric/summary.rb +5 -14
- data/lib/prometheus_exporter/middleware.rb +44 -36
- data/lib/prometheus_exporter/server/active_record_collector.rb +11 -6
- data/lib/prometheus_exporter/server/collector.rb +25 -17
- data/lib/prometheus_exporter/server/collector_base.rb +0 -2
- data/lib/prometheus_exporter/server/delayed_job_collector.rb +65 -28
- data/lib/prometheus_exporter/server/good_job_collector.rb +1 -1
- data/lib/prometheus_exporter/server/hutch_collector.rb +19 -11
- data/lib/prometheus_exporter/server/metrics_container.rb +4 -4
- data/lib/prometheus_exporter/server/process_collector.rb +9 -5
- data/lib/prometheus_exporter/server/puma_collector.rb +11 -10
- data/lib/prometheus_exporter/server/resque_collector.rb +1 -1
- data/lib/prometheus_exporter/server/runner.rb +39 -14
- data/lib/prometheus_exporter/server/shoryuken_collector.rb +22 -17
- data/lib/prometheus_exporter/server/sidekiq_collector.rb +22 -14
- data/lib/prometheus_exporter/server/sidekiq_process_collector.rb +9 -5
- data/lib/prometheus_exporter/server/sidekiq_queue_collector.rb +7 -6
- data/lib/prometheus_exporter/server/sidekiq_stats_collector.rb +12 -11
- data/lib/prometheus_exporter/server/unicorn_collector.rb +4 -4
- data/lib/prometheus_exporter/server/web_collector.rb +39 -22
- data/lib/prometheus_exporter/server/web_server.rb +12 -21
- data/lib/prometheus_exporter/version.rb +1 -1
- metadata +5 -233
- data/.github/workflows/ci.yml +0 -100
- data/.gitignore +0 -13
- data/.rubocop +0 -1
- data/.rubocop.yml +0 -18
- 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 -45
- data/examples/custom_collector.rb +0 -27
- 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 -46
- /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,227 +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
|
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
|
2
31
|
|
3
32
|
- FEATURE: improve good_job instrumentation
|
4
|
-
- FIX: improve Ruby 3.X support
|
5
33
|
- FEATURE: imstrumentation for malloc / oldmalloc increace in GC stats
|
6
34
|
|
7
|
-
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
- FIX: improve Ruby 3.X support
|
38
|
+
|
39
|
+
## [2.1.0] - 2024-01-08
|
40
|
+
|
41
|
+
### Added
|
8
42
|
|
9
43
|
- FEATURE: good_job instrumentation
|
44
|
+
|
45
|
+
### Changed
|
46
|
+
|
10
47
|
- PERF: improve performance of histogram
|
11
48
|
- DEV: use new metric collector pattern so we reuse code between collectors
|
12
49
|
|
13
|
-
2.0.8 - 2023-01-20
|
50
|
+
## [2.0.8] - 2023-01-20
|
51
|
+
|
52
|
+
### Added
|
14
53
|
|
15
54
|
- FEATURE: attempting to make our first docker release
|
16
55
|
|
17
|
-
2.0.7 - 2023-01-13
|
56
|
+
## [2.0.7] - 2023-01-13
|
18
57
|
|
58
|
+
### Added
|
19
59
|
- FEATURE: allow binding server to both ipv4 and v6
|
60
|
+
|
61
|
+
### Fixed
|
62
|
+
|
20
63
|
- FIX: expire stale sidekiq metrics
|
21
64
|
|
22
65
|
|
23
|
-
2.0.6 - 2022-11-22
|
66
|
+
## [2.0.6] - 2022-11-22
|
67
|
+
|
68
|
+
### Fixed
|
24
69
|
|
25
70
|
- FIX: use user specified labels over default in merge conflict
|
26
71
|
- FIX: sidekiq stats collector memory leak
|
27
72
|
|
28
|
-
2.0.5 - 2022-11-15
|
73
|
+
## [2.0.5] - 2022-11-15
|
74
|
+
|
75
|
+
### Fixed
|
29
76
|
|
30
77
|
- FIX: regression :prepend style instrumentation not working correctly
|
31
78
|
|
32
|
-
2.0.4 - 2022-11-10
|
79
|
+
## [2.0.4] - 2022-11-10
|
80
|
+
|
81
|
+
### Fixed
|
33
82
|
|
34
|
-
- FIX
|
83
|
+
- FIX support for Redis 5 gem instrumentation
|
35
84
|
|
36
|
-
2.0.3 - 2022-05-23
|
85
|
+
## [2.0.3] - 2022-05-23
|
86
|
+
|
87
|
+
### Added
|
37
88
|
|
38
89
|
- FEATURE: new ping endpoint for keepalive checks
|
90
|
+
|
91
|
+
### Fixed
|
92
|
+
|
39
93
|
- FIX: order histogram correctly for GCP support
|
40
94
|
- FIX: improve sidekiq instrumentation
|
41
95
|
|
42
|
-
2.0.2 - 2022-02-25
|
96
|
+
## [2.0.2] - 2022-02-25
|
97
|
+
|
98
|
+
### Fixed
|
43
99
|
|
44
100
|
- FIX: runner was not requiring unicorn integration correctly leading to a crash
|
45
101
|
|
46
|
-
2.0.1 - 2022-02-24
|
102
|
+
## [2.0.1] - 2022-02-24
|
103
|
+
|
104
|
+
### Fixed
|
47
105
|
|
48
106
|
- FIX: ensure threads do not leak when calling #start repeatedly on instrumentation classes, this is an urgent patch for Puma integration
|
49
107
|
|
50
|
-
2.0.0 - 2022-02-18
|
108
|
+
## [2.0.0] - 2022-02-18
|
109
|
+
|
110
|
+
### Added
|
51
111
|
|
52
112
|
- FEATURE: Add per worker custom labels
|
53
113
|
- FEATURE: support custom histogram buckets
|
114
|
+
|
115
|
+
### Fixed
|
116
|
+
|
54
117
|
- FIX: all metrics are exposing status label, and not only `http_requests_total`
|
118
|
+
|
119
|
+
### Changed
|
120
|
+
|
55
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).
|
56
122
|
|
57
|
-
1.0.1 - 2021-12-22
|
123
|
+
## [1.0.1] - 2021-12-22
|
124
|
+
|
125
|
+
### Added
|
58
126
|
|
59
127
|
- FEATURE: add labels to preflight requests
|
60
128
|
- FEATURE: SidekiqStats metrics
|
129
|
+
|
130
|
+
### Fixed
|
131
|
+
|
61
132
|
- FIX: mintor refactors to Sidekiq metrics
|
62
133
|
|
63
|
-
1.0.0 - 2021-11-23
|
134
|
+
## [1.0.0] - 2021-11-23
|
135
|
+
|
136
|
+
### Added
|
64
137
|
|
65
|
-
- BREAKING: rename metrics to match prometheus official naming conventions (See https://prometheus.io/docs/practices/naming/#metric-names)
|
66
138
|
- FEATURE: Sidekiq process metrics
|
67
139
|
- FEATURE: Allow collecting web metrics as histograms
|
140
|
+
|
141
|
+
### Fixed
|
142
|
+
|
68
143
|
- FIX: logger improved for web server
|
69
144
|
- FIX: Remove job labels from DelayedJob queues
|
70
145
|
|
71
|
-
|
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
|
72
154
|
|
73
155
|
- FEATURE: swap from hardcoded STDERR to logger pattern (see README for details)
|
74
156
|
|
75
|
-
0.8.0 - 2021-07-05
|
157
|
+
## [0.8.0] - 2021-07-05
|
158
|
+
|
159
|
+
### Added
|
76
160
|
|
77
|
-
- FIX: handle ThreadError more gracefully in cases where process shuts down
|
78
161
|
- FEATURE: add job_name and queue_name labels to delayed job metrics
|
79
162
|
- FEATURE: always scope puma metrics on hostname in collector
|
80
163
|
- FEATURE: add customizable labels option to puma collector
|
81
164
|
- FEATURE: support for Resque
|
82
|
-
- DEV: Remove support for EOL ruby 2.5
|
83
|
-
- FIX: Add source location to MethodProfiler patches
|
84
165
|
- FEATURE: Improve Active Record instrumentation
|
85
166
|
- FEATURE: Support HTTP_X_AMZN_TRACE_ID when supplied
|
86
167
|
|
87
|
-
|
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
|
88
188
|
|
89
189
|
- Dev: Removed support from EOL rubies, only 2.5, 2.6, 2.7 and 3.0 are supported now.
|
90
190
|
- Dev: Better support for Ruby 3.0, explicitly depending on webrick
|
91
191
|
- Dev: Rails 6.1 instrumentation support
|
92
|
-
- FEATURE: clean pattern for overriding middleware labels was introduced (in README)
|
93
|
-
- Fix: Better support for forking
|
94
192
|
|
95
|
-
0.6.0 - 2020-11-17
|
193
|
+
## [0.6.0] - 2020-11-17
|
194
|
+
|
195
|
+
### Added
|
96
196
|
|
97
197
|
- FEATURE: add support for basic-auth in the prometheus_exporter web server
|
98
198
|
|
99
|
-
0.5.3 - 2020-07-29
|
199
|
+
## [0.5.3] - 2020-07-29
|
200
|
+
|
201
|
+
### Added
|
100
202
|
|
101
203
|
- FEATURE: added #remove to all metric types so users can remove specific labels if needed
|
102
204
|
|
103
|
-
0.5.2 - 2020-07-01
|
205
|
+
## [0.5.2] - 2020-07-01
|
206
|
+
|
207
|
+
### Added
|
104
208
|
|
105
209
|
- FEATURE: expanded instrumentation for sidekiq
|
106
210
|
- FEATURE: configurable default labels
|
107
211
|
|
108
|
-
0.5.1 - 2020-02-25
|
212
|
+
## [0.5.1] - 2020-02-25
|
213
|
+
|
214
|
+
### Added
|
109
215
|
|
110
216
|
- FEATURE: Allow configuring the default client's host and port via environment variables
|
111
217
|
|
112
|
-
0.5.0 - 2020-02-14
|
218
|
+
## [0.5.0] - 2020-02-14
|
219
|
+
|
220
|
+
### Fixed
|
113
221
|
|
114
|
-
- Breaking change: listen only to localhost by default to prevent unintended insecure configuration
|
115
222
|
- FIX: Avoid calling `hostname` aggressively, instead cache it on the exporter instance
|
116
223
|
|
117
|
-
|
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
|
118
231
|
|
119
232
|
- FEATURE: add support for `to_h` on all metrics which can be used to query existing key/values
|
120
233
|
|
121
|
-
0.4.16 - 2019-11-04
|
234
|
+
## [0.4.16] - 2019-11-04
|
235
|
+
|
236
|
+
### Added
|
122
237
|
|
123
238
|
- FEATURE: Support #reset! on all metric types to reset a metric to default
|
124
239
|
|
125
|
-
0.4.15 - 2019-11-04
|
240
|
+
## [0.4.15] - 2019-11-04
|
241
|
+
|
242
|
+
### Added
|
126
243
|
|
127
244
|
- FEATURE: Improve delayed job collector, add pending counts
|
128
245
|
- FEATURE: New ActiveRecord collector (documented in readme)
|
129
246
|
- FEATURE: Allow passing in histogram and summary options
|
130
247
|
- FEATURE: Allow custom labels for unicorn collector
|
131
248
|
|
132
|
-
0.4.14 - 2019-09-10
|
249
|
+
## [0.4.14] - 2019-09-10
|
250
|
+
|
251
|
+
### Added
|
133
252
|
|
134
253
|
- FEATURE: allow finding metrics by name RemoteMetric #find_registered_metric
|
254
|
+
|
255
|
+
### Fixed
|
256
|
+
|
135
257
|
- FIX: guard socket closing
|
136
258
|
|
137
|
-
0.4.13 - 2019-07-09
|
259
|
+
## [0.4.13] - 2019-07-09
|
260
|
+
|
261
|
+
### Fixed
|
138
262
|
|
139
263
|
- Fix: Memory leak in unicorn and puma collectors
|
140
264
|
|
141
|
-
0.4.12 - 2019-05-30
|
265
|
+
## [0.4.12] - 2019-05-30
|
266
|
+
|
267
|
+
### Fixed
|
142
268
|
|
143
269
|
- Fix: unicorn collector reporting incorrect number of unicorn workers
|
144
270
|
|
145
|
-
0.4.11 - 2019-05-15
|
271
|
+
## [0.4.11] - 2019-05-15
|
272
|
+
|
273
|
+
### Fixed
|
146
274
|
|
147
275
|
- Fix: Handle stopping nil worker_threads in Client
|
276
|
+
|
277
|
+
### Changed
|
278
|
+
|
148
279
|
- Dev: add frozen string literals
|
149
280
|
|
150
|
-
0.4.10 - 2019-04-29
|
281
|
+
## [0.4.10] - 2019-04-29
|
282
|
+
|
283
|
+
### Fixed
|
151
284
|
|
152
285
|
- Fix: Custom label support for puma collector
|
153
286
|
- Fix: Raindrops socket collector not working correctly
|
154
287
|
|
155
|
-
0.4.9 - 2019-04-11
|
288
|
+
## [0.4.9] - 2019-04-11
|
289
|
+
|
290
|
+
### Fixed
|
156
291
|
|
157
292
|
- Fix: Gem was not working correctly in Ruby 2.4 and below due to a syntax error
|
158
293
|
|
159
|
-
0.4.8 - 2019-04-10
|
294
|
+
## [0.4.8] - 2019-04-10
|
295
|
+
|
296
|
+
### Added
|
160
297
|
|
161
298
|
- Feature: added helpers for instrumenting unicorn using raindrops
|
162
299
|
|
163
|
-
0.4.7 - 2019-04-08
|
300
|
+
## [0.4.7] - 2019-04-08
|
301
|
+
|
302
|
+
### Fixed
|
164
303
|
|
165
304
|
- Fix: collector was not escaping " \ and \n correctly. This could lead
|
166
305
|
to a corrupt payload in some cases.
|
167
306
|
|
168
|
-
0.4.6 - 2019-04-02
|
307
|
+
## [0.4.6] - 2019-04-02
|
308
|
+
|
309
|
+
### Added
|
169
310
|
|
170
311
|
- Feature: Allow resetting a counter
|
171
312
|
- Feature: Add sidekiq metrics: restarted, dead jobs counters
|
313
|
+
|
314
|
+
### Fixed
|
315
|
+
|
172
316
|
- Fix: Client shutting down before sending metrics to collector
|
173
317
|
|
174
|
-
0.4.5 - 2019-02-14
|
318
|
+
## [0.4.5] - 2019-02-14
|
319
|
+
|
320
|
+
### Added
|
175
321
|
|
176
322
|
- Feature: Allow process collector to ship custom labels for all process metrics
|
323
|
+
|
324
|
+
### Fixed
|
325
|
+
|
177
326
|
- Fix: Always scope process metrics on hostname in collector
|
178
327
|
|
179
|
-
0.4.4 - 2019-02-13
|
328
|
+
## [0.4.4] - 2019-02-13
|
329
|
+
|
330
|
+
### Added
|
180
331
|
|
181
332
|
- Feature: add support for local metric collection without using HTTP
|
182
333
|
|
183
|
-
0.4.3 - 2019-02-11
|
334
|
+
## [0.4.3] - 2019-02-11
|
335
|
+
|
336
|
+
### Added
|
184
337
|
|
185
338
|
- Feature: Add alias for Gauge #observe called #set, this makes it a bit easier to migrate from prom
|
186
339
|
- Feature: Add increment and decrement to Counter
|
187
340
|
|
188
|
-
0.4.2 - 2018-11-30
|
341
|
+
## [0.4.2] - 2018-11-30
|
342
|
+
|
343
|
+
### Fixed
|
189
344
|
|
190
|
-
- Fix
|
345
|
+
- Fix: setting a Gauge to nil will remove Gauge (setting to non numeric will raise)
|
191
346
|
|
192
|
-
0.4.0 - 2018-10-23
|
347
|
+
## [0.4.0] - 2018-10-23
|
348
|
+
|
349
|
+
### Added
|
193
350
|
|
194
351
|
- Feature: histogram support
|
195
352
|
- Feature: custom quantile support for summary
|
196
353
|
- Feature: Puma metrics
|
354
|
+
|
355
|
+
### Fixed
|
356
|
+
|
197
357
|
- Fix: delayed job metrics
|
198
358
|
|
199
|
-
0.3.4 - 2018-10-02
|
359
|
+
## [0.3.4] - 2018-10-02
|
360
|
+
|
361
|
+
### Fixed
|
200
362
|
|
201
363
|
- Fix: custom collector via CLI was not working correctly
|
202
364
|
|
203
|
-
0.3.3
|
365
|
+
## [0.3.3]
|
366
|
+
|
367
|
+
### Added
|
204
368
|
|
205
369
|
- Feature: Add more metrics to delayed job collector
|
206
370
|
|
207
|
-
0.3.2
|
371
|
+
## [0.3.2]
|
372
|
+
|
373
|
+
### Added
|
208
374
|
|
209
375
|
- Feature: Add posibility to set custom_labels on multi process mode
|
210
376
|
|
211
|
-
0.3.1
|
377
|
+
## [0.3.1]
|
378
|
+
|
379
|
+
### Changed
|
212
380
|
|
213
381
|
- Allow runner to accept a --timeout var
|
214
382
|
- Allow runner to accept a blank prefix
|
215
383
|
|
216
|
-
0.3.0
|
384
|
+
## [0.3.0]
|
385
|
+
|
386
|
+
### Changed
|
217
387
|
|
218
388
|
- Breaking change: Follow Prometheus metric [naming conventions](https://prometheus.io/docs/practices/naming/#metric-names)
|
219
389
|
|
220
|
-
0.1.15 - 2018-02-19
|
390
|
+
## [0.1.15] - 2018-02-19
|
391
|
+
|
392
|
+
### Added
|
221
393
|
|
222
394
|
- Feature: Prefer to use oj if it is loadable
|
223
395
|
|
224
|
-
0.1.14 - 2018-02-17
|
396
|
+
## [0.1.14] - 2018-02-17
|
397
|
+
|
398
|
+
### Added
|
225
399
|
|
226
|
-
- Fix: error when shipping summary metric with no labels
|
227
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')
|
@@ -213,13 +213,14 @@ Rails.application.middleware.unshift PrometheusExporter::Middleware, instrument:
|
|
213
213
|
|
214
214
|
#### Metrics collected by Rails integration middleware
|
215
215
|
|
216
|
-
| Type | Name
|
217
|
-
| --- | ---
|
218
|
-
| Counter | `http_requests_total`
|
219
|
-
| Summary | `http_request_duration_seconds`
|
220
|
-
| Summary | `http_request_redis_duration_seconds`¹
|
221
|
-
| Summary | `http_request_sql_duration_seconds`²
|
222
|
-
| Summary | `http_request_queue_duration_seconds`³
|
216
|
+
| Type | Name | Description |
|
217
|
+
| --- | --- | --- |
|
218
|
+
| Counter | `http_requests_total` | Total HTTP requests from web app |
|
219
|
+
| Summary | `http_request_duration_seconds` | Time spent in HTTP reqs in seconds |
|
220
|
+
| Summary | `http_request_redis_duration_seconds`¹ | Time spent in HTTP reqs in Redis, in seconds |
|
221
|
+
| Summary | `http_request_sql_duration_seconds`² | Time spent in HTTP reqs in SQL in seconds |
|
222
|
+
| Summary | `http_request_queue_duration_seconds`³ | Time spent queueing the request in load balancer in seconds |
|
223
|
+
| Summary | `http_request_memcache_duration_seconds`⁴ | Time spent in HTTP reqs in Memcache in seconds |
|
223
224
|
|
224
225
|
All metrics have a `controller` and an `action` label.
|
225
226
|
`http_requests_total` additionally has a (HTTP response) `status` label.
|
@@ -268,6 +269,7 @@ ruby_http_request_duration_seconds{path="/api/v1/teams/:id",method="GET",status=
|
|
268
269
|
¹) Only available when Redis is used.
|
269
270
|
²) Only available when Mysql or PostgreSQL are used.
|
270
271
|
³) Only available when [Instrumenting Request Queueing Time](#instrumenting-request-queueing-time) is set up.
|
272
|
+
⁴) Only available when Dalli is used.
|
271
273
|
|
272
274
|
#### Activerecord Connection Pool Metrics
|
273
275
|
|
@@ -371,6 +373,8 @@ end
|
|
371
373
|
| Counter | `major_gc_ops_total` | Major GC operations by process |
|
372
374
|
| Counter | `minor_gc_ops_total` | Minor GC operations by process |
|
373
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) |
|
374
378
|
|
375
379
|
_Metrics marked with * are only collected when `MiniRacer` is defined._
|
376
380
|
|
@@ -607,15 +611,16 @@ end
|
|
607
611
|
|
608
612
|
#### Metrics collected by Puma Instrumentation
|
609
613
|
|
610
|
-
| Type | Name | Description
|
611
|
-
| --- | --- | ---
|
612
|
-
| Gauge | `puma_workers` | Number of puma workers
|
613
|
-
| Gauge | `puma_booted_workers` | Number of puma workers booted
|
614
|
-
| Gauge | `puma_old_workers` | Number of old puma workers
|
615
|
-
| Gauge | `puma_running_threads` |
|
616
|
-
| Gauge | `puma_request_backlog` | Number of requests waiting to be processed by a puma thread
|
617
|
-
| Gauge | `puma_thread_pool_capacity` | Number of puma threads available at current scale
|
618
|
-
| 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 |
|
619
624
|
|
620
625
|
All metrics may have a `phase` label and all custom labels provided with the `labels` option.
|
621
626
|
|
@@ -17,13 +17,7 @@ module PrometheusExporter
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def standard_values(value, keys, prometheus_exporter_action = nil)
|
20
|
-
values = {
|
21
|
-
type: @type,
|
22
|
-
help: @help,
|
23
|
-
name: @name,
|
24
|
-
keys: keys,
|
25
|
-
value: value
|
26
|
-
}
|
20
|
+
values = { type: @type, help: @help, name: @name, keys: keys, value: value }
|
27
21
|
values[
|
28
22
|
:prometheus_exporter_action
|
29
23
|
] = prometheus_exporter_action if prometheus_exporter_action
|
@@ -59,16 +53,14 @@ module PrometheusExporter
|
|
59
53
|
|
60
54
|
def initialize(
|
61
55
|
host: ENV.fetch("PROMETHEUS_EXPORTER_HOST", "localhost"),
|
62
|
-
port: ENV.fetch(
|
63
|
-
"PROMETHEUS_EXPORTER_PORT",
|
64
|
-
PrometheusExporter::DEFAULT_PORT
|
65
|
-
),
|
56
|
+
port: ENV.fetch("PROMETHEUS_EXPORTER_PORT", PrometheusExporter::DEFAULT_PORT),
|
66
57
|
max_queue_size: nil,
|
67
58
|
thread_sleep: 0.5,
|
68
59
|
json_serializer: nil,
|
69
60
|
custom_labels: nil,
|
70
61
|
logger: Logger.new(STDERR),
|
71
|
-
log_level: Logger::WARN
|
62
|
+
log_level: Logger::WARN,
|
63
|
+
process_queue_once_and_stop: false
|
72
64
|
)
|
73
65
|
@logger = logger
|
74
66
|
@logger.level = log_level
|
@@ -83,9 +75,7 @@ module PrometheusExporter
|
|
83
75
|
max_queue_size ||= MAX_QUEUE_SIZE
|
84
76
|
max_queue_size = max_queue_size.to_i
|
85
77
|
|
86
|
-
if max_queue_size <= 0
|
87
|
-
raise ArgumentError, "max_queue_size must be larger than 0"
|
88
|
-
end
|
78
|
+
raise ArgumentError, "max_queue_size must be larger than 0" if max_queue_size <= 0
|
89
79
|
|
90
80
|
@max_queue_size = max_queue_size
|
91
81
|
@host = host
|
@@ -94,10 +84,10 @@ module PrometheusExporter
|
|
94
84
|
@mutex = Mutex.new
|
95
85
|
@thread_sleep = thread_sleep
|
96
86
|
|
97
|
-
@json_serializer =
|
98
|
-
json_serializer == :oj ? PrometheusExporter::OjCompat : JSON
|
87
|
+
@json_serializer = json_serializer == :oj ? PrometheusExporter::OjCompat : JSON
|
99
88
|
|
100
89
|
@custom_labels = custom_labels
|
90
|
+
@process_queue_once_and_stop = process_queue_once_and_stop
|
101
91
|
end
|
102
92
|
|
103
93
|
def custom_labels=(custom_labels)
|
@@ -105,14 +95,7 @@ module PrometheusExporter
|
|
105
95
|
end
|
106
96
|
|
107
97
|
def register(type, name, help, opts = nil)
|
108
|
-
metric =
|
109
|
-
RemoteMetric.new(
|
110
|
-
type: type,
|
111
|
-
name: name,
|
112
|
-
help: help,
|
113
|
-
client: self,
|
114
|
-
opts: opts
|
115
|
-
)
|
98
|
+
metric = RemoteMetric.new(type: type, name: name, help: help, client: self, opts: opts)
|
116
99
|
@metrics << metric
|
117
100
|
metric
|
118
101
|
end
|
@@ -163,7 +146,7 @@ module PrometheusExporter
|
|
163
146
|
@socket.write("\r\n")
|
164
147
|
rescue => e
|
165
148
|
logger.warn "Prometheus Exporter is dropping a message: #{e}"
|
166
|
-
|
149
|
+
close_socket!
|
167
150
|
raise
|
168
151
|
end
|
169
152
|
end
|
@@ -189,6 +172,11 @@ module PrometheusExporter
|
|
189
172
|
end
|
190
173
|
|
191
174
|
def ensure_worker_thread!
|
175
|
+
if @process_queue_once_and_stop
|
176
|
+
worker_loop
|
177
|
+
return
|
178
|
+
end
|
179
|
+
|
192
180
|
unless @worker_thread&.alive?
|
193
181
|
@mutex.synchronize do
|
194
182
|
return if @worker_thread&.alive?
|
@@ -253,8 +241,7 @@ module PrometheusExporter
|
|
253
241
|
|
254
242
|
nil
|
255
243
|
rescue StandardError
|
256
|
-
|
257
|
-
@socket_started = nil
|
244
|
+
close_socket!
|
258
245
|
@socket_pid = nil
|
259
246
|
raise
|
260
247
|
end
|
@@ -262,10 +249,7 @@ module PrometheusExporter
|
|
262
249
|
def wait_for_empty_queue_with_timeout(timeout_seconds)
|
263
250
|
start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
264
251
|
while @queue.length > 0
|
265
|
-
if start_time + timeout_seconds <
|
266
|
-
::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
267
|
-
break
|
268
|
-
end
|
252
|
+
break if start_time + timeout_seconds < ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
269
253
|
sleep(0.05)
|
270
254
|
end
|
271
255
|
end
|