appmap 0.74.0 → 0.77.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/lib/appmap/config.rb +3 -4
- data/lib/appmap/gem_hooks/activejob.yml +4 -0
- data/lib/appmap/gem_hooks/activesupport.yml +4 -0
- data/lib/appmap/gem_hooks/devise.yml +8 -0
- data/lib/appmap/handler.rb +38 -0
- data/lib/appmap/hook.rb +5 -2
- data/lib/appmap/trace.rb +32 -0
- data/lib/appmap/util.rb +0 -8
- data/lib/appmap/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72b52604fce9e01c3e4bc760d12f877a47b846a2f42a3e880dc3fbe3a3caf07b
|
4
|
+
data.tar.gz: 50428860dafdf6f79add97f9f51787014358b6178f5206ebc915c85dced62eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7670741f126ccf52fc7916229f29831a4320a673db755ab9c38fa9286e970baa447134c96acab4f443a4115bd8bca8f49552a983212e328bacabd88abd8352
|
7
|
+
data.tar.gz: 5e7b760bc10d31a40ae44996a9200e1ef6c3976364b4a43e5dd6b7b9b81005f57e1efac758f54b4d8274dc420cc74baebf91629ab12bc2a26b8959642feba56d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# [0.77.0](https://github.com/applandinc/appmap-ruby/compare/v0.76.0...v0.77.0) (2022-03-22)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Add label job.perform ([fb5e220](https://github.com/applandinc/appmap-ruby/commit/fb5e220a1f4fd724d8d0178fd4282fed73ff9371))
|
7
|
+
* Add labels for devise ([734ec61](https://github.com/applandinc/appmap-ruby/commit/734ec617aa81d756acf3cb392b5eaabcf9521934))
|
8
|
+
|
9
|
+
# [0.76.0](https://github.com/applandinc/appmap-ruby/compare/v0.75.0...v0.76.0) (2022-03-19)
|
10
|
+
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
* Autoload hook handlers ([4cc0e70](https://github.com/applandinc/appmap-ruby/commit/4cc0e7003a8c37d3b6c8c8bbc68cffac0335b878))
|
15
|
+
|
16
|
+
# [0.75.0](https://github.com/applandinc/appmap-ruby/compare/v0.74.0...v0.75.0) (2022-03-17)
|
17
|
+
|
18
|
+
|
19
|
+
### Features
|
20
|
+
|
21
|
+
* Apply label deserialize.safe to ActiveSupport.run_load_hooks ([1f67f9b](https://github.com/applandinc/appmap-ruby/commit/1f67f9b260503772cba6824ef746f903def14323))
|
22
|
+
* Print stacks if requested by env var ([72ef911](https://github.com/applandinc/appmap-ruby/commit/72ef9116d3248467632762ce63303a54bed998e9))
|
23
|
+
|
1
24
|
# [0.74.0](https://github.com/applandinc/appmap-ruby/compare/v0.73.0...v0.74.0) (2022-03-14)
|
2
25
|
|
3
26
|
|
data/lib/appmap/config.rb
CHANGED
@@ -4,8 +4,7 @@ require 'pathname'
|
|
4
4
|
require 'set'
|
5
5
|
require 'yaml'
|
6
6
|
require 'appmap/util'
|
7
|
-
require 'appmap/handler
|
8
|
-
require 'appmap/handler/rails/template'
|
7
|
+
require 'appmap/handler'
|
9
8
|
require 'appmap/service/guesser'
|
10
9
|
require 'appmap/swagger/configuration'
|
11
10
|
require 'appmap/depends/configuration'
|
@@ -206,8 +205,8 @@ module AppMap
|
|
206
205
|
}.compact
|
207
206
|
|
208
207
|
handler_class = hook_decl['handler_class']
|
209
|
-
options[:handler_class] =
|
210
|
-
|
208
|
+
options[:handler_class] = Handler.find(handler_class) if handler_class
|
209
|
+
|
211
210
|
package_hooks(methods, **options)
|
212
211
|
end
|
213
212
|
|
@@ -0,0 +1,8 @@
|
|
1
|
+
- method: Devise::TokenGenerator#generate
|
2
|
+
label: secret
|
3
|
+
- method: Devise.friendly_token
|
4
|
+
label: secret
|
5
|
+
- method: Devise.secure_compare
|
6
|
+
label: security.secure_compare
|
7
|
+
- method: Devise::Strategies::DatabaseAuthenticatable#authenticate!
|
8
|
+
label: security.authentication
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/inflector/methods'
|
4
|
+
|
5
|
+
module AppMap
|
6
|
+
# Specific hook handler classes and general related utilities.
|
7
|
+
module Handler
|
8
|
+
# Try to find handler module with a given name.
|
9
|
+
#
|
10
|
+
# If the module is not loaded, tries to require the appropriate file
|
11
|
+
# using the usual conventions, eg. `Acme::Handler::AppMap` will try
|
12
|
+
# to require `acme/handler/app_map`, then `acme/handler` and
|
13
|
+
# finally `acme`. Raises NameError if the module could not be loaded
|
14
|
+
# this way.
|
15
|
+
def self.find(name)
|
16
|
+
begin
|
17
|
+
return Object.const_get name
|
18
|
+
rescue NameError
|
19
|
+
try_load ActiveSupport::Inflector.underscore name
|
20
|
+
end
|
21
|
+
Object.const_get name
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.try_load(fname)
|
25
|
+
fname = fname.sub %r{^app_map/}, 'appmap/'
|
26
|
+
fname = fname.split '/'
|
27
|
+
until fname.empty?
|
28
|
+
begin
|
29
|
+
require fname.join '/'
|
30
|
+
return
|
31
|
+
rescue LoadError
|
32
|
+
# pass
|
33
|
+
end
|
34
|
+
fname.pop
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/appmap/hook.rb
CHANGED
@@ -108,8 +108,11 @@ module AppMap
|
|
108
108
|
|
109
109
|
warn "AppMap: Initiating hook for builtin #{class_name} #{method_name}" if LOG
|
110
110
|
|
111
|
-
|
112
|
-
|
111
|
+
begin
|
112
|
+
base_cls = Object.const_get class_name
|
113
|
+
rescue NameError
|
114
|
+
next
|
115
|
+
end
|
113
116
|
|
114
117
|
hook_method = lambda do |entry|
|
115
118
|
cls, method = entry
|
data/lib/appmap/trace.rb
CHANGED
@@ -84,12 +84,43 @@ module AppMap
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
class StackPrinter
|
88
|
+
class << self
|
89
|
+
def enabled?
|
90
|
+
ENV['APPMAP_PRINT_STACKS'] == 'true'
|
91
|
+
end
|
92
|
+
|
93
|
+
def depth
|
94
|
+
(ENV['APPMAP_STACK_DEPTH'] || 20).to_i
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def initialize
|
99
|
+
@@stacks ||= Hash.new
|
100
|
+
end
|
101
|
+
|
102
|
+
def record(event)
|
103
|
+
stack = caller.select { |line| !line.index('/lib/appmap/') }[0...StackPrinter.depth].join("\n ")
|
104
|
+
stack_hash = Digest::SHA256.hexdigest(stack)
|
105
|
+
unless @@stacks[stack_hash]
|
106
|
+
@@stacks[stack_hash] = stack
|
107
|
+
puts
|
108
|
+
puts 'Event: ' + event.to_h.map { |k, v| [ "#{k}: #{v}" ] }.join(", ")
|
109
|
+
puts ' ' + stack
|
110
|
+
puts
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
87
115
|
class Tracer
|
116
|
+
attr_accessor :stacks
|
117
|
+
|
88
118
|
# Records the events which happen in a program.
|
89
119
|
def initialize
|
90
120
|
@events = []
|
91
121
|
@last_package_for_thread = {}
|
92
122
|
@methods = Set.new
|
123
|
+
@stack_printer = StackPrinter.new if StackPrinter.enabled?
|
93
124
|
@enabled = false
|
94
125
|
end
|
95
126
|
|
@@ -112,6 +143,7 @@ module AppMap
|
|
112
143
|
def record_event(event, package: nil, defined_class: nil, method: nil)
|
113
144
|
return unless @enabled
|
114
145
|
|
146
|
+
@stack_printer.record(event) if @stack_printer
|
115
147
|
@last_package_for_thread[Thread.current.object_id] = package if package
|
116
148
|
@events << event
|
117
149
|
static = event.static if event.respond_to?(:static)
|
data/lib/appmap/util.rb
CHANGED
@@ -21,14 +21,6 @@ module AppMap
|
|
21
21
|
WHITE = "\e[37m"
|
22
22
|
|
23
23
|
class << self
|
24
|
-
def class_from_string(fq_class, must: true)
|
25
|
-
fq_class.split('::').inject(Object) do |mod, class_name|
|
26
|
-
mod.const_get(class_name)
|
27
|
-
end
|
28
|
-
rescue NameError
|
29
|
-
raise if must
|
30
|
-
end
|
31
|
-
|
32
24
|
def parse_function_name(name)
|
33
25
|
package_tokens = name.split('/')
|
34
26
|
|
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.77.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-03-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -369,11 +369,13 @@ files:
|
|
369
369
|
- lib/appmap/gem_hooks/activerecord.yml
|
370
370
|
- lib/appmap/gem_hooks/activesupport.yml
|
371
371
|
- lib/appmap/gem_hooks/cancancan.yml
|
372
|
+
- lib/appmap/gem_hooks/devise.yml
|
372
373
|
- lib/appmap/gem_hooks/rails.yml
|
373
374
|
- lib/appmap/gem_hooks/railties.yml
|
374
375
|
- lib/appmap/gem_hooks/resque.yml
|
375
376
|
- lib/appmap/gem_hooks/sidekiq.yml
|
376
377
|
- lib/appmap/gem_hooks/sprockets.yml
|
378
|
+
- lib/appmap/handler.rb
|
377
379
|
- lib/appmap/handler/function.rb
|
378
380
|
- lib/appmap/handler/net_http.rb
|
379
381
|
- lib/appmap/handler/rails/request_handler.rb
|