Sha256: bfb8b4ec4c204afd627ac685145381eaa7d4e25c6f5dc3261e70c3640fc4feb6

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

module Sentry
  module Rails
    module ControllerTransaction
      def self.included(base)
        base.prepend_around_action(:sentry_around_action)
      end

      private

      def sentry_around_action
        if Sentry.initialized?
          transaction_name = "#{self.class}##{action_name}"
          Sentry.get_current_scope.set_transaction_name(transaction_name, source: :view)
          Sentry.with_child_span(op: "view.process_action.action_controller", description: transaction_name) do |child_span|
            if child_span
              begin
                result = yield
              ensure
                child_span.set_http_status(response.status)
                child_span.set_data(:format, request.format)
                child_span.set_data(:method, request.method)
                child_span.set_data(:path, request.path)
                child_span.set_data(:params, request.params)
              end

              result
            else
              yield
            end
          end
        else
          yield
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sentry-rails-5.17.3 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.17.2 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.17.1 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.17.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.16.1 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.15.2 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.15.1 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.15.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.14.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.13.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.12.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.11.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.10.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.9.0 lib/sentry/rails/controller_transaction.rb
sentry-rails-5.8.0 lib/sentry/rails/controller_transaction.rb