appmap 0.41.0 → 0.41.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +21 -0
- data/lib/appmap/config.rb +6 -2
- data/lib/appmap/event.rb +14 -4
- data/lib/appmap/version.rb +1 -1
- data/test/fixtures/gem_test/appmap.yml +1 -1
- data/test/fixtures/gem_test/test/parser_test.rb +12 -0
- data/test/gem_test.rb +4 -4
- metadata +3 -3
- data/test/fixtures/gem_test/test/to_param_test.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75523ebe41aa8e327db7ff2acc4fa20bf1283474b97baf6610e11292bb1abb8b
|
4
|
+
data.tar.gz: 1c0293cf928ff1f6615d7f0a72a6ba7a03acdee04d00065ffc4a0eb41e0192ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a39d8067f455a1c0179c65a7f17ffd041de405bc3c48be567970e2b987765216a33801e7c486c6aeee66cae5c2291f91196c3132bd9ad65d147617f6282468
|
7
|
+
data.tar.gz: bdc24d37f171945127c2ff67c834fa55932c019dbbe5e74a2f1625d11b12ca881e6a2d0c6419c0ffe625bba3295b5ef2ef1e96d6256f152ca7fbaa3d2a99b52d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# v0.41.1
|
2
|
+
|
3
|
+
* Make best effort to ensure that class name is not `null` in the appmap.json.
|
4
|
+
* Don't try and instrument gems which are a dependency of the this gem.
|
5
|
+
* Fix a nil exception when applying the exclude list to builtins.
|
6
|
+
|
1
7
|
# v0.41.0
|
2
8
|
|
3
9
|
* Adjust some label names to match `provider.*`, `format.*`.
|
data/README.md
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
- [Minitest](#minitest)
|
10
10
|
- [Cucumber](#cucumber)
|
11
11
|
- [Remote recording](#remote-recording)
|
12
|
+
- [Server process recording](#server-process-recording)
|
12
13
|
- [AppMap for VSCode](#appmap-for-vscode)
|
13
14
|
- [Uploading AppMaps](#uploading-appmaps)
|
14
15
|
- [Development](#development)
|
@@ -306,6 +307,26 @@ $ bundle exec rails server
|
|
306
307
|
|
307
308
|
6. Open the AppLand browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
|
308
309
|
|
310
|
+
## Server process recording
|
311
|
+
|
312
|
+
Add this line to *configuration.rb*:
|
313
|
+
|
314
|
+
```ruby
|
315
|
+
module MyApp
|
316
|
+
class Application < Rails::Application
|
317
|
+
...
|
318
|
+
|
319
|
+
config.appmap.enabled = true if ENV['APPMAP_RECORD']
|
320
|
+
|
321
|
+
...
|
322
|
+
end
|
323
|
+
end
|
324
|
+
```
|
325
|
+
|
326
|
+
With this setting, you can run your Rails server with `APPMAP_RECORD=true`. When the server exits, an *appmap.json* file will be written to the project directory. This is a great way to start the server, interact with your app as a user (or through it's API), and then view an AppMap of everything that happened.
|
327
|
+
|
328
|
+
Be sure and set `WEB_CONCURRENCY=1`, if you are using a webserver that can run multiple processes. You only want there to be one process while you are recording, otherwise they will both try and write *appmap.json* and one of them will clobber the other.
|
329
|
+
|
309
330
|
# AppMap for VSCode
|
310
331
|
|
311
332
|
The [AppMap extension for VSCode](https://marketplace.visualstudio.com/items?itemName=appland.appmap) is a great way to onboard developers to new code, and troubleshoot hard-to-understand bugs with visuals.
|
data/lib/appmap/config.rb
CHANGED
@@ -16,6 +16,10 @@ module AppMap
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def build_from_gem(gem, shallow: true, package_name: nil, exclude: [], labels: [])
|
19
|
+
if %w[method_source activesupport].member?(gem)
|
20
|
+
warn "WARNING: #{gem} cannot be AppMapped because it is a dependency of the appmap gem"
|
21
|
+
return
|
22
|
+
end
|
19
23
|
gem_paths(gem).map do |gem_path|
|
20
24
|
Package.new(gem_path, gem, package_name, exclude, labels, shallow)
|
21
25
|
end
|
@@ -107,7 +111,7 @@ module AppMap
|
|
107
111
|
else
|
108
112
|
[ Package.build_from_path(path, exclude: package['exclude'] || [], shallow: package['shallow']) ]
|
109
113
|
end
|
110
|
-
end.flatten
|
114
|
+
end.flatten.compact
|
111
115
|
Config.new config_data['name'], packages, config_data['exclude'] || []
|
112
116
|
end
|
113
117
|
end
|
@@ -137,7 +141,7 @@ module AppMap
|
|
137
141
|
return unless location_file
|
138
142
|
|
139
143
|
location_file = location_file[Dir.pwd.length + 1..-1] if location_file.index(Dir.pwd) == 0
|
140
|
-
packages.find do |pkg|
|
144
|
+
packages.select { |pkg| pkg.path }.find do |pkg|
|
141
145
|
(location_file.index(pkg.path) == 0) &&
|
142
146
|
!pkg.exclude.find { |p| location_file.index(p) }
|
143
147
|
end
|
data/lib/appmap/event.rb
CHANGED
@@ -38,6 +38,15 @@ module AppMap
|
|
38
38
|
|
39
39
|
protected
|
40
40
|
|
41
|
+
# Heuristic for dynamically defined class whose name can be nil
|
42
|
+
def best_class_name(value)
|
43
|
+
value_cls = value.class
|
44
|
+
while value_cls.name.nil?
|
45
|
+
value_cls = value_cls.superclass
|
46
|
+
end
|
47
|
+
value_cls.name
|
48
|
+
end
|
49
|
+
|
41
50
|
def custom_display_string(value)
|
42
51
|
case value
|
43
52
|
when File
|
@@ -77,6 +86,7 @@ module AppMap
|
|
77
86
|
|
78
87
|
class << self
|
79
88
|
def build_from_invocation(mc = MethodCall.new, defined_class, method, receiver, arguments)
|
89
|
+
defined_class ||= 'Class'
|
80
90
|
mc.tap do
|
81
91
|
static = receiver.is_a?(Module)
|
82
92
|
mc.defined_class = defined_class
|
@@ -110,14 +120,14 @@ module AppMap
|
|
110
120
|
end
|
111
121
|
{
|
112
122
|
name: param_name,
|
113
|
-
class: value
|
123
|
+
class: best_class_name(value),
|
114
124
|
object_id: value.__id__,
|
115
125
|
value: display_string(value),
|
116
126
|
kind: param_type
|
117
127
|
}
|
118
128
|
end
|
119
129
|
mc.receiver = {
|
120
|
-
class: receiver
|
130
|
+
class: best_class_name(receiver),
|
121
131
|
object_id: receiver.__id__,
|
122
132
|
value: display_string(receiver)
|
123
133
|
}
|
@@ -172,7 +182,7 @@ module AppMap
|
|
172
182
|
mr.tap do |_|
|
173
183
|
if return_value
|
174
184
|
mr.return_value = {
|
175
|
-
class: return_value
|
185
|
+
class: best_class_name(return_value),
|
176
186
|
value: display_string(return_value),
|
177
187
|
object_id: return_value.__id__
|
178
188
|
}
|
@@ -183,7 +193,7 @@ module AppMap
|
|
183
193
|
while next_exception
|
184
194
|
exception_backtrace = next_exception.backtrace_locations.try(:[], 0)
|
185
195
|
exceptions << {
|
186
|
-
class: next_exception
|
196
|
+
class: best_class_name(next_exception),
|
187
197
|
message: next_exception.message,
|
188
198
|
object_id: next_exception.__id__,
|
189
199
|
path: exception_backtrace&.path,
|
data/lib/appmap/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'appmap/minitest'
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require 'parser/current'
|
7
|
+
|
8
|
+
class ParserTest < ::Minitest::Test
|
9
|
+
def test_parser
|
10
|
+
Parser::CurrentRuby.parse(File.read(__FILE__))
|
11
|
+
end
|
12
|
+
end
|
data/test/gem_test.rb
CHANGED
@@ -19,14 +19,14 @@ class MinitestTest < Minitest::Test
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_record_gem
|
22
|
-
perform_gem_test '
|
23
|
-
appmap_file = 'tmp/appmap/minitest/
|
22
|
+
perform_gem_test 'parser' do
|
23
|
+
appmap_file = 'tmp/appmap/minitest/Parser_parser.appmap.json'
|
24
24
|
appmap = JSON.parse(File.read(appmap_file))
|
25
25
|
events = appmap['events']
|
26
26
|
assert_equal 2, events.size
|
27
27
|
assert_equal 'call', events.first['event']
|
28
|
-
assert_equal '
|
29
|
-
assert_equal "#{Gem.loaded_specs['
|
28
|
+
assert_equal 'default_parser', events.first['method_id']
|
29
|
+
assert_equal "#{Gem.loaded_specs['parser'].gem_dir}/lib/parser/base.rb", events.first['path']
|
30
30
|
assert_equal 'return', events.second['event']
|
31
31
|
assert_equal 1, events.second['parent_id']
|
32
32
|
end
|
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.41.
|
4
|
+
version: 0.41.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: 2021-02-
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -573,7 +573,7 @@ files:
|
|
573
573
|
- test/fixtures/cucumber_recorder/lib/hello.rb
|
574
574
|
- test/fixtures/gem_test/Gemfile
|
575
575
|
- test/fixtures/gem_test/appmap.yml
|
576
|
-
- test/fixtures/gem_test/test/
|
576
|
+
- test/fixtures/gem_test/test/parser_test.rb
|
577
577
|
- test/fixtures/minitest_recorder/Gemfile
|
578
578
|
- test/fixtures/minitest_recorder/appmap.yml
|
579
579
|
- test/fixtures/minitest_recorder/lib/hello.rb
|
@@ -1,14 +0,0 @@
|
|
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
|