appmap 0.34.1 → 0.35.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/.gitignore +1 -1
- data/.rbenv-gemsets +1 -0
- data/CHANGELOG.md +29 -0
- data/README.md +17 -2
- data/Rakefile +10 -3
- data/appmap.gemspec +4 -0
- data/ext/appmap/appmap.c +95 -0
- data/ext/appmap/extconf.rb +6 -0
- data/lib/appmap.rb +4 -1
- data/lib/appmap/class_map.rb +5 -6
- data/lib/appmap/config.rb +2 -4
- data/lib/appmap/event.rb +28 -10
- data/lib/appmap/hook.rb +14 -21
- data/lib/appmap/hook/method.rb +53 -26
- data/lib/appmap/rails/request_handler.rb +88 -0
- data/lib/appmap/rails/sql_handler.rb +13 -10
- data/lib/appmap/railtie.rb +3 -5
- data/lib/appmap/rspec.rb +10 -0
- data/lib/appmap/trace.rb +9 -7
- data/lib/appmap/util.rb +18 -1
- data/lib/appmap/version.rb +1 -1
- data/spec/abstract_controller4_base_spec.rb +1 -1
- data/spec/abstract_controller_base_spec.rb +6 -0
- data/spec/fixtures/hook/singleton_method.rb +21 -12
- data/spec/hook_spec.rb +49 -8
- data/test/cli_test.rb +0 -10
- data/test/openssl_test.rb +0 -48
- metadata +36 -4
- data/lib/appmap/rails/action_handler.rb +0 -91
data/test/cli_test.rb
CHANGED
@@ -56,12 +56,10 @@ class CLITest < Minitest::Test
|
|
56
56
|
Class frequency:
|
57
57
|
----------------
|
58
58
|
1 Main
|
59
|
-
1 IO
|
60
59
|
|
61
60
|
Method frequency:
|
62
61
|
----------------
|
63
62
|
1 Main.say_hello
|
64
|
-
1 IO#write
|
65
63
|
OUTPUT
|
66
64
|
end
|
67
65
|
|
@@ -82,20 +80,12 @@ class CLITest < Minitest::Test
|
|
82
80
|
{
|
83
81
|
"name": "Main",
|
84
82
|
"count": 1
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"name": "IO",
|
88
|
-
"count": 1
|
89
83
|
}
|
90
84
|
],
|
91
85
|
"method_frequency": [
|
92
86
|
{
|
93
87
|
"name": "Main.say_hello",
|
94
88
|
"count": 1
|
95
|
-
},
|
96
|
-
{
|
97
|
-
"name": "IO#write",
|
98
|
-
"count": 1
|
99
89
|
}
|
100
90
|
]
|
101
91
|
}
|
data/test/openssl_test.rb
CHANGED
@@ -79,27 +79,6 @@ class OpenSSLTest < Minitest::Test
|
|
79
79
|
]
|
80
80
|
}
|
81
81
|
]
|
82
|
-
},
|
83
|
-
{
|
84
|
-
"name": "io",
|
85
|
-
"type": "package",
|
86
|
-
"children": [
|
87
|
-
{
|
88
|
-
"name": "IO",
|
89
|
-
"type": "class",
|
90
|
-
"children": [
|
91
|
-
{
|
92
|
-
"name": "write",
|
93
|
-
"type": "function",
|
94
|
-
"location": "IO#write",
|
95
|
-
"static": false,
|
96
|
-
"labels": [
|
97
|
-
"io"
|
98
|
-
]
|
99
|
-
}
|
100
|
-
]
|
101
|
-
}
|
102
|
-
]
|
103
82
|
}
|
104
83
|
]
|
105
84
|
JSON
|
@@ -167,33 +146,6 @@ class OpenSSLTest < Minitest::Test
|
|
167
146
|
"return_value": {
|
168
147
|
"class": "String"
|
169
148
|
}
|
170
|
-
},
|
171
|
-
{
|
172
|
-
"id": 5,
|
173
|
-
"event": "call",
|
174
|
-
"defined_class": "IO",
|
175
|
-
"method_id": "write",
|
176
|
-
"path": "IO#write",
|
177
|
-
"static": false,
|
178
|
-
"parameters": [
|
179
|
-
{
|
180
|
-
"name": "arg",
|
181
|
-
"class": "String",
|
182
|
-
"value": "Computed signature",
|
183
|
-
"kind": "rest"
|
184
|
-
}
|
185
|
-
],
|
186
|
-
"receiver": {
|
187
|
-
"class": "IO"
|
188
|
-
}
|
189
|
-
},
|
190
|
-
{
|
191
|
-
"id": 6,
|
192
|
-
"event": "return",
|
193
|
-
"parent_id": 5,
|
194
|
-
"return_value": {
|
195
|
-
"class": "Integer"
|
196
|
-
}
|
197
149
|
}
|
198
150
|
]
|
199
151
|
JSON
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.35.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake-compiler
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: climate_control
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,16 +276,32 @@ dependencies:
|
|
262
276
|
- - ">="
|
263
277
|
- !ruby/object:Gem::Version
|
264
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: hashie
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
265
293
|
description:
|
266
294
|
email:
|
267
295
|
- kgilpin@gmail.com
|
268
296
|
executables:
|
269
297
|
- appmap
|
270
|
-
extensions:
|
298
|
+
extensions:
|
299
|
+
- ext/appmap/extconf.rb
|
271
300
|
extra_rdoc_files: []
|
272
301
|
files:
|
273
302
|
- ".dockerignore"
|
274
303
|
- ".gitignore"
|
304
|
+
- ".rbenv-gemsets"
|
275
305
|
- ".rubocop.yml"
|
276
306
|
- ".ruby-version"
|
277
307
|
- ".travis.yml"
|
@@ -291,6 +321,8 @@ files:
|
|
291
321
|
- examples/mock_webapp/lib/mock_webapp/request.rb
|
292
322
|
- examples/mock_webapp/lib/mock_webapp/user.rb
|
293
323
|
- exe/appmap
|
324
|
+
- ext/appmap/appmap.c
|
325
|
+
- ext/appmap/extconf.rb
|
294
326
|
- lib/appmap.rb
|
295
327
|
- lib/appmap/algorithm/prune_class_map.rb
|
296
328
|
- lib/appmap/algorithm/stats.rb
|
@@ -306,7 +338,7 @@ files:
|
|
306
338
|
- lib/appmap/middleware/remote_recording.rb
|
307
339
|
- lib/appmap/minitest.rb
|
308
340
|
- lib/appmap/open.rb
|
309
|
-
- lib/appmap/rails/
|
341
|
+
- lib/appmap/rails/request_handler.rb
|
310
342
|
- lib/appmap/rails/sql_handler.rb
|
311
343
|
- lib/appmap/railtie.rb
|
312
344
|
- lib/appmap/record.rb
|
@@ -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
|