lib/sentry/client.rb in sentry-ruby-4.1.1 vs lib/sentry/client.rb in sentry-ruby-4.1.2
- old
+ new
@@ -45,20 +45,22 @@
end
event
end
- def event_from_exception(exception)
+ def event_from_exception(exception, hint = {})
+ integration_meta = Sentry.integrations[hint[:integration]]
return unless @configuration.exception_class_allowed?(exception)
- Event.new(configuration: configuration).tap do |event|
+ Event.new(configuration: configuration, integration_meta: integration_meta).tap do |event|
event.add_exception_interface(exception)
end
end
- def event_from_message(message)
- Event.new(configuration: configuration, message: message)
+ def event_from_message(message, hint = {})
+ integration_meta = Sentry.integrations[hint[:integration]]
+ Event.new(configuration: configuration, integration_meta: integration_meta, message: message)
end
def event_from_transaction(transaction)
TransactionEvent.new(configuration: configuration).tap do |event|
event.transaction = transaction.name
@@ -70,10 +72,12 @@
event.spans = finished_spans.map(&:to_hash)
end
end
def send_event(event, hint = nil)
- event = configuration.before_send.call(event, hint) if configuration.before_send
+ event_type = event.is_a?(Event) ? event.type : event["type"]
+ event = configuration.before_send.call(event, hint) if configuration.before_send && event_type == "event"
+
if event.nil?
configuration.logger.info(LOGGER_PROGNAME) { "Discarded event because before_send returned nil" }
return
end