Class: Dontbugme::Configuration
- Inherits:
-
Object
- Object
- Dontbugme::Configuration
- Defined in:
- lib/dontbugme/configuration.rb
Instance Attribute Summary collapse
-
#async_store ⇒ Object
Returns the value of attribute async_store.
-
#capture_http_body ⇒ Object
Returns the value of attribute capture_http_body.
-
#capture_http_headers ⇒ Object
Returns the value of attribute capture_http_headers.
-
#capture_redis_return_values ⇒ Object
Returns the value of attribute capture_redis_return_values.
-
#capture_redis_values ⇒ Object
Returns the value of attribute capture_redis_values.
-
#capture_span_output ⇒ Object
Returns the value of attribute capture_span_output.
-
#capture_sql_binds ⇒ Object
Returns the value of attribute capture_sql_binds.
-
#capture_variable_changes ⇒ Object
Returns the value of attribute capture_variable_changes.
-
#enable_web_ui ⇒ Object
Returns the value of attribute enable_web_ui.
-
#max_http_body_size ⇒ Object
Returns the value of attribute max_http_body_size.
-
#max_redis_value_size ⇒ Object
Returns the value of attribute max_redis_value_size.
-
#max_span_detail_size ⇒ Object
Returns the value of attribute max_span_detail_size.
-
#max_spans_per_trace ⇒ Object
Returns the value of attribute max_spans_per_trace.
-
#max_sql_bind_size ⇒ Object
Returns the value of attribute max_sql_bind_size.
-
#max_trace_buffer_bytes ⇒ Object
Returns the value of attribute max_trace_buffer_bytes.
-
#max_traces ⇒ Object
Returns the value of attribute max_traces.
-
#postgresql_connection ⇒ Object
Returns the value of attribute postgresql_connection.
-
#record_jobs ⇒ Object
Returns the value of attribute record_jobs.
-
#record_on_error ⇒ Object
Returns the value of attribute record_on_error.
-
#record_requests ⇒ Object
Returns the value of attribute record_requests.
-
#recording_mode ⇒ Object
Returns the value of attribute recording_mode.
-
#retention ⇒ Object
Returns the value of attribute retention.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#source_depth ⇒ Object
Returns the value of attribute source_depth.
-
#source_filter ⇒ Object
Returns the value of attribute source_filter.
-
#source_mode ⇒ Object
Returns the value of attribute source_mode.
-
#source_stack_limit ⇒ Object
Returns the value of attribute source_stack_limit.
-
#span_overflow_strategy ⇒ Object
Returns the value of attribute span_overflow_strategy.
-
#sqlite_path ⇒ Object
Returns the value of attribute sqlite_path.
-
#store ⇒ Object
Returns the value of attribute store.
-
#web_ui_mount_path ⇒ Object
Returns the value of attribute web_ui_mount_path.
Instance Method Summary collapse
- #apply_development_defaults ⇒ Object
- #apply_environment_defaults ⇒ Object
- #apply_production_defaults ⇒ Object
- #apply_test_defaults ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #recording? ⇒ Boolean
- #should_record_job?(job_class) ⇒ Boolean
- #should_record_request?(env) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
37 38 39 |
# File 'lib/dontbugme/configuration.rb', line 37 def initialize apply_environment_defaults end |
Instance Attribute Details
#async_store ⇒ Object
Returns the value of attribute async_store.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def async_store @async_store end |
#capture_http_body ⇒ Object
Returns the value of attribute capture_http_body.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_http_body @capture_http_body end |
#capture_http_headers ⇒ Object
Returns the value of attribute capture_http_headers.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_http_headers @capture_http_headers end |
#capture_redis_return_values ⇒ Object
Returns the value of attribute capture_redis_return_values.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_redis_return_values @capture_redis_return_values end |
#capture_redis_values ⇒ Object
Returns the value of attribute capture_redis_values.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_redis_values @capture_redis_values end |
#capture_span_output ⇒ Object
Returns the value of attribute capture_span_output.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_span_output @capture_span_output end |
#capture_sql_binds ⇒ Object
Returns the value of attribute capture_sql_binds.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_sql_binds @capture_sql_binds end |
#capture_variable_changes ⇒ Object
Returns the value of attribute capture_variable_changes.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def capture_variable_changes @capture_variable_changes end |
#enable_web_ui ⇒ Object
Returns the value of attribute enable_web_ui.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def enable_web_ui @enable_web_ui end |
#max_http_body_size ⇒ Object
Returns the value of attribute max_http_body_size.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_http_body_size @max_http_body_size end |
#max_redis_value_size ⇒ Object
Returns the value of attribute max_redis_value_size.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_redis_value_size @max_redis_value_size end |
#max_span_detail_size ⇒ Object
Returns the value of attribute max_span_detail_size.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_span_detail_size @max_span_detail_size end |
#max_spans_per_trace ⇒ Object
Returns the value of attribute max_spans_per_trace.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_spans_per_trace @max_spans_per_trace end |
#max_sql_bind_size ⇒ Object
Returns the value of attribute max_sql_bind_size.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_sql_bind_size @max_sql_bind_size end |
#max_trace_buffer_bytes ⇒ Object
Returns the value of attribute max_trace_buffer_bytes.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_trace_buffer_bytes @max_trace_buffer_bytes end |
#max_traces ⇒ Object
Returns the value of attribute max_traces.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def max_traces @max_traces end |
#postgresql_connection ⇒ Object
Returns the value of attribute postgresql_connection.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def postgresql_connection @postgresql_connection end |
#record_jobs ⇒ Object
Returns the value of attribute record_jobs.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def record_jobs @record_jobs end |
#record_on_error ⇒ Object
Returns the value of attribute record_on_error.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def record_on_error @record_on_error end |
#record_requests ⇒ Object
Returns the value of attribute record_requests.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def record_requests @record_requests end |
#recording_mode ⇒ Object
Returns the value of attribute recording_mode.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def recording_mode @recording_mode end |
#retention ⇒ Object
Returns the value of attribute retention.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def retention @retention end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def sample_rate @sample_rate end |
#source_depth ⇒ Object
Returns the value of attribute source_depth.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def source_depth @source_depth end |
#source_filter ⇒ Object
Returns the value of attribute source_filter.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def source_filter @source_filter end |
#source_mode ⇒ Object
Returns the value of attribute source_mode.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def source_mode @source_mode end |
#source_stack_limit ⇒ Object
Returns the value of attribute source_stack_limit.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def source_stack_limit @source_stack_limit end |
#span_overflow_strategy ⇒ Object
Returns the value of attribute span_overflow_strategy.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def span_overflow_strategy @span_overflow_strategy end |
#sqlite_path ⇒ Object
Returns the value of attribute sqlite_path.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def sqlite_path @sqlite_path end |
#store ⇒ Object
Returns the value of attribute store.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def store @store end |
#web_ui_mount_path ⇒ Object
Returns the value of attribute web_ui_mount_path.
5 6 7 |
# File 'lib/dontbugme/configuration.rb', line 5 def web_ui_mount_path @web_ui_mount_path end |
Instance Method Details
#apply_development_defaults ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/dontbugme/configuration.rb', line 54 def apply_development_defaults self.store = :sqlite self.sqlite_path = 'tmp/inspector/inspector.db' self.postgresql_connection = nil self.enable_web_ui = true self.web_ui_mount_path = '/inspector' self.recording_mode = :always self.record_on_error = true self.record_jobs = :all self.record_requests = :all self.sample_rate = 1.0 self.capture_sql_binds = true self.capture_http_headers = [] self.capture_http_body = false self.capture_redis_values = false self.capture_redis_return_values = true self.capture_span_output = true self.capture_variable_changes = true self.source_mode = :full self.source_filter = %w[app/ lib/] self.source_depth = 3 self.source_stack_limit = 50 self.max_spans_per_trace = 1_000 self.span_overflow_strategy = :count self.max_sql_bind_size = 4_096 self.max_http_body_size = 8_192 self.max_redis_value_size = 512 self.max_span_detail_size = 8_192 self.max_trace_buffer_bytes = 10 * 1024 * 1024 # 10 MB self.retention = retention_seconds(72, :hours) self.max_traces = 10_000 self.async_store = false end |
#apply_environment_defaults ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dontbugme/configuration.rb', line 41 def apply_environment_defaults env = defined?(Rails) ? Rails.env.to_s : 'development' case env when 'test' apply_test_defaults when 'production' apply_production_defaults else apply_development_defaults end end |
#apply_production_defaults ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/dontbugme/configuration.rb', line 98 def apply_production_defaults apply_development_defaults self.store = :postgresql self.enable_web_ui = false self.recording_mode = :selective self.record_on_error = true self.capture_sql_binds = false self.capture_redis_return_values = false self.capture_span_output = false self.capture_variable_changes = false self.source_mode = :shallow self.source_depth = 1 self.source_stack_limit = 30 self.max_spans_per_trace = 500 self.max_sql_bind_size = 512 self.max_http_body_size = 1_024 self.max_span_detail_size = 2_048 self.max_trace_buffer_bytes = 5 * 1024 * 1024 # 5 MB self.retention = retention_seconds(24, :hours) self.async_store = true end |
#apply_test_defaults ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/dontbugme/configuration.rb', line 88 def apply_test_defaults apply_development_defaults self.store = :memory self.recording_mode = :off self.enable_web_ui = false self.record_on_error = false self.capture_variable_changes = false self.max_trace_buffer_bytes = 5 * 1024 * 1024 # 5 MB end |
#recording? ⇒ Boolean
120 121 122 123 124 125 126 |
# File 'lib/dontbugme/configuration.rb', line 120 def recording? return false if recording_mode == :off return true if recording_mode == :always # :selective — caller (Recorder) decides based on record_jobs, record_requests, etc. true end |
#should_record_job?(job_class) ⇒ Boolean
128 129 130 131 132 133 134 |
# File 'lib/dontbugme/configuration.rb', line 128 def should_record_job?(job_class) return false if record_jobs == :none return true if record_jobs == :all return record_jobs.include?(job_class.to_s) if record_jobs.is_a?(Array) false end |
#should_record_request?(env) ⇒ Boolean
136 137 138 139 140 141 142 |
# File 'lib/dontbugme/configuration.rb', line 136 def should_record_request?(env) return false if record_requests == :none return true if record_requests == :all return record_requests.call(env) if record_requests.respond_to?(:call) false end |