appmap 0.51.2 → 0.54.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -1
  3. data/CHANGELOG.md +40 -0
  4. data/Rakefile +21 -5
  5. data/appmap.gemspec +8 -7
  6. data/exe/appmap-agent-init +19 -0
  7. data/exe/appmap-inspect +7 -0
  8. data/lib/appmap.rb +29 -119
  9. data/lib/appmap/agent.rb +115 -0
  10. data/lib/appmap/class_map.rb +2 -2
  11. data/lib/appmap/command/agent_setup/init.rb +44 -0
  12. data/lib/appmap/command/inspect.rb +27 -0
  13. data/lib/appmap/command_error.rb +13 -0
  14. data/lib/appmap/config.rb +13 -4
  15. data/lib/appmap/handler/net_http.rb +2 -1
  16. data/lib/appmap/handler/rails/request_handler.rb +2 -1
  17. data/lib/appmap/metadata.rb +4 -2
  18. data/lib/appmap/minitest.rb +2 -0
  19. data/lib/appmap/node_cli.rb +59 -0
  20. data/lib/appmap/railtie.rb +2 -2
  21. data/lib/appmap/rspec.rb +5 -3
  22. data/lib/appmap/service/guesser.rb +2 -9
  23. data/lib/appmap/swagger.rb +2 -0
  24. data/lib/appmap/swagger/configuration.rb +70 -0
  25. data/lib/appmap/swagger/markdown_descriptions.rb +43 -0
  26. data/lib/appmap/swagger/rake_tasks.rb +43 -0
  27. data/lib/appmap/swagger/stable.rb +37 -0
  28. data/lib/appmap/util.rb +31 -2
  29. data/lib/appmap/version.rb +1 -1
  30. data/package.json +5 -7
  31. data/spec/config_spec.rb +0 -1
  32. data/spec/fixtures/hook/.gitignore +2 -0
  33. data/spec/fixtures/hook/app/controllers/api/api_keys_controller.rb +1 -0
  34. data/spec/fixtures/hook/app/controllers/organizations_controller.rb +1 -0
  35. data/spec/fixtures/hook/app/models/api_key.rb +1 -0
  36. data/spec/fixtures/hook/app/models/configuration.rb +1 -0
  37. data/spec/fixtures/hook/app/models/show.rb +1 -0
  38. data/spec/fixtures/hook/app/models/user.rb +1 -0
  39. data/spec/fixtures/hook/revoke_api_key.appmap.json +847 -0
  40. data/spec/fixtures/hook/spec/api_spec.rb +1 -0
  41. data/spec/fixtures/hook/spec/user_spec.rb +1 -0
  42. data/spec/fixtures/hook/user_page_scenario.appmap.json +1722 -0
  43. data/spec/fixtures/rails5_users_app/config/environments/test.rb +3 -0
  44. data/spec/fixtures/rails5_users_app/docker-compose.yml +1 -1
  45. data/spec/fixtures/rails6_users_app/Dockerfile +9 -1
  46. data/spec/fixtures/rails6_users_app/appmap.yml +3 -1
  47. data/spec/fixtures/rails6_users_app/config/environments/test.rb +3 -0
  48. data/spec/fixtures/rails6_users_app/docker-compose.yml +1 -1
  49. data/spec/fixtures/rails6_users_app/lib/tasks/appmap.rake +13 -0
  50. data/spec/{abstract_controller_base_spec.rb → rails_recording_spec.rb} +2 -21
  51. data/spec/rails_spec_helper.rb +22 -0
  52. data/spec/swagger/swagger_spec.rb +47 -0
  53. data/test/{cli_test.rb → agent_setup_init_test.rb} +4 -4
  54. data/test/fixtures/gem_test/Gemfile +1 -0
  55. data/test/gem_test.rb +1 -0
  56. data/test/inspect_cli_test.rb +12 -0
  57. data/yarn.lock +477 -0
  58. metadata +39 -63
  59. data/exe/appmap-agent-setup +0 -47
  60. data/lib/appmap/algorithm/prune_class_map.rb +0 -67
  61. data/lib/appmap/algorithm/stats.rb +0 -91
  62. data/lib/appmap/command/init.rb +0 -42
  63. data/lib/appmap/command/record.rb +0 -38
  64. data/lib/appmap/command/stats.rb +0 -14
  65. data/lore/pages/2019-05-21-install-and-record/index.pug +0 -51
  66. data/lore/pages/2019-05-21-install-and-record/install_example_appmap.png +0 -0
  67. data/lore/pages/2019-05-21-install-and-record/metadata.yml +0 -5
  68. data/lore/pages/layout.pug +0 -66
  69. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css +0 -1912
  70. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css.map +0 -1
  71. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css +0 -7
  72. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css.map +0 -1
  73. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css +0 -331
  74. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css.map +0 -1
  75. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css +0 -8
  76. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css.map +0 -1
  77. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css +0 -9030
  78. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css.map +0 -1
  79. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css +0 -7
  80. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css.map +0 -1
  81. data/lore/public/stylesheets/style.css +0 -8
  82. data/package-lock.json +0 -1064
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.51.2
4
+ version: 0.54.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: 2021-06-22 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,34 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: faraday
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: gli
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: method_source
57
29
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +39,7 @@ dependencies:
67
39
  - !ruby/object:Gem::Version
