railswatch_gem 0.1.4 → 0.1.5
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31cef41294d874fdcf6b8e23b0f34d7f954359b27e60bcea834d178405dd9dc5
|
|
4
|
+
data.tar.gz: 24f4ccf4c3d9617aad4340dd2b41cf31d8028dfd3b443361f9aa90b97afe9781
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22fadd59c98cda3262e290dd2cbbed57d133469be81cb6f68951062b4dd25f51a92b4f972822d98681f9b9d5298ac23d21168a87f2907ddc0fb3a267a950f441
|
|
7
|
+
data.tar.gz: 1aceb6e85b61bea68bb581c6590d6cee2847fbab7e5dfa95883e4a2371ffd617e462ff2f8d92a0766ca827d5c9e6dbf66ff3769c052ef6f7df618ecac14c9876
|
|
@@ -40,6 +40,7 @@ module RailswatchGem
|
|
|
40
40
|
|
|
41
41
|
data = {
|
|
42
42
|
event_type: "outgoing_request",
|
|
43
|
+
status: payload[:status],
|
|
43
44
|
timestamp: Time.at(event.time).utc.iso8601(6),
|
|
44
45
|
|
|
45
46
|
# Request Details
|
|
@@ -72,15 +73,24 @@ module RailswatchGem
|
|
|
72
73
|
scheme = use_ssl? ? "https" : "http"
|
|
73
74
|
uri = URI("#{scheme}://#{address}:#{port}#{req.path}")
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
# 1. Define payload outside the block so we can modify it inside
|
|
77
|
+
payload = {
|
|
76
78
|
host: address,
|
|
77
79
|
port: port,
|
|
78
80
|
scheme: scheme,
|
|
79
81
|
path: req.path,
|
|
80
82
|
method: req.method,
|
|
81
83
|
uri: uri
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
ActiveSupport::Notifications.instrument("request.net_http", payload) do
|
|
87
|
+
# 2. Capture the response
|
|
88
|
+
response = super
|
|
89
|
+
|
|
90
|
+
# 3. Add status to payload if response exists
|
|
91
|
+
payload[:status] = response.code.to_i if response
|
|
92
|
+
|
|
93
|
+
response
|
|
84
94
|
end
|
|
85
95
|
end
|
|
86
96
|
end
|