promenade 0.7.0 → 0.8.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: c8f195d39a6967000ebf64da2a2143a85c934ad0a37b7303eb91511dd1f458bf
4
- data.tar.gz: '030960d747dd81a33a2feea7b6f3a3460fdc3952160b4c000900645df163d402'
3
+ metadata.gz: 69cb441f3ff80fd4e24c3fd1760a2930d5ec57be77d1e8defc7d5c0c91d9526a
4
+ data.tar.gz: b29b635ad8c18ad0cd990d764c9fcda51e2b5394818788a43478692a2f9bef09
5
5
  SHA512:
6
- metadata.gz: 3cb2cd2eaf07029afd1ac8ad574be62d5b5f848734ea67f1f94a919fe9a6f548c2bcb71d761b92a30077575114a7b505eebe21f20f380af47471401c62b898f6
7
- data.tar.gz: 0e94c108cd6e98d0f1280e07412e2cb9a41ef7f5a0d7f33735d785c1253424246e46c5fc49ddc0757658301f697272baa1ee882f109327442d13ffa87e6f6429
6
+ metadata.gz: 78899076a32afdabe648eed9c717ca0656880d83343c8101f68529302d232046a7b0659e00f8aa9d0f2c0c98de5f77c75ae9d43a3b0a656816b0cbd70c5e683c
7
+ data.tar.gz: 233dea29570f65d4dbed4a33c3da1898d3c41918777610fa5bba95e8f9931003554a1beb2d1ba7326eb113e0e53176f72c2176e80ab236849adfef914c1076c0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- promenade (0.7.0)
4
+ promenade (0.8.0)
5
5
  actionpack
6
6
  activesupport (> 6.0, < 8.0)
7
7
  prometheus-client-mmap (~> 0.16.0)
@@ -10,167 +10,144 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (7.0.3)
14
- actionpack (= 7.0.3)
15
- activesupport (= 7.0.3)
13
+ actioncable (7.0.4.2)
14
+ actionpack (= 7.0.4.2)
15
+ activesupport (= 7.0.4.2)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (7.0.3)
19
- actionpack (= 7.0.3)
20
- activejob (= 7.0.3)
21
- activerecord (= 7.0.3)
22
- activestorage (= 7.0.3)
23
- activesupport (= 7.0.3)
18
+ actionmailbox (7.0.4.2)
19
+ actionpack (= 7.0.4.2)
20
+ activejob (= 7.0.4.2)
21
+ activerecord (= 7.0.4.2)
22
+ activestorage (= 7.0.4.2)
23
+ activesupport (= 7.0.4.2)
24
24
  mail (>= 2.7.1)
25
25
  net-imap
26
26
  net-pop
27
27
  net-smtp
28
- actionmailer (7.0.3)
29
- actionpack (= 7.0.3)
30
- actionview (= 7.0.3)
31
- activejob (= 7.0.3)
32
- activesupport (= 7.0.3)
28
+ actionmailer (7.0.4.2)
29
+ actionpack (= 7.0.4.2)
30
+ actionview (= 7.0.4.2)
31
+ activejob (= 7.0.4.2)
32
+ activesupport (= 7.0.4.2)
33
33
  mail (~> 2.5, >= 2.5.4)
34
34
  net-imap
35
35
  net-pop
36
36
  net-smtp
37
37
  rails-dom-testing (~> 2.0)
38
- actionpack (7.0.3)
39
- actionview (= 7.0.3)
40
- activesupport (= 7.0.3)
38
+ actionpack (7.0.4.2)
39
+ actionview (= 7.0.4.2)
40
+ activesupport (= 7.0.4.2)
41
41
  rack (~> 2.0, >= 2.2.0)
42
42
  rack-test (>= 0.6.3)
43
43
  rails-dom-testing (~> 2.0)
44
44
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
- actiontext (7.0.3)
46
- actionpack (= 7.0.3)
47
- activerecord (= 7.0.3)
48
- activestorage (= 7.0.3)
49
- activesupport (= 7.0.3)
45
+ actiontext (7.0.4.2)
46
+ actionpack (= 7.0.4.2)
47
+ activerecord (= 7.0.4.2)
48
+ activestorage (= 7.0.4.2)
49
+ activesupport (= 7.0.4.2)
50
50
  globalid (>= 0.6.0)
