app_monit_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e16e8914f679acb64fd2832699c439c6878eb0d
|
4
|
+
data.tar.gz: e0ed46dbce520e13f945b24fb2426a71845a6580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7bfcdbed0582d77d103bb9de8ac428b12bca2f6e93b5d89a22916d294a894c566824d63d8a6f8149070c20795763b2d3ed7d23cc1daa9a814a5edd70a10edb
|
7
|
+
data.tar.gz: 6e48300dd255c950dc2bef186e86afa67ffbbbdd42c2cff751b42df6492e0b4ff037db7a81bebd1881689057225d1ad85b9178bcaf52bfee8962f72843e78417
|
@@ -98,8 +98,8 @@ module AppMonit
|
|
98
98
|
def convert_requests_to_events
|
99
99
|
@requests.flat_map do |minute, endpoints|
|
100
100
|
endpoints.collect do |endpoint, durations|
|
101
|
-
payload =
|
102
|
-
{ created_at: Time.at(minute), name: 'page_load', payload: payload }
|
101
|
+
payload = durations.merge(application: Config.name, endpoint: endpoint)
|
102
|
+
{ application: Config.name, created_at: Time.at(minute), name: 'page_load', payload: payload }
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -107,17 +107,19 @@ module AppMonit
|
|
107
107
|
def convert_errors_to_events
|
108
108
|
@errors.flat_map do |minute, endpoints|
|
109
109
|
endpoints.collect do |endpoint, duration|
|
110
|
-
payload = duration.merge(endpoint: endpoint)
|
110
|
+
payload = duration.merge(application: Config.name, endpoint: endpoint)
|
111
111
|
{ created_at: Time.at(minute), name: 'page_error', payload: payload }
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
def events
|
117
|
+
convert_requests_to_events + convert_errors_to_events
|
118
|
+
end
|
119
|
+
|
116
120
|
def send_to_collector
|
117
121
|
AppMonit::Rails.logger.debug "Sending to collector"
|
118
122
|
|
119
|
-
events = convert_requests_to_events + convert_errors_to_events
|
120
|
-
|
121
123
|
if events.any?
|
122
124
|
AppMonit::Http.post('/v1/events', event: events)
|
123
125
|
|
@@ -35,8 +35,9 @@ feature 'Triggered events' do
|
|
35
35
|
}.to raise_error
|
36
36
|
|
37
37
|
@worker = AppMonit::Rails::Worker.instance
|
38
|
+
@worker.push(:flush)
|
38
39
|
end
|
39
40
|
|
40
|
-
puts AppMonit::Rails::Worker.instance.
|
41
|
+
puts AppMonit::Rails::Worker.instance.events.inspect
|
41
42
|
end
|
42
43
|
end
|