getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
933 stars 494 forks source link

Sending to sentry is always enabled when using spotlight #2226

Closed william-stacken closed 8 months ago

william-stacken commented 10 months ago

Issue Description

When enabling spotlight, the sentry configuration permits sending events to sentry through sending_allowed? regardless of enabled_environments. https://github.com/getsentry/sentry-ruby/blob/5.15.0/sentry-ruby/lib/sentry/configuration.rb#L463

Not setting the dsn did not work as a workaround, since sending_allowed? also requires a valid DSN before SpotlightTransport.send_data is invoked.

Reproduction Steps

Set config.spotlight to true, config.dsn to a valid DSN, and do not include config.environment in config.enabled_environments. Trigger an event to be sent threough for example raise 'test'.

Expected Behavior

Events are sent to the spotlight sidecar only, not sentry

Actual Behavior

Events are sent to both of them

Ruby Version

3.2.2

SDK Version

5.15

Integration and Its Version

Rails 7.0.5.1, sidekiq 6.1

Sentry Config

Sentry.init do |config|

Enable Sentry in production and conditionally in development

config.environment = 'development' config.enabled_environments = ['production']

config.dsn = DSN

config.spotlight = true end