skylight-core 4.0.0.alpha2 → 4.0.0.alpha3

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
  SHA256:
3
- metadata.gz: dcb4098f385b742f3c0a35e4f15870fbfefe917b3cd21c411ade2d523ebae700
4
- data.tar.gz: 743e877a1931e73c52231db337f880e5628a5634de3e82d72e6dcc990f1a0ae6
3
+ metadata.gz: dc9eb39c7b8b4247a019740d8ac1784ed1442ae33f20bfc04fe061be5151a8e3
4
+ data.tar.gz: 78c44b3fe3015152a7ebef7da37986e25bd87d48ddae853fdd7af77030dcb40b
5
5
  SHA512:
6
- metadata.gz: 52153aa179543d1f8ec6a1c352d18e8b36050f3bfe14e56182a5db42528d831477199c8f8136f41ad1934c30fb748afa427a5f8f1d0d5c68afddfd49ce034d62
7
- data.tar.gz: 265f428b0b1ea26a0bc7456ce4a00ec79cb5571378fbf8306a49f25ed7713fefdc036beba1bdc223e22f0829a87d15c0e623e4d86255807e7da37bc7f2169ff4
6
+ metadata.gz: 6797bce1826972cba73f28d2f4c0c941fb3b9f6e593e022d6d58f7fccb155e9162055a0d3defc82aa790d8c2d4c308cd662ea9014dcdce19c3e8d3cf6eaaf201
7
+ data.tar.gz: 9831703c5ed2ecf9468c0b6ffde0237c04fe7f7abadb9c4eee9b4697730521a8a870cff9d42089edb571d3ff3ce96f16c017fbef132c4f6af0e9580b38a2ae05
@@ -20,7 +20,7 @@ module Skylight
20
20
  end
21
21
 
22
22
  def instrumenter
23
- @instrumenter
23
+ defined?(@instrumenter) && @instrumenter
24
24
  end
25
25
 
26
26
  def correlation_header
@@ -37,10 +37,10 @@ module Skylight
37
37
 
38
38
  # Start instrumenting
39
39
  def start!(config = nil)
40
- return @instrumenter if @instrumenter
40
+ return instrumenter if instrumenter
41
41
 
42
42
  const_get(:LOCK).synchronize do
43
- return @instrumenter if @instrumenter
43
+ return instrumenter if instrumenter
44
44
 
45
45
  config ||= {}
46
46
  config = config_class.load(config) unless config.is_a?(config_class)
@@ -66,13 +66,17 @@ module Skylight
66
66
  false
67
67
  end
68
68
 
69
+ def started?
70
+ !!instrumenter
71
+ end
72
+
69
73
  # Stop instrumenting
70
74
  def stop!
71
75
  t { "stop!" }
72
76
 
73
77
  const_get(:LOCK).synchronize do
74
78
  t { "stop! synchronized" }
75
- return unless @instrumenter
79
+ return unless instrumenter
76
80
  # This is only really helpful for getting specs to pass.
77
81
  @instrumenter.current_trace = nil
78
82
 
@@ -88,7 +92,7 @@ module Skylight
88
92
  end
89
93
 
90
94
  # Start a trace
91
- def trace(endpoint = nil, cat = nil, title = nil, meta = nil, segment: nil)
95
+ def trace(endpoint = nil, cat = nil, title = nil, meta: nil, segment: nil)
92
96
  unless instrumenter
93
97
  return yield if block_given?
94
98
  return
@@ -97,9 +101,9 @@ module Skylight
97
101
  cat ||= DEFAULT_CATEGORY
98
102
 
99
103
  if block_given?
100
- instrumenter.trace(endpoint, cat, title, nil, meta, segment: segment) { |tr| yield tr }
104
+ instrumenter.trace(endpoint, cat, title, nil, meta: meta, segment: segment) { |tr| yield tr }
101
105
  else
102
- instrumenter.trace(endpoint, cat, title, nil, meta, segment: segment)
106
+ instrumenter.trace(endpoint, cat, title, nil, meta: meta, segment: segment)
103
107
  end
104
108
  end
105
109
 
@@ -120,7 +120,7 @@ module Skylight::Core
120
120
  native_stop
121
121
  end
122
122
 
123
- def trace(endpoint, cat, title = nil, desc = nil, meta = nil, segment: nil)
123
+ def trace(endpoint, cat, title = nil, desc = nil, meta: nil, segment: nil)
124
124
  # If a trace is already in progress, continue with that one
125
125
  if (trace = @trace_info.current)
126
126
  return yield(trace) if block_given?
@@ -128,7 +128,7 @@ module Skylight::Core
128
128
  end
129
129
 
130
130
  begin
131
- trace = self.class.trace_class.new(self, endpoint, Util::Clock.nanos, cat, title, desc, meta, segment: segment)
131
+ trace = self.class.trace_class.new(self, endpoint, Util::Clock.nanos, cat, title, desc, meta: meta, segment: segment)
132
132
  rescue Exception => e
133
133
  log_error e.message
134
134
  t { e.backtrace.join("\n") }
@@ -155,7 +155,7 @@ module Skylight::Core
155
155
  end
156
156
 
157
157
  def disabled?
158
- @disabled
158
+ defined?(@disabled) && @disabled
159
159
  end
160
160
 
161
161
  def self.match?(string, regex)
@@ -78,8 +78,8 @@ module Skylight::Core
78
78
  else
79
79
  begin
80
80
  t { "middleware beginning trace" }
81
- trace = instrumentable.trace(endpoint_name(env), "app.rack.request", nil, endpoint_meta(env))
82
- t { "middleware began trace=#{trace.uuid}" }
81
+ trace = instrumentable.trace(endpoint_name(env), "app.rack.request", nil, meta: endpoint_meta(env))
82
+ t { "middleware began trace=#{trace ? trace.uuid : nil}" }
83
83
 
84
84
  resp = @app.call(env)
85
85
 
@@ -88,8 +88,8 @@ module Skylight::Core
88
88
  else
89
89
  resp
90
90
  end
91
- rescue Exception
92
- t { "middleware exception: #{trace}" }
91
+ rescue Exception => e
92
+ t { "middleware exception: #{e}\n#{e.backtrace.join("\n")}" }
93
93
  trace.submit if trace
94
94
  raise
95
95
  end
@@ -9,7 +9,7 @@ module Skylight::Core
9
9
  attr_reader :instrumenter, :endpoint, :notifications, :meta
10
10
  attr_accessor :uuid, :segment
11
11
 
12
- def self.new(instrumenter, endpoint, start, cat, title = nil, desc = nil, meta = nil, segment: nil)
12
+ def self.new(instrumenter, endpoint, start, cat, title = nil, desc = nil, meta: nil, segment: nil)
13
13
  uuid = SecureRandom.uuid
14
14
  inst = native_new(normalize_time(start), uuid, endpoint, meta)
15
15
  inst.uuid = uuid
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.0-alpha2".freeze
3
+ VERSION = "4.0.0-alpha3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha2
4
+ version: 4.0.0.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.15'
47
+ version: 1.17.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.15'
54
+ version: 1.17.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: puma
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -263,15 +263,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
263
263
  requirements:
264
264
  - - ">="
265
265
  - !ruby/object:Gem::Version
266
- version: 2.2.7
266
+ version: '2.3'
267
267
  required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">"
270
270
  - !ruby/object:Gem::Version
271
271
  version: 1.3.1
272
272
  requirements: []
273
- rubyforge_project:
274
- rubygems_version: 2.7.6
273
+ rubygems_version: 3.0.2
275
274
  signing_key:
276
275
  specification_version: 4
277
276
  summary: The core methods of the Skylight profiler.