rorvswild 1.5.8 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rorvswild/agent.rb +19 -2
- data/lib/rorvswild/client.rb +5 -1
- data/lib/rorvswild/locator.rb +8 -13
- data/lib/rorvswild/plugin/action_controller.rb +6 -1
- data/lib/rorvswild/section.rb +8 -0
- data/lib/rorvswild/version.rb +1 -1
- 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: 82e99bed32ec2670bc121da6de38cdfa320cf2d86f1e09004f08629eab6c0040
|
4
|
+
data.tar.gz: d92ed6e8faa815ff9be3dd3d6ee8528a5c9b43824c803616c0106276111baf45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b48fea4d285459afe675e47cde1a2ca2cd658f09dcc742b8f425e83dfa346714940688bbcbd83a356db24c154ea7bb15643b68e673714563a35261416cc6eec
|
7
|
+
data.tar.gz: 3162a68b10887ea2733757f7bd7cf3edb8b76479e6f558ac2f096aa3e9225486350dca307c22611743448cc0801b0883c42b42b16f25cf6096e39586c6c34955
|
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,7 +28,7 @@ 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
33
|
RorVsWild.logger.info("Start RorVsWild #{RorVsWild::VERSION}")
|
32
34
|
setup_plugins
|
@@ -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]
|
@@ -168,11 +170,26 @@ module RorVsWild
|
|
168
170
|
backtrace: exception.backtrace || ["No backtrace"],
|
169
171
|
exception: exception.class.to_s,
|
170
172
|
extra_details: extra_details,
|
173
|
+
environment: {
|
174
|
+
os: os_description,
|
175
|
+
user: Etc.getlogin,
|
176
|
+
host: Socket.gethostname,
|
177
|
+
ruby: RUBY_DESCRIPTION,
|
178
|
+
pid: Process.pid,
|
179
|
+
cwd: Dir.pwd,
|
180
|
+
lib_paths: locator.lib_paths,
|
181
|
+
},
|
171
182
|
}
|
172
183
|
end
|
173
184
|
|
174
185
|
def ignored_exception?(exception)
|
175
186
|
(config[:ignored_exceptions] || config[:ignore_exceptions]).include?(exception.class.to_s)
|
176
187
|
end
|
188
|
+
|
189
|
+
def os_description
|
190
|
+
@os_description ||= `uname -a`
|
191
|
+
rescue Exception => ex
|
192
|
+
@os_description = RUBY_PLATFORM
|
193
|
+
end
|
177
194
|
end
|
178
195
|
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/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)
|
@@ -42,26 +42,21 @@ 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
50
|
end
|
51
51
|
|
52
52
|
private
|
53
53
|
|
54
|
-
def
|
55
|
-
array = ["
|
54
|
+
def initialize_lib_paths
|
55
|
+
array = [RbConfig::CONFIG["rubylibprefix"]] + Gem.default_path + Gem.path
|
56
|
+
array += ["RUBYLIB", "GEM_HOME", "GEM_PATH", "BUNDLER_ORIG_GEM_PATH"].flat_map do |name|
|
56
57
|
ENV[name].split(":".freeze) if ENV[name]
|
57
58
|
end
|
58
|
-
array += [heroku_ruby_lib_path] if File.exists?(heroku_ruby_lib_path)
|
59
|
-
array += Gem.path
|
60
59
|
array.compact.uniq
|
61
60
|
end
|
62
|
-
|
63
|
-
def heroku_ruby_lib_path
|
64
|
-
"/app/vendor/ruby-#{RUBY_VERSION}/lib"
|
65
|
-
end
|
66
61
|
end
|
67
62
|
end
|
@@ -35,7 +35,12 @@ module RorVsWild
|
|
35
35
|
if hash = RorVsWild.agent.push_exception(exception)
|
36
36
|
hash[:session] = controller.session.to_hash
|
37
37
|
hash[:parameters] = controller.request.filtered_parameters
|
38
|
-
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
|
+
}
|
39
44
|
end
|
40
45
|
raise exception
|
41
46
|
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,7 +1,7 @@
|
|
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.9
|
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:
|
12
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Performances and errors insights for rails developers.
|
15
15
|
email:
|