lib/monitr-rails.rb in monitr-rails-1.2.3 vs lib/monitr-rails.rb in monitr-rails-1.2.4

- old
+ new

@@ -1,25 +1,28 @@ require "open-uri" require "cgi" class Monitr - def initialize(account_id) + def initialize(account_id, domain) @account_id = account_id + @domain = domain @monitr_request_start = Time.now.to_f end def log(controller, params = {}) - env_fields = %W( HTTP_USER_AGENT REQUEST_PATH CONTROLLER_NAME PATH_INFO REMOTE_ADDR ACCOUNT_ID REQUEST_PROCESS_TIME REQUEST_URI) + env_fields = %W( HTTP_USER_AGENT REQUEST_PATH CONTROLLER_NAME PATH_INFO REMOTE_ADDR ACCOUNT_ID REQUEST_PROCESS_TIME) env_fields.each do |label| params[label] = controller.request.env[label] end # This deals with Heroku passing the load balancers instead of the originating address if controller.request.env["HTTP_X_REAL_IP"] != nil params["REMOTE_ADDR"] = controller.request.env["HTTP_X_REAL_IP"] end + + params["REQUEST_URI"] = @domain if @monitr_request_start params["REQUEST_PROCESS_TIME"] = Time.now.to_f - @monitr_request_start end