Sha256: 2de3f41aaeaf3df6906146278358fc50868546ee4de7a3aeb35e4003ae524e9a

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

module RailsCustomerbeats
  class Middleware
    def initialize(app)
      @app = app
    end

    def call(env)
      if env["PATH_INFO"] =~ /^\/rails_customerbeats/
        @app.call(env)
      else
        RailsCustomerbeats.listen_request do
          response = notifications.instrument "rack.request",
            :path => env["PATH_INFO"], :method => env["REQUEST_METHOD"],
            :instrumenter_id => notifications.instrumenter.id do
            @app.call(env)
          end
        end
      end
    end

  protected

    def notifications
      ActiveSupport::Notifications
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_customerbeats-0.0.5 lib/rails_customerbeats/middleware.rb
rails_customerbeats-0.0.4 lib/rails_customerbeats/middleware.rb
rails_customerbeats-0.3 lib/rails_customerbeats/middleware.rb