rookout 0.1.36 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rookout/augs/actions/action_run_processor.rb +1 -0
- data/lib/rookout/augs/aug.rb +3 -5
- data/lib/rookout/augs/aug_factory.rb +40 -16
- data/lib/rookout/augs/aug_rate_limiter.rb +35 -36
- data/lib/rookout/augs/limits_manager.rb +31 -0
- data/lib/rookout/augs/locations/location_file_line.rb +5 -1
- data/lib/rookout/com_ws/agent_com_ws.rb +4 -3
- data/lib/rookout/com_ws/envelope_wrapper.rb +7 -5
- data/lib/rookout/com_ws/git.rb +1 -1
- data/lib/rookout/com_ws/information.rb +2 -1
- data/lib/rookout/com_ws/output.rb +13 -7
- data/lib/rookout/commit.rb +1 -1
- data/lib/rookout/config.rb +55 -17
- data/lib/rookout/exceptions.rb +12 -9
- data/lib/rookout/interface.rb +9 -8
- data/lib/rookout/logger.rb +13 -7
- data/lib/rookout/processor/namespace_serializer.rb +1 -1
- data/lib/rookout/processor/namespace_serializer2.rb +26 -12
- data/lib/rookout/processor/namespaces/container_namespace.rb +1 -0
- data/lib/rookout/processor/namespaces/frame_namespace.rb +2 -3
- data/lib/rookout/processor/namespaces/namespace.rb +1 -0
- data/lib/rookout/processor/namespaces/noop_namespace.rb +0 -4
- data/lib/rookout/processor/namespaces/ruby_object_namespace.rb +31 -16
- data/lib/rookout/processor/namespaces/ruby_object_serializer.rb +9 -7
- data/lib/rookout/processor/namespaces/ruby_utils_namespace.rb +0 -4
- data/lib/rookout/processor/namespaces/stack_namespace.rb +1 -0
- data/lib/rookout/processor/namespaces/traceback_namespace.rb +4 -1
- data/lib/rookout/processor/operations/set_operation.rb +2 -0
- data/lib/rookout/processor/paths/arithmetic_path.rb +3 -1
- data/lib/rookout/processor/paths/canopy/actions.rb +5 -1
- data/lib/rookout/processor/paths/canopy/consts.rb +6 -4
- data/lib/rookout/processor/paths/canopy/markers.rb +15 -5
- data/lib/rookout/processor/processor_factory.rb +0 -2
- data/lib/rookout/processor/rook_error.rb +3 -1
- data/lib/rookout/rookout_singleton.rb +3 -2
- data/lib/rookout/sanitizer.rb +22 -0
- data/lib/rookout/services/position.rb +3 -2
- data/lib/rookout/services/tracer.rb +2 -2
- data/lib/rookout/utils.rb +7 -1
- data/lib/rookout/version.rb +1 -1
- data/lib/rookout.rb +4 -0
- metadata +41 -11
data/lib/rookout/logger.rb
CHANGED
@@ -66,7 +66,7 @@ module Rookout
|
|
66
66
|
|
67
67
|
arguments.each do |argument|
|
68
68
|
if argument.is_a? Exception
|
69
|
-
@formatted_message += "\n
|
69
|
+
@formatted_message += "\n#{argument.message}\n#{argument.backtrace.join "\n\t"}"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -74,7 +74,13 @@ module Rookout
|
|
74
74
|
set_caller
|
75
75
|
end
|
76
76
|
|
77
|
-
attr_reader :level
|
77
|
+
attr_reader :level
|
78
|
+
attr_reader :time
|
79
|
+
attr_reader :filename
|
80
|
+
attr_reader :lineno
|
81
|
+
attr_reader :message
|
82
|
+
attr_reader :formatted_message
|
83
|
+
attr_reader :arguments
|
78
84
|
|
79
85
|
def format
|
80
86
|
"#{@time} #{Process.pid}:#{Thread.current.name}-" \
|
@@ -137,19 +143,19 @@ module Rookout
|
|
137
143
|
file = nil
|
138
144
|
|
139
145
|
if Config.debug
|
140
|
-
|
141
|
-
|
146
|
+
$stderr.puts "[Rookout] Failed to open log file: #{log_file_path}"
|
147
|
+
$stderr.puts e.backtrace
|
142
148
|
end
|
143
149
|
end
|
144
150
|
|
145
|
-
->(record) { file.write record.format
|
151
|
+
->(record) { file.write "#{record.format}\n" if file }
|
146
152
|
end
|
147
153
|
|
148
154
|
def calculate_log_file_path
|
149
155
|
return Config.logger_filename if absolute_path? Config.logger_filename
|
150
156
|
|
151
157
|
if RUBY_PLATFORM.include? "darwin"
|
152
|
-
File.join
|
158
|
+
File.join Dir.home, Config.logger_filename
|
153
159
|
elsif RUBY_PLATFORM.match?(/cygwin|mswin|mingw|bccwin|wince|emx/)
|
154
160
|
File.join ENV["USERPROFILE"], Config.logger_filename
|
155
161
|
else
|
@@ -158,7 +164,7 @@ module Rookout
|
|
158
164
|
end
|
159
165
|
|
160
166
|
def new_stderr_handler
|
161
|
-
->(record) {
|
167
|
+
->(record) { $stderr.puts record.format }
|
162
168
|
end
|
163
169
|
|
164
170
|
def new_remote_handler
|
@@ -9,12 +9,20 @@ module Rookout
|
|
9
9
|
require_relative "./namespaces/container_namespace"
|
10
10
|
require_relative "./namespaces/traceback_namespace"
|
11
11
|
|
12
|
+
begin
|
13
|
+
require "hashie/mash"
|
14
|
+
MASH = ::Hashie::Mash
|
15
|
+
rescue LoadError
|
16
|
+
MASH = nil
|
17
|
+
end
|
18
|
+
|
12
19
|
def initialize
|
13
20
|
@string_cache = {}
|
14
21
|
@estimated_pending_bytes = 0
|
15
22
|
end
|
16
23
|
|
17
|
-
attr_reader :string_cache
|
24
|
+
attr_reader :string_cache
|
25
|
+
attr_reader :estimated_pending_bytes
|
18
26
|
|
19
27
|
def get_string_index_in_cache str
|
20
28
|
if @string_cache.key? str
|
@@ -35,13 +43,16 @@ module Rookout
|
|
35
43
|
variant.variant_type_max_depth = (type << 1) | 1
|
36
44
|
end
|
37
45
|
|
38
|
-
def dump namespace, log_errors
|
39
|
-
|
46
|
+
def dump namespace, log_errors
|
47
|
+
case namespace
|
48
|
+
when Namespaces::RubyObjectNamespace
|
40
49
|
dump_ruby_object_namespace namespace, log_errors
|
41
|
-
|
50
|
+
when Namespaces::ContainerNamespace
|
42
51
|
dump_container_namespace namespace, log_errors
|
43
|
-
|
52
|
+
when Namespaces::TracebackNamespace
|
44
53
|
dump_traceback_namespace namespace
|
54
|
+
else
|
55
|
+
raise NotImplementedError
|
45
56
|
end
|
46
57
|
rescue StandardError => e
|
47
58
|
message = "Failed to serialize namespace"
|
@@ -80,6 +91,7 @@ module Rookout
|
|
80
91
|
# rubocop:disable Metrics/AbcSize
|
81
92
|
# rubocop:disable Metrics/PerceivedComplexity
|
82
93
|
# rubocop:disable Metrics/CyclomaticComplexity
|
94
|
+
# rubocop:disable Style/ClassEqualityComparison
|
83
95
|
def unsafe_dump_object obj, current_depth, config, log_object_errors
|
84
96
|
variant = Com::Rookout::Variant2.new original_type_index_in_cache: get_string_index_in_cache(obj.class.to_s)
|
85
97
|
|
@@ -93,7 +105,7 @@ module Rookout
|
|
93
105
|
dump_time obj, variant
|
94
106
|
elsif obj.class == Array
|
95
107
|
dump_array obj, variant, current_depth, config, log_object_errors
|
96
|
-
elsif obj.class == Hash
|
108
|
+
elsif obj.class == Hash || (!MASH.nil? && obj.is_a?(MASH))
|
97
109
|
dump_hash obj, variant, current_depth, config, log_object_errors
|
98
110
|
elsif obj.is_a? Exception
|
99
111
|
dump_exception obj, variant, current_depth, config, log_object_errors
|
@@ -105,6 +117,7 @@ module Rookout
|
|
105
117
|
|
106
118
|
variant
|
107
119
|
end
|
120
|
+
# rubocop:enable Style/ClassEqualityComparison
|
108
121
|
# rubocop:enable Metrics/AbcSize
|
109
122
|
# rubocop:enable Metrics/PerceivedComplexity
|
110
123
|
# rubocop:enable Metrics/CyclomaticComplexity
|
@@ -120,20 +133,21 @@ module Rookout
|
|
120
133
|
INT64_MAX = (1 << 63) - 1
|
121
134
|
|
122
135
|
def dump_numeric obj, variant, config
|
123
|
-
|
136
|
+
case obj
|
137
|
+
when true
|
124
138
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
|
125
139
|
variant.long_value = 1
|
126
|
-
|
140
|
+
when false
|
127
141
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_LONG
|
128
142
|
variant.long_value = 0
|
129
|
-
|
143
|
+
when Integer
|
130
144
|
dump_integer obj, variant
|
131
|
-
|
145
|
+
when Float
|
132
146
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_DOUBLE
|
133
147
|
variant.double_value = obj.to_f
|
134
|
-
|
148
|
+
when BigDecimal
|
135
149
|
dump_string obj.to_s, variant, config # TODO: NS: This might cut the decimal value, is that ok?
|
136
|
-
|
150
|
+
when Complex
|
137
151
|
dump_variant_type variant, Com::Rookout::Variant::Type::VARIANT_COMPLEX
|
138
152
|
variant.complex_value = Com::Rookout::Variant::Complex.new real: obj.real.to_f,
|
139
153
|
imaginary: obj.imaginary.to_f
|
@@ -8,6 +8,7 @@ module Rookout
|
|
8
8
|
|
9
9
|
class FrameNamespace < Namespace
|
10
10
|
def initialize binding
|
11
|
+
super()
|
11
12
|
@binding = binding
|
12
13
|
end
|
13
14
|
|
@@ -19,14 +20,12 @@ module Rookout
|
|
19
20
|
|
20
21
|
def call_method name, args
|
21
22
|
case name
|
22
|
-
when "filename"
|
23
|
+
when "filename", "module"
|
23
24
|
RubyObjectNamespace.new @binding.source_location[0]
|
24
25
|
when "line"
|
25
26
|
RubyObjectNamespace.new @binding.source_location[1]
|
26
27
|
when "function"
|
27
28
|
RubyObjectNamespace.new @binding.eval("__method__").to_s
|
28
|
-
when "module"
|
29
|
-
RubyObjectNamespace.new @binding.source_location[0]
|
30
29
|
when "locals"
|
31
30
|
locals args
|
32
31
|
when "dump"
|
@@ -17,7 +17,10 @@ module Rookout
|
|
17
17
|
@max_string = max_string
|
18
18
|
end
|
19
19
|
|
20
|
-
attr_reader :max_depth
|
20
|
+
attr_reader :max_depth
|
21
|
+
attr_reader :max_width
|
22
|
+
attr_reader :max_collection_depth
|
23
|
+
attr_reader :max_string
|
21
24
|
end
|
22
25
|
|
23
26
|
OBJECT_DUMP_CONFIG_STRICT = ObjectDumpConfig.new 2, 10, 2, 128
|
@@ -37,12 +40,14 @@ module Rookout
|
|
37
40
|
class RubyObjectNamespace < Namespace
|
38
41
|
include RubyObjectSerializer
|
39
42
|
|
40
|
-
def initialize obj, dump_config =
|
43
|
+
def initialize obj, dump_config = nil
|
44
|
+
super()
|
41
45
|
@obj = obj
|
42
|
-
@dump_config = dump_config
|
46
|
+
@dump_config = dump_config || OBJECT_DUMP_CONFIG_DEFAULT
|
43
47
|
end
|
44
48
|
|
45
|
-
attr_reader :obj
|
49
|
+
attr_reader :obj
|
50
|
+
attr_reader :dump_config
|
46
51
|
|
47
52
|
def tailor_limits!
|
48
53
|
if @obj.is_a? String
|
@@ -62,18 +67,11 @@ module Rookout
|
|
62
67
|
end
|
63
68
|
|
64
69
|
def read_key key
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
elsif @obj.is_a? Hash
|
71
|
-
return RubyObjectNamespace.new @obj[key] if @obj.key? key
|
72
|
-
return RubyObjectNamespace.new @obj[key.to_sym] if @obj.key? key.to_s.to_sym
|
73
|
-
|
74
|
-
@obj.each { |it, value| return RubyObjectNamespace.new value if it.to_s == key }
|
75
|
-
|
76
|
-
raise Exceptions::RookKeyNotFound, key
|
70
|
+
case @obj
|
71
|
+
when Array, String
|
72
|
+
read_key_as_int key
|
73
|
+
when Hash
|
74
|
+
read_key_from_hash key
|
77
75
|
else
|
78
76
|
raise Exceptions::RookInvalidObjectForAccess.new(@obj.class.to_s, "ReadKey")
|
79
77
|
end
|
@@ -94,6 +92,23 @@ module Rookout
|
|
94
92
|
dump_raw_object @obj, 0, @dump_config, log_object_errors
|
95
93
|
end
|
96
94
|
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def read_key_as_int key
|
99
|
+
key_int = key.to_i
|
100
|
+
return RubyObjectNamespace.new @obj[key_int] if key_int >= 0 && key_int < @obj.length
|
101
|
+
raise Exceptions::RookKeyNotFound, key
|
102
|
+
end
|
103
|
+
|
104
|
+
def read_key_from_hash key
|
105
|
+
return RubyObjectNamespace.new @obj[key] if @obj.key? key
|
106
|
+
return RubyObjectNamespace.new @obj[key.to_sym] if @obj.key? key.to_s.to_sym
|
107
|
+
|
108
|
+
@obj.each { |it, value| return RubyObjectNamespace.new value if it.to_s == key }
|
109
|
+
|
110
|
+
raise Exceptions::RookKeyNotFound, key
|
111
|
+
end
|
97
112
|
end
|
98
113
|
end
|
99
114
|
end
|
@@ -24,6 +24,7 @@ module Rookout
|
|
24
24
|
|
25
25
|
# rubocop:disable Metrics/PerceivedComplexity
|
26
26
|
# rubocop:disable Metrics/CyclomaticComplexity
|
27
|
+
# rubocop:disable Style/ClassEqualityComparison
|
27
28
|
def unsafe_dump_object obj, current_depth, config, log_object_errors
|
28
29
|
variant = create_base_variant obj, current_depth, config, log_object_errors
|
29
30
|
|
@@ -49,7 +50,7 @@ module Rookout
|
|
49
50
|
|
50
51
|
variant
|
51
52
|
end
|
52
|
-
|
53
|
+
# rubocop:enable Style/ClassEqualityComparison
|
53
54
|
# rubocop:enable Metrics/CyclomaticComplexity
|
54
55
|
# rubocop:enable Metrics/PerceivedComplexity
|
55
56
|
|
@@ -83,23 +84,24 @@ module Rookout
|
|
83
84
|
INT64_MAX = (1 << 63) - 1
|
84
85
|
|
85
86
|
def dump_numeric obj, variant
|
86
|
-
|
87
|
+
case obj
|
88
|
+
when true
|
87
89
|
variant.variant_type = :VARIANT_INT
|
88
90
|
variant.int_value = 1
|
89
|
-
|
91
|
+
when false
|
90
92
|
variant.variant_type = :VARIANT_INT
|
91
93
|
variant.int_value = 0
|
92
|
-
|
94
|
+
when Integer
|
93
95
|
dump_integer obj, variant
|
94
|
-
|
96
|
+
when Float
|
95
97
|
variant.variant_type = :VARIANT_DOUBLE
|
96
98
|
variant.double_value = obj.to_f
|
97
|
-
|
99
|
+
when BigDecimal
|
98
100
|
serialized_decimal = obj.to_s
|
99
101
|
variant.variant_type = :VARIANT_STRING
|
100
102
|
variant.string_value = Com::Rookout::Variant::String.new value: serialized_decimal,
|
101
103
|
original_size: serialized_decimal.length
|
102
|
-
|
104
|
+
when Complex
|
103
105
|
variant.variant_type = :VARIANT_COMPLEX
|
104
106
|
variant.complex_value = Com::Rookout::Variant::Complex.new real: obj.real.to_f,
|
105
107
|
imaginary: obj.imaginary.to_f
|
@@ -8,12 +8,15 @@ module Rookout
|
|
8
8
|
|
9
9
|
class TracebackNamespace < Namespace
|
10
10
|
def initialize backtrace, offset, depth
|
11
|
+
super()
|
11
12
|
@backtrace = backtrace
|
12
13
|
@offset = offset
|
13
14
|
@depth = depth
|
14
15
|
end
|
15
16
|
|
16
|
-
attr_reader :backtrace
|
17
|
+
attr_reader :backtrace
|
18
|
+
attr_reader :offset
|
19
|
+
attr_reader :depth
|
17
20
|
|
18
21
|
def read_key key
|
19
22
|
FrameNamespace.new @backtrace[key + @offset]
|
@@ -13,6 +13,8 @@ module Rookout
|
|
13
13
|
|
14
14
|
class ArithmeticPath < Path
|
15
15
|
def initialize path
|
16
|
+
super()
|
17
|
+
|
16
18
|
if path.is_a? Hash
|
17
19
|
path = path["path"] || path[:path]
|
18
20
|
end
|
@@ -20,7 +22,7 @@ module Rookout
|
|
20
22
|
@raw_path = path
|
21
23
|
|
22
24
|
if path.start_with?("NOT(") && path.end_with?(")")
|
23
|
-
@path = path["NOT(".length..-2]
|
25
|
+
@path = path[("NOT(".length)..-2]
|
24
26
|
@negation = true
|
25
27
|
else
|
26
28
|
@path = path
|
@@ -79,6 +79,8 @@ module Rookout
|
|
79
79
|
end
|
80
80
|
|
81
81
|
# rubocop:disable Metrics/AbcSize
|
82
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
83
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
82
84
|
def make_comp_exp _input, _start, _finish, elements
|
83
85
|
# We can assume the following: atom ( opt_ atom )*
|
84
86
|
# the first (which must be) will be simple atom
|
@@ -108,7 +110,7 @@ module Rookout
|
|
108
110
|
flat_elements.each_with_index do |e, index|
|
109
111
|
if e.is_a?(Opt) && e.level == level
|
110
112
|
result = e.execute_operation flat_elements[index - 1], flat_elements[index + 1]
|
111
|
-
flat_elements = flat_elements[0...index - 1] + [result] + flat_elements[index + 2
|
113
|
+
flat_elements = flat_elements[0...index - 1] + [result] + flat_elements[index + 2..]
|
112
114
|
restart_scan = true
|
113
115
|
break
|
114
116
|
end
|
@@ -122,6 +124,8 @@ module Rookout
|
|
122
124
|
|
123
125
|
flat_elements[0]
|
124
126
|
end
|
127
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
128
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
125
129
|
# rubocop:enable Metrics/AbcSize
|
126
130
|
|
127
131
|
def make_opt _input, _start, _finish, elements
|
@@ -50,9 +50,10 @@ module Rookout
|
|
50
50
|
# If it's a dict, scan the keys, compensating for additional abstraction
|
51
51
|
if b.is_a? Hash
|
52
52
|
b.each_key do |key|
|
53
|
-
|
53
|
+
case key
|
54
|
+
when ObjectMarker
|
54
55
|
return true if key.obj == a
|
55
|
-
|
56
|
+
when a
|
56
57
|
return true
|
57
58
|
end
|
58
59
|
end
|
@@ -62,9 +63,10 @@ module Rookout
|
|
62
63
|
# If it's an array, scan the value, compensating for additional abstraction
|
63
64
|
if b.is_a? Array
|
64
65
|
b.each do |value|
|
65
|
-
|
66
|
+
case value
|
67
|
+
when ObjectMarker
|
66
68
|
return true if value.obj == a
|
67
|
-
|
69
|
+
when a
|
68
70
|
return true
|
69
71
|
end
|
70
72
|
end
|
@@ -7,7 +7,11 @@ module Rookout
|
|
7
7
|
require_relative "../../../exceptions"
|
8
8
|
require_relative "../../namespaces/container_namespace"
|
9
9
|
|
10
|
-
|
10
|
+
# rubocop:disable Lint/EmptyClass
|
11
|
+
class Marker
|
12
|
+
# Empty base class
|
13
|
+
end
|
14
|
+
# rubocop:enable Lint/EmptyClass
|
11
15
|
|
12
16
|
class Operation < Marker
|
13
17
|
def read _namespace, _create
|
@@ -21,6 +25,7 @@ module Rookout
|
|
21
25
|
|
22
26
|
class FunctionOperation < Operation
|
23
27
|
def initialize name, args
|
28
|
+
super()
|
24
29
|
@name = name
|
25
30
|
@args = args
|
26
31
|
end
|
@@ -32,6 +37,7 @@ module Rookout
|
|
32
37
|
|
33
38
|
class AttributeOperation < Operation
|
34
39
|
def initialize name
|
40
|
+
super()
|
35
41
|
@name = name
|
36
42
|
end
|
37
43
|
|
@@ -49,6 +55,7 @@ module Rookout
|
|
49
55
|
|
50
56
|
class LookupOperation < Operation
|
51
57
|
def initialize text
|
58
|
+
super()
|
52
59
|
if (text.start_with?("'") && text.end_with?("'")) || (text.start_with?("\"") && text.end_with?("\""))
|
53
60
|
@key = text[1...-1]
|
54
61
|
else
|
@@ -63,11 +70,13 @@ module Rookout
|
|
63
70
|
|
64
71
|
class ObjectMarker < Marker
|
65
72
|
def initialize text, obj
|
73
|
+
super()
|
66
74
|
@text = text
|
67
75
|
@obj = obj
|
68
76
|
end
|
69
77
|
|
70
|
-
attr_reader :text
|
78
|
+
attr_reader :text
|
79
|
+
attr_reader :obj
|
71
80
|
|
72
81
|
def to_s
|
73
82
|
@obj.to_s
|
@@ -136,6 +145,8 @@ module Rookout
|
|
136
145
|
|
137
146
|
class Opt < Marker
|
138
147
|
def initialize opt
|
148
|
+
super()
|
149
|
+
|
139
150
|
@opt = opt
|
140
151
|
@level = nil
|
141
152
|
|
@@ -160,9 +171,8 @@ module Rookout
|
|
160
171
|
return
|
161
172
|
end
|
162
173
|
|
163
|
-
|
164
|
-
raise Exceptions::RookNonPrimitiveObjectType, first_obj.class.to_s
|
165
|
-
PRIMITIVES.include? first_obj.class
|
174
|
+
if !first_obj.nil? && !(PRIMITIVES.include? first_obj.class)
|
175
|
+
raise Exceptions::RookNonPrimitiveObjectType, first_obj.class.to_s
|
166
176
|
end
|
167
177
|
|
168
178
|
return if second_obj.nil?
|
@@ -24,7 +24,9 @@ module Rookout
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
attr_reader :message
|
27
|
+
attr_reader :message
|
28
|
+
attr_reader :exception
|
29
|
+
attr_reader :parameters
|
28
30
|
|
29
31
|
def dumps
|
30
32
|
parameters = NamespaceSerializer.dump Namespaces::RubyObjectNamespace.new(@parameters), false
|
@@ -82,9 +82,10 @@ module Rookout
|
|
82
82
|
private
|
83
83
|
|
84
84
|
def check_version_supported
|
85
|
-
raise Exceptions::
|
85
|
+
raise Exceptions::RookVersionNotSupported.new("platform", RUBY_ENGINE) unless RUBY_ENGINE == "ruby"
|
86
86
|
raise Exceptions::RookVersionNotSupported.new("version", RUBY_VERSION) unless
|
87
|
-
RUBY_VERSION.start_with?("2.7") || RUBY_VERSION.start_with?("2.6")
|
87
|
+
RUBY_VERSION.start_with?("2.7") || RUBY_VERSION.start_with?("2.6") ||
|
88
|
+
RUBY_VERSION.start_with?("3.0") || RUBY_VERSION.start_with?("3.1")
|
88
89
|
end
|
89
90
|
end
|
90
91
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "set"
|
2
|
+
module Rookout
|
3
|
+
class Sanitizer
|
4
|
+
@@blacklisted_properties = Set["labels", "ROOKOUT_LABELS"]
|
5
|
+
|
6
|
+
def self.sanitize_object! obj
|
7
|
+
obj.each_key do |key|
|
8
|
+
if obj[key].is_a?(String) && !@@blacklisted_properties.include?(key.to_s)
|
9
|
+
obj[key] = obj[key].strip
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.sanitize_properties!
|
15
|
+
ENV.each do |key, val|
|
16
|
+
if key.start_with?("ROOKOUT_") && !@@blacklisted_properties.include?(key.to_s)
|
17
|
+
ENV[key] = val.strip
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -11,7 +11,8 @@ module Rookout
|
|
11
11
|
@method = method
|
12
12
|
end
|
13
13
|
|
14
|
-
attr_reader :lineno
|
14
|
+
attr_reader :lineno
|
15
|
+
attr_reader :method
|
15
16
|
end
|
16
17
|
|
17
18
|
class PositionResolver
|
@@ -54,7 +55,7 @@ module Rookout
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def clear_augs
|
57
|
-
@augs.
|
58
|
+
@augs.each_value do |aug_id|
|
58
59
|
remove_aug aug_id
|
59
60
|
end
|
60
61
|
|
@@ -26,7 +26,7 @@ module Rookout
|
|
26
26
|
|
27
27
|
# We add and remove a dummy trace point to re-align the tracing mechanism as a result of some bug in adding
|
28
28
|
# a breakpoint
|
29
|
-
dummy_trace_point = TracePoint.new(:line) {}
|
29
|
+
dummy_trace_point = TracePoint.new(:line) {} # Dummy
|
30
30
|
dummy_trace_point.enable target: position.method, target_line: position.lineno
|
31
31
|
dummy_trace_point.disable
|
32
32
|
|
@@ -53,7 +53,7 @@ module Rookout
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def clear_augs
|
56
|
-
@augs.
|
56
|
+
@augs.each_value do |aug_id|
|
57
57
|
remove_aug aug_id
|
58
58
|
end
|
59
59
|
|
data/lib/rookout/utils.rb
CHANGED
@@ -15,6 +15,12 @@ module Utils
|
|
15
15
|
def time_to_nanoseconds time_obj
|
16
16
|
secs = time_obj.to_i
|
17
17
|
nsecs = time_obj.nsec
|
18
|
-
(10**9) * secs + nsecs
|
18
|
+
((10**9) * secs) + nsecs
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class String
|
23
|
+
def is_number?
|
24
|
+
to_f.to_s == self || to_i.to_s == self
|
19
25
|
end
|
20
26
|
end
|
data/lib/rookout/version.rb
CHANGED
data/lib/rookout.rb
CHANGED