Class: Sentry::Rails::Configuration
- Inherits:
-
Object
- Object
- Sentry::Rails::Configuration
- Defined in:
- lib/sentry/rails/configuration.rb
Instance Attribute Summary collapse
-
#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.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/sentry/rails/configuration.rb', line 172 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 @structured_logging = StructuredLoggingConfiguration.new end |
Instance Attribute Details
#active_job_report_on_retry_error ⇒ Object
Set this option to true if you want Sentry to capture each retry failure
166 167 168 |
# File 'lib/sentry/rails/configuration.rb', line 166 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.
163 164 165 |
# File 'lib/sentry/rails/configuration.rb', line 163 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
“‘rb %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:
“‘rb Sentry.init do |config|
config.rails.assets_regexp = /my_regexp/
end “‘
159 160 161 |
# File 'lib/sentry/rails/configuration.rb', line 159 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.
144 145 146 |
# File 'lib/sentry/rails/configuration.rb', line 144 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.
140 141 142 |
# File 'lib/sentry/rails/configuration.rb', line 140 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: github.com/rails/rails/pull/43625#issuecomment-1072514175
124 125 126 |
# File 'lib/sentry/rails/configuration.rb', line 124 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.
130 131 132 |
# File 'lib/sentry/rails/configuration.rb', line 130 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.
134 135 136 |
# File 'lib/sentry/rails/configuration.rb', line 134 def skippable_job_adapters @skippable_job_adapters end |
#structured_logging ⇒ StructuredLoggingConfiguration (readonly)
Configuration for structured logging feature
170 171 172 |
# File 'lib/sentry/rails/configuration.rb', line 170 def structured_logging @structured_logging end |
#tracing_subscribers ⇒ Object
Returns the value of attribute tracing_subscribers.
136 137 138 |
# File 'lib/sentry/rails/configuration.rb', line 136 def tracing_subscribers @tracing_subscribers end |