Sha256: ec185b62712cb0eb08f69f74d9b55f565842bb970e8406fa7f63f16224ee1578

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Sentry
  class TransactionEvent < Event
    TYPE = "transaction"

    SERIALIZEABLE_ATTRIBUTES = %i(
      event_id level timestamp start_timestamp
      release environment server_name modules
      user tags contexts extra
      transaction platform sdk type
    )

    WRITER_ATTRIBUTES = SERIALIZEABLE_ATTRIBUTES - %i(type timestamp start_timestamp level)

    attr_writer(*WRITER_ATTRIBUTES)
    attr_reader(*SERIALIZEABLE_ATTRIBUTES)

    # @return [<Array[Span]>]
    attr_accessor :spans

    # @param configuration [Configuration]
    # @param integration_meta [Hash, nil]
    # @param message [String, nil]
    def initialize(configuration:, integration_meta: nil, message: nil)
      super
      @type = TYPE
    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
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sentry-ruby-core-5.2.0 lib/sentry/transaction_event.rb
sentry-ruby-core-5.1.1 lib/sentry/transaction_event.rb
sentry-ruby-core-5.1.0 lib/sentry/transaction_event.rb
sentry-ruby-core-5.0.2 lib/sentry/transaction_event.rb
sentry-ruby-core-5.0.1 lib/sentry/transaction_event.rb
sentry-ruby-core-5.0.0 lib/sentry/transaction_event.rb
sentry-ruby-core-4.9.2 lib/sentry/transaction_event.rb
sentry-ruby-core-4.9.1 lib/sentry/transaction_event.rb
sentry-ruby-core-4.9.0 lib/sentry/transaction_event.rb