51
51
  nokogiri (>= 1.8.5)
52
- actionview (7.0.3)
53
- activesupport (= 7.0.3)
52
+ actionview (7.0.4.2)
53
+ activesupport (= 7.0.4.2)
54
54
  builder (~> 3.1)
55
55
  erubi (~> 1.4)
56
56
  rails-dom-testing (~> 2.0)
57
57
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
58
- activejob (7.0.3)
59
- activesupport (= 7.0.3)
58
+ activejob (7.0.4.2)
59
+ activesupport (= 7.0.4.2)
60
60
  globalid (>= 0.3.6)
61
- activemodel (7.0.3)
62
- activesupport (= 7.0.3)
63
- activerecord (7.0.3)
64
- activemodel (= 7.0.3)
65
- activesupport (= 7.0.3)
66
- activestorage (7.0.3)
67
- actionpack (= 7.0.3)
68
- activejob (= 7.0.3)
69
- activerecord (= 7.0.3)
70
- activesupport (= 7.0.3)
61
+ activemodel (7.0.4.2)
62
+ activesupport (= 7.0.4.2)
63
+ activerecord (7.0.4.2)
64
+ activemodel (= 7.0.4.2)
65
+ activesupport (= 7.0.4.2)
66
+ activestorage (7.0.4.2)
67
+ actionpack (= 7.0.4.2)
68
+ activejob (= 7.0.4.2)
69
+ activerecord (= 7.0.4.2)
70
+ activesupport (= 7.0.4.2)
71
71
  marcel (~> 1.0)
72
72
  mini_mime (>= 1.1.0)
73
- activesupport (7.0.3)
73
+ activesupport (7.0.4.2)
74
74
  concurrent-ruby (~> 1.0, >= 1.0.2)
75
75
  i18n (>= 1.6, < 2)
76
76
  minitest (>= 5.1)
77
77
  tzinfo (~> 2.0)
78
78
  ast (2.4.2)
79
- backports (3.23.0)
80
- binding_of_caller (1.0.0)
81
- debug_inspector (>= 0.0.1)
82
79
  builder (3.2.4)
83
80
  byebug (11.1.3)
84
- climate_control (1.1.1)
81
+ climate_control (1.2.0)
85
82
  codecov (0.6.0)
86
83
  simplecov (>= 0.15, < 0.22)
87
- coderay (1.1.3)
88
- concurrent-ruby (1.1.10)
84
+ concurrent-ruby (1.2.2)
89
85
  crass (1.0.6)
90
- debug_inspector (1.1.0)
91
- deep-cover (1.1.0)
92
- deep-cover-core (= 1.1.0)
93
- highline
94
- thor (>= 0.20.3)
95
- with_progress
96
- deep-cover-core (1.1.0)
97
- backports (>= 3.11.0)
98
- binding_of_caller
99
- parser (>= 2.5)
100
- pry
101
- term-ansicolor
102
- terminal-table
86
+ date (3.3.3)
103
87
  diff-lcs (1.5.0)
104
- digest (3.1.0)
105
88
  docile (1.4.0)
106
- erubi (1.10.0)
107
- globalid (1.0.0)
89
+ erubi (1.12.0)
90
+ globalid (1.1.0)
108
91
  activesupport (>= 5.0)
109
- highline (2.0.3)
110
- i18n (1.10.0)
92
+ i18n (1.12.0)
111
93
  concurrent-ruby (~> 1.0)
112
94
  json (2.6.3)
113
- loofah (2.18.0)
95
+ loofah (2.19.1)
114
96
  crass (~> 1.0.2)
115
97
  nokogiri (>= 1.5.9)
116
- mail (2.7.1)
98
+ mail (2.8.1)
117
99
  mini_mime (>= 0.1.1)
100
+ net-imap
101
+ net-pop
102
+ net-smtp
118
103
  marcel (1.0.2)
119
104
  method_source (1.0.0)
120
105
  mini_mime (1.1.2)
121
- mini_portile2 (2.8.0)
122
- minitest (5.16.0)
123
- net-imap (0.2.3)
124
- digest
106
+ mini_portile2 (2.8.1)
107
+ minitest (5.17.0)
108
+ net-imap (0.3.4)
109
+ date
125
110
  net-protocol
