Sha256: a9d0bcc9c93dd5da0844dfeb5b0c6facfac66f2ae832c96ed0e09ffd6eaff934
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module Sentry # TransactionEvent represents events that carry transaction data (type: "transaction"). class TransactionEvent < Event TYPE = "transaction" # @return [<Array[Span]>] attr_accessor :spans # @return [Hash, nil] attr_accessor :dynamic_sampling_context # @return [Float, nil] attr_reader :start_timestamp def initialize(transaction:, **options) super(**options) self.transaction = transaction.name self.transaction_info = { source: transaction.source } self.contexts.merge!(transaction.contexts) self.contexts.merge!(trace: transaction.get_trace_context) self.timestamp = transaction.timestamp self.start_timestamp = transaction.start_timestamp self.tags = transaction.tags self.dynamic_sampling_context = transaction.get_baggage.dynamic_sampling_context finished_spans = transaction.span_recorder.spans.select { |span| span.timestamp && span != transaction } self.spans = finished_spans.map(&:to_hash) end # Sets the event's start_timestamp. # @param time [Time, Float] # @return [void] def start_timestamp=(time) @start_timestamp = time.is_a?(Time) ? time.to_f : time end # @return [Hash] def to_hash data = super data[:spans] = @spans.map(&:to_hash) if @spans data[:start_timestamp] = @start_timestamp data end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
sentry-ruby-core-5.7.0 | lib/sentry/transaction_event.rb |
sentry-ruby-5.7.0 | lib/sentry/transaction_event.rb |