chaos_detector 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chaos_detector/tracker.rb +36 -13
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a48c248ec02d045966d0e5ed5fafdab7c59989a9949c36b2757d571fa04e3e
|
4
|
+
data.tar.gz: cb67f69b6f8c7d1a6c07563e89a8d9b153c8b5c5b9ce8745b0830e898b7ad618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60a4d7e0c3cac8956c4eed8323917d51f8fc209bddcf5d14b4ac79af9e30e4cf6a9d05239821ac56518750e82c75cb6485c12a019c3eb831329a35f341171ac6
|
7
|
+
data.tar.gz: e6dcb825c4cfe0bef110c175fb0ee0d54e7180a3d8968cf44a4fdda7ac7a96345ef097114d4364240853facc430924aa4947fb5184322aa2f105a11e2a12c576
|
@@ -45,19 +45,39 @@ module ChaosDetector
|
|
45
45
|
tp_path = tracepoint.path
|
46
46
|
next if full_path_skip?(tp_path)
|
47
47
|
|
48
|
+
# puts("Tracepoint: #{tracepoint.inspect}")
|
49
|
+
# log_mod_details(tracepoint)
|
50
|
+
|
48
51
|
tp_class = tracepoint.defined_class
|
52
|
+
tp_event = tracepoint.event
|
53
|
+
|
54
|
+
fn_name = tracepoint.callee_id.to_s
|
55
|
+
fn_line = tracepoint.lineno
|
56
|
+
fn_path = localize_path(tp_path)
|
57
|
+
binding_info = tracepoint.self.send(:class)&.name
|
58
|
+
caller_locations = tracepoint.self.send(:caller_locations)
|
49
59
|
|
50
60
|
# trace_mod_details(tracepoint)
|
51
|
-
|
52
|
-
|
53
|
-
|
61
|
+
tracepoint.disable do
|
62
|
+
mod_info = mod_info_at(tp_class, mod_full_path: tp_path)
|
63
|
+
# puts "mod_info: #{mod_info} #{tp_class.respond_to?(:superclass) && tp_class.superclass}"
|
64
|
+
next unless mod_info
|
54
65
|
|
55
|
-
fn_info = fn_info_at(tracepoint)
|
56
|
-
e = tracepoint.event
|
57
|
-
@trace.disable do
|
58
66
|
@total_traces += 1
|
59
|
-
|
60
|
-
|
67
|
+
fn_info = fn_info_at(fn_name, fn_line: fn_line, fn_path: fn_path)
|
68
|
+
caller_info = extract_caller(caller_locations: caller_locations, fn_info: fn_info)
|
69
|
+
write_event_frame(tp_event, fn_info: fn_info, mod_info: mod_info, caller_info: caller_info)
|
70
|
+
|
71
|
+
if tp_event==:call
|
72
|
+
puts('<' * 50)
|
73
|
+
puts("Binding: #{binding_info}")
|
74
|
+
puts("Module: #{mod_info}")
|
75
|
+
puts("Function: #{fn_info}")
|
76
|
+
puts("Caller: #{caller_info.inspect}") if caller_info
|
77
|
+
puts('>' * 50)
|
78
|
+
puts
|
79
|
+
end
|
80
|
+
|
61
81
|
|
62
82
|
# Detect superclass association:
|
63
83
|
ChaosUtils.with(superclass_mod_info(tp_class)) do |super_mod_info|
|
@@ -139,9 +159,8 @@ module ChaosDetector
|
|
139
159
|
@app_root_path = ChaosUtils.with(@options.app_root_path) { |p| Pathname.new(p)&.to_s}
|
140
160
|
end
|
141
161
|
|
142
|
-
def extract_caller(
|
143
|
-
callers =
|
144
|
-
callers = callers.select do |bt|
|
162
|
+
def extract_caller(caller_locations:, fn_info:)
|
163
|
+
callers = caller_locations.select do |bt|
|
145
164
|
!full_path_skip?(bt.absolute_path) &&
|
146
165
|
ChaosUtils.aught?(bt.base_label) &&
|
147
166
|
!bt.base_label.start_with?('<')
|
@@ -195,8 +214,12 @@ module ChaosDetector
|
|
195
214
|
end
|
196
215
|
end
|
197
216
|
|
198
|
-
def fn_info_at(
|
199
|
-
ChaosDetector::Stacker::FnInfo.new(
|
217
|
+
def fn_info_at(fn_name, fn_line:, fn_path:)
|
218
|
+
ChaosDetector::Stacker::FnInfo.new(
|
219
|
+
fn_name: fn_name,
|
220
|
+
fn_line: fn_line,
|
221
|
+
fn_path: fn_path,
|
222
|
+
)
|
200
223
|
end
|
201
224
|
|
202
225
|
# TODO: MAKE more LIKE module_skip below:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chaos_detector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Miers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -80,7 +80,8 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.20.3
|
83
|
-
description:
|
83
|
+
description: Infer and discover and graph dependencies for ruby and RoR apps during
|
84
|
+
EXECUTION
|
84
85
|
email: steven.miers@gmail.com
|
85
86
|
executables:
|
86
87
|
- detect_chaos
|