appmap 0.87.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 +12 -0
- data/lib/appmap/handler/rails/request_handler.rb +42 -2
- data/lib/appmap/railtie.rb +9 -1
- 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,15 @@
|
|
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
|
+
|
1
13
|
# [0.87.0](https://github.com/applandinc/appmap-ruby/compare/v0.86.0...v0.87.0) (2022-08-19)
|
2
14
|
|
3
15
|
|
@@ -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/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/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
|