tuttle 0.0.5 → 0.0.6
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/README.md +61 -4
- data/Rakefile +1 -16
- data/app/controllers/tuttle/active_job_controller.rb +51 -0
- data/app/controllers/tuttle/active_model_serializers_controller.rb +3 -8
- data/app/controllers/tuttle/application_controller.rb +3 -0
- data/app/controllers/tuttle/cancancan_controller.rb +8 -15
- data/app/controllers/tuttle/devise_controller.rb +1 -2
- data/app/controllers/tuttle/gems_controller.rb +4 -4
- data/app/controllers/tuttle/home_controller.rb +0 -1
- data/app/controllers/tuttle/paperclip_controller.rb +1 -2
- data/app/controllers/tuttle/rack_mini_profiler_controller.rb +15 -0
- data/app/controllers/tuttle/rails_controller.rb +45 -7
- data/app/controllers/tuttle/request_controller.rb +0 -4
- data/app/controllers/tuttle/ruby_controller.rb +6 -2
- data/app/helpers/tuttle/application_helper.rb +13 -8
- data/app/models/tuttle/configuration_registry.rb +25 -0
- data/app/models/tuttle/version_detector.rb +9 -0
- data/app/views/layouts/tuttle/application.html.erb +29 -20
- data/app/views/tuttle/active_job/index.html.erb +48 -0
- data/app/views/tuttle/active_model_serializers/index.html.erb +2 -0
- data/app/views/tuttle/gems/get_process_mem.html.erb +13 -13
- data/app/views/tuttle/gems/http_clients.html.erb +9 -10
- data/app/views/tuttle/gems/json.html.erb +3 -3
- data/app/views/tuttle/gems/other.html.erb +41 -11
- data/app/views/tuttle/home/index.html.erb +27 -23
- data/app/views/tuttle/{performance_tuning → rack_mini_profiler}/index.html.erb +6 -6
- data/app/views/tuttle/rails/_cache_dalli_store.html.erb +65 -0
- data/app/views/tuttle/rails/_cache_memory_store.html.erb +43 -0
- data/app/views/tuttle/rails/_cache_monitor.html.erb +63 -0
- data/app/views/tuttle/rails/assets.html.erb +181 -28
- data/app/views/tuttle/rails/cache.html.erb +92 -102
- data/app/views/tuttle/rails/database.html.erb +2 -2
- data/app/views/tuttle/rails/index.html.erb +20 -21
- data/app/views/tuttle/rails/routes.html.erb +88 -36
- data/app/views/tuttle/rails/schema_cache.html.erb +2 -1
- data/app/views/tuttle/ruby/index.html.erb +24 -20
- data/config/rails_config_base.yml +80 -0
- data/config/rails_config_v4.x.yml +14 -0
- data/config/rails_config_v5.x.yml +12 -0
- data/config/routes.rb +7 -1
- data/lib/tuttle.rb +3 -6
- data/lib/tuttle/engine.rb +24 -12
- data/lib/tuttle/instrumenter.rb +7 -7
- data/lib/tuttle/middleware/request_profiler.rb +165 -24
- data/lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb +7 -3
- data/lib/tuttle/presenters/rack_mini_profiler/client_settings.rb +27 -0
- data/lib/tuttle/ruby_prof/fast_call_stack_printer.rb +26 -53
- data/lib/tuttle/version.rb +1 -1
- metadata +18 -8
- data/app/controllers/tuttle/performance_tuning_controller.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49cad804b33f2b81f6a9bc6a2e6504e4cf37c962
|
4
|
+
data.tar.gz: e8e15e4dee3836b696168ad3a89b102b4f4af856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03f4de6b82666e963e1b6c1b5b4347389e8a2cd5ae00a2ece02953954a84d17fb37668adf43e88a473263cd15780e59afb8adbc66b11e2e1472f89ebb3d54a3
|
7
|
+
data.tar.gz: a8b9074ed5bbcfeae270e7b2ab875710acd826b383e76f3e2169945f23df06c20f542cad4f35821bbcfe88fb902db747110b4da6439fc40e22956365be0a3bf0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
### 0.0.6
|
2
|
+
|
3
|
+
* Features
|
4
|
+
* Easier configuration with config.enable_profiling to load profiling middleware
|
5
|
+
* Improved Asset Pipeline configuration inspector
|
6
|
+
* Improved Rails Caching configuration inspector
|
7
|
+
* Basic ActiveJob configuration inspector
|
8
|
+
* Improved Rails general configuration options from Rails Guides
|
9
|
+
* Syntax highlighting with highlight.js
|
10
|
+
* Experimental inspector for Facter
|
11
|
+
* Experimental profiler for Busted with additional DTrace inspections
|
12
|
+
|
1
13
|
### 0.0.5
|
2
14
|
|
3
15
|
* Features
|
data/README.md
CHANGED
@@ -2,17 +2,74 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/dgynn/tuttle)
|
4
4
|
[](https://codeclimate.com/github/dgynn/tuttle)
|
5
|
+
[](https://www.codacy.com/app/davegynn/tuttle)
|
5
6
|
[](https://codeclimate.com/github/dgynn/tuttle)
|
6
7
|
[](https://gemnasium.com/dgynn/tuttle)
|
7
8
|
|
8
|
-
Tuttle is a tool
|
9
|
+
Tuttle is a tool that helps Rails developers peek behind the curtain to inspect runtime configuration
|
10
|
+
information for their applications. Tuttle can help with troubleshooting misconfigured
|
11
|
+
apps or just help you better understand what is going on inside the frameworks you use.
|
9
12
|
|
10
|
-
|
13
|
+
#### Features
|
14
|
+
|
15
|
+
* Web dashboard mounted in your running app
|
16
|
+
* Rails general configuration including defaults
|
17
|
+
* Runtime internals of libraries and frameworks (eg ActiveRecord Query Cache)
|
18
|
+
* Application inventory of Controllers and Models
|
19
|
+
* Gems loaded
|
20
|
+
* Ruby VM runtime information (GC stats, tuning parameters)
|
21
|
+
* Optional profiling middleware for on-demand request profiling
|
22
|
+
* Memory profiling using [memory_profiler](https://github.com/SamSaffron/memory_profiler)
|
23
|
+
* CPU profiling using [ruby-prof](https://github.com/ruby-prof/ruby-prof)
|
24
|
+
|
25
|
+
|
26
|
+
Tuttle has no dependencies other than Rails but works with a number of gems if
|
27
|
+
they are loaded to provide inspections.
|
28
|
+
Gems supported include devise, paperclip, active_model_serializers, cancancan, and more.
|
29
|
+
|
30
|
+
Tuttle is still in beta/proof-of-concept mode but is safe to use in development and disabled by default in other environments.
|
31
|
+
|
32
|
+
You can see it in action in a [simple demo application](http://tuttle-demo.herokuapp.com/). The [source code](https://github.com/dgynn/tuttle-demo) for that demo is also on GitHub.
|
11
33
|
|
12
34
|
## To use...
|
13
35
|
|
14
|
-
Add tuttle to
|
36
|
+
Add tuttle to your Gemfile
|
15
37
|
```ruby
|
16
|
-
gem 'tuttle'
|
38
|
+
gem 'tuttle'
|
39
|
+
|
40
|
+
# Include optional profiling gems
|
41
|
+
gem 'memory_profiler'
|
42
|
+
gem 'ruby-prof'
|
43
|
+
|
17
44
|
```
|
18
45
|
Browse to `/tuttle`
|
46
|
+
|
47
|
+
## Configuration
|
48
|
+
|
49
|
+
Tuttle will automatically be enabled and mounted in development. To control the
|
50
|
+
configuration, you can use an initializer.
|
51
|
+
|
52
|
+
config/initializers/tuttle.rb
|
53
|
+
```ruby
|
54
|
+
if defined?(::Tuttle::Engine)
|
55
|
+
Tuttle.setup do |config|
|
56
|
+
config.enabled = true # Defaults to true in development, false in other environments
|
57
|
+
config.automount_engine = true # Defaults to true to mount the engine at /tuttle
|
58
|
+
config.enable_profiling = true # Defaults to false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
**Important:** Do not enable Tuttle in production. Tuttle does not require authentication
|
64
|
+
and exposes internal application details. Sensitive data should be filtered but
|
65
|
+
it is still not something end users should be able to access.
|
66
|
+
|
67
|
+
It is also possible to use the profiling middleware without the Tuttle engine enabled.
|
68
|
+
|
69
|
+
You can directly include the profiling middleware as follows:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
# Add memory/cpu profiler middleware at the end of the stack
|
73
|
+
require 'tuttle/middleware/request_profiler'
|
74
|
+
Rails.application.config.middleware.use Tuttle::Middleware::RequestProfiler
|
75
|
+
```
|
data/Rakefile
CHANGED
@@ -4,21 +4,6 @@ begin
|
|
4
4
|
rescue LoadError
|
5
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
6
|
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'Tuttle'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.md')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
7
|
|
23
8
|
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
24
9
|
load 'rails/tasks/engine.rake'
|
@@ -28,10 +13,10 @@ Bundler::GemHelper.install_tasks
|
|
28
13
|
require 'rake/testtask'
|
29
14
|
|
30
15
|
Rake::TestTask.new(:test) do |t|
|
31
|
-
t.libs << 'lib'
|
32
16
|
t.libs << 'test'
|
33
17
|
t.pattern = 'test/**/*_test.rb'
|
34
18
|
t.verbose = false
|
19
|
+
t.warning = false
|
35
20
|
end
|
36
21
|
|
37
22
|
task :default => :test
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_dependency 'tuttle/application_controller'
|
2
|
+
|
3
|
+
module Tuttle
|
4
|
+
class ActiveJobController < ApplicationController
|
5
|
+
|
6
|
+
def index
|
7
|
+
@job_classes = ActiveJob::Base.descendants # May want to not includ ApplicationJob if it exists
|
8
|
+
|
9
|
+
# TODO: could also look to see if GlobalID is available
|
10
|
+
# https://github.com/rails/globalid
|
11
|
+
|
12
|
+
# See http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html
|
13
|
+
|
14
|
+
# TODO: detect available backend libraries
|
15
|
+
# TODO: catalog the .descendants of ActiveJob::Base
|
16
|
+
# - list the queue_name and queue_adapter per job
|
17
|
+
|
18
|
+
# == Active Job adapters
|
19
|
+
#
|
20
|
+
# Active Job has adapters for the following queueing backends:
|
21
|
+
#
|
22
|
+
# * {Backburner}[https://github.com/nesquena/backburner]
|
23
|
+
# * {Delayed Job}[https://github.com/collectiveidea/delayed_job]
|
24
|
+
# * {Qu}[https://github.com/bkeepers/qu]
|
25
|
+
# * {Que}[https://github.com/chanks/que]
|
26
|
+
# * {queue_classic}[https://github.com/QueueClassic/queue_classic]
|
27
|
+
# * {Resque 1.x}[https://github.com/resque/resque/tree/1-x-stable]
|
28
|
+
# * {Sidekiq}[http://sidekiq.org]
|
29
|
+
# * {Sneakers}[https://github.com/jondot/sneakers]
|
30
|
+
# * {Sucker Punch}[https://github.com/brandonhilkert/sucker_punch]
|
31
|
+
# * {Active Job Async Job}[http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html]
|
32
|
+
# * {Active Job Inline}[http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html]
|
33
|
+
#
|
34
|
+
# === Backends Features
|
35
|
+
#
|
36
|
+
# | | Async | Queues | Delayed | Priorities | Timeout | Retries |
|
37
|
+
# |-------------------|-------|--------|------------|------------|---------|---------|
|
38
|
+
# | Backburner | Yes | Yes | Yes | Yes | Job | Global |
|
39
|
+
# | Delayed Job | Yes | Yes | Yes | Job | Global | Global |
|
40
|
+
# | Qu | Yes | Yes | No | No | No | Global |
|
41
|
+
# | Que | Yes | Yes | Yes | Job | No | Job |
|
42
|
+
# | queue_classic | Yes | Yes | Yes* | No | No | No |
|
43
|
+
# | Resque | Yes | Yes | Yes (Gem) | Queue | Global | Yes |
|
44
|
+
# | Sidekiq | Yes | Yes | Yes | Queue | No | Job |
|
45
|
+
# | Sneakers | Yes | Yes | No | Queue | Queue | No |
|
46
|
+
# | Sucker Punch | Yes | Yes | Yes | No | No | No |
|
47
|
+
# | Active Job Async | Yes | Yes | Yes | No | No | No |
|
48
|
+
# | Active Job Inline | No | Yes | N/A | N/A | N/A | N/A |
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -10,16 +10,11 @@ module Tuttle
|
|
10
10
|
@serializers = ::ActiveModel::Serializer.descendants
|
11
11
|
@serializers.sort_by!(&:name)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
ActiveModelSerializers::Adapter.const_get(:ADAPTER_MAP)
|
17
|
-
end
|
18
|
-
|
19
|
-
unless defined?(ActiveModelSerializers)
|
13
|
+
if defined?(ActiveModelSerializers)
|
14
|
+
render 'index'
|
15
|
+
else
|
20
16
|
render 'index9'
|
21
17
|
end
|
22
|
-
|
23
18
|
end
|
24
19
|
|
25
20
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Tuttle
|
2
2
|
class ApplicationController < ActionController::Base
|
3
3
|
abstract!
|
4
|
+
protect_from_forgery with: :exception
|
4
5
|
|
5
6
|
before_action :check_reload_status
|
6
7
|
|
8
|
+
private
|
9
|
+
|
7
10
|
def check_reload_status
|
8
11
|
return unless Tuttle::Engine.reload_needed && !Rails.configuration.eager_load
|
9
12
|
Tuttle::Engine.logger.warn('Eager-loading application')
|
@@ -9,25 +9,18 @@ module Tuttle
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def rule_tester
|
12
|
-
@models = ActiveRecord::Base.descendants
|
12
|
+
@models = ActiveRecord::Base.descendants.reject(&:abstract_class)
|
13
13
|
@action = params[:action_name] || 'read'
|
14
|
-
@subject =
|
15
|
-
|
16
|
-
subject_class = params[:subject_class]
|
17
|
-
subject_id = params[:subject_id]
|
18
|
-
|
19
|
-
if !subject_class.blank? && Kernel.const_defined?(subject_class)
|
20
|
-
begin
|
21
|
-
subject_klass = Kernel.const_get(params[:subject_class])
|
22
|
-
@subject = subject_klass.find(subject_id) unless subject_id.blank?
|
23
|
-
@subject ||= subject_klass.new
|
24
|
-
rescue
|
25
|
-
# Could not load subject
|
26
|
-
end
|
27
|
-
end
|
14
|
+
@subject = find_subject(params[:subject_class], params[:subject_id])
|
28
15
|
@cancan_user = current_user || User.new
|
29
16
|
@ability = Ability.new(@cancan_user)
|
30
17
|
end
|
31
18
|
|
19
|
+
private
|
20
|
+
|
21
|
+
def find_subject(subject_class, subject_id)
|
22
|
+
subject_klass = @models.detect { |x| x.name == subject_class } if subject_class.present?
|
23
|
+
subject_klass.find_or_initialize_by(:id => subject_id) if subject_klass
|
24
|
+
end
|
32
25
|
end
|
33
26
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
require_dependency 'tuttle/application_controller'
|
2
|
-
require 'devise/version' if defined?
|
2
|
+
require 'devise/version' if defined?(Devise)
|
3
3
|
|
4
4
|
module Tuttle
|
5
5
|
class DeviseController < ApplicationController
|
6
6
|
|
7
7
|
def index
|
8
|
-
render(plain: "Devise not installed") and return unless defined? ::Devise
|
9
8
|
end
|
10
9
|
|
11
10
|
end
|
@@ -4,23 +4,23 @@ module Tuttle
|
|
4
4
|
class GemsController < ApplicationController
|
5
5
|
|
6
6
|
def index
|
7
|
-
|
8
7
|
end
|
9
8
|
|
10
9
|
def http_clients
|
11
|
-
|
12
10
|
end
|
13
11
|
|
14
12
|
def json
|
15
|
-
|
16
13
|
end
|
17
14
|
|
15
|
+
# rubocop:disable Style/AccessorMethodName
|
18
16
|
def get_process_mem
|
17
|
+
require 'get_process_mem'
|
19
18
|
require 'get_process_mem/version'
|
19
|
+
@memory_self = GetProcessMem.new
|
20
|
+
@memory_parent = GetProcessMem.new(Process.ppid)
|
20
21
|
end
|
21
22
|
|
22
23
|
def other
|
23
|
-
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
require_dependency 'tuttle/application_controller'
|
2
|
-
require 'paperclip/version' if defined?(
|
2
|
+
require 'paperclip/version' if defined?(Paperclip)
|
3
3
|
|
4
4
|
module Tuttle
|
5
5
|
class PaperclipController < ApplicationController
|
6
6
|
|
7
7
|
def index
|
8
8
|
# Note: in development with reloading, classes will show up in the registry multiple times
|
9
|
-
render(plain: "Paperclip not installed") and return unless defined?(::Paperclip)
|
10
9
|
@pcar = Paperclip::AttachmentRegistry.instance
|
11
10
|
end
|
12
11
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_dependency 'tuttle/application_controller'
|
2
|
+
|
3
|
+
module Tuttle
|
4
|
+
class RackMiniProfilerController < ApplicationController
|
5
|
+
|
6
|
+
def index
|
7
|
+
return redirect_to gems_other_path unless defined?(::Rack::MiniProfiler::Config)
|
8
|
+
|
9
|
+
require_dependency 'tuttle/presenters/rack_mini_profiler/client_settings'
|
10
|
+
@mp_config = ::Rack::MiniProfiler.config
|
11
|
+
@mp_client_settings = Tuttle::Presenters::RackMiniProfiler::ClientSettings.new(request.env)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -6,6 +6,7 @@ module Tuttle
|
|
6
6
|
class RailsController < ApplicationController
|
7
7
|
|
8
8
|
def index
|
9
|
+
@config_options = Tuttle::ConfigurationRegistry.data.to_a.sort_by!(&:first)
|
9
10
|
end
|
10
11
|
|
11
12
|
def controllers
|
@@ -34,6 +35,7 @@ module Tuttle
|
|
34
35
|
|
35
36
|
def database
|
36
37
|
@conn = ActiveRecord::Base.connection
|
38
|
+
@data_sources = @conn.respond_to?(:data_sources) ? @conn.data_sources : @conn.tables
|
37
39
|
end
|
38
40
|
|
39
41
|
def schema_cache
|
@@ -59,11 +61,12 @@ module Tuttle
|
|
59
61
|
# helper_symbol = Rails.application.helpers.instance_methods.first
|
60
62
|
# Rails.application.helpers.instance_method(helper_symbol).owner
|
61
63
|
# Rails.application.helpers.instance_method(helper_symbol).parameters
|
62
|
-
@helpers = ::ApplicationController.send(:modules_for_helpers,[:all])
|
64
|
+
@helpers = ::ApplicationController.send(:modules_for_helpers, [:all])
|
63
65
|
end
|
64
66
|
|
65
67
|
def assets
|
66
|
-
@
|
68
|
+
@sprockets_env = Rails.application.assets
|
69
|
+
@assets_config = Rails.application.config.assets
|
67
70
|
# TODO: revisit detection of "engines" which are classified as processors, transformers, etc.
|
68
71
|
end
|
69
72
|
|
@@ -71,6 +74,10 @@ module Tuttle
|
|
71
74
|
@routes = Rails.application.routes.routes.collect do |route|
|
72
75
|
Tuttle::Presenters::ActionDispatch::Routing::RouteWrapper.new(route)
|
73
76
|
end
|
77
|
+
if params[:recognize_path]
|
78
|
+
@path_to_recognize = params[:recognize_path]
|
79
|
+
@recognized_paths = recognize_paths(params[:recognize_path])
|
80
|
+
end
|
74
81
|
# TODO: include engine-mounted routes
|
75
82
|
end
|
76
83
|
|
@@ -80,14 +87,45 @@ module Tuttle
|
|
80
87
|
end
|
81
88
|
|
82
89
|
def cache
|
90
|
+
@cache = Rails.cache
|
83
91
|
# TODO: make cache instrumentation controllable - this will automatically turn in on in Rails < 4.2
|
84
92
|
# Instrumentation is always on in Rails 4.2+
|
85
|
-
if Rails::VERSION::STRING =~ /^4\.1\./ && !ActiveSupport::Cache::Store.instrument
|
86
|
-
|
93
|
+
# if Rails::VERSION::STRING =~ /^4\.1\./ && !ActiveSupport::Cache::Store.instrument
|
94
|
+
# ActiveSupport::Cache::Store.instrument = true
|
95
|
+
# end
|
96
|
+
# @cache_events = Tuttle::Instrumenter.events.select {|e| /cache_(read|write)\.active_support/ =~ e.name }
|
97
|
+
# @tuttle_cache_events = Tuttle::Instrumenter.cache_events
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
def recognize_paths(path)
|
103
|
+
results = {}
|
104
|
+
[:get, :post, :put, :delete, :patch].each {|method| results[method] = recognize_path(path, method: method)}
|
105
|
+
results
|
106
|
+
end
|
107
|
+
|
108
|
+
# a version that handles engines - based on https://gist.github.com/jtanium/6114632
|
109
|
+
# it's possible that multiple engines could handle a particular path. So we will
|
110
|
+
# capture each of them
|
111
|
+
def recognize_path(path, options)
|
112
|
+
recognized_paths = []
|
113
|
+
recognized_paths << Rails.application.routes.recognize_path(path, options)
|
114
|
+
rescue ActionController::RoutingError => exception
|
115
|
+
# The main app didn't recognize the path, try the engines...
|
116
|
+
Rails::Engine.subclasses.each do |engine|
|
117
|
+
engine_instance = engine.instance
|
118
|
+
engine_class = engine_instance.class
|
119
|
+
begin
|
120
|
+
recognized_path = engine_instance.routes.recognize_path(path, options)
|
121
|
+
recognized_path[:engine] = engine_class
|
122
|
+
recognized_paths << recognized_path
|
123
|
+
rescue ActionController::RoutingError
|
124
|
+
Tuttle::Engine.logger.info("Routing error recognizing path for #{path}")
|
125
|
+
end
|
87
126
|
end
|
88
|
-
|
89
|
-
|
90
|
-
@tuttle_cache_events = Tuttle::Instrumenter.cache_events
|
127
|
+
|
128
|
+
recognized_paths.empty? ? [{ error: exception.message }] : recognized_paths
|
91
129
|
end
|
92
130
|
|
93
131
|
end
|
@@ -5,15 +5,20 @@ require_dependency 'tuttle/application_controller'
|
|
5
5
|
module Tuttle
|
6
6
|
class RubyController < ApplicationController
|
7
7
|
|
8
|
+
ENV_FILTERS = [/.*_(URL|PASSWORD|KEY|KEY_BASE|AUTHENTICATION)$/].freeze
|
9
|
+
|
8
10
|
def index
|
9
11
|
# TODO: need better filter for sensitive values. this covers DB-style URLs with passwords, passwords, and keys
|
10
|
-
|
12
|
+
env_hash = ENV.to_hash
|
13
|
+
env_hash = ActionDispatch::Http::ParameterFilter.new(ENV_FILTERS).filter(env_hash) unless params[:nofilter]
|
14
|
+
@filtered_env = env_hash.sort
|
11
15
|
end
|
12
16
|
|
13
17
|
def tuning
|
14
18
|
@gc_enabled = (GC.disable ? false : GC.enable)
|
15
19
|
|
16
20
|
# taken verbatim from the ruby 2.2 man page
|
21
|
+
# rubocop:disable Metrics/LineLength
|
17
22
|
@gc_params = {
|
18
23
|
'RUBY_GC_HEAP_INIT_SLOTS' => 'Initial allocation slots. Introduced in Ruby 2.1, default: 10000.',
|
19
24
|
'RUBY_GC_HEAP_FREE_SLOTS' => 'Prepare at least this amount of slots after GC. Allocate this number slots if there are not enough slots. Introduced in Ruby 2.1, default: 4096',
|
@@ -30,7 +35,6 @@ module Tuttle
|
|
30
35
|
end
|
31
36
|
|
32
37
|
def miscellaneous
|
33
|
-
|
34
38
|
end
|
35
39
|
|
36
40
|
end
|