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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82650226a057fc3b8b8595ac4fc760edaf56c656
4
- data.tar.gz: f50d0c8f8e3d22d915664760f7eba80aece2fbae
3
+ metadata.gz: beabf95b91656caa37b7d50b1e67b7aa9177ff01
4
+ data.tar.gz: a4b2173c7f2e4e9eab641b84091bc492d807ecad
5
5
  SHA512:
6
- metadata.gz: 99a7f5225e962df3c946c6440454a1892c1401d19feebee8cb3698a048c4f3a26980d2db77e99092f55023020ec6f85b88146ffd0aa799c03e4b3f1880c969c6
7
- data.tar.gz: 0b40b0d1f2c08ee5872f6891f7b889900e96ec70beb6c938fe2016c35e07c8271e901f7b6d1e5c1919418a963698027fddbad7e2fe63d78ef2c13953da7b85d6
6
+ metadata.gz: 0edc44d2ed75e928ebb93ac2c8c88e0e8916cd7c3e2915e95d229b046666c0f48d627fb016c5f9ab5a41e9b9307fc5bef0c64b0e43dfcfaf0e32fad5941e1ffa
7
+ data.tar.gz: 8af1715ad4e6e168cdb8310b3b265e147311b09853ada14f7744dc3f8361b31a71d7db3d4d1e80346279f8344923ba8e532e6dc5e069da2c8a953def8d847297
@@ -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'
@@ -96,7 +96,8 @@ module Skylight
96
96
  end
97
97
 
98
98
  def config
99
- @config ||= Config.new
99
+ # Calling .load checks ENV variables
100
+ @config ||= Config.load
100
101
  end
101
102
 
102
103
  end
@@ -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
@@ -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] == APPLICATION_JSON
105
- @body = JSON.parse(body)
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
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.1.0.alpha1'
2
+ VERSION = '0.1.0.alpha2'
3
3
  end
4
4
 
@@ -215,7 +215,7 @@ module Skylight
215
215
  reload(msg)
216
216
  end
217
217
  when Messages::Trace
218
- t { fmt "received trace; t=%p", msg }
218
+ t { "received trace" }
219
219
  @collector.submit(msg)
220
220
  when :unknown
221
221
  debug "received unknown message"
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha1
4
+ version: 0.1.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.