126
- strscan
127
- net-pop (0.1.1)
128
- digest
111
+ net-pop (0.1.2)
129
112
  net-protocol
113
+ net-protocol (0.2.1)
130
114
  timeout
131
- net-protocol (0.1.3)
132
- timeout
133
- net-smtp (0.3.1)
134
- digest
115
+ net-smtp (0.3.3)
135
116
  net-protocol
136
- timeout
137
117
  nio4r (2.5.8)
138
- nokogiri (1.13.6)
118
+ nokogiri (1.14.2)
139
119
  mini_portile2 (~> 2.8.0)
140
120
  racc (~> 1.4)
141
121
  parallel (1.22.1)
142
122
  parser (3.2.1.0)
143
123
  ast (~> 2.4.1)
144
124
  prometheus-client-mmap (0.16.2)
145
- pry (0.14.1)
146
- coderay (~> 1.1)
147
- method_source (~> 1.0)
148
- racc (1.6.0)
149
- rack (2.2.3.1)
150
- rack-test (1.1.0)
151
- rack (>= 1.0, < 3)
152
- rails (7.0.3)
153
- actioncable (= 7.0.3)
154
- actionmailbox (= 7.0.3)
155
- actionmailer (= 7.0.3)
156
- actionpack (= 7.0.3)
157
- actiontext (= 7.0.3)
158
- actionview (= 7.0.3)
159
- activejob (= 7.0.3)
160
- activemodel (= 7.0.3)
161
- activerecord (= 7.0.3)
162
- activestorage (= 7.0.3)
163
- activesupport (= 7.0.3)
125
+ racc (1.6.2)
126
+ rack (2.2.6.2)
127
+ rack-test (2.0.2)
128
+ rack (>= 1.3)
129
+ rails (7.0.4.2)
130
+ actioncable (= 7.0.4.2)
131
+ actionmailbox (= 7.0.4.2)
132
+ actionmailer (= 7.0.4.2)
133
+ actionpack (= 7.0.4.2)
134
+ actiontext (= 7.0.4.2)
135
+ actionview (= 7.0.4.2)
136
+ activejob (= 7.0.4.2)
137
+ activemodel (= 7.0.4.2)
138
+ activerecord (= 7.0.4.2)
139
+ activestorage (= 7.0.4.2)
140
+ activesupport (= 7.0.4.2)
164
141
  bundler (>= 1.15.0)
165
- railties (= 7.0.3)
142
+ railties (= 7.0.4.2)
166
143
  rails-dom-testing (2.0.3)
167
144
  activesupport (>= 4.2.0)
168
145
  nokogiri (>= 1.6)
169
- rails-html-sanitizer (1.4.3)
170
- loofah (~> 2.3)
171
- railties (7.0.3)
172
- actionpack (= 7.0.3)
173
- activesupport (= 7.0.3)
146
+ rails-html-sanitizer (1.5.0)
147
+ loofah (~> 2.19, >= 2.19.1)
148
+ railties (7.0.4.2)
149
+ actionpack (= 7.0.4.2)
150
+ activesupport (= 7.0.4.2)
174
151
  method_source
175
152
  rake (>= 12.2)
176
153
  thor (~> 1.0)
@@ -179,18 +156,18 @@ GEM
179
156
  rake (13.0.6)
180
157
  regexp_parser (2.7.0)
181
158
  rexml (3.2.5)
182
- rspec (3.11.0)
183
- rspec-core (~> 3.11.0)
184
- rspec-expectations (~> 3.11.0)
185
- rspec-mocks (~> 3.11.0)
186
- rspec-core (3.11.0)
187
- rspec-support (~> 3.11.0)
188
- rspec-expectations (3.11.0)
159
+ rspec (3.12.0)
160
+ rspec-core (~> 3.12.0)
161
+ rspec-expectations (~> 3.12.0)
162
+ rspec-mocks (~> 3.12.0)
163
+ rspec-core (3.12.1)
164
+ rspec-support (~> 3.12.0)
165
+ rspec-expectations (3.12.2)
189
166
  diff-lcs (>= 1.2.0, < 2.0)
