Sha256: 838b23855b54f79aedde2e360dccbbe5c004fe40e7e0cf06d8e55ad9e65e1647

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 KB

Contents

require "sentry/rails/tracing/abstract_subscriber"

module Sentry
  module Rails
    module Tracing
      class ActiveStorageSubscriber < AbstractSubscriber
        EVENT_NAMES = %w(
          service_upload.active_storage
          service_download.active_storage
          service_streaming_download.active_storage
          service_download_chunk.active_storage
          service_delete.active_storage
          service_delete_prefixed.active_storage
          service_exist.active_storage
          service_url.active_storage
          service_mirror.active_storage
          service_update_metadata.active_storage
          preview.active_storage
          analyze.active_storage
        ).freeze

        def self.subscribe!
          subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
            record_on_current_span(op: "file.#{event_name}".freeze, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:service], duration: duration) do |span|
              payload.each do |key, value|
                span.set_data(key, value) unless key == START_TIMESTAMP_NAME
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sentry-rails-5.16.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.15.2 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.15.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.15.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.14.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.13.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.12.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.11.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.10.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.9.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.8.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.7.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.6.0 lib/sentry/rails/tracing/active_storage_subscriber.rb