monitr-rails 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/monitr-rails.rb +5 -2
- metadata +1 -1
data/lib/monitr-rails.rb
CHANGED
|
@@ -3,13 +3,14 @@ require "cgi"
|
|
|
3
3
|
|
|
4
4
|
class Monitr
|
|
5
5
|
|
|
6
|
-
def initialize(account_id)
|
|
6
|
+
def initialize(account_id, domain)
|
|
7
7
|
@account_id = account_id
|
|
8
|
+
@domain = domain
|
|
8
9
|
@monitr_request_start = Time.now.to_f
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def log(controller, params = {})
|
|
12
|
-
env_fields = %W( HTTP_USER_AGENT REQUEST_PATH CONTROLLER_NAME PATH_INFO REMOTE_ADDR ACCOUNT_ID REQUEST_PROCESS_TIME
|
|
13
|
+
env_fields = %W( HTTP_USER_AGENT REQUEST_PATH CONTROLLER_NAME PATH_INFO REMOTE_ADDR ACCOUNT_ID REQUEST_PROCESS_TIME)
|
|
13
14
|
env_fields.each do |label|
|
|
14
15
|
|
|
15
16
|
params[label] = controller.request.env[label]
|
|
@@ -20,6 +21,8 @@ class Monitr
|
|
|
20
21
|
params["REMOTE_ADDR"] = controller.request.env["HTTP_X_REAL_IP"]
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
params["REQUEST_URI"] = @domain
|
|
25
|
+
|
|
23
26
|
if @monitr_request_start
|
|
24
27
|
params["REQUEST_PROCESS_TIME"] = Time.now.to_f - @monitr_request_start
|
|
25
28
|
end
|