190
- rspec-support (~> 3.11.0)
191
- rspec-mocks (3.11.1)
167
+ rspec-support (~> 3.12.0)
168
+ rspec-mocks (3.12.3)
192
169
  diff-lcs (>= 1.2.0, < 2.0)
193
- rspec-support (~> 3.11.0)
170
+ rspec-support (~> 3.12.0)
194
171
  rspec-rails (5.1.2)
195
172
  actionpack (>= 5.2)
196
173
  activesupport (>= 5.2)
@@ -199,8 +176,8 @@ GEM
199
176
  rspec-expectations (~> 3.10)
200
177
  rspec-mocks (~> 3.10)
201
178
  rspec-support (~> 3.10)
202
- rspec-support (3.11.0)
203
- rubocop (1.46.0)
179
+ rspec-support (3.12.0)
180
+ rubocop (1.47.0)
204
181
  json (~> 2.3)
205
182
  parallel (~> 1.10)
206
183
  parser (>= 3.2.0.0)
@@ -214,43 +191,33 @@ GEM
214
191
  parser (>= 3.2.1.0)
215
192
  rubocop-capybara (2.17.1)
216
193
  rubocop (~> 1.41)
217
- rubocop-performance (1.14.2)
194
+ rubocop-performance (1.16.0)
218
195
  rubocop (>= 1.7.0, < 2.0)
219
196
  rubocop-ast (>= 0.4.0)
220
- rubocop-rails (2.15.0)
197
+ rubocop-rails (2.18.0)
221
198
  activesupport (>= 4.2.0)
222
199
  rack (>= 1.1)
223
- rubocop (>= 1.7.0, < 2.0)
200
+ rubocop (>= 1.33.0, < 2.0)
224
201
  rubocop-rspec (2.18.1)
225
202
  rubocop (~> 1.33)
226
203
  rubocop-capybara (~> 2.17)
227
- ruby-progressbar (1.11.0)
204
+ ruby-progressbar (1.12.0)
228
205
  simplecov (0.21.2)
229
206
  docile (~> 1.1)
230
207
  simplecov-html (~> 0.11)
231
208
  simplecov_json_formatter (~> 0.1)
232
209
  simplecov-html (0.12.3)
233
210
  simplecov_json_formatter (0.1.4)
234
- strscan (3.0.3)
235
- sync (0.5.0)
236
- term-ansicolor (1.7.1)
237
- tins (~> 1.0)
238
- terminal-table (3.0.2)
239
- unicode-display_width (>= 1.1.1, < 3)
240
211
  thor (1.2.1)
241
- timeout (0.3.0)
242
- tins (1.31.1)
243
- sync
244
- tzinfo (2.0.4)
212
+ timeout (0.3.2)
213
+ tzinfo (2.0.6)
245
214
  concurrent-ruby (~> 1.0)
246
215
  unicode-display_width (2.4.2)
247
- webrick (1.7.0)
216
+ webrick (1.8.1)
248
217
  websocket-driver (0.7.5)
249
218
  websocket-extensions (>= 0.1.0)
250
219
  websocket-extensions (0.1.5)
251
- with_progress (1.0.1)
252
- ruby-progressbar (~> 1.4)
253
- zeitwerk (2.6.0)
220
+ zeitwerk (2.6.7)
254
221
 
255
222
  PLATFORMS
256
223
  ruby
@@ -260,7 +227,6 @@ DEPENDENCIES
260
227
  byebug
261
228
  climate_control
262
229
  codecov
263
- deep-cover
264
230
  promenade!
265
231
  rails (> 3.0, < 8.0)
266
232
  rake
@@ -8,10 +8,11 @@ module Promenade
8
8
  class ExceptionHandler
9
9
  extend SingletonCaller
10
10
 
11
- attr_reader :histogram_name, :exceptions_counter_name, :registry
11
+ attr_reader :histogram_name, :requests_counter_name, :exceptions_counter_name, :registry
12
12
 
13
- def initialize(histogram_name:, exceptions_counter_name:, registry:)
13
+ def initialize(histogram_name:, requests_counter_name:, exceptions_counter_name:, registry:)
14
14
  @histogram_name = histogram_name
15
+ @requests_counter_name = requests_counter_name
15
16
  @exceptions_counter_name = exceptions_counter_name
16
17
  @registry = registry
17
18
  end
