appmap 0.34.5 → 0.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +24 -0
- data/README.md +11 -8
- data/Rakefile +2 -1
- data/appmap.gemspec +2 -1
- data/appmap.yml +1 -7
- data/lib/appmap.rb +2 -2
- data/lib/appmap/class_map.rb +22 -9
- data/lib/appmap/config.rb +55 -25
- data/lib/appmap/event.rb +28 -10
- data/lib/appmap/hook.rb +9 -8
- data/lib/appmap/hook/method.rb +10 -6
- data/lib/appmap/rails/request_handler.rb +88 -0
- data/lib/appmap/rails/sql_handler.rb +10 -2
- data/lib/appmap/railtie.rb +4 -6
- data/lib/appmap/rspec.rb +11 -1
- data/lib/appmap/trace.rb +9 -7
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller4_base_spec.rb +1 -1
- data/spec/abstract_controller_base_spec.rb +6 -0
- data/spec/class_map_spec.rb +36 -0
- data/spec/fixtures/hook/exception_method.rb +44 -0
- data/spec/hook_spec.rb +145 -2
- data/test/cli_test.rb +0 -10
- data/test/expectations/openssl_test_key_sign1.json +55 -0
- data/test/expectations/openssl_test_key_sign2.json +58 -0
- data/test/fixtures/gem_test/Gemfile +6 -0
- data/test/fixtures/gem_test/appmap.yml +3 -0
- data/test/fixtures/gem_test/test/to_param_test.rb +14 -0
- data/test/gem_test.rb +34 -0
- data/test/minitest_test.rb +2 -2
- data/test/openssl_test.rb +10 -165
- metadata +30 -10
- data/.ruby-version +0 -1
- data/lib/appmap/rails/action_handler.rb +0 -91
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.6.2
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'appmap/event'
|
4
|
-
|
5
|
-
module AppMap
|
6
|
-
module Rails
|
7
|
-
module ActionHandler
|
8
|
-
Context = Struct.new(:id, :start_time)
|
9
|
-
|
10
|
-
module ContextKey
|
11
|
-
def context_key
|
12
|
-
"#{HTTPServerRequest.name}#call"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class HTTPServerRequest
|
17
|
-
include ContextKey
|
18
|
-
|
19
|
-
class Call < AppMap::Event::MethodCall
|
20
|
-
attr_accessor :payload
|
21
|
-
|
22
|
-
def initialize(payload)
|
23
|
-
super AppMap::Event.next_id_counter, :call, Thread.current.object_id
|
24
|
-
|
25
|
-
self.payload = payload
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_h
|
29
|
-
super.tap do |h|
|
30
|
-
h[:http_server_request] = {
|
31
|
-
request_method: payload[:method],
|
32
|
-
path_info: payload[:path]
|
33
|
-
}
|
34
|
-
|
35
|
-
params = payload[:params]
|
36
|
-
h[:message] = params.keys.map do |key|
|
37
|
-
val = params[key]
|
38
|
-
{
|
39
|
-
name: key,
|
40
|
-
class: val.class.name,
|
41
|
-
value: self.class.display_string(val),
|
42
|
-
object_id: val.__id__
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def call(_, started, finished, _, payload) # (name, started, finished, unique_id, payload)
|
50
|
-
event = Call.new(payload)
|
51
|
-
Thread.current[context_key] = Context.new(event.id, Time.now)
|
52
|
-
AppMap.tracing.record_event(event)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class HTTPServerResponse
|
57
|
-
include ContextKey
|
58
|
-
|
59
|
-
class Call < AppMap::Event::MethodReturnIgnoreValue
|
60
|
-
attr_accessor :payload
|
61
|
-
|
62
|
-
def initialize(payload, parent_id, elapsed)
|
63
|
-
super AppMap::Event.next_id_counter, :return, Thread.current.object_id
|
64
|
-
|
65
|
-
self.payload = payload
|
66
|
-
self.parent_id = parent_id
|
67
|
-
self.elapsed = elapsed
|
68
|
-
end
|
69
|
-
|
70
|
-
def to_h
|
71
|
-
super.tap do |h|
|
72
|
-
h[:http_server_response] = {
|
73
|
-
status: payload[:status]
|
74
|
-
}
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def call(_, started, finished, _, payload) # (name, started, finished, unique_id, payload)
|
80
|
-
return unless Thread.current[context_key]
|
81
|
-
|
82
|
-
context = Thread.current[context_key]
|
83
|
-
Thread.current[context_key] = nil
|
84
|
-
|
85
|
-
event = Call.new(payload, context.id, Time.now - context.start_time)
|
86
|
-
AppMap.tracing.record_event(event)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|