Sha256: debfb1e35e2349dc0e0a30ad2a8e14690822af47a65728e47c83f10718fe9d89

Contents?: true

Size: 570 Bytes

Versions: 14

Compression:

Stored size: 570 Bytes

Contents

module Rhoconnect
  module Stats
    class Middleware
      def initialize(app)
        @app = app
      end

      def call(env)
        start = Time.now.to_f
        status, headers, body = @app.call(env)
        finish = Time.now.to_f
        metric = "http:#{env['REQUEST_METHOD']}:#{env['PATH_INFO']}"
        source_name = env['rack.request.query_hash']["source_name"] if env['rack.request.query_hash']
        metric << ":#{source_name}" if source_name
        Record.save_average(metric,finish - start)
        [status, headers, body]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rhoconnect-3.1.1 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.1.0 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.1.0.beta2 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.1.0.beta1 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.6 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.5 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.4 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.3 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.2 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.1 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.0 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.0.rc1 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.0.beta3 lib/rhoconnect/stats/middleware.rb
rhoconnect-3.0.0.beta1 lib/rhoconnect/stats/middleware.rb