Sha256: 8a1cd4d5549baeb5b7d6121e172579db42fd4a6a86b03cc69d9373d212202ebc

Contents?: true

Size: 1.15 KB

Versions: 20

Compression:

Stored size: 1.15 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: event_name, 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

20 entries across 20 versions & 1 rubygems

Version Path
sentry-rails-5.5.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.4.2 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.4.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.4.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.3.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.3.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.2.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.2.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.1.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.1.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.0.2 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.0.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-5.0.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.9.2 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.9.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.9.0 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.8.3 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.8.2 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.8.1 lib/sentry/rails/tracing/active_storage_subscriber.rb
sentry-rails-4.8.0 lib/sentry/rails/tracing/active_storage_subscriber.rb