appmap 1.0.0 → 1.0.1
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 +7 -0
- data/lib/appmap/handler/rails/request_handler.rb +21 -18
- data/lib/appmap/handler/rails/test_route.rb +26 -0
- data/lib/appmap/version.rb +1 -1
- metadata +3 -3
- data/.github/workflows/main.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef590ede8fe883183358cb975bb4531c07ee332de2708bfce4743c4cfc0c7f15
|
4
|
+
data.tar.gz: 23d4c0d3c7fa26d5c298186d3e8c9e6318ffe8aa265dcd55358a02ace656db04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dcfac0480a1e5cf59be2bfa03614d141135d1e2a06010e494fd8807e58803b2361627cd861a038cc4ea7b1e21013628ae04e4a75fadc7df877c9c143d5a8f5d
|
7
|
+
data.tar.gz: bb9dadf2e3dae77b280497223544ffe84f9fed42cb742ea021e049be311a07f5e79b5715a59c523ff4ca7fff9ed37db301f243b5d6a722cde5d5b44ad8c98fc1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [1.0.1](https://github.com/getappmap/appmap-ruby/compare/v1.0.0...v1.0.1) (2024-04-30)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Handle exceptions in app.matches? ([0e9db0d](https://github.com/getappmap/appmap-ruby/commit/0e9db0dc6d574785865c8883a85f011635fa1495)), closes [#358](https://github.com/getappmap/appmap-ruby/issues/358)
|
7
|
+
|
1
8
|
# [1.0.0](https://github.com/getappmap/appmap-ruby/compare/v0.103.0...v1.0.0) (2024-02-06)
|
2
9
|
|
3
10
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "appmap/event"
|
4
|
+
require "appmap/hook"
|
5
|
+
require "appmap/util"
|
6
|
+
require "appmap/handler/rails/context"
|
7
|
+
require "appmap/handler/rails/test_route"
|
7
8
|
|
8
9
|
module AppMap
|
9
10
|
module Handler
|
10
11
|
module Rails
|
11
|
-
|
12
12
|
module RequestHandler
|
13
13
|
class HTTPServerRequest < AppMap::Event::MethodEvent
|
14
14
|
attr_accessor :normalized_path_info, :request_method, :path_info, :params, :headers, :call_elapsed_instrumentation
|
@@ -19,7 +19,7 @@ module AppMap
|
|
19
19
|
self.request_method = request.request_method
|
20
20
|
self.normalized_path_info = normalized_path(request)
|
21
21
|
self.headers = AppMap::Util.select_rack_headers(request.env)
|
22
|
-
self.path_info = request.path_info.split(
|
22
|
+
self.path_info = request.path_info.split("?")[0]
|
23
23
|
# ActionDispatch::Http::ParameterFilter is deprecated
|
24
24
|
parameter_filter_cls = \
|
25
25
|
if defined?(ActiveSupport::ParameterFilter)
|
@@ -36,7 +36,7 @@ module AppMap
|
|
36
36
|
request_method: request_method,
|
37
37
|
path_info: path_info,
|
38
38
|
normalized_path_info: normalized_path_info,
|
39
|
-
headers: headers
|
39
|
+
headers: headers
|
40
40
|
}.compact
|
41
41
|
|
42
42
|
unless Util.blank?(params)
|
@@ -46,7 +46,7 @@ module AppMap
|
|
46
46
|
name: key,
|
47
47
|
class: val.class.name,
|
48
48
|
value: self.class.display_string(val),
|
49
|
-
object_id: val.__id__
|
49
|
+
object_id: val.__id__
|
50
50
|
}.tap do |message|
|
51
51
|
AppMap::Event::MethodEvent.add_schema message, val
|
52
52
|
end
|
@@ -60,9 +60,12 @@ module AppMap
|
|
60
60
|
def normalized_path(request, router = ::Rails.application.routes.router)
|
61
61
|
# use a cloned environment because the router can modify it
|
62
62
|
request = ActionDispatch::Request.new request.env.clone
|
63
|
+
|
63
64
|
router.recognize request do |route, _|
|
64
65
|
app = route.app
|
65
|
-
|
66
|
+
|
67
|
+
next unless Rails.test_route(app, request)
|
68
|
+
|
66
69
|
return normalized_path request, app.rack_app.routes.router if app.engine?
|
67
70
|
|
68
71
|
return AppMap::Util.swaggerize_path(route.path.spec.to_s)
|
@@ -113,19 +116,19 @@ module AppMap
|
|
113
116
|
req = receiver.request
|
114
117
|
return unless Context.create req.env
|
115
118
|
|
116
|
-
before_hook_start_time = AppMap::Util.gettime
|
119
|
+
before_hook_start_time = AppMap::Util.gettime
|
117
120
|
call_event = HTTPServerRequest.new(req)
|
118
|
-
call_event.call_elapsed_instrumentation = (AppMap::Util.gettime
|
121
|
+
call_event.call_elapsed_instrumentation = (AppMap::Util.gettime - before_hook_start_time)
|
119
122
|
# http_server_request events are i/o and do not require a package name.
|
120
123
|
AppMap.tracing.record_event call_event, defined_class: defined_class, method: hook_method
|
121
124
|
call_event
|
122
125
|
end
|
123
126
|
|
124
127
|
def after_hook(receiver, call_event, elapsed, *)
|
125
|
-
after_hook_start_time = AppMap::Util.gettime
|
128
|
+
after_hook_start_time = AppMap::Util.gettime
|
126
129
|
return_event = HTTPServerResponse.build_from_invocation \
|
127
130
|
call_event.id, Context.new.find_template_render_value, elapsed, receiver.response
|
128
|
-
return_event.elapsed_instrumentation = (AppMap::Util.gettime
|
131
|
+
return_event.elapsed_instrumentation = (AppMap::Util.gettime - after_hook_start_time) + call_event.call_elapsed_instrumentation
|
129
132
|
call_event.call_elapsed_instrumentation = nil # to stay consistent with elapsed_instrumentation only being stored in return
|
130
133
|
AppMap.tracing.record_event return_event
|
131
134
|
Context.remove receiver.request.env
|
@@ -191,28 +194,28 @@ module AppMap
|
|
191
194
|
@request_id = payload[:request].request_id
|
192
195
|
@subscriber = self.class.instance_method(:after_hook).bind(self)
|
193
196
|
|
194
|
-
ActiveSupport::Notifications.subscribe
|
197
|
+
ActiveSupport::Notifications.subscribe "process_action.action_controller", @subscriber
|
195
198
|
before_hook payload
|
196
199
|
end
|
197
200
|
|
198
201
|
def before_hook(payload)
|
199
|
-
before_hook_start_time = AppMap::Util.gettime
|
202
|
+
before_hook_start_time = AppMap::Util.gettime
|
200
203
|
@call_event = HTTPServerRequest.new payload[:request]
|
201
|
-
@call_event.call_elapsed_instrumentation = (AppMap::Util.gettime
|
204
|
+
@call_event.call_elapsed_instrumentation = (AppMap::Util.gettime - before_hook_start_time)
|
202
205
|
AppMap.tracing.record_event @call_event
|
203
206
|
end
|
204
207
|
|
205
208
|
def after_hook(_name, started, finished, _unique_id, payload)
|
206
209
|
return unless @request_id == payload[:request].request_id
|
207
210
|
|
208
|
-
after_hook_start_time = AppMap::Util.gettime
|
211
|
+
after_hook_start_time = AppMap::Util.gettime
|
209
212
|
return_event = HTTPServerResponse.build_from_invocation(
|
210
213
|
@call_event.id,
|
211
214
|
Context.new.find_template_render_value,
|
212
215
|
finished - started,
|
213
216
|
payload[:response] || payload
|
214
217
|
)
|
215
|
-
return_event.elapsed_instrumentation = (AppMap::Util.gettime
|
218
|
+
return_event.elapsed_instrumentation = (AppMap::Util.gettime - after_hook_start_time) + @call_event.call_elapsed_instrumentation
|
216
219
|
|
217
220
|
AppMap.tracing.record_event return_event
|
218
221
|
Context.remove payload[:request].env
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module AppMap
|
2
|
+
module Handler
|
3
|
+
module Rails
|
4
|
+
class << self
|
5
|
+
def test_route(app, request)
|
6
|
+
app.matches?(request)
|
7
|
+
rescue
|
8
|
+
test_route_warn(request)
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
@test_route_warned = false
|
15
|
+
|
16
|
+
def test_route_warn(request)
|
17
|
+
return if @test_route_warned
|
18
|
+
|
19
|
+
@test_route_warned = true
|
20
|
+
warn "Notice: Failed to match route for #{request&.path_info || "an unknown path"}: #{$ERROR_INFO}"
|
21
|
+
warn "Notice: A solution for this problem is forthcoming, see https://github.com/getappmap/appmap-ruby/issues/360"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
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: 1.0.
|
4
|
+
version: 1.0.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: 2024-
|
11
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -305,7 +305,6 @@ extensions:
|
|
305
305
|
extra_rdoc_files: []
|
306
306
|
files:
|
307
307
|
- ".dockerignore"
|
308
|
-
- ".github/workflows/main.yml"
|
309
308
|
- ".gitignore"
|
310
309
|
- ".nvmrc"
|
311
310
|
- ".rbenv-gemsets"
|
@@ -398,6 +397,7 @@ files:
|
|
398
397
|
- lib/appmap/handler/rails/request_handler.rb
|
399
398
|
- lib/appmap/handler/rails/sql_handler.rb
|
400
399
|
- lib/appmap/handler/rails/template.rb
|
400
|
+
- lib/appmap/handler/rails/test_route.rb
|
401
401
|
- lib/appmap/hook.rb
|
402
402
|
- lib/appmap/hook/method.rb
|
403
403
|
- lib/appmap/hook/method/ruby2.rb
|
data/.github/workflows/main.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
name: Add new issues to project tracker
|
2
|
-
|
3
|
-
on:
|
4
|
-
issues:
|
5
|
-
types:
|
6
|
-
- opened
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
add-to-project:
|
10
|
-
name: Add issue to project
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
steps:
|
13
|
-
- uses: actions/add-to-project@main
|
14
|
-
with:
|
15
|
-
project-url: https://github.com/orgs/getappmap/projects/15
|
16
|
-
github-token: ${{ secrets.ADD_TO_PROJECT_BOARD_PAT }}
|