appmap 0.34.4 → 0.36.0
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/CHANGELOG.md +24 -0
- data/README.md +11 -0
- data/Rakefile +1 -1
- data/appmap.gemspec +1 -1
- data/appmap.yml +1 -7
- data/ext/appmap/appmap.c +63 -4
- data/lib/appmap.rb +1 -1
- data/lib/appmap/class_map.rb +6 -7
- data/lib/appmap/config.rb +55 -25
- data/lib/appmap/event.rb +28 -10
- data/lib/appmap/hook.rb +12 -8
- data/lib/appmap/hook/method.rb +35 -28
- 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 +10 -0
- data/lib/appmap/trace.rb +9 -7
- data/lib/appmap/util.rb +1 -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/exception_method.rb +44 -0
- data/spec/hook_spec.rb +135 -2
- data/test/cli_test.rb +0 -10
- 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 +1 -49
- metadata +13 -10
- data/.ruby-version +0 -1
- 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
|
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'appmap/minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'active_support'
|
7
|
+
require 'active_support/core_ext'
|
8
|
+
|
9
|
+
class ToParamTest < ::Minitest::Test
|
10
|
+
def test_to_param
|
11
|
+
# record use of a core extension
|
12
|
+
assert_equal 'my+id', 'my+id'.to_param
|
13
|
+
end
|
14
|
+
end
|
data/test/gem_test.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
require 'English'
|
6
|
+
|
7
|
+
class MinitestTest < Minitest::Test
|
8
|
+
def perform_gem_test(test_name)
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
Dir.chdir 'test/fixtures/gem_test' do
|
11
|
+
FileUtils.rm_rf 'tmp'
|
12
|
+
system 'bundle config --local local.appmap ../../..'
|
13
|
+
system 'bundle'
|
14
|
+
system({ 'APPMAP' => 'true' }, %(bundle exec ruby -Ilib -Itest test/#{test_name}_test.rb))
|
15
|
+
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_record_gem
|
22
|
+
perform_gem_test 'to_param' do
|
23
|
+
appmap_file = 'tmp/appmap/minitest/To_param_to_param.appmap.json'
|
24
|
+
appmap = JSON.parse(File.read(appmap_file))
|
25
|
+
events = appmap['events']
|
26
|
+
assert_equal 2, events.size
|
27
|
+
assert_equal 'call', events.first['event']
|
28
|
+
assert_equal 'to_param', events.first['method_id']
|
29
|
+
assert_equal "#{Gem.loaded_specs['activesupport'].gem_dir}/lib/active_support/core_ext/object/to_query.rb", events.first['path']
|
30
|
+
assert_equal 'return', events.second['event']
|
31
|
+
assert_equal 1, events.second['parent_id']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/test/minitest_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
require 'English'
|
6
6
|
|
7
7
|
class MinitestTest < Minitest::Test
|
8
|
-
def
|
8
|
+
def perform_minitest_test(test_name)
|
9
9
|
Bundler.with_clean_env do
|
10
10
|
Dir.chdir 'test/fixtures/minitest_recorder' do
|
11
11
|
FileUtils.rm_rf 'tmp'
|
@@ -19,7 +19,7 @@ class MinitestTest < Minitest::Test
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_hello
|
22
|
-
|
22
|
+
perform_minitest_test 'hello' do
|
23
23
|
appmap_file = 'tmp/appmap/minitest/Hello_hello.appmap.json'
|
24
24
|
|
25
25
|
assert File.file?(appmap_file), 'appmap output file does not exist'
|
data/test/openssl_test.rb
CHANGED
@@ -11,7 +11,7 @@ class OpenSSLTest < Minitest::Test
|
|
11
11
|
FileUtils.rm_rf 'tmp'
|
12
12
|
system 'bundle config --local local.appmap ../../..'
|
13
13
|
system 'bundle'
|
14
|
-
system({ 'APPMAP' => 'true'
|
14
|
+
system({ 'APPMAP' => 'true' }, %(bundle exec ruby lib/openssl_#{test_name}.rb))
|
15
15
|
|
16
16
|
yield
|
17
17
|
end
|
@@ -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.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -84,14 +84,14 @@ dependencies:
|
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.16'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.16'
|
97
97
|
- !ruby/object:Gem::Dependency
|
@@ -290,7 +290,7 @@ dependencies:
|
|
290
290
|
- - ">="
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
|
-
description:
|
293
|
+
description:
|
294
294
|
email:
|
295
295
|
- kgilpin@gmail.com
|
296
296
|
executables:
|
@@ -303,7 +303,6 @@ files:
|
|
303
303
|
- ".gitignore"
|
304
304
|
- ".rbenv-gemsets"
|
305
305
|
- ".rubocop.yml"
|
306
|
-
- ".ruby-version"
|
307
306
|
- ".travis.yml"
|
308
307
|
- CHANGELOG.md
|
309
308
|
- Dockerfile.appmap
|
@@ -338,7 +337,7 @@ files:
|
|
338
337
|
- lib/appmap/middleware/remote_recording.rb
|
339
338
|
- lib/appmap/minitest.rb
|
340
339
|
- lib/appmap/open.rb
|
341
|
-
- lib/appmap/rails/
|
340
|
+
- lib/appmap/rails/request_handler.rb
|
342
341
|
- lib/appmap/rails/sql_handler.rb
|
343
342
|
- lib/appmap/railtie.rb
|
344
343
|
- lib/appmap/record.rb
|
@@ -545,6 +544,9 @@ files:
|
|
545
544
|
- test/fixtures/cucumber_recorder/features/support/hooks.rb
|
546
545
|
- test/fixtures/cucumber_recorder/features/support/steps.rb
|
547
546
|
- test/fixtures/cucumber_recorder/lib/hello.rb
|
547
|
+
- test/fixtures/gem_test/Gemfile
|
548
|
+
- test/fixtures/gem_test/appmap.yml
|
549
|
+
- test/fixtures/gem_test/test/to_param_test.rb
|
548
550
|
- test/fixtures/minitest_recorder/Gemfile
|
549
551
|
- test/fixtures/minitest_recorder/appmap.yml
|
550
552
|
- test/fixtures/minitest_recorder/lib/hello.rb
|
@@ -562,6 +564,7 @@ files:
|
|
562
564
|
- test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb
|
563
565
|
- test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb
|
564
566
|
- test/fixtures/rspec_recorder/spec/plain_hello_spec.rb
|
567
|
+
- test/gem_test.rb
|
565
568
|
- test/minitest_test.rb
|
566
569
|
- test/openssl_test.rb
|
567
570
|
- test/record_process_test.rb
|
@@ -571,7 +574,7 @@ homepage: https://github.com/applandinc/appmap-ruby
|
|
571
574
|
licenses:
|
572
575
|
- MIT
|
573
576
|
metadata: {}
|
574
|
-
post_install_message:
|
577
|
+
post_install_message:
|
575
578
|
rdoc_options: []
|
576
579
|
require_paths:
|
577
580
|
- lib
|
@@ -587,7 +590,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
587
590
|
version: '0'
|
588
591
|
requirements: []
|
589
592
|
rubygems_version: 3.0.3
|
590
|
-
signing_key:
|
593
|
+
signing_key:
|
591
594
|
specification_version: 4
|
592
595
|
summary: Record the operation of a Ruby program, using the AppLand 'AppMap' format.
|
593
596
|
test_files: []
|
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
|