skylight 0.1.0.alpha1 → 0.1.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skylight.rb +1 -0
- data/lib/skylight/cli.rb +2 -1
- data/lib/skylight/railtie.rb +6 -0
- data/lib/skylight/util/http.rb +8 -4
- data/lib/skylight/version.rb +1 -1
- data/lib/skylight/worker/server.rb +1 -1
- data/lib/skylight/worker/standalone.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beabf95b91656caa37b7d50b1e67b7aa9177ff01
|
4
|
+
data.tar.gz: a4b2173c7f2e4e9eab641b84091bc492d807ecad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0edc44d2ed75e928ebb93ac2c8c88e0e8916cd7c3e2915e95d229b046666c0f48d627fb016c5f9ab5a41e9b9307fc5bef0c64b0e43dfcfaf0e32fad5941e1ffa
|
7
|
+
data.tar.gz: 8af1715ad4e6e168cdb8310b3b265e147311b09853ada14f7744dc3f8361b31a71d7db3d4d1e80346279f8344923ba8e532e6dc5e069da2c8a953def8d847297
|
data/lib/skylight.rb
CHANGED
@@ -22,6 +22,7 @@ module Skylight
|
|
22
22
|
autoload :GC, 'skylight/gc'
|
23
23
|
autoload :Instrumenter, 'skylight/instrumenter'
|
24
24
|
autoload :Messages, 'skylight/messages'
|
25
|
+
autoload :Middleware, 'skylight/middleware'
|
25
26
|
autoload :Normalizers, 'skylight/normalizers'
|
26
27
|
autoload :Subscriber, 'skylight/subscriber'
|
27
28
|
autoload :Worker, 'skylight/worker'
|
data/lib/skylight/cli.rb
CHANGED
data/lib/skylight/railtie.rb
CHANGED
@@ -29,8 +29,14 @@ module Skylight
|
|
29
29
|
path = config_path(app)
|
30
30
|
path = nil unless File.exist?(path)
|
31
31
|
|
32
|
+
unless tmp = app.config.paths['tmp'].first
|
33
|
+
Rails.logger.warn "[SKYLIGHT] tmp directory missing from rails configuration"
|
34
|
+
return nil
|
35
|
+
end
|
36
|
+
|
32
37
|
config = Config.load(path, Rails.env.to_s, ENV)
|
33
38
|
config.logger = Rails.logger
|
39
|
+
config['agent.sockfile_path'] = tmp
|
34
40
|
config['normalizers.render.view_paths'] = app.config.paths["app/views"].existent
|
35
41
|
config.validate!
|
36
42
|
config
|
data/lib/skylight/util/http.rb
CHANGED
@@ -30,7 +30,7 @@ module Skylight
|
|
30
30
|
request = build_request(Net::HTTP::Get, endpoint, hdrs)
|
31
31
|
execute(request)
|
32
32
|
rescue Exception => e
|
33
|
-
error "http GET failed; msg=%s", e.message
|
33
|
+
error "http GET failed; error=%s; msg=%s", e.class, e.message
|
34
34
|
t { e.backtrace.join("\n") }
|
35
35
|
nil
|
36
36
|
end
|
@@ -44,7 +44,7 @@ module Skylight
|
|
44
44
|
request = build_request(Net::HTTP::Post, endpoint, hdrs, body.bytesize)
|
45
45
|
execute(request, body)
|
46
46
|
rescue Exception => e
|
47
|
-
error "http POST failed; msg=%s", e.message
|
47
|
+
error "http POST failed; error=%s; msg=%s", e.class, e.message
|
48
48
|
t { e.backtrace.join("\n") }
|
49
49
|
nil
|
50
50
|
end
|
@@ -101,8 +101,12 @@ module Skylight
|
|
101
101
|
@status = status
|
102
102
|
@headers = headers
|
103
103
|
|
104
|
-
if headers[CONTENT_TYPE]
|
105
|
-
|
104
|
+
if (headers[CONTENT_TYPE] || "").include?(APPLICATION_JSON)
|
105
|
+
begin
|
106
|
+
@body = JSON.parse(body)
|
107
|
+
rescue JSON::ParserError
|
108
|
+
@body = body # not really JSON I guess
|
109
|
+
end
|
106
110
|
else
|
107
111
|
@body = body
|
108
112
|
end
|
data/lib/skylight/version.rb
CHANGED
@@ -140,6 +140,8 @@ module Skylight
|
|
140
140
|
def repair
|
141
141
|
@sock.close rescue nil if @sock
|
142
142
|
|
143
|
+
t { "repairing socket" }
|
144
|
+
|
143
145
|
# Attempt to reconnect to the currently known agent PID. If the agent
|
144
146
|
# is still healthy but is simply reloading itself, this should work
|
145
147
|
# just fine.
|
@@ -150,8 +152,12 @@ module Skylight
|
|
150
152
|
return true
|
151
153
|
end
|
152
154
|
|
155
|
+
t { "failed to reconnect -- attempting worker respawn" }
|
156
|
+
|
153
157
|
# Attempt to respawn the agent process
|
154
158
|
unless __spawn
|
159
|
+
t { "could not respawn -- shutting down" }
|
160
|
+
|
155
161
|
@pid = nil
|
156
162
|
@sock = nil
|
157
163
|
return false
|
@@ -300,6 +306,9 @@ module Skylight
|
|
300
306
|
# Deal w/ the inherited socket
|
301
307
|
@sock.close rescue nil if @sock
|
302
308
|
@sock = nil
|
309
|
+
|
310
|
+
@writer = build_queue
|
311
|
+
@writer.spawn
|
303
312
|
end
|
304
313
|
end
|
305
314
|
end
|