Issue Description
Hello! In working recently with sentry-ruby, a colleague and I found that the recently added global event processors from #1974 don't seem to clear on invocation of Sentry.init. This is a bit unexpected, considering the overall action of Sentry.init to reset other options.
If this is the intended behavior and simply could use a documentation note, then please feel free to close this issue report.
Reproduction Steps
Sentry.init to get started
Sentry.add_global_event_processor
Sentry.init to reset state
Sentry.add_global_event_processor
- Examine
Sentry::Scope.global_event_processors.length or similar
For example:
Gemfile
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'rspec'
gem 'rubocop'
gem 'sentry-ruby', '~> 5.9'
spec/sentry_ruby_spec.rb
# frozen_string_literal: true
require 'rspec'
require 'sentry-ruby'
describe Sentry do
it 'flushes global event processors on .init' do
# Setup - init and set one global event processor
Sentry.init
Sentry.add_global_event_processor do |event, _hint|
event.tags = { foo: 42 }
event
end
expect(Sentry::Scope.global_event_processors.length).to eq(1)
# When - init and set another global event processor
Sentry.init
Sentry.add_global_event_processor do |event, _hint|
event.tags = { foo: 42 }
event
end
# Then there should be one global event processor.
expect(Sentry::Scope.global_event_processors.length).to eq(1)
# However, this fails: length is 2, because Sentry.init retains global event processors.
end
end
Expected Behavior
Sentry::Scope.global_event_processors.length shows one configured global event processor.
Actual Behavior
Sentry::Scope.global_event_processors.length shows two configured global event processors.
Ruby Version
3.2.2
SDK Version
5.9.0
Integration and Its Version
Non-specific
Sentry Config
None needed. Works with sentry-ruby defaults.
Issue Description
Hello! In working recently with
sentry-ruby, a colleague and I found that the recently added global event processors from #1974 don't seem to clear on invocation ofSentry.init. This is a bit unexpected, considering the overall action ofSentry.initto reset other options.If this is the intended behavior and simply could use a documentation note, then please feel free to close this issue report.
Reproduction Steps
Sentry.initto get startedSentry.add_global_event_processorSentry.initto reset stateSentry.add_global_event_processorSentry::Scope.global_event_processors.lengthor similarFor example:
Gemfilespec/sentry_ruby_spec.rbExpected Behavior
Sentry::Scope.global_event_processors.lengthshows one configured global event processor.Actual Behavior
Sentry::Scope.global_event_processors.lengthshows two configured global event processors.Ruby Version
3.2.2
SDK Version
5.9.0
Integration and Its Version
Non-specific
Sentry Config
None needed. Works with
sentry-rubydefaults.