Class: Sentry::Rails::Configuration
- Inherits:
-
Object
- Object
- Sentry::Rails::Configuration
- Defined in:
- lib/sentry/rails/configuration.rb
Instance Attribute Summary collapse
-
#active_job_propagate_traces ⇒ Object
Whether we should inject trace propagation headers into the serialized job payload in order to have a connected trace between producer and consumer.
-
#active_job_report_on_retry_error ⇒ Object
Set this option to true if you want Sentry to capture each retry failure.
-
#active_support_logger_subscription_items ⇒ Hash<String, Array<Symbol>>
Hash of subscription items that will be shown in breadcrumbs active support logger.
-
#assets_regexp ⇒ Object
sentry-rails by default skips asset request' transactions by checking if the path matches.
-
#db_query_source_threshold_ms ⇒ Object
The threshold in milliseconds for the ActiveRecordSubscriber to capture the source location of the query in the span data.
-
#enable_db_query_source ⇒ Object
When the ActiveRecordSubscriber is enabled, capture the source location of the query in the span data.
-
#register_error_subscriber ⇒ Object
Rails 7.0 introduced a new error reporter feature, which the SDK once opted-in by default.
-
#report_rescued_exceptions ⇒ Object
Rails catches exceptions in the ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions middlewares, depending on the environment.
-
#skippable_job_adapters ⇒ Object
Some adapters, like sidekiq, already have their own sentry integration.
-
#structured_logging ⇒ StructuredLoggingConfiguration
readonly
Configuration for structured logging feature.
-
#tracing_subscribers ⇒ Object
Returns the value of attribute tracing_subscribers.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/sentry/rails/configuration.rb', line 190 def initialize @register_error_subscriber = false @report_rescued_exceptions = true @skippable_job_adapters = [] @assets_regexp = if defined?(::Sprockets::Rails) %r(\A/{0,2}#{::Rails.application.config.assets.prefix}) end @tracing_subscribers = Set.new([ Sentry::Rails::Tracing::ActionViewSubscriber, Sentry::Rails::Tracing::ActiveSupportSubscriber, Sentry::Rails::Tracing::ActiveRecordSubscriber, Sentry::Rails::Tracing::ActiveStorageSubscriber ]) @enable_db_query_source = true @db_query_source_threshold_ms = 100 @active_support_logger_subscription_items = Sentry::Rails::ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT.dup @active_job_report_on_retry_error = false @active_job_propagate_traces = true @structured_logging = StructuredLoggingConfiguration.new end |
Instance Attribute Details
#active_job_propagate_traces ⇒ Object
Whether we should inject trace propagation headers into the serialized job payload in order to have a connected trace between producer and consumer. Defaults to true. Set to false to opt out.
184 185 186 |
# File 'lib/sentry/rails/configuration.rb', line 184 def active_job_propagate_traces @active_job_propagate_traces end |
#active_job_report_on_retry_error ⇒ Object
Set this option to true if you want Sentry to capture each retry failure
179 180 181 |
# File 'lib/sentry/rails/configuration.rb', line 179 def active_job_report_on_retry_error @active_job_report_on_retry_error end |
#active_support_logger_subscription_items ⇒ Hash<String, Array<Symbol>>
Hash of subscription items that will be shown in breadcrumbs active support logger.
176 177 178 |
# File 'lib/sentry/rails/configuration.rb', line 176 def active_support_logger_subscription_items @active_support_logger_subscription_items end |
#assets_regexp ⇒ Object
sentry-rails by default skips asset request' transactions by checking if the path matches
%r(\A/{0,2}#{::Rails.application.config.assets.prefix})
If you want to use a different pattern, you can configure the assets_regexp option like:
Sentry.init do |config|
config.rails.assets_regexp = /my_regexp/
end
172 173 174 |
# File 'lib/sentry/rails/configuration.rb', line 172 def assets_regexp @assets_regexp end |
#db_query_source_threshold_ms ⇒ Object
The threshold in milliseconds for the ActiveRecordSubscriber to capture the source location of the query in the span data. Default is 100ms.
157 158 159 |
# File 'lib/sentry/rails/configuration.rb', line 157 def db_query_source_threshold_ms @db_query_source_threshold_ms end |
#enable_db_query_source ⇒ Object
When the ActiveRecordSubscriber is enabled, capture the source location of the query in the span data. This is enabled by default, but can be disabled by setting this to false.
153 154 155 |
# File 'lib/sentry/rails/configuration.rb', line 153 def enable_db_query_source @enable_db_query_source end |
#register_error_subscriber ⇒ Object
Rails 7.0 introduced a new error reporter feature, which the SDK once opted-in by default. But after receiving multiple issue reports, the integration seemed to cause serious troubles to some users. So the integration is now controlled by this configuration, which is disabled (false) by default. More information can be found from: https://github.com/rails/rails/pull/43625#issuecomment-1072514175
137 138 139 |
# File 'lib/sentry/rails/configuration.rb', line 137 def register_error_subscriber @register_error_subscriber end |
#report_rescued_exceptions ⇒ Object
Rails catches exceptions in the ActionDispatch::ShowExceptions or
ActionDispatch::DebugExceptions middlewares, depending on the environment.
When report_rescued_exceptions is true (it is by default), Sentry will
report exceptions even when they are rescued by these middlewares.
143 144 145 |
# File 'lib/sentry/rails/configuration.rb', line 143 def report_rescued_exceptions @report_rescued_exceptions end |
#skippable_job_adapters ⇒ Object
Some adapters, like sidekiq, already have their own sentry integration. In those cases, we should skip ActiveJob's reporting to avoid duplicated reports.
147 148 149 |
# File 'lib/sentry/rails/configuration.rb', line 147 def skippable_job_adapters @skippable_job_adapters end |
#structured_logging ⇒ StructuredLoggingConfiguration (readonly)
Configuration for structured logging feature
188 189 190 |
# File 'lib/sentry/rails/configuration.rb', line 188 def structured_logging @structured_logging end |
#tracing_subscribers ⇒ Object
Returns the value of attribute tracing_subscribers.
149 150 151 |
# File 'lib/sentry/rails/configuration.rb', line 149 def tracing_subscribers @tracing_subscribers end |