68
40
  version: '0'
69
41
  - !ruby/object:Gem::Dependency
70
- name: parser
42
+ name: rack
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - ">="
@@ -81,7 +53,7 @@ dependencies:
81
53
  - !ruby/object:Gem::Version
82
54
  version: '0'
83
55
  - !ruby/object:Gem::Dependency
84
- name: rack
56
+ name: reverse_markdown
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
59
  - - ">="
@@ -112,16 +84,16 @@ dependencies:
112
84
  name: minitest
113
85
  requirement: !ruby/object:Gem::Requirement
114
86
  requirements:
115
- - - "~>"
87
+ - - '='
116
88
  - !ruby/object:Gem::Version
117
- version: '5.0'
89
+ version: 5.14.4
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
93
  requirements:
122
- - - "~>"
94
+ - - '='
123
95
  - !ruby/object:Gem::Version
124
- version: '5.0'
96
+ version: 5.14.4
125
97
  - !ruby/object:Gem::Dependency
126
98
  name: pry-byebug
127
99
  requirement: !ruby/object:Gem::Requirement
@@ -308,7 +280,8 @@ description:
308
280
  email:
309
281
  - kgilpin@gmail.com
310
282
  executables:
311
- - appmap-agent-setup
283
+ - appmap-agent-init
284
+ - appmap-inspect
312
285
  extensions:
313
286
  - ext/appmap/extconf.rb
314
287
  extra_rdoc_files: []
@@ -336,16 +309,16 @@ files:
336
309
  - examples/mock_webapp/lib/mock_webapp/controller.rb
337
310
  - examples/mock_webapp/lib/mock_webapp/request.rb
338
311
  - examples/mock_webapp/lib/mock_webapp/user.rb
339
- - exe/appmap-agent-setup
312
+ - exe/appmap-agent-init
313
+ - exe/appmap-inspect
340
314
  - ext/appmap/appmap.c
341
315
  - ext/appmap/extconf.rb
342
316
  - lib/appmap.rb
343
- - lib/appmap/algorithm/prune_class_map.rb
344
- - lib/appmap/algorithm/stats.rb
317
+ - lib/appmap/agent.rb
345
318
  - lib/appmap/class_map.rb
346
- - lib/appmap/command/init.rb
347
- - lib/appmap/command/record.rb
348
- - lib/appmap/command/stats.rb
319
+ - lib/appmap/command/agent_setup/init.rb
320
+ - lib/appmap/command/inspect.rb
321
+ - lib/appmap/command_error.rb
349
322
  - lib/appmap/config.rb
350
323
  - lib/appmap/cucumber.rb
351
324
  - lib/appmap/event.rb
@@ -359,37 +332,31 @@ files:
359
332
  - lib/appmap/metadata.rb
360
333
  - lib/appmap/middleware/remote_recording.rb
361
334
  - lib/appmap/minitest.rb
335
+ - lib/appmap/node_cli.rb
362
336
  - lib/appmap/open.rb
