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
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/sentry/rails/configuration.rb', line 179 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
173 174 175 |
# File 'lib/sentry/rails/configuration.rb', line 173 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.
170 171 172 |
# File 'lib/sentry/rails/configuration.rb', line 170 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 “‘
166 167 168 |
# File 'lib/sentry/rails/configuration.rb', line 166 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.
151 152 153 |
# File 'lib/sentry/rails/configuration.rb', line 151 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.
147 148 149 |
# File 'lib/sentry/rails/configuration.rb', line 147 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
131 132 133 |
# File 'lib/sentry/rails/configuration.rb', line 131 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.
137 138 139 |
# File 'lib/sentry/rails/configuration.rb', line 137 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.
141 142 143 |
# File 'lib/sentry/rails/configuration.rb', line 141 def skippable_job_adapters @skippable_job_adapters end |
#structured_logging ⇒ StructuredLoggingConfiguration (readonly)
Configuration for structured logging feature
177 178 179 |
# File 'lib/sentry/rails/configuration.rb', line 177 def structured_logging @structured_logging end |
#tracing_subscribers ⇒ Object
Returns the value of attribute tracing_subscribers.
143 144 145 |
# File 'lib/sentry/rails/configuration.rb', line 143 def tracing_subscribers @tracing_subscribers end |