@@ -21,6 +22,7 @@ module Promenade
21
22
  labels.merge!(code: status_code_for_exception(exception))
22
23
 
23
24
  histogram.observe(labels, duration.to_f)
25
+ requests_counter.increment(labels)
24
26
  exceptions_counter.increment(exception: exception.class.name)
25
27
 
26
28
  raise exception
@@ -32,6 +34,10 @@ module Promenade
32
34
  registry.get(histogram_name)
33
35
  end
34
36
 
37
+ def requests_counter
38
+ registry.get(requests_counter_name)
39
+ end
40
+
35
41
  def exceptions_counter
36
42
  registry.get(exceptions_counter_name)
37
43
  end
@@ -10,9 +10,17 @@ module Promenade
10
10
  class HTTPRequestDurationCollector < MiddlwareBase
11
11
  REQUEST_DURATION_HISTOGRAM_NAME = :http_req_duration_seconds
12
12
 
13
+ # We specifically want to record a separate metric `http_requests_total` even
14
+ # though we know it is a duplicate of http_req_duration_seconds_count.
15
+ # This is a very commonly used prometheus metric name, and is very useful
16
+ # e.g. for autoscaling. Using the http_req_duration_seconds_count in such
17
+ # queries can be confusing
18
+ REQUESTS_COUNTER_NAME = :http_requests_total
19
+
13
20
  EXCEPTIONS_COUNTER_NAME = :http_exceptions_total
14
21
 
15
22
  private_constant :REQUEST_DURATION_HISTOGRAM_NAME,
23
+ :REQUESTS_COUNTER_NAME,
16
24
  :EXCEPTIONS_COUNTER_NAME
17
25
 
18
26
  def initialize(app,
@@ -42,6 +50,7 @@ module Promenade
42
50
  end
43
51
 
44
52
  def record_request_duration(labels, duration)
53
+ requests_counter.increment(labels)
45
54
  durations_histogram.observe(labels, duration)
46
55
  end
47
56
 
@@ -57,7 +66,13 @@ module Promenade
57
66
  registry.get(REQUEST_DURATION_HISTOGRAM_NAME)
58
67
  end
59
68
 
69
+ def requests_counter
70
+ registry.get(REQUESTS_COUNTER_NAME)
71
+ end
72
+
60
73
  def register_metrics!
74
+ registry.counter(REQUESTS_COUNTER_NAME,
75
+ "A counter of the total number of HTTP requests made.")
61
76
  registry.histogram(REQUEST_DURATION_HISTOGRAM_NAME,
62
77
  "A histogram of the response latency.", {}, latency_buckets)
63
78
  registry.counter(EXCEPTIONS_COUNTER_NAME,
@@ -71,6 +86,7 @@ module Promenade
71
86
  def default_exception_handler
72
87
  ExceptionHandler.initialize_singleton(
73
88
  histogram_name: REQUEST_DURATION_HISTOGRAM_NAME,
89
+ requests_counter_name: REQUESTS_COUNTER_NAME,
74
90
  exceptions_counter_name: EXCEPTIONS_COUNTER_NAME,
75
91
  registry: registry,
76
92
  )
@@ -1,3 +1,3 @@
1
1
  module Promenade
2
- VERSION = "0.7.0".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
data/promenade.gemspec CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "bundler", "~> 2.0"
32
32
  spec.add_development_dependency "byebug"
33
33
  spec.add_development_dependency "climate_control"
34
- spec.add_development_dependency "deep-cover"
35
34
  spec.add_development_dependency "rails", "> 3.0", "< 8.0"
36
35
  spec.add_development_dependency "rake"
37
36
  spec.add_development_dependency "rspec", "~> 3.11"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promenade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Robinson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -114,20 +114,6 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
- - !ruby/object:Gem::Dependency
118
- name: deep-cover
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
117
  - !ruby/object:Gem::Dependency
132
118
  name: rails
133
119
  requirement: !ruby/object:Gem::Requirement
@@ -327,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
313
  - !ruby/object:Gem::Version
328
314
  version: '0'
329
315
  requirements: []
330
- rubygems_version: 3.3.7
316
+ rubygems_version: 3.4.6
331
317
  signing_key:
332
318
  specification_version: 4
333
319
  summary: Promenade makes it simple to instrument Ruby apps for prometheus scraping