@@ -53,8 +53,7 @@ def capture_event(event, scope, hint = {})
5353 return
5454 end
5555
56- event_type = event . is_a? ( Event ) ? event . type : event [ "type" ]
57- data_category = Envelope ::Item . data_category ( event_type )
56+ data_category = Envelope ::Item . data_category ( event . type )
5857 event = scope . apply_to_event ( event , hint )
5958
6059 if event . nil?
@@ -63,9 +62,7 @@ def capture_event(event, scope, hint = {})
6362 return
6463 end
6564
66- if async_block = configuration . async
67- dispatch_async_event ( async_block , event , hint )
68- elsif configuration . background_worker_threads != 0 && hint . fetch ( :background , true )
65+ if configuration . background_worker_threads != 0 && hint . fetch ( :background , true )
6966 queued = dispatch_background_event ( event , hint )
7067 transport . record_lost_event ( :queue_overflow , data_category ) unless queued
7168 else
@@ -166,10 +163,9 @@ def event_from_transaction(transaction)
166163
167164 # @!macro send_event
168165 def send_event ( event , hint = nil )
169- event_type = event . is_a? ( Event ) ? event . type : event [ "type" ]
170- data_category = Envelope ::Item . data_category ( event_type )
166+ data_category = Envelope ::Item . data_category ( event . type )
171167
172- if event_type != TransactionEvent ::TYPE && configuration . before_send
168+ if event . type != TransactionEvent ::TYPE && configuration . before_send
173169 event = configuration . before_send . call ( event , hint )
174170
175171 if event . nil?
@@ -179,7 +175,7 @@ def send_event(event, hint = nil)
179175 end
180176 end
181177
182- if event_type == TransactionEvent ::TYPE && configuration . before_send_transaction
178+ if event . type == TransactionEvent ::TYPE && configuration . before_send_transaction
183179 event = configuration . before_send_transaction . call ( event , hint )
184180
185181 if event . nil?
@@ -254,28 +250,5 @@ def dispatch_background_event(event, hint)
254250 send_event ( event , hint )
255251 end
256252 end
257-
258- def dispatch_async_event ( async_block , event , hint )
259- # We have to convert to a JSON-like hash, because background job
260- # processors (esp ActiveJob) may not like weird types in the event hash
261-
262- event_hash =
263- begin
264- event . to_json_compatible
265- rescue => e
266- log_error ( "Converting #{ event . type } (#{ event . event_id } ) to JSON compatible hash failed" , e , debug : configuration . debug )
267- return
268- end
269-
270- if async_block . arity == 2
271- hint = JSON . parse ( JSON . generate ( hint ) )
272- async_block . call ( event_hash , hint )
273- else
274- async_block . call ( event_hash )
275- end
276- rescue => e
277- log_error ( "Async #{ event_hash [ "type" ] } sending failed" , e , debug : configuration . debug )
278- send_event ( event , hint )
279- end
280253 end
281254end
0 commit comments