Feature
-
Propagated sampling rates as specified in Traces docs (#2671)
-
Support for Rails ActiveSupport log subscribers (#2690)
-
Support for defining custom Rails log subscribers that work with Sentry Structured Logging (#2689)
Rails applications can now define custom log subscribers that integrate with Sentry's structured logging system. The feature includes built-in subscribers for ActionController, ActiveRecord, ActiveJob, and ActionMailer events, with automatic parameter filtering that respects Rails'
config.filter_parameters
configuration.To enable structured logging with Rails log subscribers:
Sentry.init do |config| # ... your setup ... # Make sure structured logging is enabled config.enable_logs = true # Enable default Rails log subscribers (ActionController and ActiveRecord) config.rails.structured_logging.enabled = true end
To configure all subscribers:
Sentry.init do |config| # ... your setup ... # Make sure structured logging is enabled config.enable_logs = true # Enable Rails log subscribers config.rails.structured_logging.enabled = true # Add ActionMailer and ActiveJob subscribers config.rails.structured_logging.subscribers.update( action_mailer: Sentry::Rails::LogSubscribers::ActionMailerSubscriber, active_job: Sentry::Rails::LogSubscribers::ActiveJobSubscriber ) end
You can also define custom log subscribers by extending the base class:
class MyCustomSubscriber < Sentry::Rails::LogSubscriber attach_to :my_component def my_event(event) log_structured_event( message: "Custom event occurred", level: :info, attributes: { duration_ms: event.duration } ) end end Sentry.init do |config| # ... your setup ... # Make sure structured logging is enabled config.enable_logs = true # Enable Rails log subscribers config.rails.structured_logging.enabled = true # Add custom subscriber config.rails.structured_logging.subscribers[:my_component] = MyCustomSubscriber end
-
Introduce
structured_logging
config namespace (#2692)
Bug Fixes
- Silence
_perform
method redefinition warning (#2682) - Update sentry trace regexp (#2678)
- Remove redundant
attr_reader
(#2673)
Internal
- Factor out do_request in HTTP transport (#2662)
- Add
Sentry::DebugTransport
that captures events and stores them as JSON for debugging purposes (#2664) - Add
Sentry::DebugStructuredLogger
that caputres log events and stores them as JSON to a file for debugging purposes (#2693) - Rails test runner (#2687)
- Update common gem deps for development (#2688)
- Make devcontainer work with ancient Ruby/Rails (#2679)
- Improved devcontainer setup with e2e test mini infra (#2672)
- Address various flaky specs