appmap 0.48.1 → 0.48.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 698da91c88a89867584e3d78e10974a4a2f8d726636d60366c214be9e3ddbf97
4
- data.tar.gz: eee0b62c442eecc5cf978960128c0b19ff2ebdc393770d8cefc820c82a451d4f
3
+ metadata.gz: 455ac48f4acf31694cb571912703f62b95687b8b833be0ced7b8ab5008c3960b
4
+ data.tar.gz: 272c68f804affe1a461ec504475b95d1c7968e506644442437a45dd28ff7d664
5
5
  SHA512:
6
- metadata.gz: 77ae4b055912a7bd6f62f32bb2db7d3684d614453fb82bb7d8f53496181919609ca2af0a65906ca36f1f28aaf28e06c64d6f5e6326b8f384f4c1206c22af559a
7
- data.tar.gz: a72831c1908beb0130b4797ea5455b976677caec810edcdf0009b9be609ba6510a59873b66ca4df5406fe8f3e5aea995d8dabc983573517adc67fdf86cad822a
6
+ metadata.gz: 3bfbb562490380393c669aaeb2813389a52bf18f8e769f69a496ffe9fc26a493d9f55cfa161926d26deca370b1e18f99896eb0e269e59cbd6647801b7238c565
7
+ data.tar.gz: ba4b69852fc4be1850b5fd20c713e21799848bd32a251cdcc3bae87e4bf25605621dccc381e32018397ff52bbc442859065d8f1d8313211c135c1a9fb3ecb6d7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.48.2](https://github.com/applandinc/appmap-ruby/compare/v0.48.1...v0.48.2) (2021-05-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Correct the method-hooking logic to capture some missing model methods ([be529bd](https://github.com/applandinc/appmap-ruby/commit/be529bdce7d4fdf9f1a2fdd32259d792f29f4f13))
7
+
1
8
  ## [0.48.1](https://github.com/applandinc/appmap-ruby/compare/v0.48.0...v0.48.1) (2021-05-25)
2
9
 
3
10
 
data/README.md CHANGED
@@ -311,10 +311,10 @@ end
311
311
 
312
312
  2. (optional) Download and unpack the [AppLand browser extension](https://github.com/applandinc/appland-browser-extension). Install into Chrome using `chrome://extensions/`. Turn on "Developer Mode" and then load the extension using the "Load unpacked" button.
313
313
 
314
- 3. Start your Rails application server, with `APPMAP_RECORD=true`. For example:
314
+ 3. Start your Rails application server, with `APPMAP=true`. For example:
315
315
 
316
316
  ```sh-session
317
- $ APPMAP_RECORD=true bundle exec rails server
317
+ $ APPMAP=true bundle exec rails server
318
318
  ```
319
319
 
320
320
  4. Start the recording
data/lib/appmap/hook.rb CHANGED
@@ -36,7 +36,7 @@ module AppMap
36
36
 
37
37
  def initialize(config)
38
38
  @config = config
39
- @trace_locations = []
39
+ @trace_enabled = []
40
40
  # Paths that are known to be non-tracing
41
41
  @notrace_paths = Set.new
42
42
  end
@@ -47,10 +47,8 @@ module AppMap
47
47
 
48
48
  hook_builtins
49
49
 
50
- @trace_begin = TracePoint.new(:class, &method(:trace_class))
51
50
  @trace_end = TracePoint.new(:end, &method(:trace_end))
52
-
53
- @trace_begin.enable(&block)
51
+ @trace_end.enable(&block)
54
52
  end
55
53
 
56
54
  # hook_builtins builds hooks for code that is built in to the Ruby standard library.
@@ -96,29 +94,22 @@ module AppMap
96
94
 
97
95
  protected
98
96
 
99
- def trace_class(trace_point)
100
- path = trace_point.path
101
-
102
- return if @notrace_paths.member?(path)
103
-
104
- if config.path_enabled?(path)
105
- location = trace_location(trace_point)
106
- warn "Entering hook-enabled location #{location}" if Hook::LOG || Hook::LOG_HOOK
107
- @trace_locations << location
108
- unless @trace_end.enabled?
109
- warn "Enabling hooking" if Hook::LOG || Hook::LOG_HOOK
110
- @trace_end.enable
111
- end
112
- else
113
- @notrace_paths << path
114
- end
115
- end
116
-
117
97
  def trace_location(trace_point)
118
98
  [ trace_point.path, trace_point.lineno ].join(':')
119
99
  end
120
100
 
121
101
  def trace_end(trace_point)
102
+ location = trace_location(trace_point)
103
+ warn "Class or module ends at location #{trace_location(trace_point)}" if Hook::LOG || Hook::LOG_HOOK
104
+
105
+ path = trace_point.path
106
+ enabled = !@notrace_paths.member?(path) && config.path_enabled?(path)
107
+ if !enabled
108
+ warn "Not hooking - path is not enabled" if Hook::LOG || Hook::LOG_HOOK
109
+ @notrace_paths << path
110
+ return
111
+ end
112
+
122
113
  cls = trace_point.self
123
114
 
124
115
  instance_methods = cls.public_instance_methods(false) - OBJECT_INSTANCE_METHODS
@@ -151,7 +142,8 @@ module AppMap
151
142
  warn "AppMap: Examining #{hook_cls} #{method.name}" if LOG
152
143
 
153
144
  disasm = RubyVM::InstructionSequence.disasm(method)
154
- # Skip methods that have no instruction sequence, as they are obviously trivial.
145
+ # Skip methods that have no instruction sequence, as they are either have no body or they are or native.
146
+ # TODO: Figure out how to tell the difference?
155
147
  next unless disasm
156
148
 
157
149
  package = config.lookup_package(hook_cls, method)
@@ -170,13 +162,6 @@ module AppMap
170
162
  # uninitialized constant Faraday::Connection
171
163
  warn "NameError in #{__FILE__}: #{$!.message}"
172
164
  end
173
-
174
- location = @trace_locations.pop
175
- warn "Leaving hook-enabled location #{location}" if Hook::LOG || Hook::LOG_HOOK
176
- if @trace_locations.empty?
177
- warn "Disabling hooking" if Hook::LOG || Hook::LOG_HOOK
178
- @trace_end.disable
179
- end
180
165
  end
181
166
  end
182
167
  end
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.48.1'
6
+ VERSION = '0.48.2'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
  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.48.1
4
+ version: 0.48.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport