skylight 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/skylight/api.rb +1 -0
- data/lib/skylight/instrumenter.rb +5 -2
- data/lib/skylight/messages/trace.rb +11 -2
- data/lib/skylight/middleware.rb +10 -1
- data/lib/skylight/normalizers/sql.rb +10 -2
- data/lib/skylight/probes/excon.rb +10 -5
- data/lib/skylight/probes/excon/middleware.rb +1 -0
- data/lib/skylight/railtie.rb +4 -3
- data/lib/skylight/util/http.rb +6 -1
- data/lib/skylight/util/task.rb +1 -0
- data/lib/skylight/version.rb +1 -1
- data/lib/skylight/worker/metrics_reporter.rb +1 -0
- data/lib/skylight/worker/standalone.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e55c1c2dc7308e528ed6b70c50bc46ded112deb
|
4
|
+
data.tar.gz: b1cfa59af5c1b1b1c453c6cccefc8d3f7d83a031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902ff0813ae73c280619f70728b2669cb17bb249abab8e5f7508893d81f9cd1ab25b2d6b9d4a4203080175934c63d8a48f37fe3199d8df384269d7fc7cf590ba
|
7
|
+
data.tar.gz: be41caa2f4ad1c66bfb779c1d0b851cc21388d63a17153b4c3c5c2ac216209d72b302b5e7d114a3df7968041592cdb392b87f2bc389083cb2115e4757921b2b2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.3.13 (May 12, 2014)
|
2
|
+
|
3
|
+
* Load probes even when agent is disabled
|
4
|
+
* Check for Excon::Middlewares before installing the probe
|
5
|
+
* SQL error encoder should not operate in-place
|
6
|
+
* Fix Middleware
|
7
|
+
* More debug logging
|
8
|
+
* Log Rails version in MetricsReporter
|
9
|
+
* Handle missing Net::ReadTimeout in 1.9.3
|
10
|
+
* Include original exception information in sql_parse errors
|
11
|
+
* Debugging for failed application creation
|
12
|
+
* Make double sure that Trace started_at is an Integer
|
13
|
+
|
1
14
|
## 0.3.12 (April 17, 2014)
|
2
15
|
|
3
16
|
* Include more information in type check errors
|
data/lib/skylight/api.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'thread'
|
2
|
-
require 'set'
|
3
|
-
require 'base64'
|
4
2
|
require 'strscan'
|
5
3
|
|
6
4
|
module Skylight
|
@@ -42,6 +40,9 @@ module Skylight
|
|
42
40
|
def self.stop!
|
43
41
|
LOCK.synchronize do
|
44
42
|
return unless @instance
|
43
|
+
# This is only really helpful for getting specs to pass.
|
44
|
+
@instance.current_trace = nil
|
45
|
+
|
45
46
|
@instance.shutdown
|
46
47
|
@instance = nil
|
47
48
|
end
|
@@ -120,6 +121,8 @@ module Skylight
|
|
120
121
|
return trace
|
121
122
|
end
|
122
123
|
|
124
|
+
t { "starting trace" }
|
125
|
+
|
123
126
|
begin
|
124
127
|
trace = Messages::Trace::Builder.new(self, endpoint, Util::Clock.nanos, cat, title, desc, annot)
|
125
128
|
rescue Exception => e
|
@@ -76,6 +76,8 @@ module Skylight
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def instrument(cat, title=nil, desc=nil, annot=nil)
|
79
|
+
t { "instrument: #{cat}, #{title}" }
|
80
|
+
|
79
81
|
if Hash === title
|
80
82
|
annot = title
|
81
83
|
title = desc = nil
|
@@ -123,7 +125,12 @@ module Skylight
|
|
123
125
|
end
|
124
126
|
|
125
127
|
def submit
|
126
|
-
|
128
|
+
t { "submitting trace" }
|
129
|
+
|
130
|
+
if @submitted
|
131
|
+
t { "already submitted" }
|
132
|
+
return
|
133
|
+
end
|
127
134
|
|
128
135
|
release
|
129
136
|
@submitted = true
|
@@ -148,7 +155,9 @@ module Skylight
|
|
148
155
|
end
|
149
156
|
|
150
157
|
def normalize_time(time)
|
151
|
-
|
158
|
+
# At least one customer has extensions that cause integer division to produce rationals.
|
159
|
+
# Since the native code expects an integer, we force it again.
|
160
|
+
(time.to_i / 100_000).to_i
|
152
161
|
end
|
153
162
|
|
154
163
|
def span(time, cat, title=nil, desc=nil, annot=nil)
|
data/lib/skylight/middleware.rb
CHANGED
@@ -40,20 +40,29 @@ module Skylight
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
include Util::Logging
|
44
|
+
|
45
|
+
# For Util::Logging
|
46
|
+
attr_reader :config
|
47
|
+
|
48
|
+
def initialize(app, opts={})
|
44
49
|
@app = app
|
50
|
+
@config = opts[:config]
|
45
51
|
end
|
46
52
|
|
47
53
|
def call(env)
|
48
54
|
begin
|
55
|
+
t { "middleware beginning trace" }
|
49
56
|
trace = Skylight.trace "Rack", 'app.rack.request'
|
50
57
|
resp = @app.call(env)
|
51
58
|
resp[2] = BodyProxy.new(resp[2]) { trace.submit } if trace
|
52
59
|
resp
|
53
60
|
rescue Exception
|
61
|
+
t { "middleware exception: #{trace}"}
|
54
62
|
trace.submit if trace
|
55
63
|
raise
|
56
64
|
ensure
|
65
|
+
t { "middleware release: #{trace}"}
|
57
66
|
trace.release if trace
|
58
67
|
end
|
59
68
|
end
|
@@ -48,6 +48,10 @@ module Skylight
|
|
48
48
|
group = "sql_parse"
|
49
49
|
description = e.inspect
|
50
50
|
details = encode(backtrace: e.backtrace,
|
51
|
+
original_exception: {
|
52
|
+
class_name: e.class.name,
|
53
|
+
message: e.message
|
54
|
+
},
|
51
55
|
payload: payload,
|
52
56
|
precalculated: precalculated)
|
53
57
|
|
@@ -55,11 +59,15 @@ module Skylight
|
|
55
59
|
[ nil, nil, nil, error ]
|
56
60
|
end
|
57
61
|
|
62
|
+
# While operating in place would save memory, some of these passed in items are re-used elsewhere
|
63
|
+
# and, as such, should not be modified.
|
58
64
|
def encode(body)
|
59
65
|
if body.is_a?(Hash)
|
60
|
-
|
66
|
+
hash = {}
|
67
|
+
body.each{|k,v| hash[k] = encode(v) }
|
68
|
+
hash
|
61
69
|
elsif body.is_a?(Array)
|
62
|
-
body.
|
70
|
+
body.map{|v| encode(v) }
|
63
71
|
elsif body.respond_to?(:encoding) && (body.encoding == Encoding::BINARY || !body.valid_encoding?)
|
64
72
|
Base64.encode64(body)
|
65
73
|
else
|
@@ -3,13 +3,18 @@ module Skylight
|
|
3
3
|
module Excon
|
4
4
|
class Probe
|
5
5
|
def install
|
6
|
-
|
7
|
-
|
6
|
+
if defined?(::Excon::Middleware)
|
7
|
+
# Don't require until installation since it depends on Excon being loaded
|
8
|
+
require 'skylight/probes/excon/middleware'
|
8
9
|
|
9
|
-
|
10
|
+
idx = ::Excon.defaults[:middlewares].index(::Excon::Middleware::Instrumentor)
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
# TODO: Handle possibility of idx being nil
|
13
|
+
::Excon.defaults[:middlewares].insert(idx, Skylight::Probes::Excon::Middleware)
|
14
|
+
else
|
15
|
+
puts "[SKYLIGHT] [#{Skylight::VERSION}] The installed version of Excon doesn't " \
|
16
|
+
"support Middlewares. The Excon probe will be disabled."
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
15
20
|
end
|
data/lib/skylight/railtie.rb
CHANGED
@@ -16,12 +16,13 @@ module Skylight
|
|
16
16
|
config.skylight.probes = []
|
17
17
|
|
18
18
|
initializer 'skylight.configure' do |app|
|
19
|
-
|
20
|
-
|
19
|
+
# Load probes even when agent is inactive to catch probe related bugs sooner
|
20
|
+
load_probes
|
21
21
|
|
22
|
+
if activate?
|
22
23
|
if config = load_skylight_config(app)
|
23
24
|
if Instrumenter.start!(config)
|
24
|
-
app.middleware.insert 0, Middleware
|
25
|
+
app.middleware.insert 0, Middleware, config: config
|
25
26
|
puts "[SKYLIGHT] [#{Skylight::VERSION}] Skylight agent enabled"
|
26
27
|
end
|
27
28
|
end
|
data/lib/skylight/util/http.rb
CHANGED
@@ -22,6 +22,11 @@ module Skylight
|
|
22
22
|
attr_accessor :authentication
|
23
23
|
attr_reader :host, :port
|
24
24
|
|
25
|
+
READ_EXCEPTIONS = [Timeout::Error, EOFError]
|
26
|
+
# This doesn't exist on Ruby 1.9.3
|
27
|
+
READ_EXCEPTIONS << Net::ReadTimeout if defined?(Net::ReadTimeout)
|
28
|
+
READ_EXCEPTIONS.freeze
|
29
|
+
|
25
30
|
class StartError < StandardError; end
|
26
31
|
class ReadResponseError < StandardError; end
|
27
32
|
|
@@ -108,7 +113,7 @@ module Skylight
|
|
108
113
|
|
109
114
|
begin
|
110
115
|
res = client.request(req)
|
111
|
-
rescue
|
116
|
+
rescue *READ_EXCEPTIONS => e
|
112
117
|
raise ReadResponseError, e.inspect
|
113
118
|
end
|
114
119
|
|
data/lib/skylight/util/task.rb
CHANGED
data/lib/skylight/version.rb
CHANGED
@@ -54,6 +54,7 @@ module Skylight
|
|
54
54
|
"host.info" => RbConfig::CONFIG['arch'],
|
55
55
|
"ruby.version" => "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}",
|
56
56
|
"ruby.engine" => RUBY_ENGINE,
|
57
|
+
"rails.version" => defined?(Rails) ? Rails.version : nil,
|
57
58
|
"skylight.version" => Skylight::VERSION
|
58
59
|
}
|
59
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|