Method: Sentry::Client#capture_event
- Defined in:
- lib/sentry/client.rb
#capture_event(event, scope, hint = {}) ⇒ Event?
Applies the given scope’s data to the event and sends it to Sentry.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/sentry/client.rb', line 65 def capture_event(event, scope, hint = {}) return unless configuration.sending_allowed? if event.is_a?(ErrorEvent) && !configuration.sample_allowed? transport.record_lost_event(:sample_rate, "error") return end data_category = Envelope::Item.data_category(event.type) is_transaction = event.is_a?(TransactionEvent) spans_before = is_transaction ? event.spans.size : 0 event = scope.apply_to_event(event, hint) if event.nil? log_debug("Discarded event because one of the event processors returned nil") transport.record_lost_event(:event_processor, data_category) transport.record_lost_event(:event_processor, "span", num: spans_before + 1) if is_transaction return elsif is_transaction spans_delta = spans_before - event.spans.size transport.record_lost_event(:event_processor, "span", num: spans_delta) if spans_delta > 0 end if configuration.background_worker_threads != 0 && hint.fetch(:background, true) unless dispatch_background_event(event, hint) transport.record_lost_event(:queue_overflow, data_category) transport.record_lost_event(:queue_overflow, "span", num: spans_before + 1) if is_transaction end else send_event(event, hint) end event rescue => e log_error("Event capturing failed", e, debug: configuration.debug) nil end |