appmap 0.85.0 → 0.88.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 +26 -0
- data/lib/appmap/handler/rails/request_handler.rb +42 -2
- data/lib/appmap/hook.rb +10 -9
- data/lib/appmap/railtie.rb +9 -1
- data/lib/appmap/rspec.rb +8 -2
- data/lib/appmap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22745bf509f674a271a3bc42eb870813cf22d6e0c399a87e99377311a0ddaf67
|
4
|
+
data.tar.gz: 482036f94bc62a732263ac7318e6c942efd22282d9b2ace1ae1245bda28de591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd9fe2dc676c639487b19c5ad4c10e52d8dd1ff95ef10f0829077fc6a4100613d220df7bb8aea5c425e65158617112148827136bc2151cfd8e0a13666e49c347
|
7
|
+
data.tar.gz: 5913ce200514ce676f26a6bf20e348fe9481ecd929ac9b8a5874b9f2e2d20d3bdc82722a535afebe7a153c7a7290ccf8e8e510a336f0b5d7265b6b3665b18a69
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
# [0.88.0](https://github.com/applandinc/appmap-ruby/compare/v0.87.0...v0.88.0) (2022-08-31)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Allow recording of error responses ([e538556](https://github.com/applandinc/appmap-ruby/commit/e5385560cbbab2d27ce6c0a1620d5c7539e0d985))
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* Add HTTP server request support for Rails 7 ([bd7f6c9](https://github.com/applandinc/appmap-ruby/commit/bd7f6c9109ee6c850250016276c8fbb6a8a66a2e))
|
12
|
+
|
13
|
+
# [0.87.0](https://github.com/applandinc/appmap-ruby/compare/v0.86.0...v0.87.0) (2022-08-19)
|
14
|
+
|
15
|
+
|
16
|
+
### Features
|
17
|
+
|
18
|
+
* Improve performance of initial hooking ([901e262](https://github.com/applandinc/appmap-ruby/commit/901e26237027920ede6b0f9d4bc3d175c861b23a))
|
19
|
+
|
20
|
+
# [0.86.0](https://github.com/applandinc/appmap-ruby/compare/v0.85.0...v0.86.0) (2022-08-10)
|
21
|
+
|
22
|
+
|
23
|
+
### Features
|
24
|
+
|
25
|
+
* Don't record rspec test when appmap: false ([09c4a24](https://github.com/applandinc/appmap-ruby/commit/09c4a249c7446c6aebcc1d462d3d7b35817334fc))
|
26
|
+
|
1
27
|
# [0.85.0](https://github.com/applandinc/appmap-ruby/compare/v0.84.0...v0.85.0) (2022-08-08)
|
2
28
|
|
3
29
|
|
@@ -73,8 +73,8 @@ module AppMap
|
|
73
73
|
class << self
|
74
74
|
def build_from_invocation(parent_id, return_value, elapsed, response, event: HTTPServerResponse.new)
|
75
75
|
event ||= HTTPServerResponse.new
|
76
|
-
event.status = response.status
|
77
|
-
event.headers = response.headers.dup
|
76
|
+
event.status = response[:status] || response.status
|
77
|
+
event.headers = (response[:headers] || response.headers).dup
|
78
78
|
AppMap::Event::MethodReturn.build_from_invocation parent_id, return_value, nil, elapsed: elapsed, event: event, parameter_schema: true
|
79
79
|
end
|
80
80
|
end
|
@@ -114,6 +114,46 @@ module AppMap
|
|
114
114
|
AppMap.tracing.record_event return_event
|
115
115
|
end
|
116
116
|
end
|
117
|
+
|
118
|
+
# RequestListener listens to the 'start_processing.action_controller' notification as a
|
119
|
+
# source of HTTP server request events. A strategy other than HookMethod is required for
|
120
|
+
# Rails >= 7 due to the hooked methods visibility dropping to private.
|
121
|
+
class RequestListener
|
122
|
+
def self.begin_request(_name, _started, _finished, _unique_id, payload)
|
123
|
+
RequestListener.new(payload)
|
124
|
+
end
|
125
|
+
|
126
|
+
protected
|
127
|
+
|
128
|
+
def initialize(payload)
|
129
|
+
@request_id = payload[:request].request_id
|
130
|
+
@subscriber = self.class.instance_method(:after_hook).bind(self)
|
131
|
+
|
132
|
+
ActiveSupport::Notifications.subscribe 'process_action.action_controller', @subscriber
|
133
|
+
before_hook payload
|
134
|
+
end
|
135
|
+
|
136
|
+
def before_hook(payload)
|
137
|
+
@call_event = HTTPServerRequest.new payload[:request]
|
138
|
+
AppMap.tracing.record_event @call_event
|
139
|
+
end
|
140
|
+
|
141
|
+
def after_hook(_name, started, finished, _unique_id, payload)
|
142
|
+
return unless @request_id == payload[:request].request_id
|
143
|
+
|
144
|
+
return_value = Thread.current[TEMPLATE_RENDER_VALUE]
|
145
|
+
Thread.current[TEMPLATE_RENDER_VALUE] = nil
|
146
|
+
return_event = HTTPServerResponse.build_from_invocation(
|
147
|
+
@call_event.id,
|
148
|
+
return_value,
|
149
|
+
finished - started,
|
150
|
+
payload[:response] || payload
|
151
|
+
)
|
152
|
+
|
153
|
+
AppMap.tracing.record_event return_event
|
154
|
+
ActiveSupport::Notifications.unsubscribe(@subscriber)
|
155
|
+
end
|
156
|
+
end
|
117
157
|
end
|
118
158
|
end
|
119
159
|
end
|
data/lib/appmap/hook.rb
CHANGED
@@ -183,12 +183,6 @@ module AppMap
|
|
183
183
|
|
184
184
|
hook = lambda do |hook_cls|
|
185
185
|
lambda do |method_id|
|
186
|
-
# Don't try and trace the AppMap methods or there will be
|
187
|
-
# a stack overflow in the defined hook method.
|
188
|
-
next if %w[Marshal AppMap ActiveSupport].member?((hook_cls&.name || '').split('::')[0])
|
189
|
-
|
190
|
-
next if method_id == :call
|
191
|
-
|
192
186
|
method = \
|
193
187
|
begin
|
194
188
|
hook_cls.instance_method(method_id)
|
@@ -197,6 +191,16 @@ module AppMap
|
|
197
191
|
next
|
198
192
|
end
|
199
193
|
|
194
|
+
package = config.lookup_package(hook_cls, method)
|
195
|
+
# doing this check first returned early in 98.7% of cases in sample_app_6th_ed
|
196
|
+
next unless package
|
197
|
+
|
198
|
+
# Don't try and trace the AppMap methods or there will be
|
199
|
+
# a stack overflow in the defined hook method.
|
200
|
+
next if %w[Marshal AppMap ActiveSupport].member?((hook_cls&.name || '').split('::')[0])
|
201
|
+
|
202
|
+
next if method_id == :call
|
203
|
+
|
200
204
|
next if self.class.already_hooked?(method)
|
201
205
|
|
202
206
|
warn "AppMap: Examining #{hook_cls} #{method.name}" if LOG
|
@@ -206,9 +210,6 @@ module AppMap
|
|
206
210
|
# TODO: Figure out how to tell the difference?
|
207
211
|
next unless disasm
|
208
212
|
|
209
|
-
package = config.lookup_package(hook_cls, method)
|
210
|
-
next unless package
|
211
|
-
|
212
213
|
package.handler_class.new(package, hook_cls, method).activate
|
213
214
|
end
|
214
215
|
end
|
data/lib/appmap/railtie.rb
CHANGED
@@ -18,7 +18,15 @@ module AppMap
|
|
18
18
|
ActiveSupport::Notifications.subscribe 'sql.sequel', AppMap::Handler::Rails::SQLHandler.new
|
19
19
|
ActiveSupport::Notifications.subscribe 'sql.active_record', AppMap::Handler::Rails::SQLHandler.new
|
20
20
|
|
21
|
-
|
21
|
+
http_hook_available = ActionController::Instrumentation.public_instance_methods.include?(:process_action)
|
22
|
+
if http_hook_available
|
23
|
+
AppMap::Handler::Rails::RequestHandler::HookMethod.new.activate
|
24
|
+
else
|
25
|
+
ActiveSupport::Notifications.subscribe(
|
26
|
+
'start_processing.action_controller',
|
27
|
+
AppMap::Handler::Rails::RequestHandler::RequestListener.method(:begin_request)
|
28
|
+
)
|
29
|
+
end
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end if ENV['APPMAP'] == 'true'
|
data/lib/appmap/rspec.rb
CHANGED
@@ -157,14 +157,20 @@ module AppMap
|
|
157
157
|
AppMap.info 'Configuring AppMap recorder for RSpec' if first_recording?
|
158
158
|
@recording_count += 1
|
159
159
|
|
160
|
-
|
160
|
+
recording = if example.metadata[:appmap] != false
|
161
|
+
Recording.new(example)
|
162
|
+
else
|
163
|
+
:false
|
164
|
+
end
|
165
|
+
|
166
|
+
@recordings_by_example[example.object_id] = recording
|
161
167
|
end
|
162
168
|
|
163
169
|
def end_spec(example, exception:)
|
164
170
|
recording = @recordings_by_example.delete(example.object_id)
|
165
171
|
return warn "No recording found for #{example}" unless recording
|
166
172
|
|
167
|
-
recording.finish exception
|
173
|
+
recording.finish exception unless recording == :false
|
168
174
|
end
|
169
175
|
|
170
176
|
def config
|
data/lib/appmap/version.rb
CHANGED
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.88.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|