363
337
  - lib/appmap/railtie.rb
364
338
  - lib/appmap/record.rb
365
339
  - lib/appmap/rspec.rb
366
340
  - lib/appmap/service/guesser.rb
341
+ - lib/appmap/swagger.rb
342
+ - lib/appmap/swagger/configuration.rb
343
+ - lib/appmap/swagger/markdown_descriptions.rb
344
+ - lib/appmap/swagger/rake_tasks.rb
345
+ - lib/appmap/swagger/stable.rb
367
346
  - lib/appmap/trace.rb
368
347
  - lib/appmap/util.rb
369
348
  - lib/appmap/version.rb
370
- - lore/pages/2019-05-21-install-and-record/index.pug
371
- - lore/pages/2019-05-21-install-and-record/install_example_appmap.png
372
- - lore/pages/2019-05-21-install-and-record/metadata.yml
373
- - lore/pages/layout.pug
374
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css
375
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css.map
376
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css
377
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css.map
378
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css
379
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css.map
380
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css
381
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css.map
382
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap.css
383
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap.css.map
384
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css
385
- - lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css.map
386
- - lore/public/stylesheets/style.css
387
- - package-lock.json
388
349
  - package.json
389
350
  - release.sh
390
- - spec/abstract_controller_base_spec.rb
391
351
  - spec/class_map_spec.rb
392
352
  - spec/config_spec.rb
353
+ - spec/fixtures/hook/.gitignore
354
+ - spec/fixtures/hook/app/controllers/api/api_keys_controller.rb
355
+ - spec/fixtures/hook/app/controllers/organizations_controller.rb
356
+ - spec/fixtures/hook/app/models/api_key.rb
357
+ - spec/fixtures/hook/app/models/configuration.rb
358
+ - spec/fixtures/hook/app/models/show.rb
359
+ - spec/fixtures/hook/app/models/user.rb
393
360
  - spec/fixtures/hook/attr_accessor.rb
394
361
  - spec/fixtures/hook/compare.rb
395
362
  - spec/fixtures/hook/constructor.rb
@@ -399,7 +366,11 @@ files:
399
366
  - spec/fixtures/hook/instance_method.rb
400
367
  - spec/fixtures/hook/labels.rb
401
368
  - spec/fixtures/hook/method_named_call.rb
369
+ - spec/fixtures/hook/revoke_api_key.appmap.json
402
370
  - spec/fixtures/hook/singleton_method.rb
371
+ - spec/fixtures/hook/spec/api_spec.rb
372
+ - spec/fixtures/hook/spec/user_spec.rb
373
+ - spec/fixtures/hook/user_page_scenario.appmap.json
403
374
  - spec/fixtures/rack_users_app/.dockerignore
404
375
  - spec/fixtures/rack_users_app/.gitignore
405
376
  - spec/fixtures/rack_users_app/Dockerfile
@@ -542,6 +513,7 @@ files:
542
513
  - spec/fixtures/rails6_users_app/features/support/hooks.rb
543
514
  - spec/fixtures/rails6_users_app/features/support/steps.rb
544
515
  - spec/fixtures/rails6_users_app/lib/tasks/.keep
516
+ - spec/fixtures/rails6_users_app/lib/tasks/appmap.rake
545
517
  - spec/fixtures/rails6_users_app/log/.keep
546
518
  - spec/fixtures/rails6_users_app/public/robots.txt
547
519
  - spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb
@@ -552,15 +524,17 @@ files:
552
524
  - spec/fixtures/rails6_users_app/users_app/.gitignore
553
525
  - spec/hook_spec.rb
554
526
  - spec/open_spec.rb
527
+ - spec/rails_recording_spec.rb
555
528
  - spec/rails_spec_helper.rb
556
529
  - spec/railtie_spec.rb
557
530
  - spec/record_net_http_spec.rb
558
531
  - spec/record_sql_rails_pg_spec.rb
559
532
  - spec/remote_recording_spec.rb
560
533
  - spec/spec_helper.rb
534
+ - spec/swagger/swagger_spec.rb
561
535
  - spec/util_spec.rb
