File tree Expand file tree Collapse file tree 5 files changed +32
-7
lines changed
Expand file tree Collapse file tree 5 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 7979- Only instantiate SessionFlusher when the SDK is enabled under the current env [# 2245](https://github.com/getsentry/sentry-ruby/pull/2245)
8080 - Fixes [# 2234](https://github.com/getsentry/sentry-ruby/issues/2234)
8181- Update backtrace parsing regexp to support Ruby 3.4 ([# 2252](https://github.com/getsentry/sentry-ruby/pull/2252))
82+ - Make sure ` ` sending_allowed?` ` is respected irrespective of spotlight configuration ([# 2231](https://github.com/getsentry/sentry-ruby/pull/2231))
83+ - Fixes [# 2226](https://github.com/getsentry/sentry-ruby/issues/2226)
8284
8385# # 5.16.1
8486
Original file line number Diff line number Diff line change @@ -172,8 +172,8 @@ def send_event(event, hint = nil)
172172 end
173173 end
174174
175- transport . send_event ( event )
176- spotlight_transport & .send_event ( event )
175+ transport . send_event ( event ) if configuration . sending_to_dsn_allowed?
176+ spotlight_transport . send_event ( event ) if spotlight_transport
177177
178178 event
179179 rescue => e
Original file line number Diff line number Diff line change @@ -485,9 +485,13 @@ def profiles_sample_rate=(profiles_sample_rate)
485485 end
486486
487487 def sending_allowed?
488+ spotlight || sending_to_dsn_allowed?
489+ end
490+
491+ def sending_to_dsn_allowed?
488492 @errors = [ ]
489493
490- spotlight || ( valid? && capture_in_environment? )
494+ valid? && capture_in_environment?
491495 end
492496
493497 def sample_allowed?
Original file line number Diff line number Diff line change 276276 subject . spotlight = true
277277 expect ( subject . sending_allowed? ) . to eq ( true )
278278 end
279+
280+ it "true when sending to dsn allowed" do
281+ allow ( subject ) . to receive ( :sending_to_dsn_allowed? ) . and_return ( true )
282+ expect ( subject . sending_allowed? ) . to eq ( true )
283+ end
284+
285+ it "false when no spotlight and sending to dsn not allowed" do
286+ allow ( subject ) . to receive ( :sending_to_dsn_allowed? ) . and_return ( false )
287+ subject . spotlight = false
288+ expect ( subject . sending_allowed? ) . to eq ( false )
289+ end
279290 end
280291
281292 context 'configuring for async' do
Original file line number Diff line number Diff line change 116116 capture_subject
117117 end
118118
119- it "doesn't send the event nor assign last_event_id " do
120- # don't even initialize Event objects
119+ it "doesn't build the event" do
120+ # don't even initialize event objects
121121 expect ( Sentry ::Event ) . not_to receive ( :new )
122-
123122 described_class . send ( capture_helper , capture_subject )
123+ end
124+ end
124125
126+ context "with sending allowed but sending to dsn not allowed" do
127+ before do
128+ allow ( Sentry . configuration ) . to receive ( :sending_allowed? ) . and_return ( true )
129+ allow ( Sentry . configuration ) . to receive ( :sending_to_dsn_allowed? ) . and_return ( false )
130+ end
131+
132+ it "doesn't send the event nor assign last_event_id" do
133+ described_class . send ( capture_helper , capture_subject )
125134 expect ( sentry_events ) . to be_empty
126- expect ( subject . last_event_id ) . to eq ( nil )
127135 end
128136 end
129137
You can’t perform that action at this time.
0 commit comments