Class: Profiler::Configuration
- Inherits:
-
Object
- Object
- Profiler::Configuration
- Defined in:
- lib/profiler/configuration.rb
Instance Attribute Summary collapse
-
#ajax_skip_paths ⇒ Object
Returns the value of attribute ajax_skip_paths.
-
#authorization_mode ⇒ Object
Returns the value of attribute authorization_mode.
-
#authorize_block ⇒ Object
readonly
Returns the value of attribute authorize_block.
-
#capture_mail_body ⇒ Object
Returns the value of attribute capture_mail_body.
-
#cluster_heartbeat_interval ⇒ Object
Returns the value of attribute cluster_heartbeat_interval.
-
#cluster_offline_threshold ⇒ Object
Returns the value of attribute cluster_offline_threshold.
-
#collectors ⇒ Object
Returns the value of attribute collectors.
-
#compress_bodies ⇒ Object
Returns the value of attribute compress_bodies.
-
#compress_body_threshold ⇒ Object
Returns the value of attribute compress_body_threshold.
-
#cors_allowed_origins ⇒ Object
Returns the value of attribute cors_allowed_origins.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#extension_cors_enabled ⇒ Object
Returns the value of attribute extension_cors_enabled.
-
#http_backtrace_depth ⇒ Object
Returns the value of attribute http_backtrace_depth.
-
#http_skip_hosts ⇒ Object
Returns the value of attribute http_skip_hosts.
-
#mailer_skip_actions ⇒ Object
Returns the value of attribute mailer_skip_actions.
-
#master_url ⇒ Object
Returns the value of attribute master_url.
-
#max_profiles ⇒ Object
Returns the value of attribute max_profiles.
-
#max_queries_warning ⇒ Object
Returns the value of attribute max_queries_warning.
-
#mcp_enabled ⇒ Object
Returns the value of attribute mcp_enabled.
-
#mcp_port ⇒ Object
Returns the value of attribute mcp_port.
-
#mcp_transport ⇒ Object
Returns the value of attribute mcp_transport.
-
#memory_warning_threshold ⇒ Object
Returns the value of attribute memory_warning_threshold.
-
#name ⇒ Object
Returns the value of attribute name.
-
#sanitize_mailer_recipients ⇒ Object
Returns the value of attribute sanitize_mailer_recipients.
-
#self_url ⇒ Object
Returns the value of attribute self_url.
-
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
-
#slow_http_threshold ⇒ Object
Returns the value of attribute slow_http_threshold.
-
#slow_query_threshold ⇒ Object
Returns the value of attribute slow_query_threshold.
-
#storage_options ⇒ Object
Returns the value of attribute storage_options.
- #tmp_path ⇒ Object
-
#track_ajax ⇒ Object
Returns the value of attribute track_ajax.
-
#track_console ⇒ Object
Returns the value of attribute track_console.
-
#track_http ⇒ Object
Returns the value of attribute track_http.
-
#track_jobs ⇒ Object
Returns the value of attribute track_jobs.
-
#track_mailers ⇒ Object
Returns the value of attribute track_mailers.
-
#track_memory ⇒ Object
Returns the value of attribute track_memory.
-
#track_tests ⇒ Object
Returns the value of attribute track_tests.
Instance Method Summary collapse
- #authorize_with(&block) ⇒ Object
- #authorized?(request) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #master? ⇒ Boolean
- #resolved_name ⇒ Object
- #slave? ⇒ Boolean
- #storage ⇒ Object
- #storage=(value) ⇒ Object
- #storage_backend ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/profiler/configuration.rb', line 25 def initialize @enabled = false @storage = :memory @storage_options = {} @collectors = [] @skip_paths = [%r{^/_profiler}, /\.well-known/, /favicon\.ico/, /manifest\.json/] @slow_query_threshold = 100 # milliseconds @max_queries_warning = 50 @track_memory = true @memory_warning_threshold = 100 * 1024 * 1024 # 100 MB @mcp_enabled = false @mcp_transport = :stdio @mcp_port = 3001 @authorization_mode = :allow_all @authorize_block = nil @max_profiles = 100 @extension_cors_enabled = true @cors_allowed_origins = ["*"] @track_ajax = true @ajax_skip_paths = [/^\/_profiler/] @track_http = true @slow_http_threshold = 500 # milliseconds @http_skip_hosts = [] @http_backtrace_depth = 40 @track_jobs = true @track_console = true @track_tests = false @track_mailers = true @capture_mail_body = false @sanitize_mailer_recipients = false @mailer_skip_actions = [] @compress_bodies = true @compress_body_threshold = 10 * 1024 # 10 KB @tmp_path = nil @name = nil @master_url = nil @self_url = nil @cluster_heartbeat_interval = 15 @cluster_offline_threshold = 60 end |
Instance Attribute Details
#ajax_skip_paths ⇒ Object
Returns the value of attribute ajax_skip_paths.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def ajax_skip_paths @ajax_skip_paths end |
#authorization_mode ⇒ Object
Returns the value of attribute authorization_mode.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def @authorization_mode end |
#authorize_block ⇒ Object (readonly)
Returns the value of attribute authorize_block.
23 24 25 |
# File 'lib/profiler/configuration.rb', line 23 def @authorize_block end |
#capture_mail_body ⇒ Object
Returns the value of attribute capture_mail_body.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def capture_mail_body @capture_mail_body end |
#cluster_heartbeat_interval ⇒ Object
Returns the value of attribute cluster_heartbeat_interval.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def cluster_heartbeat_interval @cluster_heartbeat_interval end |
#cluster_offline_threshold ⇒ Object
Returns the value of attribute cluster_offline_threshold.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def cluster_offline_threshold @cluster_offline_threshold end |
#collectors ⇒ Object
Returns the value of attribute collectors.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def collectors @collectors end |
#compress_bodies ⇒ Object
Returns the value of attribute compress_bodies.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def compress_bodies @compress_bodies end |
#compress_body_threshold ⇒ Object
Returns the value of attribute compress_body_threshold.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def compress_body_threshold @compress_body_threshold end |
#cors_allowed_origins ⇒ Object
Returns the value of attribute cors_allowed_origins.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def cors_allowed_origins @cors_allowed_origins end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def enabled @enabled end |
#extension_cors_enabled ⇒ Object
Returns the value of attribute extension_cors_enabled.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def extension_cors_enabled @extension_cors_enabled end |
#http_backtrace_depth ⇒ Object
Returns the value of attribute http_backtrace_depth.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def http_backtrace_depth @http_backtrace_depth end |
#http_skip_hosts ⇒ Object
Returns the value of attribute http_skip_hosts.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def http_skip_hosts @http_skip_hosts end |
#mailer_skip_actions ⇒ Object
Returns the value of attribute mailer_skip_actions.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def mailer_skip_actions @mailer_skip_actions end |
#master_url ⇒ Object
Returns the value of attribute master_url.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def master_url @master_url end |
#max_profiles ⇒ Object
Returns the value of attribute max_profiles.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def max_profiles @max_profiles end |
#max_queries_warning ⇒ Object
Returns the value of attribute max_queries_warning.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def max_queries_warning @max_queries_warning end |
#mcp_enabled ⇒ Object
Returns the value of attribute mcp_enabled.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def mcp_enabled @mcp_enabled end |
#mcp_port ⇒ Object
Returns the value of attribute mcp_port.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def mcp_port @mcp_port end |
#mcp_transport ⇒ Object
Returns the value of attribute mcp_transport.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def mcp_transport @mcp_transport end |
#memory_warning_threshold ⇒ Object
Returns the value of attribute memory_warning_threshold.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def memory_warning_threshold @memory_warning_threshold end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def name @name end |
#sanitize_mailer_recipients ⇒ Object
Returns the value of attribute sanitize_mailer_recipients.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def sanitize_mailer_recipients @sanitize_mailer_recipients end |
#self_url ⇒ Object
Returns the value of attribute self_url.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def self_url @self_url end |
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def skip_paths @skip_paths end |
#slow_http_threshold ⇒ Object
Returns the value of attribute slow_http_threshold.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def slow_http_threshold @slow_http_threshold end |
#slow_query_threshold ⇒ Object
Returns the value of attribute slow_query_threshold.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def slow_query_threshold @slow_query_threshold end |
#storage_options ⇒ Object
Returns the value of attribute storage_options.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def @storage_options end |
#tmp_path ⇒ Object
66 67 68 |
# File 'lib/profiler/configuration.rb', line 66 def tmp_path @tmp_path || default_tmp_path end |
#track_ajax ⇒ Object
Returns the value of attribute track_ajax.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_ajax @track_ajax end |
#track_console ⇒ Object
Returns the value of attribute track_console.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_console @track_console end |
#track_http ⇒ Object
Returns the value of attribute track_http.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_http @track_http end |
#track_jobs ⇒ Object
Returns the value of attribute track_jobs.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_jobs @track_jobs end |
#track_mailers ⇒ Object
Returns the value of attribute track_mailers.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_mailers @track_mailers end |
#track_memory ⇒ Object
Returns the value of attribute track_memory.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_memory @track_memory end |
#track_tests ⇒ Object
Returns the value of attribute track_tests.
5 6 7 |
# File 'lib/profiler/configuration.rb', line 5 def track_tests @track_tests end |
Instance Method Details
#authorize_with(&block) ⇒ Object
82 83 84 |
# File 'lib/profiler/configuration.rb', line 82 def (&block) @authorize_block = block end |
#authorized?(request) ⇒ Boolean
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/profiler/configuration.rb', line 86 def (request) case @authorization_mode when :allow_all true when :allow_authorized @authorize_block ? @authorize_block.call(request) : false else false end end |
#master? ⇒ Boolean
74 75 76 |
# File 'lib/profiler/configuration.rb', line 74 def master? !slave? end |
#resolved_name ⇒ Object
78 79 80 |
# File 'lib/profiler/configuration.rb', line 78 def resolved_name @name || (defined?(Rails) ? Rails.application.class.module_parent_name.underscore : "profiler") end |
#slave? ⇒ Boolean
70 71 72 |
# File 'lib/profiler/configuration.rb', line 70 def slave? !master_url.nil? && !master_url.empty? end |
#storage ⇒ Object
97 98 99 |
# File 'lib/profiler/configuration.rb', line 97 def storage @storage end |
#storage=(value) ⇒ Object
101 102 103 104 |
# File 'lib/profiler/configuration.rb', line 101 def storage=(value) @storage = value @storage_backend = nil end |
#storage_backend ⇒ Object
106 107 108 |
# File 'lib/profiler/configuration.rb', line 106 def storage_backend @storage_backend ||= build_storage_backend end |