rorvswild 1.6.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/lib/rorvswild/agent.rb +10 -14
- data/lib/rorvswild/client.rb +7 -2
- data/lib/rorvswild/deployment.rb +12 -7
- data/lib/rorvswild/local/local.html.erb +1 -2
- data/lib/rorvswild/local/stylesheet/local.css +56 -40
- data/lib/rorvswild/local/stylesheet/vendor/prism.css +8 -8
- data/lib/rorvswild/plugin/active_job.rb +2 -0
- data/lib/rorvswild/plugin/active_record.rb +22 -2
- data/lib/rorvswild/queue.rb +3 -0
- data/lib/rorvswild/rails_loader.rb +3 -2
- data/lib/rorvswild/section.rb +1 -1
- data/lib/rorvswild/version.rb +1 -1
- data/lib/rorvswild.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d75bdcf83d7aa718c5055d7860d870a79d815901d627e9829f60cc93f5288d2
|
4
|
+
data.tar.gz: 3b6d6e61cff88594c4d6d888a9597c8f2db4a600d8d260514d93c5a4e1ff7b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7157d2f6925a01ebac1e54fb08db8017405cd00df633a736b7fcbbdfd11a9886b708ec9680c499540b36b22130744338efd1fab7159bc38fea19f333704cd619
|
7
|
+
data.tar.gz: ee290b637cba8ff57439ca673ea681d2d32fa9823127b66cf6418cbe298525c9a873bf941c40a8d37586e132df036628fdcf3c4d7d53a4e4e78ee3b2522ed061
|
data/README.md
CHANGED
@@ -155,12 +155,15 @@ From the configuration file, you can tell RorVsWild to skip monitoring some requ
|
|
155
155
|
production:
|
156
156
|
api_key: API_KEY
|
157
157
|
ignore_requests:
|
158
|
-
-
|
158
|
+
- HeartbeatController#show
|
159
|
+
- !ruby/regexp /SecretController/ # Ignore the entire controller
|
159
160
|
ignore_jobs:
|
160
161
|
- SecretJob
|
162
|
+
- !ruby/regexp /Secret::/ # Ignore the entire Secret namespace
|
161
163
|
ignore_exceptions:
|
162
164
|
- ActionController::RoutingError # Ignore by default any 404
|
163
165
|
- ZeroDivisionError
|
166
|
+
- !ruby/regexp /Secret::/ # Ignore all secret errors
|
164
167
|
ignore_plugins:
|
165
168
|
- Sidekiq # If you don't want to monitor your Sidekiq jobs
|
166
169
|
```
|
@@ -171,9 +174,9 @@ Here is the equivalent if you prefer initialising RorVsWild manually.
|
|
171
174
|
# config/initializers/rorvswild.rb
|
172
175
|
RorVsWild.start(
|
173
176
|
api_key: "API_KEY",
|
174
|
-
ignore_requests: ["
|
175
|
-
ignore_jobs: ["SecretJob"],
|
176
|
-
ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError"],
|
177
|
+
ignore_requests: ["ApplicationController#heartbeat", /SecretController/],
|
178
|
+
ignore_jobs: ["SecretJob", /Secret::/],
|
179
|
+
ignore_exceptions: ["ActionController::RoutingError", "ZeroDivisionError", /Secret::/],
|
177
180
|
ignore_plugins: ["Sidekiq"])
|
178
181
|
```
|
179
182
|
|
data/lib/rorvswild/agent.rb
CHANGED
@@ -36,7 +36,6 @@ module RorVsWild
|
|
36
36
|
RorVsWild.logger.debug("Start RorVsWild #{RorVsWild::VERSION}")
|
37
37
|
setup_plugins
|
38
38
|
cleanup_data
|
39
|
-
send_deployment
|
40
39
|
end
|
41
40
|
|
42
41
|
def load_features
|
@@ -101,17 +100,17 @@ module RorVsWild
|
|
101
100
|
queue_request
|
102
101
|
end
|
103
102
|
|
104
|
-
def catch_error(
|
103
|
+
def catch_error(context = nil, &block)
|
105
104
|
begin
|
106
105
|
block.call
|
107
106
|
rescue Exception => ex
|
108
|
-
record_error(ex,
|
107
|
+
record_error(ex, context)
|
109
108
|
ex
|
110
109
|
end
|
111
110
|
end
|
112
111
|
|
113
|
-
def record_error(exception,
|
114
|
-
send_error(exception_to_hash(exception,
|
112
|
+
def record_error(exception, context = nil)
|
113
|
+
send_error(exception_to_hash(exception, context)) if !ignored_exception?(exception)
|
115
114
|
end
|
116
115
|
|
117
116
|
def push_exception(exception, options = nil)
|
@@ -148,15 +147,16 @@ module RorVsWild
|
|
148
147
|
end
|
149
148
|
|
150
149
|
def ignored_request?(name)
|
151
|
-
|
150
|
+
config[:ignore_requests].any? { |str_or_regex| str_or_regex === name }
|
152
151
|
end
|
153
152
|
|
154
153
|
def ignored_job?(name)
|
155
|
-
config[:ignore_jobs].
|
154
|
+
config[:ignore_jobs].any? { |str_or_regex| str_or_regex === name }
|
156
155
|
end
|
157
156
|
|
158
|
-
def
|
159
|
-
|
157
|
+
def ignored_exception?(exception)
|
158
|
+
return false unless config[:ignore_exceptions]
|
159
|
+
config[:ignore_exceptions].any? { |str_or_regex| str_or_regex === exception.class.to_s }
|
160
160
|
end
|
161
161
|
|
162
162
|
#######################
|
@@ -201,13 +201,9 @@ module RorVsWild
|
|
201
201
|
message: exception.message,
|
202
202
|
backtrace: exception.backtrace || ["No backtrace"],
|
203
203
|
exception: exception.class.to_s,
|
204
|
-
|
204
|
+
context: context,
|
205
205
|
environment: Host.to_h,
|
206
206
|
}
|
207
207
|
end
|
208
|
-
|
209
|
-
def ignored_exception?(exception)
|
210
|
-
(config[:ignored_exceptions] || config[:ignore_exceptions]).include?(exception.class.to_s)
|
211
|
-
end
|
212
208
|
end
|
213
209
|
end
|
data/lib/rorvswild/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "set"
|
2
4
|
require "uri"
|
3
5
|
require "json/ext"
|
@@ -27,6 +29,7 @@ module RorVsWild
|
|
27
29
|
"X-Ruby-Version" => RUBY_VERSION,
|
28
30
|
}
|
29
31
|
@headers["X-Rails-Version"] = Rails.version if defined?(Rails)
|
32
|
+
@http_unauthorized = false
|
30
33
|
end
|
31
34
|
|
32
35
|
def post(path, data)
|
@@ -60,8 +63,10 @@ module RorVsWild
|
|
60
63
|
end
|
61
64
|
|
62
65
|
def transmit(request)
|
63
|
-
if http = take_or_create_connection
|
64
|
-
http.request(request)
|
66
|
+
if !@http_unauthorized && http = take_or_create_connection
|
67
|
+
response = http.request(request)
|
68
|
+
@http_unauthorized = true if response.code == "401"
|
69
|
+
response
|
65
70
|
end
|
66
71
|
rescue Exception => ex
|
67
72
|
RorVsWild.logger.error(ex.full_message)
|
data/lib/rorvswild/deployment.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "open3"
|
4
|
+
|
3
5
|
module RorVsWild
|
4
6
|
module Deployment
|
5
7
|
def self.load_config(config)
|
@@ -57,15 +59,13 @@ module RorVsWild
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def self.read_from_scalingo
|
60
|
-
return unless ENV["SOURCE_VERSION"]
|
61
62
|
@revision = ENV["SOURCE_VERSION"]
|
62
63
|
end
|
63
64
|
|
64
65
|
def self.read_from_git
|
65
|
-
@revision = normalize_string(
|
66
|
-
return unless
|
67
|
-
lines =
|
68
|
-
return unless lines
|
66
|
+
return unless @revision = normalize_string(shell("git rev-parse HEAD"))
|
67
|
+
return @revision unless log_stdout = shell("git log -1 --pretty=%an%n%ae%n%B")
|
68
|
+
lines = log_stdout.lines
|
69
69
|
@author = normalize_string(lines[0])
|
70
70
|
@email = normalize_string(lines[1])
|
71
71
|
@description = lines[2..-1] && normalize_string(lines[2..-1].join)
|
@@ -75,8 +75,8 @@ module RorVsWild
|
|
75
75
|
def self.read_from_capistrano
|
76
76
|
return unless File.readable?("REVISION")
|
77
77
|
return unless @revision = File.read("REVISION")
|
78
|
-
|
79
|
-
|
78
|
+
return unless stdout = shell("git --git-dir ../../repo log --format=%an%n%ae%n%B -n 1 #{@revision}")
|
79
|
+
lines = stdout.lines
|
80
80
|
@author = normalize_string(lines[0])
|
81
81
|
@email = normalize_string(lines[1])
|
82
82
|
@description = lines[2..-1] && normalize_string(lines[2..-1].join)
|
@@ -89,5 +89,10 @@ module RorVsWild
|
|
89
89
|
string.empty? ? nil : string
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
def self.shell(command)
|
94
|
+
stdout, stderr, process = Open3.capture3(command) rescue nil
|
95
|
+
stdout if process && process.success?
|
96
|
+
end
|
92
97
|
end
|
93
98
|
end
|
@@ -55,8 +55,7 @@
|
|
55
55
|
{{/currentRequest}}
|
56
56
|
</div>
|
57
57
|
<div class="rorvswild-local-panel__footer">
|
58
|
-
This data is not sent to rorvswild.com.
|
59
|
-
<a href="https://www.rorvswild.com" class="rorvswild-local-panel__footer__link">create an account</a>.
|
58
|
+
This data is not sent to rorvswild.com. <a href="https://www.rorvswild.com" class="rorvswild-local-panel__footer__link">Create an account</a> to monitor your production environment.
|
60
59
|
</div>
|
61
60
|
</div>
|
62
61
|
|
@@ -3,10 +3,11 @@
|
|
3
3
|
/********************************************/
|
4
4
|
|
5
5
|
.rorvswild-local-toggler {
|
6
|
-
background:
|
7
|
-
color:
|
8
|
-
|
9
|
-
|
6
|
+
background: rgb(16, 20, 28) !important;
|
7
|
+
color: rgb(135,173,250) !important;
|
8
|
+
font-weight: 700 !important;
|
9
|
+
box-shadow: 0 0 0 1px rgba(69,74,84,1) inset, 0 1px 4px 0px rgba(14,18,26,0.96) !important;
|
10
|
+
border-radius: 2px !important;
|
10
11
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
11
12
|
font-size: 15px !important;
|
12
13
|
line-height: 24px !important;
|
@@ -19,8 +20,9 @@
|
|
19
20
|
}
|
20
21
|
|
21
22
|
.rorvswild-local-toggler small {
|
22
|
-
color:
|
23
|
-
font-
|
23
|
+
color: rgb(133,139,150) !important;
|
24
|
+
font-weight: 400 !important;
|
25
|
+
font-size: 10px !important;
|
24
26
|
margin-left: 4px !important;
|
25
27
|
display: inline-block !important;
|
26
28
|
}
|
@@ -54,9 +56,10 @@
|
|
54
56
|
/********************************************/
|
55
57
|
|
56
58
|
.rorvswild-local-panel {
|
57
|
-
background:
|
58
|
-
box-shadow: 0 0 0 48px rgba(
|
59
|
-
|
59
|
+
background: rgb(16,20,28) !important;
|
60
|
+
box-shadow: 0 0 0 48px rgba(69,74,84, 0.95),
|
61
|
+
0 1px 16px 2px rgba(14,18,26,0.96) !important;
|
62
|
+
color: rgb(168,174,186) !important;
|
60
63
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
61
64
|
font-size: 15px !important;
|
62
65
|
line-height: 24px !important;
|
@@ -88,34 +91,35 @@
|
|
88
91
|
}
|
89
92
|
|
90
93
|
.rorvswild-local-panel ::-moz-selection {
|
91
|
-
background:
|
92
|
-
color:
|
94
|
+
background: rgb(69,74,84) !important;
|
95
|
+
color: rgb(219,234,241) !important;
|
93
96
|
}
|
94
97
|
|
95
98
|
.rorvswild-local-panel ::selection {
|
96
|
-
background:
|
97
|
-
color:
|
99
|
+
background: rgb(69,74,84) !important;
|
100
|
+
color: rgb(219,234,241) !important;
|
98
101
|
}
|
99
102
|
|
100
103
|
.rorvswild-local-panel small {
|
101
|
-
color:
|
102
|
-
font-size:
|
103
|
-
|
104
|
+
color: rgb(133,139,150) !important;
|
105
|
+
font-size: 10px !important;
|
106
|
+
font-weight: 400 !important;
|
107
|
+
margin-left: 2px !important;
|
104
108
|
}
|
105
109
|
|
106
110
|
/* Panel Header */
|
107
111
|
.rorvswild-local-panel__header {
|
108
|
-
background:
|
112
|
+
background: rgb(24,28,36) !important;
|
109
113
|
z-index: 100000000000000005 !important;
|
110
114
|
padding: 12px !important;
|
111
|
-
box-shadow: 0 1px 2px 0 rgba(
|
115
|
+
box-shadow: 0 1px 2px 0 rgba(14,18,26, .8) !important;
|
112
116
|
display: -webkit-box;
|
113
117
|
display: -ms-flexbox;
|
114
118
|
display: flex;
|
115
119
|
}
|
116
120
|
|
117
121
|
.rorvswild-local-panel__header__title {
|
118
|
-
color:
|
122
|
+
color: rgb(168,174,186) !important;
|
119
123
|
text-transform: uppercase !important;
|
120
124
|
font-size: 12px !important;
|
121
125
|
letter-spacing: 2px !important;
|
@@ -131,13 +135,13 @@
|
|
131
135
|
stroke-width: 2 !important;
|
132
136
|
fill: none !important;
|
133
137
|
stroke-linecap: square !important;
|
134
|
-
stroke:
|
138
|
+
stroke: rgb(133,139,150) !important;
|
135
139
|
stroke-miterlimit: 10 !important;
|
136
140
|
vertical-align: middle !important;
|
137
141
|
}
|
138
142
|
|
139
143
|
.rorvswild-local-panel svg:hover {
|
140
|
-
stroke:
|
144
|
+
stroke: rgb(193,204,214) !important;
|
141
145
|
}
|
142
146
|
|
143
147
|
.rorvswild-local-panel__logo {
|
@@ -161,12 +165,12 @@
|
|
161
165
|
|
162
166
|
.rorvswild-local-panel__github svg {
|
163
167
|
stroke: none !important;
|
164
|
-
fill:
|
168
|
+
fill: rgb(133,139,150) !important;
|
165
169
|
}
|
166
170
|
|
167
171
|
.rorvswild-local-panel__github svg:hover {
|
168
172
|
stroke: none !important;
|
169
|
-
fill:
|
173
|
+
fill: rgb(193,204,214) !important;
|
170
174
|
}
|
171
175
|
|
172
176
|
/* Panel Content */
|
@@ -179,7 +183,7 @@
|
|
179
183
|
overflow-x: auto !important;
|
180
184
|
}
|
181
185
|
|
182
|
-
.rorvswild-local-panel__content::-webkit-scrollbar { width:
|
186
|
+
.rorvswild-local-panel__content::-webkit-scrollbar { width: 4px !important; }
|
183
187
|
|
184
188
|
.rorvswild-local-panel__content::-webkit-scrollbar-corner { background: transparent !important; }
|
185
189
|
|
@@ -189,8 +193,8 @@
|
|
189
193
|
}
|
190
194
|
|
191
195
|
.rorvswild-local-panel__content::-webkit-scrollbar-thumb {
|
192
|
-
background-color:
|
193
|
-
outline: 1px solid
|
196
|
+
background-color: rgb(100,106,116) !important;
|
197
|
+
outline: 1px solid rgb(100,106,116) !important;
|
194
198
|
}
|
195
199
|
|
196
200
|
/* Panel request summary */
|
@@ -200,30 +204,36 @@
|
|
200
204
|
display: -ms-flexbox !important;
|
201
205
|
display: flex !important;
|
202
206
|
padding: 12px 12px 11px !important;
|
203
|
-
border-bottom: 1px solid
|
207
|
+
border-bottom: 1px solid rgb(24,28,36) !important;
|
204
208
|
cursor: pointer !important;
|
205
209
|
-ms-flex-wrap: wrap !important;
|
206
210
|
flex-wrap: wrap !important;
|
207
211
|
}
|
208
212
|
|
209
|
-
.rorvswild-local-panel__request:hover { background:
|
213
|
+
.rorvswild-local-panel__request:hover { background: rgb(21,25,34) !important; }
|
210
214
|
|
211
215
|
.rorvswild-local-panel__request__name {
|
212
216
|
word-break: break-all !important;
|
213
217
|
overflow-wrap: break-word !important;
|
214
218
|
width: 100% !important;
|
219
|
+
color: rgb(193,204,214) !important;
|
220
|
+
font-weight: 700;
|
215
221
|
}
|
216
222
|
|
217
223
|
.rorvswild-local-panel__request__path {
|
218
|
-
color:
|
224
|
+
color: rgb(133,139,150) !important;
|
225
|
+
font-weight: 400;
|
219
226
|
display: block !important;
|
220
227
|
}
|
221
228
|
|
222
229
|
.rorvswild-local-panel__request__started-at {
|
223
|
-
color:
|
230
|
+
color: rgb(133,139,150) !important;
|
224
231
|
margin-left: 12px !important;
|
225
232
|
}
|
226
|
-
.rorvswild-local-panel__request__runtime {
|
233
|
+
.rorvswild-local-panel__request__runtime {
|
234
|
+
color: rgb(135,173,250) !important;
|
235
|
+
font-weight: bold !important;
|
236
|
+
}
|
227
237
|
|
228
238
|
/* Panel request details */
|
229
239
|
|
@@ -257,12 +267,12 @@ h2.rorvswild-local-panel__request__name__title {
|
|
257
267
|
|
258
268
|
.rorvswild-local-panel__request-details__section {
|
259
269
|
padding: 12px 12px 11px !important;
|
260
|
-
border-bottom: 1px solid
|
270
|
+
border-bottom: 1px solid rgb(24,28,36) !important;
|
261
271
|
display: block !important;
|
262
272
|
}
|
263
273
|
|
264
274
|
.rorvswild-local-panel__request-details__section:hover {
|
265
|
-
background:
|
275
|
+
background: rgb(21,25,34) !important;
|
266
276
|
-webkit-transition: all .3s !important;
|
267
277
|
transition: all .3s !important;
|
268
278
|
}
|
@@ -281,22 +291,26 @@ h2.rorvswild-local-panel__request__name__title {
|
|
281
291
|
word-break: break-all !important;
|
282
292
|
overflow-wrap: break-word !important;
|
283
293
|
min-width: 0 !important;
|
294
|
+
color: rgb(193,204,214) !important;
|
284
295
|
}
|
285
296
|
|
286
297
|
.rorvswild-local-panel__request-details__section__average {
|
287
|
-
color:
|
298
|
+
color: rgb(135,173,250) !important;
|
299
|
+
font-weight: 700 !important;
|
288
300
|
width: 48px !important;
|
289
301
|
margin:0 12px 0 0 !important;
|
290
302
|
}
|
291
303
|
|
292
304
|
.rorvswild-local-panel__request-details__section__calls {
|
293
|
-
color:
|
305
|
+
color: rgb(168,174,186) !important;
|
294
306
|
width: 48px !important;
|
295
307
|
margin: 0 12px 0 0 !important;
|
296
308
|
}
|
297
309
|
|
298
310
|
.rorvswild-local-panel__request-details__section__impact {
|
311
|
+
color: rgb(193,204,214) !important;
|
299
312
|
width: 48px !important;
|
313
|
+
font-weight: 700 !important;
|
300
314
|
margin: 0 12px 0 0 !important;
|
301
315
|
}
|
302
316
|
|
@@ -304,10 +318,12 @@ h2.rorvswild-local-panel__request__name__title {
|
|
304
318
|
display: -webkit-box !important;
|
305
319
|
display: -ms-flexbox !important;
|
306
320
|
display: flex !important;
|
321
|
+
color: rgb(133,139,150) !important;
|
322
|
+
margin-top: 8px !important;
|
307
323
|
}
|
308
324
|
|
309
325
|
.rorvswild-local-panel__request-details__section__kind {
|
310
|
-
background:
|
326
|
+
background: rgb(40,44,54) !important;
|
311
327
|
font-size: 10px !important;
|
312
328
|
text-transform: uppercase !important;
|
313
329
|
text-align: center !important;
|
@@ -318,7 +334,7 @@ h2.rorvswild-local-panel__request__name__title {
|
|
318
334
|
}
|
319
335
|
|
320
336
|
.rorvswild-local-panel__request-details__section__command {
|
321
|
-
color:
|
337
|
+
color: rgb(133,139,150) !important;
|
322
338
|
-webkit-box-flex: 1 !important;
|
323
339
|
-ms-flex: 1 !important;
|
324
340
|
flex: 1 !important;
|
@@ -331,14 +347,14 @@ h2.rorvswild-local-panel__request__name__title {
|
|
331
347
|
|
332
348
|
.rorvswild-local-panel__footer {
|
333
349
|
width: 100% !important;
|
334
|
-
background:
|
335
|
-
color:
|
350
|
+
background: rgb(40,44,54) !important;
|
351
|
+
color: rgb(168,174,186) !important;
|
336
352
|
padding: 12px !important;
|
337
353
|
text-align: center !important;
|
338
354
|
}
|
339
355
|
|
340
356
|
a.rorvswild-local-panel__footer__link {
|
341
|
-
color:
|
357
|
+
color: rgb(193,204,214) !important;
|
342
358
|
text-decoration: underline !important;
|
343
359
|
line-height: inherit !important;
|
344
360
|
}
|
@@ -7,7 +7,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
7
7
|
*/
|
8
8
|
.rorvswild-local-panel code[class*="language-"],
|
9
9
|
.rorvswild-local-panel pre[class*="language-"] {
|
10
|
-
color:
|
10
|
+
color: rgb(133,139,150) !important;
|
11
11
|
background: none !important;
|
12
12
|
font-family: SF Mono, Menlo, Consolas, DejaVu Sans Mono, monospace !important;
|
13
13
|
text-align: left !important;
|
@@ -60,7 +60,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
60
60
|
.rorvswild-local-panel .token.prolog,
|
61
61
|
.rorvswild-local-panel .token.doctype,
|
62
62
|
.rorvswild-local-panel .token.cdata {
|
63
|
-
color:
|
63
|
+
color: rgb(133,139,150) !important;
|
64
64
|
font-style: italic !important;
|
65
65
|
opacity: 0.7 !important;
|
66
66
|
}
|
@@ -77,7 +77,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
77
77
|
.rorvswild-local-panel .token.boolean,
|
78
78
|
.rorvswild-local-panel .token.number,
|
79
79
|
.rorvswild-local-panel .token.deleted {
|
80
|
-
color:
|
80
|
+
color: rgb(195,116,112) !important;
|
81
81
|
}
|
82
82
|
|
83
83
|
.rorvswild-local-panel .token.property,
|
@@ -85,7 +85,7 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
85
85
|
.rorvswild-local-panel .token.symbol,
|
86
86
|
.rorvswild-local-panel .token.builtin,
|
87
87
|
.rorvswild-local-panel .token.string {
|
88
|
-
color:
|
88
|
+
color: rgb(108,138,200) !important;
|
89
89
|
}
|
90
90
|
|
91
91
|
.rorvswild-local-panel .token.attr-name,
|
@@ -98,17 +98,17 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
98
98
|
.rorvswild-local-panel .token.atrule,
|
99
99
|
.rorvswild-local-panel .token.attr-value,
|
100
100
|
.rorvswild-local-panel .token.keyword {
|
101
|
-
color:
|
101
|
+
color: rgb(171,120,176) !important;
|
102
102
|
}
|
103
103
|
|
104
104
|
.rorvswild-local-panel .token.constant,
|
105
105
|
.rorvswild-local-panel .token.regex,
|
106
106
|
.rorvswild-local-panel .token.important {
|
107
|
-
color:
|
107
|
+
color: rgb(167,133,61) !important;
|
108
108
|
}
|
109
109
|
|
110
110
|
.rorvswild-local-panel .token.function {
|
111
|
-
color:
|
111
|
+
color: rgb(30,151,162) !important;
|
112
112
|
}
|
113
113
|
|
114
114
|
.rorvswild-local-panel .token.important,
|
@@ -132,5 +132,5 @@ http://prismjs.com/download.html?themes=prism-twilight&languages=markup+css+clik
|
|
132
132
|
.rorvswild-local-panel .language-markup .token.tag,
|
133
133
|
.rorvswild-local-panel .language-markup .token.attr-name,
|
134
134
|
.rorvswild-local-panel .language-markup .token.punctuation {
|
135
|
-
color:
|
135
|
+
color: rgb(133,139,150) !important;
|
136
136
|
}
|
@@ -16,6 +16,8 @@ module RorVsWild
|
|
16
16
|
section.file, section.line = job.method(:perform).source_location
|
17
17
|
section.file = RorVsWild.agent.locator.relative_path(section.file)
|
18
18
|
block.call
|
19
|
+
rescue Exception => ex
|
20
|
+
job.rescue_with_handler(ex) or raise
|
19
21
|
ensure
|
20
22
|
RorVsWild::Section.stop
|
21
23
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RorVsWild
|
2
4
|
module Plugin
|
3
5
|
class ActiveRecord
|
@@ -19,8 +21,8 @@ module RorVsWild
|
|
19
21
|
return if IGNORED_QUERIES.include?(payload[:name])
|
20
22
|
RorVsWild::Section.start do |section|
|
21
23
|
section.appendable_command = APPENDABLE_QUERIES.include?(payload[:sql])
|
22
|
-
section.command = payload[:sql]
|
23
|
-
section.kind = "sql"
|
24
|
+
section.command = normalize_sql_query(payload[:sql])
|
25
|
+
section.kind = "sql"
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -28,6 +30,24 @@ module RorVsWild
|
|
28
30
|
return if IGNORED_QUERIES.include?(payload[:name])
|
29
31
|
RorVsWild::Section.stop
|
30
32
|
end
|
33
|
+
|
34
|
+
SQL_STRING_REGEX = /'((?:''|\\'|[^'])*)'/
|
35
|
+
SQL_NUMERIC_REGEX = /(?<!\w)\d+(\.\d+)?(?!\w)/
|
36
|
+
SQL_PARAMETER_REGEX = /\$\d+/
|
37
|
+
SQL_IN_REGEX = /(\bIN\s*\()([^)]+)(\))/i
|
38
|
+
SQL_ONE_LINE_COMMENT_REGEX =/--.*$/
|
39
|
+
SQL_MULTI_LINE_COMMENT_REGEX = /\/\*.*?\*\//m
|
40
|
+
|
41
|
+
def normalize_sql_query(sql)
|
42
|
+
sql = sql.to_s.gsub(SQL_STRING_REGEX, "?")
|
43
|
+
sql.gsub!(SQL_PARAMETER_REGEX, "?")
|
44
|
+
sql.gsub!(SQL_NUMERIC_REGEX, "?")
|
45
|
+
sql.gsub!(SQL_IN_REGEX, '\1?\3')
|
46
|
+
sql.gsub!(SQL_ONE_LINE_COMMENT_REGEX, "")
|
47
|
+
sql.gsub!(SQL_MULTI_LINE_COMMENT_REGEX, "")
|
48
|
+
sql.strip!
|
49
|
+
sql
|
50
|
+
end
|
31
51
|
end
|
32
52
|
end
|
33
53
|
end
|
data/lib/rorvswild/queue.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RorVsWild
|
2
4
|
class Queue
|
3
5
|
SLEEP_TIME = 10
|
@@ -56,6 +58,7 @@ module RorVsWild
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def flush_indefinetely
|
61
|
+
client.post("/deployments", deployment: Deployment.to_h)
|
59
62
|
sleep(SLEEP_TIME) and flush while true
|
60
63
|
rescue Exception => ex
|
61
64
|
RorVsWild.logger.error(ex)
|
@@ -20,8 +20,9 @@ module RorVsWild
|
|
20
20
|
|
21
21
|
def self.load_config
|
22
22
|
if (path = Rails.root.join("config/rorvswild.yml")).exist?
|
23
|
-
|
24
|
-
hash
|
23
|
+
yaml = ERB.new(path.read).result
|
24
|
+
hash = YAML.safe_load(yaml, permitted_classes: [Regexp])
|
25
|
+
hash[Rails.env] && hash[Rails.env].deep_symbolize_keys
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
data/lib/rorvswild/section.rb
CHANGED
data/lib/rorvswild/version.rb
CHANGED
data/lib/rorvswild.rb
CHANGED
@@ -38,12 +38,12 @@ module RorVsWild
|
|
38
38
|
agent ? agent.measure_block(name , &block) : block.call
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.catch_error(
|
42
|
-
agent ? agent.catch_error(
|
41
|
+
def self.catch_error(context = nil, &block)
|
42
|
+
agent ? agent.catch_error(context, &block) : block.call
|
43
43
|
end
|
44
44
|
|
45
|
-
def self.record_error(exception,
|
46
|
-
agent.record_error(exception,
|
45
|
+
def self.record_error(exception, context = nil)
|
46
|
+
agent.record_error(exception, context) if agent
|
47
47
|
end
|
48
48
|
|
49
49
|
def self.merge_error_context(hash)
|
@@ -68,6 +68,7 @@ module RorVsWild
|
|
68
68
|
|
69
69
|
def self.check
|
70
70
|
api_key = RorVsWild.agent.config[:api_key]
|
71
|
+
agent.client.instance_variable_set(:@http_unauthorized, false)
|
71
72
|
return puts "You API key is missing and has to be defined in config/rorvswild.yml." if !api_key || api_key.empty?
|
72
73
|
puts case response = agent.client.post("/jobs", jobs: [{sections: [], name: "RorVsWild.check", runtime: 0}])
|
73
74
|
when Net::HTTPOK then "Connection to RorVsWild works fine !"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rorvswild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Bernard
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Performances and errors insights for rails developers.
|
15
15
|
email:
|