rorvswild 1.5.5 → 1.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/rorvswild/agent.rb +22 -4
- data/lib/rorvswild/client.rb +5 -1
- data/lib/rorvswild/local/middleware.rb +1 -0
- data/lib/rorvswild/local/stylesheet/local.css +53 -27
- data/lib/rorvswild/local/stylesheet/vendor/prism.css +2 -6
- data/lib/rorvswild/locator.rb +14 -15
- data/lib/rorvswild/plugin/action_controller.rb +13 -3
- data/lib/rorvswild/plugin/resque.rb +2 -0
- data/lib/rorvswild/queue.rb +1 -1
- data/lib/rorvswild/section.rb +8 -0
- data/lib/rorvswild/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1e098cc5c0d18dcb26f720fc2be0927cf5cd06dad63098f7fd81a7ddd5a552c
|
4
|
+
data.tar.gz: 44eec8c8b452579850a97ce36c1365f75259cf2d29b407b5fb25a239ba46d58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b869f3ebee5a12e17e75d90c4ed26a1dd212b5fe414b3214895e4746e173f2bc72ac397af315bc0cc7445e0a4346db9b1f98aab5c4fa4a821b4f66e7e038e1
|
7
|
+
data.tar.gz: bde1938595d5353f9fb686fa7c6955f55ee4d4349184e4574da0f85e434ff363d52041323be8a5452064b4887ad8c600f44cc7c9e7e28e77afc5f35f4ad9c72c
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/rorvswild.svg)](https://badge.fury.io/rb/rorvswild)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/2c4805cf658d7af794fe/maintainability)](https://codeclimate.com/github/BaseSecrete/rorvswild/maintainability)
|
6
6
|
|
7
|
-
<img align="right" src="
|
7
|
+
<img align="right" src="./images/rorvswild_logo.jpg">
|
8
8
|
|
9
9
|
*RoRvsWild* is a ruby gem to monitor performances and exceptions in Ruby on Rails applications.
|
10
10
|
|
@@ -21,7 +21,7 @@ It can also be used in your production and staging environments with an account
|
|
21
21
|
* Run `bundle install` in you terminal
|
22
22
|
* Restart your local server and you’ll see a small button in the bottom left corner of your page.
|
23
23
|
|
24
|
-
![RoRvsWild Local Button](
|
24
|
+
![RoRvsWild Local Button](./images/rorvswild_local_button.jpg)
|
25
25
|
|
26
26
|
This is all what you need to do to monitor your local environment requests.
|
27
27
|
|
@@ -47,9 +47,11 @@ RorVsWild.start(api_key: API_KEY)
|
|
47
47
|
|
48
48
|
You can create unlimited apps on *rorvswild.com*. If you want to monitor your staging environment, create a new app and edit your rorvswild.yml to add the API key.
|
49
49
|
|
50
|
+
In case there is no data in the dashboard, you can run in a rails console : `RorVsWild.check`.
|
51
|
+
|
50
52
|
## Development mode: *RoRvsWild Local*
|
51
53
|
|
52
|
-
![RoRvsWild Local](
|
54
|
+
![RoRvsWild Local](./images/rorvswild_local.jpg)
|
53
55
|
|
54
56
|
*RorVsWild Local* monitors the performances of requests in development environment.
|
55
57
|
It shows most of the requests performances insights *RoRvsWild.com* displays. **A big difference is everything works locally and no data is sent and recorded on our servers**. You don’t even need an account to use it.
|
@@ -69,7 +71,7 @@ If you are using `Rack::Deflater` middleware you won't see the small button in t
|
|
69
71
|
|
70
72
|
## Production mode: *RoRvsWild.com*
|
71
73
|
|
72
|
-
![RoRvsWild.com](
|
74
|
+
![RoRvsWild.com](./images/rorvswild_prod.jpg)
|
73
75
|
|
74
76
|
*RoRvsWild.com* makes it easy to monitor requests, background jobs and errors in your production and staging environment.
|
75
77
|
It also comes with some extra options listed below.
|
data/lib/rorvswild/agent.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require "logger"
|
2
|
+
require "socket"
|
3
|
+
require "etc"
|
2
4
|
|
3
5
|
module RorVsWild
|
4
6
|
class Agent
|
@@ -26,9 +28,9 @@ module RorVsWild
|
|
26
28
|
@config = self.class.default_config.merge(config)
|
27
29
|
@client = Client.new(@config)
|
28
30
|
@queue = config[:queue] || Queue.new(client)
|
29
|
-
@locator = RorVsWild::Locator.new
|
31
|
+
@locator = RorVsWild::Locator.new
|
30
32
|
|
31
|
-
RorVsWild.logger.
|
33
|
+
RorVsWild.logger.debug("Start RorVsWild #{RorVsWild::VERSION}")
|
32
34
|
setup_plugins
|
33
35
|
cleanup_data
|
34
36
|
end
|
@@ -37,7 +39,7 @@ module RorVsWild
|
|
37
39
|
for name in RorVsWild::Plugin.constants
|
38
40
|
next if config[:ignore_plugins] && config[:ignore_plugins].include?(name.to_s)
|
39
41
|
if (plugin = RorVsWild::Plugin.const_get(name)).respond_to?(:setup)
|
40
|
-
RorVsWild.logger.
|
42
|
+
RorVsWild.logger.debug("Setup RorVsWild::Plugin::#{name}")
|
41
43
|
plugin.setup
|
42
44
|
end
|
43
45
|
end
|
@@ -72,7 +74,7 @@ module RorVsWild
|
|
72
74
|
begin
|
73
75
|
block.call
|
74
76
|
rescue Exception => ex
|
75
|
-
push_exception(ex, parameters: parameters)
|
77
|
+
push_exception(ex, parameters: parameters, job: {name: name})
|
76
78
|
raise
|
77
79
|
ensure
|
78
80
|
current_data[:runtime] = RorVsWild.clock_milliseconds - current_data[:started_at]
|
@@ -105,6 +107,7 @@ module RorVsWild
|
|
105
107
|
|
106
108
|
def push_exception(exception, options = nil)
|
107
109
|
return if ignored_exception?(exception)
|
110
|
+
return unless current_data
|
108
111
|
current_data[:error] = exception_to_hash(exception)
|
109
112
|
current_data[:error].merge!(options) if options
|
110
113
|
current_data[:error]
|
@@ -168,11 +171,26 @@ module RorVsWild
|
|
168
171
|
backtrace: exception.backtrace || ["No backtrace"],
|
169
172
|
exception: exception.class.to_s,
|
170
173
|
extra_details: extra_details,
|
174
|
+
environment: {
|
175
|
+
os: os_description,
|
176
|
+
user: Etc.getlogin,
|
177
|
+
host: Socket.gethostname,
|
178
|
+
ruby: RUBY_DESCRIPTION,
|
179
|
+
pid: Process.pid,
|
180
|
+
cwd: Dir.pwd,
|
181
|
+
lib_paths: locator.lib_paths,
|
182
|
+
},
|
171
183
|
}
|
172
184
|
end
|
173
185
|
|
174
186
|
def ignored_exception?(exception)
|
175
187
|
(config[:ignored_exceptions] || config[:ignore_exceptions]).include?(exception.class.to_s)
|
176
188
|
end
|
189
|
+
|
190
|
+
def os_description
|
191
|
+
@os_description ||= `uname -a`
|
192
|
+
rescue Exception => ex
|
193
|
+
@os_description = RUBY_PLATFORM
|
194
|
+
end
|
177
195
|
end
|
178
196
|
end
|
data/lib/rorvswild/client.rb
CHANGED
@@ -21,7 +21,11 @@ module RorVsWild
|
|
21
21
|
@connection_count = 0
|
22
22
|
@mutex = Mutex.new
|
23
23
|
@config = config
|
24
|
-
@headers = {
|
24
|
+
@headers = {
|
25
|
+
"Content-Type" => "application/json",
|
26
|
+
"X-RorVsWild-Version" => RorVsWild::VERSION,
|
27
|
+
"X-Ruby-Version" => RUBY_VERSION,
|
28
|
+
}
|
25
29
|
@headers["X-Rails-Version"] = Rails.version if defined?(Rails)
|
26
30
|
end
|
27
31
|
|
@@ -26,6 +26,7 @@ module RorVsWild
|
|
26
26
|
|
27
27
|
def serve_embed_profiler(env)
|
28
28
|
status, headers, body = app.call(env)
|
29
|
+
status = status.to_i
|
29
30
|
if status >= 200 && status < 300 && headers["Content-Type"] && headers["Content-Type"].include?("text/html")
|
30
31
|
if headers["Content-Encoding"]
|
31
32
|
log_incompatible_middleware_warning
|
@@ -5,7 +5,7 @@
|
|
5
5
|
.rorvswild-local-toggler {
|
6
6
|
background: #1d242f !important;
|
7
7
|
color: #80abe3 !important;
|
8
|
-
box-shadow: 0 0 0 1px rgba(159, 169, 187, 0.3), 0 1px 4px 0px rgba(25, 32, 42, .9) !important;
|
8
|
+
box-shadow: 0 0 0 1px rgba(159, 169, 187, 0.3), 0 1px 4px 0px rgba(25, 32, 42, 0.9) !important;
|
9
9
|
border-radius: 4px !important;
|
10
10
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
11
11
|
font-size: 15px !important;
|
@@ -13,10 +13,11 @@
|
|
13
13
|
position: fixed !important;
|
14
14
|
bottom: 12px !important;
|
15
15
|
left: 12px !important;
|
16
|
-
padding:0 12px !important;
|
16
|
+
padding: 0 12px !important;
|
17
17
|
cursor: pointer !important;
|
18
18
|
z-index: 100000000000000003 !important;
|
19
19
|
}
|
20
|
+
|
20
21
|
.rorvswild-local-toggler small {
|
21
22
|
color: #9fa9bb !important;
|
22
23
|
font-size: 12px !important;
|
@@ -30,7 +31,7 @@
|
|
30
31
|
|
31
32
|
.rorvswild-local-panel {
|
32
33
|
background: #1d242f !important;
|
33
|
-
box-shadow: 0 0 0 48px rgba(25, 32, 42, .9) !important;
|
34
|
+
box-shadow: 0 0 0 48px rgba(25, 32, 42, 0.9) !important;
|
34
35
|
color: #eceef1 !important;
|
35
36
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
36
37
|
font-size: 15px !important;
|
@@ -84,6 +85,7 @@
|
|
84
85
|
display: -ms-flexbox;
|
85
86
|
display: flex;
|
86
87
|
}
|
88
|
+
|
87
89
|
.rorvswild-local-panel__header__title {
|
88
90
|
color: #9fa9bb !important;
|
89
91
|
text-transform: uppercase !important;
|
@@ -94,6 +96,7 @@
|
|
94
96
|
-ms-flex: 1;
|
95
97
|
flex: 1;
|
96
98
|
}
|
99
|
+
|
97
100
|
.rorvswild-local-panel svg {
|
98
101
|
height: 24px !important;
|
99
102
|
width: 24px !important;
|
@@ -104,12 +107,15 @@
|
|
104
107
|
stroke-miterlimit: 10 !important;
|
105
108
|
vertical-align: middle !important;
|
106
109
|
}
|
110
|
+
|
107
111
|
.rorvswild-local-panel svg:hover {
|
108
112
|
stroke: #eceef1 !important;
|
109
113
|
}
|
114
|
+
|
110
115
|
.rorvswild-local-panel__logo {
|
111
116
|
width: 60px !important;
|
112
117
|
}
|
118
|
+
|
113
119
|
.rorvswild-local-panel__header__icons {
|
114
120
|
width: 60px !important;
|
115
121
|
display: -webkit-box !important;
|
@@ -119,14 +125,17 @@
|
|
119
125
|
-ms-flex-pack: end !important;
|
120
126
|
justify-content: flex-end !important;
|
121
127
|
}
|
128
|
+
|
122
129
|
.rorvswild-local-panel__close {
|
123
130
|
cursor: pointer !important;
|
124
131
|
margin-left: 12px !important;
|
125
132
|
}
|
133
|
+
|
126
134
|
.rorvswild-local-panel__github svg {
|
127
135
|
stroke: none !important;
|
128
136
|
fill: #9fa9bb !important;
|
129
137
|
}
|
138
|
+
|
130
139
|
.rorvswild-local-panel__github svg:hover {
|
131
140
|
stroke: none !important;
|
132
141
|
fill: #eceef1 !important;
|
@@ -136,17 +145,21 @@
|
|
136
145
|
|
137
146
|
.rorvswild-local-panel__content {
|
138
147
|
-webkit-box-flex: 1 !important;
|
139
|
-
|
140
|
-
|
148
|
+
-ms-flex: 1 !important;
|
149
|
+
flex: 1 !important;
|
141
150
|
height: calc(100% - 48px) !important;
|
142
151
|
overflow-x: auto !important;
|
143
152
|
}
|
153
|
+
|
144
154
|
.rorvswild-local-panel__content::-webkit-scrollbar { width: 3px !important; }
|
155
|
+
|
145
156
|
.rorvswild-local-panel__content::-webkit-scrollbar-corner { background: transparent !important; }
|
157
|
+
|
146
158
|
.rorvswild-local-panel__content::-webkit-scrollbar-track {
|
147
|
-
box-shadow: inset 0 0 0 rgba(0,0,0,0.3) !important;
|
159
|
+
box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.3) !important;
|
148
160
|
background: transparent !important;
|
149
161
|
}
|
162
|
+
|
150
163
|
.rorvswild-local-panel__content::-webkit-scrollbar-thumb {
|
151
164
|
background-color: #9fa9bb !important;
|
152
165
|
outline: 1px solid #9fa9bb !important;
|
@@ -162,18 +175,22 @@
|
|
162
175
|
border-bottom: 1px solid rgba(25, 32, 42, 1) !important;
|
163
176
|
cursor: pointer !important;
|
164
177
|
-ms-flex-wrap: wrap !important;
|
165
|
-
|
178
|
+
flex-wrap: wrap !important;
|
166
179
|
}
|
180
|
+
|
167
181
|
.rorvswild-local-panel__request:hover { background: #222835 !important; }
|
182
|
+
|
168
183
|
.rorvswild-local-panel__request__name {
|
169
184
|
word-break: break-all !important;
|
170
185
|
overflow-wrap: break-word !important;
|
171
186
|
width: 100% !important;
|
172
187
|
}
|
188
|
+
|
173
189
|
.rorvswild-local-panel__request__path {
|
174
190
|
color: #9fa9bb !important;
|
175
191
|
display: block !important;
|
176
192
|
}
|
193
|
+
|
177
194
|
.rorvswild-local-panel__request__started-at {
|
178
195
|
color: #9fa9bb !important;
|
179
196
|
margin-left: 12px !important;
|
@@ -187,6 +204,7 @@
|
|
187
204
|
cursor: pointer !important;
|
188
205
|
display: block !important;
|
189
206
|
}
|
207
|
+
|
190
208
|
.rorvswild-local-panel__request-details__request {
|
191
209
|
display: -webkit-box !important;
|
192
210
|
display: -ms-flexbox !important;
|
@@ -194,8 +212,9 @@
|
|
194
212
|
margin-bottom: 48px !important;
|
195
213
|
padding: 12px 12px 0 !important;
|
196
214
|
-ms-flex-wrap: wrap !important;
|
197
|
-
|
215
|
+
flex-wrap: wrap !important;
|
198
216
|
}
|
217
|
+
|
199
218
|
h2.rorvswild-local-panel__request__name__title {
|
200
219
|
margin:-18px 0 0 !important;
|
201
220
|
padding:0 !important;
|
@@ -213,6 +232,7 @@ h2.rorvswild-local-panel__request__name__title {
|
|
213
232
|
border-bottom: 1px solid rgba(25, 32, 42, 1) !important;
|
214
233
|
display: block !important;
|
215
234
|
}
|
235
|
+
|
216
236
|
.rorvswild-local-panel__request-details__section:hover {
|
217
237
|
background: #212834 !important;
|
218
238
|
-webkit-transition: all .3s !important;
|
@@ -227,31 +247,37 @@ h2.rorvswild-local-panel__request__name__title {
|
|
227
247
|
-ms-flex-wrap: wrap !important;
|
228
248
|
flex-wrap: wrap !important;
|
229
249
|
}
|
250
|
+
|
230
251
|
.rorvswild-local-panel__request-details__section__file {
|
231
252
|
width: 100% !important;
|
232
253
|
word-break: break-all !important;
|
233
254
|
overflow-wrap: break-word !important;
|
234
255
|
min-width: 0 !important;
|
235
256
|
}
|
257
|
+
|
236
258
|
.rorvswild-local-panel__request-details__section__average {
|
237
259
|
color: #80abe3 !important;
|
238
260
|
width: 48px !important;
|
239
261
|
margin:0 12px 0 0 !important;
|
240
262
|
}
|
263
|
+
|
241
264
|
.rorvswild-local-panel__request-details__section__calls {
|
242
265
|
color: #9fa9bb !important;
|
243
266
|
width: 48px !important;
|
244
|
-
margin:0 12px 0 0 !important;
|
267
|
+
margin: 0 12px 0 0 !important;
|
245
268
|
}
|
269
|
+
|
246
270
|
.rorvswild-local-panel__request-details__section__impact {
|
247
271
|
width: 48px !important;
|
248
|
-
margin:0 12px 0 0 !important;
|
272
|
+
margin: 0 12px 0 0 !important;
|
249
273
|
}
|
274
|
+
|
250
275
|
.rorvswild-local-panel__request-details__section__code {
|
251
276
|
display: -webkit-box !important;
|
252
277
|
display: -ms-flexbox !important;
|
253
278
|
display: flex !important;
|
254
279
|
}
|
280
|
+
|
255
281
|
.rorvswild-local-panel__request-details__section__kind {
|
256
282
|
background: rgba(25, 32, 42, 1) !important;
|
257
283
|
font-size: 10px !important;
|
@@ -262,18 +288,15 @@ h2.rorvswild-local-panel__request__name__title {
|
|
262
288
|
height: 24px !important;
|
263
289
|
display: inline-block !important;
|
264
290
|
}
|
291
|
+
|
265
292
|
.rorvswild-local-panel__request-details__section__command {
|
266
|
-
overflow: hidden !important;
|
267
293
|
color: #9fa9bb !important;
|
268
|
-
margin-left: 12px !important;
|
269
294
|
-webkit-box-flex: 1 !important;
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
.rorvswild-local-panel__request-details__section:hover .rorvswild-local-panel__request-details__section__command {
|
276
|
-
opacity: 1 !important;
|
295
|
+
-ms-flex: 1 !important;
|
296
|
+
flex: 1 !important;
|
297
|
+
margin-left: 12px !important;
|
298
|
+
opacity: 1;
|
299
|
+
overflow: hidden !important;
|
277
300
|
}
|
278
301
|
|
279
302
|
/* Panel Footer */
|
@@ -285,6 +308,7 @@ h2.rorvswild-local-panel__request__name__title {
|
|
285
308
|
padding: 12px !important;
|
286
309
|
text-align: center !important;
|
287
310
|
}
|
311
|
+
|
288
312
|
a.rorvswild-local-panel__footer__link {
|
289
313
|
color: #eceef1 !important;
|
290
314
|
text-decoration: underline !important;
|
@@ -296,33 +320,35 @@ a.rorvswild-local-panel__footer__link {
|
|
296
320
|
@media screen and (min-width: 720px) {
|
297
321
|
.rorvswild-local-panel__request-details__section__main {
|
298
322
|
-ms-flex-wrap: nowrap !important;
|
299
|
-
|
323
|
+
flex-wrap: nowrap !important;
|
300
324
|
}
|
301
325
|
|
302
326
|
.rorvswild-local-panel__request__name {
|
303
327
|
-webkit-box-flex: 1 !important;
|
304
|
-
|
305
|
-
|
328
|
+
-ms-flex: 1 !important;
|
329
|
+
flex: 1 !important;
|
306
330
|
}
|
307
331
|
|
308
332
|
.rorvswild-local-panel__request__runtime { margin-left: 12px !important; }
|
309
333
|
|
310
334
|
.rorvswild-local-panel__request-details__section__file {
|
311
335
|
-webkit-box-flex: 1 !important;
|
312
|
-
|
313
|
-
|
336
|
+
-ms-flex: 1 !important;
|
337
|
+
flex: 1 !important;
|
314
338
|
}
|
315
339
|
|
316
340
|
.rorvswild-local-panel__request-details__section__average {
|
317
341
|
text-align: right !important;
|
318
|
-
margin:0 0 0 12px !important;
|
342
|
+
margin: 0 0 0 12px !important;
|
319
343
|
}
|
344
|
+
|
320
345
|
.rorvswild-local-panel__request-details__section__calls {
|
321
346
|
text-align: right !important;
|
322
|
-
margin:0 0 0 12px !important;
|
347
|
+
margin: 0 0 0 12px !important;
|
323
348
|
}
|
349
|
+
|
324
350
|
.rorvswild-local-panel__request-details__section__impact {
|
325
351
|
text-align: right !important;
|
326
|
-
margin:0 0 0 12px !important;
|
352
|
+
margin: 0 0 0 12px !important;
|
327
353
|
}
|
328
354
|
}
|
@@ -25,9 +25,6 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
25
25
|
-ms-hyphens: none !important;
|
26
26
|
hyphens: none !important;
|
27
27
|
|
28
|
-
-webkit-filter: saturate(75%) !important; /* Safari 6.0 - 9.0 */
|
29
|
-
filter: saturate(75%) !important;
|
30
|
-
|
31
28
|
border-radius: 0 !important;
|
32
29
|
border: 0 !important;
|
33
30
|
box-shadow: 0 0 0 !important;
|
@@ -40,7 +37,6 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
40
37
|
background: transparent !important;
|
41
38
|
}
|
42
39
|
|
43
|
-
|
44
40
|
/* Text Selection colour */
|
45
41
|
.rorvswild-local-panel pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
46
42
|
.rorvswild-local-panel code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
@@ -66,7 +62,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
66
62
|
.rorvswild-local-panel .token.cdata {
|
67
63
|
color: #9fa9bb !important;
|
68
64
|
font-style: italic !important;
|
69
|
-
opacity: 0.
|
65
|
+
opacity: 0.7 !important;
|
70
66
|
}
|
71
67
|
|
72
68
|
.rorvswild-local-panel .token.punctuation {
|
@@ -89,7 +85,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
89
85
|
.rorvswild-local-panel .token.symbol,
|
90
86
|
.rorvswild-local-panel .token.builtin,
|
91
87
|
.rorvswild-local-panel .token.string {
|
92
|
-
color: #
|
88
|
+
color: #69b3c8 !important;
|
93
89
|
}
|
94
90
|
|
95
91
|
.rorvswild-local-panel .token.attr-name,
|
data/lib/rorvswild/locator.rb
CHANGED
@@ -2,8 +2,8 @@ module RorVsWild
|
|
2
2
|
class Locator
|
3
3
|
attr_reader :current_path
|
4
4
|
|
5
|
-
def initialize(current_path =
|
6
|
-
@current_path = current_path
|
5
|
+
def initialize(current_path = Dir.pwd)
|
6
|
+
@current_path = File.join(current_path, "")
|
7
7
|
end
|
8
8
|
|
9
9
|
def find_most_relevant_file_and_line(locations)
|
@@ -12,7 +12,7 @@ module RorVsWild
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_most_relevant_location(locations)
|
15
|
-
locations.find { |l| relevant_path?(l.path) } || locations.find { |l| !
|
15
|
+
locations.find { |l| relevant_path?(l.path) } || locations.find { |l| !l.path.start_with?(rorvswild_lib_path) } || locations.first
|
16
16
|
end
|
17
17
|
|
18
18
|
def find_most_relevant_file_and_line_from_exception(exception)
|
@@ -29,7 +29,7 @@ module RorVsWild
|
|
29
29
|
|
30
30
|
def find_most_relevant_file_and_line_from_array_of_strings(stack)
|
31
31
|
location = stack.find { |str| relevant_path?(str) }
|
32
|
-
location ||= stack.find { |str| !
|
32
|
+
location ||= stack.find { |str| !str.start_with?(rorvswild_lib_path) }
|
33
33
|
relative_path(location || stack.first).split(":".freeze)
|
34
34
|
end
|
35
35
|
|
@@ -42,26 +42,25 @@ module RorVsWild
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def irrelevant_path?(path)
|
45
|
-
path.start_with?(*
|
45
|
+
path.start_with?(*lib_paths)
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
@
|
48
|
+
def lib_paths
|
49
|
+
@lib_paths ||= initialize_lib_paths
|
50
|
+
end
|
51
|
+
|
52
|
+
def rorvswild_lib_path
|
53
|
+
@rorvswild_lib_path ||= File.dirname(File.expand_path(__FILE__))
|
50
54
|
end
|
51
55
|
|
52
56
|
private
|
53
57
|
|
54
|
-
def
|
55
|
-
array = ["
|
58
|
+
def initialize_lib_paths
|
59
|
+
array = [RbConfig::CONFIG["rubylibprefix"]] + Gem.default_path + Gem.path
|
60
|
+
array += ["RUBYLIB", "GEM_HOME", "GEM_PATH", "BUNDLER_ORIG_GEM_PATH"].flat_map do |name|
|
56
61
|
ENV[name].split(":".freeze) if ENV[name]
|
57
62
|
end
|
58
|
-
array += [heroku_ruby_lib_path] if File.exists?(heroku_ruby_lib_path)
|
59
|
-
array += Gem.path
|
60
63
|
array.compact.uniq
|
61
64
|
end
|
62
|
-
|
63
|
-
def heroku_ruby_lib_path
|
64
|
-
"/app/vendor/ruby-#{RUBY_VERSION}/lib"
|
65
|
-
end
|
66
65
|
end
|
67
66
|
end
|
@@ -6,6 +6,11 @@ module RorVsWild
|
|
6
6
|
return unless defined?(::ActionController::Base)
|
7
7
|
::ActionController::Base.around_action(&method(:around_action))
|
8
8
|
::ActionController::Base.rescue_from(StandardError) { |ex| RorVsWild::Plugin::ActionController.after_exception(ex, self) }
|
9
|
+
|
10
|
+
if defined?(::ActionController::API) && ::ActionController::API.respond_to?(:around_action)
|
11
|
+
::ActionController::API.around_action(&method(:around_action))
|
12
|
+
::ActionController::API.rescue_from(StandardError) { |ex| RorVsWild::Plugin::ActionController.after_exception(ex, self) }
|
13
|
+
end
|
9
14
|
@installed = true
|
10
15
|
end
|
11
16
|
|
@@ -14,11 +19,11 @@ module RorVsWild
|
|
14
19
|
return block.call if RorVsWild.agent.ignored_request?(controller_action)
|
15
20
|
begin
|
16
21
|
RorVsWild::Section.start do |section|
|
17
|
-
method_name = controller.method_for_action
|
22
|
+
method_name = controller.send(:method_for_action, controller.action_name)
|
18
23
|
section.file, section.line = controller.method(method_name).source_location
|
19
24
|
section.file = RorVsWild.agent.locator.relative_path(section.file)
|
20
25
|
section.command = "#{controller.class}##{method_name}"
|
21
|
-
RorVsWild.agent.current_data[:name] = controller_action
|
26
|
+
RorVsWild.agent.current_data[:name] = controller_action if RorVsWild.agent.current_data
|
22
27
|
end
|
23
28
|
block.call
|
24
29
|
ensure
|
@@ -30,7 +35,12 @@ module RorVsWild
|
|
30
35
|
if hash = RorVsWild.agent.push_exception(exception)
|
31
36
|
hash[:session] = controller.session.to_hash
|
32
37
|
hash[:parameters] = controller.request.filtered_parameters
|
33
|
-
hash[:
|
38
|
+
hash[:request] = {
|
39
|
+
headers: extract_http_headers(controller.request.filtered_env),
|
40
|
+
name: "#{controller.class}##{controller.action_name}",
|
41
|
+
method: controller.request.method,
|
42
|
+
url: controller.request.url,
|
43
|
+
}
|
34
44
|
end
|
35
45
|
raise exception
|
36
46
|
end
|
data/lib/rorvswild/queue.rb
CHANGED
data/lib/rorvswild/section.rb
CHANGED
@@ -66,5 +66,13 @@ module RorVsWild
|
|
66
66
|
def command=(value)
|
67
67
|
@command = value && value.size > COMMAND_MAX_SIZE ? value[0, COMMAND_MAX_SIZE] + " [TRUNCATED]" : value
|
68
68
|
end
|
69
|
+
|
70
|
+
def to_h
|
71
|
+
{calls: calls, total_runtime: total_runtime, children_runtime: children_runtime, kind: kind, started_at: started_at, file: file, line: line, command: command}
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_json(options = {})
|
75
|
+
to_h.to_json(options)
|
76
|
+
end
|
69
77
|
end
|
70
78
|
end
|
data/lib/rorvswild/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorvswild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
8
|
+
- Antoine Marguerie
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-03-30 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
|
-
description: Performances and
|
14
|
+
description: Performances and errors insights for rails developers.
|
14
15
|
email:
|
15
16
|
- alexis@bernard.io
|
17
|
+
- antoine@basesecrete.com
|
16
18
|
executables:
|
17
19
|
- rorvswild-install
|
18
20
|
extensions: []
|
@@ -79,5 +81,5 @@ requirements: []
|
|
79
81
|
rubygems_version: 3.0.3
|
80
82
|
signing_key:
|
81
83
|
specification_version: 4
|
82
|
-
summary: Ruby on Rails
|
84
|
+
summary: Ruby on Rails applications monitoring
|
83
85
|
test_files: []
|