promenade 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +1 -1
- data/.rubocop.yml +4 -0
- data/Gemfile.lock +115 -141
- data/exe/promenade +1 -1
- data/lib/promenade/client/rack/exception_handler.rb +2 -2
- data/lib/promenade/client/rack/http_request_duration_collector.rb +7 -2
- data/lib/promenade/client/rack/request_controller_action_labeler.rb +42 -0
- data/lib/promenade/client/rack/request_labeler.rb +1 -28
- data/lib/promenade/version.rb +1 -1
- data/lib/promenade.rb +1 -1
- data/promenade.gemspec +3 -3
- metadata +18 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69cb441f3ff80fd4e24c3fd1760a2930d5ec57be77d1e8defc7d5c0c91d9526a
|
4
|
+
data.tar.gz: b29b635ad8c18ad0cd990d764c9fcda51e2b5394818788a43478692a2f9bef09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78899076a32afdabe648eed9c717ca0656880d83343c8101f68529302d232046a7b0659e00f8aa9d0f2c0c98de5f77c75ae9d43a3b0a656816b0cbd70c5e683c
|
7
|
+
data.tar.gz: 233dea29570f65d4dbed4a33c3da1898d3c41918777610fa5bba95e8f9931003554a1beb2d1ba7326eb113e0e53176f72c2176e80ab236849adfef914c1076c0
|
data/.github/workflows/ci.yaml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
promenade (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,186 +10,164 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (7.0.
|
14
|
-
actionpack (= 7.0.
|
15
|
-
activesupport (= 7.0.
|
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.
|
19
|
-
actionpack (= 7.0.
|
20
|
-
activejob (= 7.0.
|
21
|
-
activerecord (= 7.0.
|
22
|
-
activestorage (= 7.0.
|
23
|
-
activesupport (= 7.0.
|
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.
|
29
|
-
actionpack (= 7.0.
|
30
|
-
actionview (= 7.0.
|
31
|
-
activejob (= 7.0.
|
32
|
-
activesupport (= 7.0.
|
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.
|
39
|
-
actionview (= 7.0.
|
40
|
-
activesupport (= 7.0.
|
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.
|
46
|
-
actionpack (= 7.0.
|
47
|
-
activerecord (= 7.0.
|
48
|
-
activestorage (= 7.0.
|
49
|
-
activesupport (= 7.0.
|
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.
|
53
|
-
activesupport (= 7.0.
|
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.
|
59
|
-
activesupport (= 7.0.
|
58
|
+
activejob (7.0.4.2)
|
59
|
+
activesupport (= 7.0.4.2)
|
60
60
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.0.
|
62
|
-
activesupport (= 7.0.
|
63
|
-
activerecord (7.0.
|
64
|
-
activemodel (= 7.0.
|
65
|
-
activesupport (= 7.0.
|
66
|
-
activestorage (7.0.
|
67
|
-
actionpack (= 7.0.
|
68
|
-
activejob (= 7.0.
|
69
|
-
activerecord (= 7.0.
|
70
|
-
activesupport (= 7.0.
|
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.
|
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.
|
81
|
+
climate_control (1.2.0)
|
85
82
|
codecov (0.6.0)
|
86
83
|
simplecov (>= 0.15, < 0.22)
|
87
|
-
|
88
|
-
concurrent-ruby (1.1.10)
|
84
|
+
concurrent-ruby (1.2.2)
|
89
85
|
crass (1.0.6)
|
90
|
-
|
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.
|
107
|
-
globalid (1.
|
89
|
+
erubi (1.12.0)
|
90
|
+
globalid (1.1.0)
|
108
91
|
activesupport (>= 5.0)
|
109
|
-
|
110
|
-
i18n (1.10.0)
|
92
|
+
i18n (1.12.0)
|
111
93
|
concurrent-ruby (~> 1.0)
|
112
|
-
|
94
|
+
json (2.6.3)
|
95
|
+
loofah (2.19.1)
|
113
96
|
crass (~> 1.0.2)
|
114
97
|
nokogiri (>= 1.5.9)
|
115
|
-
mail (2.
|
98
|
+
mail (2.8.1)
|
116
99
|
mini_mime (>= 0.1.1)
|
100
|
+
net-imap
|
101
|
+
net-pop
|
102
|
+
net-smtp
|
117
103
|
marcel (1.0.2)
|
118
104
|
method_source (1.0.0)
|
119
105
|
mini_mime (1.1.2)
|
120
|
-
mini_portile2 (2.8.
|
121
|
-
minitest (5.
|
122
|
-
net-imap (0.
|
123
|
-
|
106
|
+
mini_portile2 (2.8.1)
|
107
|
+
minitest (5.17.0)
|
108
|
+
net-imap (0.3.4)
|
109
|
+
date
|
124
110
|
net-protocol
|
125
|
-
|
126
|
-
net-pop (0.1.1)
|
127
|
-
digest
|
111
|
+
net-pop (0.1.2)
|
128
112
|
net-protocol
|
113
|
+
net-protocol (0.2.1)
|
129
114
|
timeout
|
130
|
-
net-
|
131
|
-
timeout
|
132
|
-
net-smtp (0.3.1)
|
133
|
-
digest
|
115
|
+
net-smtp (0.3.3)
|
134
116
|
net-protocol
|
135
|
-
timeout
|
136
117
|
nio4r (2.5.8)
|
137
|
-
nokogiri (1.
|
118
|
+
nokogiri (1.14.2)
|
138
119
|
mini_portile2 (~> 2.8.0)
|
139
120
|
racc (~> 1.4)
|
140
121
|
parallel (1.22.1)
|
141
|
-
parser (3.1.
|
122
|
+
parser (3.2.1.0)
|
142
123
|
ast (~> 2.4.1)
|
143
124
|
prometheus-client-mmap (0.16.2)
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
activerecord (= 7.0.3)
|
161
|
-
activestorage (= 7.0.3)
|
162
|
-
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)
|
163
141
|
bundler (>= 1.15.0)
|
164
|
-
railties (= 7.0.
|
142
|
+
railties (= 7.0.4.2)
|
165
143
|
rails-dom-testing (2.0.3)
|
166
144
|
activesupport (>= 4.2.0)
|
167
145
|
nokogiri (>= 1.6)
|
168
|
-
rails-html-sanitizer (1.
|
169
|
-
loofah (~> 2.
|
170
|
-
railties (7.0.
|
171
|
-
actionpack (= 7.0.
|
172
|
-
activesupport (= 7.0.
|
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)
|
173
151
|
method_source
|
174
152
|
rake (>= 12.2)
|
175
153
|
thor (~> 1.0)
|
176
154
|
zeitwerk (~> 2.5)
|
177
155
|
rainbow (3.1.1)
|
178
156
|
rake (13.0.6)
|
179
|
-
regexp_parser (2.
|
157
|
+
regexp_parser (2.7.0)
|
180
158
|
rexml (3.2.5)
|
181
|
-
rspec (3.
|
182
|
-
rspec-core (~> 3.
|
183
|
-
rspec-expectations (~> 3.
|
184
|
-
rspec-mocks (~> 3.
|
185
|
-
rspec-core (3.
|
186
|
-
rspec-support (~> 3.
|
187
|
-
rspec-expectations (3.
|
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)
|
188
166
|
diff-lcs (>= 1.2.0, < 2.0)
|
189
|
-
rspec-support (~> 3.
|
190
|
-
rspec-mocks (3.
|
167
|
+
rspec-support (~> 3.12.0)
|
168
|
+
rspec-mocks (3.12.3)
|
191
169
|
diff-lcs (>= 1.2.0, < 2.0)
|
192
|
-
rspec-support (~> 3.
|
170
|
+
rspec-support (~> 3.12.0)
|
193
171
|
rspec-rails (5.1.2)
|
194
172
|
actionpack (>= 5.2)
|
195
173
|
activesupport (>= 5.2)
|
@@ -198,52 +176,48 @@ GEM
|
|
198
176
|
rspec-expectations (~> 3.10)
|
199
177
|
rspec-mocks (~> 3.10)
|
200
178
|
rspec-support (~> 3.10)
|
201
|
-
rspec-support (3.
|
202
|
-
rubocop (1.
|
179
|
+
rspec-support (3.12.0)
|
180
|
+
rubocop (1.47.0)
|
181
|
+
json (~> 2.3)
|
203
182
|
parallel (~> 1.10)
|
204
|
-
parser (>= 3.
|
183
|
+
parser (>= 3.2.0.0)
|
205
184
|
rainbow (>= 2.2.2, < 4.0)
|
206
185
|
regexp_parser (>= 1.8, < 3.0)
|
207
186
|
rexml (>= 3.2.5, < 4.0)
|
208
|
-
rubocop-ast (>= 1.
|
187
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
209
188
|
ruby-progressbar (~> 1.7)
|
210
|
-
unicode-display_width (>=
|
211
|
-
rubocop-ast (1.
|
212
|
-
parser (>= 3.
|
213
|
-
rubocop-
|
189
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
190
|
+
rubocop-ast (1.27.0)
|
191
|
+
parser (>= 3.2.1.0)
|
192
|
+
rubocop-capybara (2.17.1)
|
193
|
+
rubocop (~> 1.41)
|
194
|
+
rubocop-performance (1.16.0)
|
214
195
|
rubocop (>= 1.7.0, < 2.0)
|
215
196
|
rubocop-ast (>= 0.4.0)
|
216
|
-
rubocop-rails (2.
|
197
|
+
rubocop-rails (2.18.0)
|
217
198
|
activesupport (>= 4.2.0)
|
218
199
|
rack (>= 1.1)
|
219
|
-
rubocop (>= 1.
|
220
|
-
|
200
|
+
rubocop (>= 1.33.0, < 2.0)
|
201
|
+
rubocop-rspec (2.18.1)
|
202
|
+
rubocop (~> 1.33)
|
203
|
+
rubocop-capybara (~> 2.17)
|
204
|
+
ruby-progressbar (1.12.0)
|
221
205
|
simplecov (0.21.2)
|
222
206
|
docile (~> 1.1)
|
223
207
|
simplecov-html (~> 0.11)
|
224
208
|
simplecov_json_formatter (~> 0.1)
|
225
209
|
simplecov-html (0.12.3)
|
226
210
|
simplecov_json_formatter (0.1.4)
|
227
|
-
strscan (3.0.3)
|
228
|
-
sync (0.5.0)
|
229
|
-
term-ansicolor (1.7.1)
|
230
|
-
tins (~> 1.0)
|
231
|
-
terminal-table (3.0.2)
|
232
|
-
unicode-display_width (>= 1.1.1, < 3)
|
233
211
|
thor (1.2.1)
|
234
|
-
timeout (0.3.
|
235
|
-
|
236
|
-
sync
|
237
|
-
tzinfo (2.0.4)
|
212
|
+
timeout (0.3.2)
|
213
|
+
tzinfo (2.0.6)
|
238
214
|
concurrent-ruby (~> 1.0)
|
239
|
-
unicode-display_width (2.
|
240
|
-
webrick (1.
|
215
|
+
unicode-display_width (2.4.2)
|
216
|
+
webrick (1.8.1)
|
241
217
|
websocket-driver (0.7.5)
|
242
218
|
websocket-extensions (>= 0.1.0)
|
243
219
|
websocket-extensions (0.1.5)
|
244
|
-
|
245
|
-
ruby-progressbar (~> 1.4)
|
246
|
-
zeitwerk (2.6.0)
|
220
|
+
zeitwerk (2.6.7)
|
247
221
|
|
248
222
|
PLATFORMS
|
249
223
|
ruby
|
@@ -253,7 +227,6 @@ DEPENDENCIES
|
|
253
227
|
byebug
|
254
228
|
climate_control
|
255
229
|
codecov
|
256
|
-
deep-cover
|
257
230
|
promenade!
|
258
231
|
rails (> 3.0, < 8.0)
|
259
232
|
rake
|
@@ -262,6 +235,7 @@ DEPENDENCIES
|
|
262
235
|
rubocop
|
263
236
|
rubocop-performance
|
264
237
|
rubocop-rails
|
238
|
+
rubocop-rspec
|
265
239
|
simplecov
|
266
240
|
webrick
|
267
241
|
|
data/exe/promenade
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "action_dispatch/middleware/exception_wrapper"
|
2
2
|
require_relative "singleton_caller"
|
3
|
-
require_relative "
|
3
|
+
require_relative "request_controller_action_labeler"
|
4
4
|
|
5
5
|
module Promenade
|
6
6
|
module Client
|
@@ -18,7 +18,7 @@ module Promenade
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call(exception, env_hash, duration)
|
21
|
-
labels =
|
21
|
+
labels = RequestControllerActionLabeler.call(env_hash)
|
22
22
|
labels.merge!(code: status_code_for_exception(exception))
|
23
23
|
|
24
24
|
histogram.observe(labels, duration.to_f)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "prometheus/client"
|
2
2
|
require_relative "middleware_base"
|
3
|
-
require_relative "
|
3
|
+
require_relative "request_controller_action_labeler"
|
4
4
|
require_relative "exception_handler"
|
5
5
|
require_relative "queue_time_duration"
|
6
6
|
|
@@ -10,6 +10,11 @@ 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
|
13
18
|
REQUESTS_COUNTER_NAME = :http_requests_total
|
14
19
|
|
15
20
|
EXCEPTIONS_COUNTER_NAME = :http_exceptions_total
|
@@ -20,7 +25,7 @@ module Promenade
|
|
20
25
|
|
21
26
|
def initialize(app,
|
22
27
|
registry: ::Prometheus::Client.registry,
|
23
|
-
label_builder:
|
28
|
+
label_builder: RequestControllerActionLabeler,
|
24
29
|
exception_handler: nil)
|
25
30
|
|
26
31
|
@latency_buckets = Promenade.configuration.rack_latency_buckets
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative "request_labeler"
|
2
|
+
module Promenade
|
3
|
+
module Client
|
4
|
+
module Rack
|
5
|
+
class RequestControllerActionLabeler < RequestLabeler
|
6
|
+
PARAMS_KEY = "action_dispatch.request.parameters".freeze
|
7
|
+
|
8
|
+
PATH_PARAMS_KEY = "action_dispatch.request.path_parameters".freeze
|
9
|
+
|
10
|
+
CONTROLLER = "controller".freeze
|
11
|
+
|
12
|
+
ACTION = "action".freeze
|
13
|
+
|
14
|
+
UNKNOWN = "unknown".freeze
|
15
|
+
|
16
|
+
SEPARATOR = "#".freeze
|
17
|
+
|
18
|
+
private_constant :PARAMS_KEY, :CONTROLLER, :ACTION, :UNKNOWN, :SEPARATOR
|
19
|
+
|
20
|
+
def call(env)
|
21
|
+
super.merge({
|
22
|
+
controller_action: controller_action_from_env(env),
|
23
|
+
})
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def controller_action_from_env(env)
|
29
|
+
controller = env.dig(PARAMS_KEY, CONTROLLER) ||
|
30
|
+
env.dig(PATH_PARAMS_KEY, CONTROLLER.to_sym) ||
|
31
|
+
UNKNOWN
|
32
|
+
|
33
|
+
action = env.dig(PARAMS_KEY, ACTION) ||
|
34
|
+
env.dig(PATH_PARAMS_KEY, ACTION.to_sym) ||
|
35
|
+
UNKNOWN
|
36
|
+
|
37
|
+
[controller, action].join(SEPARATOR)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -9,41 +9,14 @@ module Promenade
|
|
9
9
|
|
10
10
|
HTTP_HOST = "HTTP_HOST".freeze
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
PATH_PARAMS_KEY = "action_dispatch.request.path_parameters".freeze
|
15
|
-
|
16
|
-
CONTROLLER = "controller".freeze
|
17
|
-
|
18
|
-
ACTION = "action".freeze
|
19
|
-
|
20
|
-
UNKNOWN = "unknown".freeze
|
21
|
-
|
22
|
-
SEPARATOR = "#".freeze
|
23
|
-
|
24
|
-
private_constant :REQUEST_METHOD, :HTTP_HOST, :PARAMS_KEY, :CONTROLLER, :ACTION, :UNKNOWN, :SEPARATOR
|
12
|
+
private_constant :REQUEST_METHOD, :HTTP_HOST
|
25
13
|
|
26
14
|
def call(env)
|
27
15
|
{
|
28
16
|
method: env[REQUEST_METHOD].to_s.downcase,
|
29
17
|
host: env[HTTP_HOST].to_s,
|
30
|
-
controller_action: controller_action_from_env(env),
|
31
18
|
}
|
32
19
|
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def controller_action_from_env(env)
|
37
|
-
controller = env.dig(PARAMS_KEY, CONTROLLER) ||
|
38
|
-
env.dig(PATH_PARAMS_KEY, CONTROLLER.to_sym) ||
|
39
|
-
UNKNOWN
|
40
|
-
|
41
|
-
action = env.dig(PARAMS_KEY, ACTION) ||
|
42
|
-
env.dig(PATH_PARAMS_KEY, ACTION.to_sym) ||
|
43
|
-
UNKNOWN
|
44
|
-
|
45
|
-
[controller, action].join(SEPARATOR)
|
46
|
-
end
|
47
20
|
end
|
48
21
|
end
|
49
22
|
end
|
data/lib/promenade/version.rb
CHANGED
data/lib/promenade.rb
CHANGED
data/promenade.gemspec
CHANGED
@@ -2,7 +2,7 @@ lib = File.expand_path("lib", __dir__)
|
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require "promenade/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |spec|
|
5
|
+
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "promenade"
|
7
7
|
spec.version = Promenade::VERSION
|
8
8
|
spec.authors = ["Ed Robinson"]
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = ">= 2.7"
|
25
|
+
spec.required_ruby_version = ">= 2.7"
|
26
26
|
|
27
27
|
spec.add_dependency "actionpack"
|
28
28
|
spec.add_dependency "activesupport", "> 6.0", "< 8.0"
|
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
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"
|
@@ -39,6 +38,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
39
38
|
spec.add_development_dependency "rubocop"
|
40
39
|
spec.add_development_dependency "rubocop-performance"
|
41
40
|
spec.add_development_dependency "rubocop-rails"
|
41
|
+
spec.add_development_dependency "rubocop-rspec"
|
42
42
|
spec.add_development_dependency "simplecov"
|
43
43
|
spec.metadata["rubygems_mfa_required"] = "true"
|
44
44
|
end
|
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.
|
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:
|
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
|
@@ -232,6 +218,20 @@ dependencies:
|
|
232
218
|
- - ">="
|
233
219
|
- !ruby/object:Gem::Version
|
234
220
|
version: '0'
|
221
|
+
- !ruby/object:Gem::Dependency
|
222
|
+
name: rubocop-rspec
|
223
|
+
requirement: !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
225
|
+
- - ">="
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
version: '0'
|
228
|
+
type: :development
|
229
|
+
prerelease: false
|
230
|
+
version_requirements: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
235
|
- !ruby/object:Gem::Dependency
|
236
236
|
name: simplecov
|
237
237
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/promenade/client/rack/http_request_queue_time_collector.rb
|
277
277
|
- lib/promenade/client/rack/middleware_base.rb
|
278
278
|
- lib/promenade/client/rack/queue_time_duration.rb
|
279
|
+
- lib/promenade/client/rack/request_controller_action_labeler.rb
|
279
280
|
- lib/promenade/client/rack/request_labeler.rb
|
280
281
|
- lib/promenade/client/rack/singleton_caller.rb
|
281
282
|
- lib/promenade/configuration.rb
|
@@ -306,16 +307,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
307
|
- - ">="
|
307
308
|
- !ruby/object:Gem::Version
|
308
309
|
version: '2.7'
|
309
|
-
- - "<"
|
310
|
-
- !ruby/object:Gem::Version
|
311
|
-
version: '3.2'
|
312
310
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
311
|
requirements:
|
314
312
|
- - ">="
|
315
313
|
- !ruby/object:Gem::Version
|
316
314
|
version: '0'
|
317
315
|
requirements: []
|
318
|
-
rubygems_version: 3.
|
316
|
+
rubygems_version: 3.4.6
|
319
317
|
signing_key:
|
320
318
|
specification_version: 4
|
321
319
|
summary: Promenade makes it simple to instrument Ruby apps for prometheus scraping
|