536
+ - test/agent_setup_init_test.rb
562
537
  - test/bundle_vendor_test.rb
563
- - test/cli_test.rb
564
538
  - test/cucumber_test.rb
565
539
  - test/expectations/openssl_test_key_sign1.json
566
540
  - test/expectations/openssl_test_key_sign2.json
@@ -604,11 +578,13 @@ files:
604
578
  - test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb
605
579
  - test/fixtures/rspec_recorder/spec/plain_hello_spec.rb
606
580
  - test/gem_test.rb
581
+ - test/inspect_cli_test.rb
607
582
  - test/minitest_test.rb
608
583
  - test/openssl_test.rb
609
584
  - test/record_process_test.rb
610
585
  - test/rspec_test.rb
611
586
  - test/test_helper.rb
587
+ - yarn.lock
612
588
  homepage: https://github.com/applandinc/appmap-ruby
613
589
  licenses:
614
590
  - MIT
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'gli'
5
-
6
- require 'appmap'
7
-
8
- class App
9
- extend GLI::App
10
-
11
- program_desc 'CLI tool to be used by IDEs for AppMap setup and configuration'
12
-
13
- version AppMap::VERSION
14
-
15
- subcommand_option_handling :normal
16
- arguments :strict
17
- preserve_argv true
18
-
19
- desc 'AppMap configuration file name'
20
- default_value ENV['APPMAP_CONFIG'] || AppMap::DEFAULT_CONFIG_FILE_PATH
21
- arg_name 'filename'
22
- flag %i[c config]
23
-
24
- desc 'Creates base configuration file for the current project'
25
- command :init do |c|
26
- c.action do
27
- require 'appmap/command/init'
28
- AppMap::Command::Init.new(@config_file).perform
29
- end
30
- end
31
-
32
- pre do |global, _, _, _|
33
- @config_file = global[:config]
34
- @config = interpret_config_option(@config_file) if File.exist?(@config_file)
35
- true
36
- end
37
-
38
- class << self
39
- protected
40
-
41
- def interpret_config_option(fname)
42
- AppMap::Config.load_from_file fname
43
- end
44
- end
45
- end
46
-
47
- exit App.run(ARGV)
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AppMap
4
- module Algorithm
5
- # Prune a class map so that only functions, classes and packages which are referenced
6
- # by some event are retained.
7
- class PruneClassMap
8
- attr_reader :class_map
9
- # Set this attribute to a function which will log algorithm events.
10
- attr_writer :logger
11
- attr_accessor :events
12
-
13
- # Construct the algorithm, with a class map that will be pruned in place.
14
- def initialize(class_map)
15
- @class_map = class_map
16
- @logger = ->(msg) {}
17
- end
18
-
19
- def perform
20
- # This proc counts the number of objects in the class map whose type is 'k'
21
- count = proc do |k, e|
22
- n = 0
23
- n += 1 if e['type'] == k
24
- n += (e['children'] || []).map { |child| count.call(k, child) }.reduce(0, :+)
25
- n
26
- end
27
-
28
- @logger.call "Full classMap contains #{class_map.map { |m| count.call('class', m) }.reduce(0, :+)} classes"
29
-
30
- # Prune all the classes which fail a test.
31
- reject = proc do |list, test|
32
- list.tap do |_|
33
- list.each do |item|
34
- children = item['children']
35
- next unless children
36
-
37
- reject.call(children, test)
38
- end
39
- list.reject!(&test)
40
- end
41
- end
42
-
43
- if events
44
- locations = \
45
- Set.new(events.select { |e| e['event'] == 'call' }
46
- .map { |e| [ e['path'], e['lineno'] ].join(':') })
47
-
48
- # Prune all functions which aren't called
49
- reject.call class_map,
50
- ->(e) { e['type'] == 'function' && !locations.member?(e['location']) }
51
- end
52
-
53
- # Prune all empty classes
54
- reject.call class_map,
55
- ->(e) { e['type'] == 'class' && (e['children'] || []).empty? }
56
-
57
- # Prune all empty packages
58
- reject.call class_map,
59
- ->(e) { e['type'] == 'package' && (e['children'] || []).empty? }
60
-
61
- @logger.call "Pruned classMap contains #{class_map.map { |m| count.call('class', m) }.reduce(0, :+)} classes"
62
-
63
- class_map
64
- end
65
- end
66
- end
67
- end
@@ -1,91 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AppMap
4
- module Algorithm
5
- StatsStruct = Struct.new(:appmap)
6
-
7
- # Compute AppMap statistics.
8
- class Stats < StatsStruct
9
- Result = Struct.new(:class_frequency, :method_frequency) do
10
- def merge!(other)
11
- merge = lambda do |freq, other_freq|
12
- freq_by_name = freq.inject({}) do |table, entry|
13
- table.tap do
14
- table[entry.name] = entry
15
- end
16
- end
17
- other_freq.each do |other_entry|
18
- entry = freq_by_name[other_entry.name]
19
- if entry
20
- entry.count += other_entry.count
21
- else
22
- freq << other_entry
23
- end
24
- end
25
- end
26
- merge.call(class_frequency, other.class_frequency)
27
- merge.call(method_frequency, other.method_frequency)
28
-
29
- self
30
- end
31
-
32
- def sort!
33
- comparator = ->(a,b) { b.count <=> a.count }
34
- class_frequency.sort!(&comparator)
35
- method_frequency.sort!(&comparator)
36
-
37
- self
38
- end
39
-
40
- def limit!(limit)
41
- self.class_frequency = class_frequency[0...limit]
42
- self.method_frequency = method_frequency[0...limit]
43
-
44
- self
45
- end
46
-
47
- def as_text
48
- lines = [
49
- "Class frequency:",
50
- "----------------",
51
- ] + class_frequency.map(&:to_a).map(&:reverse).map { |line | line.join("\t") } + [
52
- "",
53
- "Method frequency:",
54
- "----------------",
55
- ] + method_frequency.map(&:to_a).map(&:reverse).map { |line | line.join("\t") }
56
- lines.join("\n")
57
- end
58
- end
59
- Frequency = Struct.new(:name, :count)
60
-
61
- def perform(limit: nil)
62
- events = appmap['events'] || []
63
- frequency_calc = lambda do |key_func|
64
- events_by_key = events.inject(Hash.new(0)) do |memo, event|
65
- key = key_func.call(event)
66
- memo.tap do
67
- memo[key] += 1 if key
68
- end
69
- end
70
- events_by_key.map do |key, count|
71
- Frequency.new(key, count)
72
- end
73
- end
74
-
75
- class_name_func = ->(event) { event['defined_class'] }
76
- full_name_func = lambda do |event|
77
- call = event['event'] == 'call'
78
- class_name = event['defined_class']
79
- static = event['static']
80
- function_name = event['method_id']
81
- [ class_name, static ? '.' : '#', function_name ].join if call && class_name && !static.nil? && function_name
82
- end
83
-
84
- class_frequency = frequency_calc.call(class_name_func)
85
- method_frequency = frequency_calc.call(full_name_func)
86
-
87
- Result.new(class_frequency, method_frequency)
88
- end
89
- end
90
- end
91
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'appmap/service/guesser'
5
- require 'appmap/util'
6
-
7
- module AppMap
8
- module Command
9
- InitStruct = Struct.new(:config_file)
10
-
11
- class Init < InitStruct
12
- def perform
13
- if File.exist?(config_file)
14
- puts AppMap::Util.color(%(The AppMap config file #{config_file} already exists.), :magenta)
15
- return
16
- end
17
-
18
- ensure_directory_exists
19
-
20
- config = {
21
- 'name' => Service::Guesser.guess_name,
22
- 'packages' => Service::Guesser.guess_paths.map { |path| { 'path' => path } }
23
- }
24
- content = YAML.dump(config).gsub("---\n", '')
25
-
26
- File.write(config_file, content)
27
- puts AppMap::Util.color(
28
- %(The following AppMap config file #{config_file} has been created:),
29
- :green
30
- )
31
- puts content
32
- end
33
-
34
- private
35
-
36
- def ensure_directory_exists
37
- dirname = File.dirname(config_file)
38
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
39
- end
40
- end
41
- end
42
- end