lib/sentry/client.rb in sentry-ruby-0.1.3 vs lib/sentry/client.rb in sentry-ruby-0.2.0

- old
+ new

@@ -49,9 +49,21 @@ def event_from_message(message) Event.new(configuration: configuration, message: message) end + def event_from_transaction(transaction) + TransactionEvent.new(configuration: configuration).tap do |event| + event.transaction = transaction.name + event.contexts.merge!(trace: transaction.get_trace_context) + event.timestamp = transaction.timestamp + event.start_timestamp = transaction.start_timestamp + + finished_spans = transaction.span_recorder.spans.select { |span| span.timestamp && span != transaction } + event.spans = finished_spans.map(&:to_hash) + end + end + def send_event(event) return false unless configuration.sending_allowed?(event) event = configuration.before_send.call(event) if configuration.before_send if event.nil?