skylight 0.2.0.beta.2 → 0.2.0.beta.3
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 +9 -0
- data/lib/skylight/instrumenter.rb +11 -0
- data/lib/skylight/subscriber.rb +2 -0
- data/lib/skylight/version.rb +1 -1
- data/lib/skylight/worker/collector.rb +2 -2
- data/lib/sql_lexer/lexer.rb +8 -3
- 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: 2b6ffd4680bf0bfa2f2e725a0ed6601c70d8da33
|
4
|
+
data.tar.gz: 7467f5495f63fe61cf9ebf342c1b9970e69f4ac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63aac94d7f9c0ed6f337901c37b8bbe3e4a519d800092a6a1c023e7881d095740130d299b23e9def21e7c2e9cc7c89664c26c425e6b4fdbcebd76f101a099de5
|
7
|
+
data.tar.gz: 93b7b2607ddc3a677b04b648c6246b5c8201b46355c01d34892e9291d0cf1555c97308e21019cdf5ec2609b85c10821c644e86dc0f9d6cbe5096fcf2136e476c
|
data/lib/skylight.rb
CHANGED
@@ -99,6 +99,15 @@ module Skylight
|
|
99
99
|
inst.instrument(category, title, desc, &blk)
|
100
100
|
end
|
101
101
|
|
102
|
+
def self.disable(&block)
|
103
|
+
unless inst = Instrumenter.instance
|
104
|
+
return yield if block_given?
|
105
|
+
return
|
106
|
+
end
|
107
|
+
|
108
|
+
inst.disable(&block)
|
109
|
+
end
|
110
|
+
|
102
111
|
RUBYBIN = File.join(
|
103
112
|
RbConfig::CONFIG['bindir'],
|
104
113
|
"#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
|
@@ -115,6 +115,17 @@ module Skylight
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
def disable
|
119
|
+
@disabled = true
|
120
|
+
yield
|
121
|
+
ensure
|
122
|
+
@disabled = false
|
123
|
+
end
|
124
|
+
|
125
|
+
def disabled?
|
126
|
+
@disabled
|
127
|
+
end
|
128
|
+
|
118
129
|
def instrument(cat, *args)
|
119
130
|
unless trace = @trace_info.current
|
120
131
|
return yield if block_given?
|
data/lib/skylight/subscriber.rb
CHANGED
@@ -36,6 +36,7 @@ module Skylight
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def start(name, id, payload)
|
39
|
+
return if @instrumenter.disabled?
|
39
40
|
return unless trace = @instrumenter.current_trace
|
40
41
|
|
41
42
|
cat, title, desc, annot = normalize(trace, name, payload)
|
@@ -61,6 +62,7 @@ module Skylight
|
|
61
62
|
end
|
62
63
|
|
63
64
|
def finish(name, id, payload)
|
65
|
+
return if @instrumenter.disabled?
|
64
66
|
return unless trace = @instrumenter.current_trace
|
65
67
|
|
66
68
|
while curr = trace.notifications.pop
|
data/lib/skylight/version.rb
CHANGED
@@ -68,7 +68,7 @@ module Skylight
|
|
68
68
|
res = @http_auth.post("/agent/error?hostname=#{escape(config[:'hostname'])}", reason: msg.reason, body: msg.body)
|
69
69
|
|
70
70
|
unless res.success?
|
71
|
-
if (400..499).include?
|
71
|
+
if (400..499).include? res.status
|
72
72
|
warn "error wasn't sent successfully; status=%s", res.status
|
73
73
|
end
|
74
74
|
|
@@ -109,7 +109,7 @@ module Skylight
|
|
109
109
|
res = @http_auth.get("/agent/authenticate?hostname=#{escape(config[:'hostname'])}")
|
110
110
|
|
111
111
|
unless res.success?
|
112
|
-
if (400..499).include?
|
112
|
+
if (400..499).include? res.status
|
113
113
|
warn "token request rejected; status=%s", res.status
|
114
114
|
@http_report = nil
|
115
115
|
end
|
data/lib/sql_lexer/lexer.rb
CHANGED
@@ -16,6 +16,7 @@ module SqlLexer
|
|
16
16
|
OpPart = %q<\+|\-(?!-)|\*|/(?!\*)|\<|\>|=|~|!|@|#|%|\^|&|\||\?|\.|,|\(|\)>
|
17
17
|
WS = %q< \t\r\n>
|
18
18
|
OptWS = %Q<[#{WS}]*>
|
19
|
+
End = %Q<;|$>
|
19
20
|
|
20
21
|
InOp = %q<IN>
|
21
22
|
SpecialOps = %Q<#{InOp}(?=[#{WS}])>
|
@@ -24,7 +25,11 @@ module SqlLexer
|
|
24
25
|
StartTickedID = %Q<`>
|
25
26
|
StartString = %Q<'>
|
26
27
|
StartDigit = %q<[\p{Digit}\.]>
|
27
|
-
|
28
|
+
|
29
|
+
# Binds that are also IDs do not need to be included here, since AfterOp (which uses StartBind)
|
30
|
+
# also checks for StartAnyId
|
31
|
+
StartBind = %Q<#{StartString}|#{StartDigit}|#{SpecialOps}>
|
32
|
+
|
28
33
|
StartNonBind = %Q<#{StartQuotedID}|#{StartTickedID}|\\$(?=\\p{Digit})>
|
29
34
|
TableNext = %Q<(#{OptWS}((?=#{StartQuotedID})|(?=#{StartTickedID}))|[#{WS}]+(?=[#{StartID}]))>
|
30
35
|
StartAnyId = %Q<"#{StartID}>
|
@@ -52,7 +57,7 @@ module SqlLexer
|
|
52
57
|
|
53
58
|
Number = %Q<#{HeadDecimal}|#{TailDecimal}|#{ExpDecimal}|#{Digits}>
|
54
59
|
|
55
|
-
|
60
|
+
Literals = %Q<(?:NULL|TRUE|FALSE)(?=(?:[#{WS}]|#{OpPart}|#{End}))>
|
56
61
|
|
57
62
|
TkWS = %r<[#{WS}]+>
|
58
63
|
TkOptWS = %r<[#{WS}]*>
|
@@ -66,7 +71,7 @@ module SqlLexer
|
|
66
71
|
TkFromTable = %r<FROM#{TableNext}>i
|
67
72
|
TkID = %r<#{ID}>
|
68
73
|
TkEnd = %r<;?[#{WS}]*>
|
69
|
-
TkBind = %r<#{String}|#{Number}|#{
|
74
|
+
TkBind = %r<#{String}|#{Number}|#{Literals}>
|
70
75
|
TkIn = %r<#{InOp}>i
|
71
76
|
TkSpecialOp = %r<#{SpecialOps}>i
|
72
77
|
|
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.2.0.beta.
|
4
|
+
version: 0.2.0.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|