skylight 0.2.0.beta.2 → 0.2.0.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eff1d9d8e44d8af2a98286288aec951a38720666
4
- data.tar.gz: 6092bd5bbe56c2061083f0b335305ca0665e5fa1
3
+ metadata.gz: 2b6ffd4680bf0bfa2f2e725a0ed6601c70d8da33
4
+ data.tar.gz: 7467f5495f63fe61cf9ebf342c1b9970e69f4ac5
5
5
  SHA512:
6
- metadata.gz: 43a42aef2eccd54531eb14186ceda1b480d06568cb6ccc91fd516be7f9fe9ff11a162dc2db8668d48c0b61e81f2844e9936f2799292f48392d6c0979af776dff
7
- data.tar.gz: 52079fa8a4a2a6c32913681088059f216769098ff1e5553b8d3b38ff074695616a52e635b6ca1265ccaba743c1e86df4ac805be9bd89ff479a475c8c13a75ace
6
+ metadata.gz: 63aac94d7f9c0ed6f337901c37b8bbe3e4a519d800092a6a1c023e7881d095740130d299b23e9def21e7c2e9cc7c89664c26c425e6b4fdbcebd76f101a099de5
7
+ data.tar.gz: 93b7b2607ddc3a677b04b648c6246b5c8201b46355c01d34892e9291d0cf1555c97308e21019cdf5ec2609b85c10821c644e86dc0f9d6cbe5096fcf2136e476c
@@ -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?
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.2.0.beta.2'
2
+ VERSION = '0.2.0.beta.3'
3
3
  end
4
4
 
@@ -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? @res.status
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? @res.status
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
@@ -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
- StartBind = %Q<#{StartString}|#{StartDigit}|#{SpecialOps}|N(?=ULL(?:[#{WS}]|#{OpPart}))>
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
- Null = %Q<NULL(?=(?:[#{WS}]|#{OpPart}))>
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}|#{Null}>
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.2
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-01 00:00:00.000000000 Z
11
+ date: 2013-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport