lib/rhosync/stats/middleware.rb in rhosync-2.0.9 vs lib/rhosync/stats/middleware.rb in rhosync-2.1.0.beta.1

- old
+ new

@@ -7,15 +7,13 @@ 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['REQUEST_PATH']}" - source_id = env['rack.request.query_hash']["source_id"] if env['rack.request.query_hash'] - metric << ":#{source_id}" if source_id - Record.add(metric,finish - start) do |counter,aggregate| - Record.save_average(counter,aggregate) - end + 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 \ No newline at end of file