rorvswild 1.5.6 → 1.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -4
- data/lib/rorvswild/agent.rb +22 -4
- data/lib/rorvswild/client.rb +5 -1
- data/lib/rorvswild/local.rb +2 -2
- data/lib/rorvswild/local/{local.html → local.html.erb} +1 -1
- data/lib/rorvswild/local/middleware.rb +8 -1
- data/lib/rorvswild/local/stylesheet/local.css +77 -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 +12 -4
- data/lib/rorvswild/plugin/resque.rb +2 -0
- data/lib/rorvswild/queue.rb +1 -1
- data/lib/rorvswild/rails_loader.rb +9 -10
- data/lib/rorvswild/section.rb +8 -0
- data/lib/rorvswild/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35897aa29faf0bcc0fe63db30ef4e837ce9a29fea2527b830bdd81c22f28b3b5
|
4
|
+
data.tar.gz: 8c2f951e47e9a4834ed97068651077d5672b2cc909799c240ab41e4eb7f6145d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94a20f60b6967ded361bc37a695fe9cef4f2b79d5d63d7a4ff658189eadd351dd9e587a25950bb9fe2a3dd353a55dbf9b095cdd96ba43a276796abad589e2cb
|
7
|
+
data.tar.gz: f89fb8baf1d6db2d7d1d6af631740423402df53112c60474061fd1514744bc727f79cd4e8c07c7ddd3a98ea236723b74cffcf175593f829b022e7ac442ce4e45
|
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,15 +47,31 @@ 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.
|
56
58
|
|
57
59
|
*RoRvsWild Local* renders a small button in the bottom left corner of your page showing the runtime of the current request. If you click on it, you get all the profiled sections ordered by impact, which is depending on the sections average runtime and the calls count. As on RoRvsWild.com, the bottleneck is always on the top of the list.
|
58
60
|
|
61
|
+
Sometimes the widget displayed in the bottom left corner can be annoying depending on your site layout. You can change its position like in the example below with the `widget` option :
|
62
|
+
|
63
|
+
|
64
|
+
```yaml
|
65
|
+
# config/rorvswild.yml
|
66
|
+
|
67
|
+
development:
|
68
|
+
widget: top-right # Default is bottom-left
|
69
|
+
# All possition values :
|
70
|
+
# top-left, top-right, bottom-right, bottom-left, hidden
|
71
|
+
```
|
72
|
+
|
73
|
+
If you choose to hide the widget, you can still see request profilings via the following URL http://localhost:3000/rorvswild.
|
74
|
+
|
59
75
|
Be aware that the performances on your development machine may vary from the production server. Obviously because of the different hardware and database size. Also, Rails is reloading all the code in development environment and this takes quite a lot of time.
|
60
76
|
To prevent this behaviour and better match the production, turn on cache_classes in your config/environments/development.rb:
|
61
77
|
|
@@ -69,7 +85,7 @@ If you are using `Rack::Deflater` middleware you won't see the small button in t
|
|
69
85
|
|
70
86
|
## Production mode: *RoRvsWild.com*
|
71
87
|
|
72
|
-
![RoRvsWild.com](
|
88
|
+
![RoRvsWild.com](./images/rorvswild_prod.jpg)
|
73
89
|
|
74
90
|
*RoRvsWild.com* makes it easy to monitor requests, background jobs and errors in your production and staging environment.
|
75
91
|
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
|
|
data/lib/rorvswild/local.rb
CHANGED
@@ -3,9 +3,9 @@ require "rorvswild/local/queue"
|
|
3
3
|
|
4
4
|
module RorVsWild
|
5
5
|
module Local
|
6
|
-
def self.start
|
6
|
+
def self.start(config = {})
|
7
7
|
Rails.application.config.middleware.unshift(RorVsWild::Local::Middleware, nil)
|
8
|
-
RorVsWild.start(queue: RorVsWild::Local::Queue.new)
|
8
|
+
RorVsWild.start(config.merge(queue: RorVsWild::Local::Queue.new))
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -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
|
@@ -55,9 +56,15 @@ module RorVsWild
|
|
55
56
|
|
56
57
|
private
|
57
58
|
|
59
|
+
def widget_css
|
60
|
+
config = RorVsWild.agent.config
|
61
|
+
config && config[:widget] && "is-#{config[:widget]}"
|
62
|
+
end
|
63
|
+
|
58
64
|
def inject_into(html)
|
59
65
|
if index = html.index("</body>")
|
60
|
-
markup = File.read(File.join(LOCAL_FOLDER, "local.html"))
|
66
|
+
markup = File.read(File.join(LOCAL_FOLDER, "local.html.erb"))
|
67
|
+
markup = ERB.new(markup).result(binding)
|
61
68
|
markup = markup.html_safe if markup.respond_to?(:html_safe)
|
62
69
|
html.insert(index, markup)
|
63
70
|
end
|
@@ -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;
|
@@ -24,13 +25,37 @@
|
|
24
25
|
display: inline-block !important;
|
25
26
|
}
|
26
27
|
|
28
|
+
/************* TOGGLER POSITION OPTION(default bottom-left)**********************/
|
29
|
+
|
30
|
+
.is-top-right .rorvswild-local-toggler {
|
31
|
+
bottom: auto !important;
|
32
|
+
left: auto !important;
|
33
|
+
right: 12px !important;
|
34
|
+
top: 12px !important;
|
35
|
+
}
|
36
|
+
|
37
|
+
.is-top-left .rorvswild-local-toggler {
|
38
|
+
bottom: auto !important;
|
39
|
+
top: 12px !important;
|
40
|
+
}
|
41
|
+
|
42
|
+
.is-bottom-right .rorvswild-local-toggler {
|
43
|
+
bottom: 12px !important;
|
44
|
+
left: auto !important;
|
45
|
+
right: 12px !important;
|
46
|
+
}
|
47
|
+
|
48
|
+
.is-hidden .rorvswild-local-toggler {
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
|
27
52
|
/********************************************/
|
28
53
|
/*************** PANEL **********************/
|
29
54
|
/********************************************/
|
30
55
|
|
31
56
|
.rorvswild-local-panel {
|
32
57
|
background: #1d242f !important;
|
33
|
-
box-shadow: 0 0 0 48px rgba(25, 32, 42, .9) !important;
|
58
|
+
box-shadow: 0 0 0 48px rgba(25, 32, 42, 0.9) !important;
|
34
59
|
color: #eceef1 !important;
|
35
60
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
36
61
|
font-size: 15px !important;
|
@@ -84,6 +109,7 @@
|
|
84
109
|
display: -ms-flexbox;
|
85
110
|
display: flex;
|
86
111
|
}
|
112
|
+
|
87
113
|
.rorvswild-local-panel__header__title {
|
88
114
|
color: #9fa9bb !important;
|
89
115
|
text-transform: uppercase !important;
|
@@ -94,6 +120,7 @@
|
|
94
120
|
-ms-flex: 1;
|
95
121
|
flex: 1;
|
96
122
|
}
|
123
|
+
|
97
124
|
.rorvswild-local-panel svg {
|
98
125
|
height: 24px !important;
|
99
126
|
width: 24px !important;
|
@@ -104,12 +131,15 @@
|
|
104
131
|
stroke-miterlimit: 10 !important;
|
105
132
|
vertical-align: middle !important;
|
106
133
|
}
|
134
|
+
|
107
135
|
.rorvswild-local-panel svg:hover {
|
108
136
|
stroke: #eceef1 !important;
|
109
137
|
}
|
138
|
+
|
110
139
|
.rorvswild-local-panel__logo {
|
111
140
|
width: 60px !important;
|
112
141
|
}
|
142
|
+
|
113
143
|
.rorvswild-local-panel__header__icons {
|
114
144
|
width: 60px !important;
|
115
145
|
display: -webkit-box !important;
|
@@ -119,14 +149,17 @@
|
|
119
149
|
-ms-flex-pack: end !important;
|
120
150
|
justify-content: flex-end !important;
|
121
151
|
}
|
152
|
+
|
122
153
|
.rorvswild-local-panel__close {
|
123
154
|
cursor: pointer !important;
|
124
155
|
margin-left: 12px !important;
|
125
156
|
}
|
157
|
+
|
126
158
|
.rorvswild-local-panel__github svg {
|
127
159
|
stroke: none !important;
|
128
160
|
fill: #9fa9bb !important;
|
129
161
|
}
|
162
|
+
|
130
163
|
.rorvswild-local-panel__github svg:hover {
|
131
164
|
stroke: none !important;
|
132
165
|
fill: #eceef1 !important;
|
@@ -136,17 +169,21 @@
|
|
136
169
|
|
137
170
|
.rorvswild-local-panel__content {
|
138
171
|
-webkit-box-flex: 1 !important;
|
139
|
-
|
140
|
-
|
172
|
+
-ms-flex: 1 !important;
|
173
|
+
flex: 1 !important;
|
141
174
|
height: calc(100% - 48px) !important;
|
142
175
|
overflow-x: auto !important;
|
143
176
|
}
|
177
|
+
|
144
178
|
.rorvswild-local-panel__content::-webkit-scrollbar { width: 3px !important; }
|
179
|
+
|
145
180
|
.rorvswild-local-panel__content::-webkit-scrollbar-corner { background: transparent !important; }
|
181
|
+
|
146
182
|
.rorvswild-local-panel__content::-webkit-scrollbar-track {
|
147
|
-
box-shadow: inset 0 0 0 rgba(0,0,0,0.3) !important;
|
183
|
+
box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.3) !important;
|
148
184
|
background: transparent !important;
|
149
185
|
}
|
186
|
+
|
150
187
|
.rorvswild-local-panel__content::-webkit-scrollbar-thumb {
|
151
188
|
background-color: #9fa9bb !important;
|
152
189
|
outline: 1px solid #9fa9bb !important;
|
@@ -162,18 +199,22 @@
|
|
162
199
|
border-bottom: 1px solid rgba(25, 32, 42, 1) !important;
|
163
200
|
cursor: pointer !important;
|
164
201
|
-ms-flex-wrap: wrap !important;
|
165
|
-
|
202
|
+
flex-wrap: wrap !important;
|
166
203
|
}
|
204
|
+
|
167
205
|
.rorvswild-local-panel__request:hover { background: #222835 !important; }
|
206
|
+
|
168
207
|
.rorvswild-local-panel__request__name {
|
169
208
|
word-break: break-all !important;
|
170
209
|
overflow-wrap: break-word !important;
|
171
210
|
width: 100% !important;
|
172
211
|
}
|
212
|
+
|
173
213
|
.rorvswild-local-panel__request__path {
|
174
214
|
color: #9fa9bb !important;
|
175
215
|
display: block !important;
|
176
216
|
}
|
217
|
+
|
177
218
|
.rorvswild-local-panel__request__started-at {
|
178
219
|
color: #9fa9bb !important;
|
179
220
|
margin-left: 12px !important;
|
@@ -187,6 +228,7 @@
|
|
187
228
|
cursor: pointer !important;
|
188
229
|
display: block !important;
|
189
230
|
}
|
231
|
+
|
190
232
|
.rorvswild-local-panel__request-details__request {
|
191
233
|
display: -webkit-box !important;
|
192
234
|
display: -ms-flexbox !important;
|
@@ -194,8 +236,9 @@
|
|
194
236
|
margin-bottom: 48px !important;
|
195
237
|
padding: 12px 12px 0 !important;
|
196
238
|
-ms-flex-wrap: wrap !important;
|
197
|
-
|
239
|
+
flex-wrap: wrap !important;
|
198
240
|
}
|
241
|
+
|
199
242
|
h2.rorvswild-local-panel__request__name__title {
|
200
243
|
margin:-18px 0 0 !important;
|
201
244
|
padding:0 !important;
|
@@ -213,6 +256,7 @@ h2.rorvswild-local-panel__request__name__title {
|
|
213
256
|
border-bottom: 1px solid rgba(25, 32, 42, 1) !important;
|
214
257
|
display: block !important;
|
215
258
|
}
|
259
|
+
|
216
260
|
.rorvswild-local-panel__request-details__section:hover {
|
217
261
|
background: #212834 !important;
|
218
262
|
-webkit-transition: all .3s !important;
|
@@ -227,31 +271,37 @@ h2.rorvswild-local-panel__request__name__title {
|
|
227
271
|
-ms-flex-wrap: wrap !important;
|
228
272
|
flex-wrap: wrap !important;
|
229
273
|
}
|
274
|
+
|
230
275
|
.rorvswild-local-panel__request-details__section__file {
|
231
276
|
width: 100% !important;
|
232
277
|
word-break: break-all !important;
|
233
278
|
overflow-wrap: break-word !important;
|
234
279
|
min-width: 0 !important;
|
235
280
|
}
|
281
|
+
|
236
282
|
.rorvswild-local-panel__request-details__section__average {
|
237
283
|
color: #80abe3 !important;
|
238
284
|
width: 48px !important;
|
239
285
|
margin:0 12px 0 0 !important;
|
240
286
|
}
|
287
|
+
|
241
288
|
.rorvswild-local-panel__request-details__section__calls {
|
242
289
|
color: #9fa9bb !important;
|
243
290
|
width: 48px !important;
|
244
|
-
margin:0 12px 0 0 !important;
|
291
|
+
margin: 0 12px 0 0 !important;
|
245
292
|
}
|
293
|
+
|
246
294
|
.rorvswild-local-panel__request-details__section__impact {
|
247
295
|
width: 48px !important;
|
248
|
-
margin:0 12px 0 0 !important;
|
296
|
+
margin: 0 12px 0 0 !important;
|
249
297
|
}
|
298
|
+
|
250
299
|
.rorvswild-local-panel__request-details__section__code {
|
251
300
|
display: -webkit-box !important;
|
252
301
|
display: -ms-flexbox !important;
|
253
302
|
display: flex !important;
|
254
303
|
}
|
304
|
+
|
255
305
|
.rorvswild-local-panel__request-details__section__kind {
|
256
306
|
background: rgba(25, 32, 42, 1) !important;
|
257
307
|
font-size: 10px !important;
|
@@ -262,18 +312,15 @@ h2.rorvswild-local-panel__request__name__title {
|
|
262
312
|
height: 24px !important;
|
263
313
|
display: inline-block !important;
|
264
314
|
}
|
315
|
+
|
265
316
|
.rorvswild-local-panel__request-details__section__command {
|
266
|
-
overflow: hidden !important;
|
267
317
|
color: #9fa9bb !important;
|
268
|
-
margin-left: 12px !important;
|
269
318
|
-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;
|
319
|
+
-ms-flex: 1 !important;
|
320
|
+
flex: 1 !important;
|
321
|
+
margin-left: 12px !important;
|
322
|
+
opacity: 1;
|
323
|
+
overflow: hidden !important;
|
277
324
|
}
|
278
325
|
|
279
326
|
/* Panel Footer */
|
@@ -285,6 +332,7 @@ h2.rorvswild-local-panel__request__name__title {
|
|
285
332
|
padding: 12px !important;
|
286
333
|
text-align: center !important;
|
287
334
|
}
|
335
|
+
|
288
336
|
a.rorvswild-local-panel__footer__link {
|
289
337
|
color: #eceef1 !important;
|
290
338
|
text-decoration: underline !important;
|
@@ -296,33 +344,35 @@ a.rorvswild-local-panel__footer__link {
|
|
296
344
|
@media screen and (min-width: 720px) {
|
297
345
|
.rorvswild-local-panel__request-details__section__main {
|
298
346
|
-ms-flex-wrap: nowrap !important;
|
299
|
-
|
347
|
+
flex-wrap: nowrap !important;
|
300
348
|
}
|
301
349
|
|
302
350
|
.rorvswild-local-panel__request__name {
|
303
351
|
-webkit-box-flex: 1 !important;
|
304
|
-
|
305
|
-
|
352
|
+
-ms-flex: 1 !important;
|
353
|
+
flex: 1 !important;
|
306
354
|
}
|
307
355
|
|
308
356
|
.rorvswild-local-panel__request__runtime { margin-left: 12px !important; }
|
309
357
|
|
310
358
|
.rorvswild-local-panel__request-details__section__file {
|
311
359
|
-webkit-box-flex: 1 !important;
|
312
|
-
|
313
|
-
|
360
|
+
-ms-flex: 1 !important;
|
361
|
+
flex: 1 !important;
|
314
362
|
}
|
315
363
|
|
316
364
|
.rorvswild-local-panel__request-details__section__average {
|
317
365
|
text-align: right !important;
|
318
|
-
margin:0 0 0 12px !important;
|
366
|
+
margin: 0 0 0 12px !important;
|
319
367
|
}
|
368
|
+
|
320
369
|
.rorvswild-local-panel__request-details__section__calls {
|
321
370
|
text-align: right !important;
|
322
|
-
margin:0 0 0 12px !important;
|
371
|
+
margin: 0 0 0 12px !important;
|
323
372
|
}
|
373
|
+
|
324
374
|
.rorvswild-local-panel__request-details__section__impact {
|
325
375
|
text-align: right !important;
|
326
|
-
margin:0 0 0 12px !important;
|
376
|
+
margin: 0 0 0 12px !important;
|
327
377
|
}
|
328
378
|
}
|
@@ -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
|
@@ -4,10 +4,13 @@ module RorVsWild
|
|
4
4
|
def self.setup
|
5
5
|
return if @installed
|
6
6
|
return unless defined?(::ActionController::Base)
|
7
|
-
::ActionController::API.around_action(&method(:around_action))
|
8
7
|
::ActionController::Base.around_action(&method(:around_action))
|
9
|
-
::ActionController::API.rescue_from(StandardError) { |ex| RorVsWild::Plugin::ActionController.after_exception(ex, self) }
|
10
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
|
11
14
|
@installed = true
|
12
15
|
end
|
13
16
|
|
@@ -20,7 +23,7 @@ module RorVsWild
|
|
20
23
|
section.file, section.line = controller.method(method_name).source_location
|
21
24
|
section.file = RorVsWild.agent.locator.relative_path(section.file)
|
22
25
|
section.command = "#{controller.class}##{method_name}"
|
23
|
-
RorVsWild.agent.current_data[:name] = controller_action
|
26
|
+
RorVsWild.agent.current_data[:name] = controller_action if RorVsWild.agent.current_data
|
24
27
|
end
|
25
28
|
block.call
|
26
29
|
ensure
|
@@ -32,7 +35,12 @@ module RorVsWild
|
|
32
35
|
if hash = RorVsWild.agent.push_exception(exception)
|
33
36
|
hash[:session] = controller.session.to_hash
|
34
37
|
hash[:parameters] = controller.request.filtered_parameters
|
35
|
-
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
|
+
}
|
36
44
|
end
|
37
45
|
raise exception
|
38
46
|
end
|
data/lib/rorvswild/queue.rb
CHANGED
@@ -10,20 +10,19 @@ module RorVsWild
|
|
10
10
|
def self.start
|
11
11
|
return if RorVsWild.agent
|
12
12
|
|
13
|
-
if (
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
if !RorVsWild.agent && Rails.env.development?
|
13
|
+
if (config = load_config) && config["api_key"]
|
14
|
+
RorVsWild.start(config)
|
15
|
+
elsif Rails.env.development?
|
20
16
|
require "rorvswild/local"
|
21
|
-
RorVsWild::Local.start
|
17
|
+
RorVsWild::Local.start(config || {})
|
22
18
|
end
|
23
19
|
end
|
24
20
|
|
25
|
-
def self.
|
26
|
-
|
21
|
+
def self.load_config
|
22
|
+
if (path = Rails.root.join("config/rorvswild.yml")).exist?
|
23
|
+
hash = YAML.load(ERB.new(path.read).result)[Rails.env]
|
24
|
+
hash && hash.deep_symbolize_keys
|
25
|
+
end
|
27
26
|
end
|
28
27
|
end
|
29
28
|
end
|
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.11
|
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-05-21 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: []
|
@@ -32,7 +34,7 @@ files:
|
|
32
34
|
- lib/rorvswild/local/javascript/vendor/barber.js
|
33
35
|
- lib/rorvswild/local/javascript/vendor/mustache.js
|
34
36
|
- lib/rorvswild/local/javascript/vendor/prism.js
|
35
|
-
- lib/rorvswild/local/local.html
|
37
|
+
- lib/rorvswild/local/local.html.erb
|
36
38
|
- lib/rorvswild/local/middleware.rb
|
37
39
|
- lib/rorvswild/local/queue.rb
|
38
40
|
- lib/rorvswild/local/stylesheet/local.css
|
@@ -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: []
|