skylight-core 3.0.0 → 3.1.0.beta
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 +4 -4
- data/lib/skylight/core/fanout.rb +14 -2
- data/lib/skylight/core/probes/action_dispatch/routing/route_set.rb +27 -0
- data/lib/skylight/core/probes/action_dispatch.rb +1 -0
- data/lib/skylight/core/probes/middleware.rb +1 -24
- data/lib/skylight/core/probes/sinatra.rb +1 -6
- data/lib/skylight/core/trace.rb +4 -0
- data/lib/skylight/core/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e728cb584714e19aa0ccdc0922ac399c52e59b580033094eff49a478589da1fa
|
4
|
+
data.tar.gz: d0e4c19a788911437dd92e89a9161c00462aab63815490ea2818ae4c821e3e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4489f1a54319bc0cdc05048d38b0f96e54caacce381893f16e8b3dcf55a043a8e4e0f65b6b65a53cf2509181fbe50f86d81870a43ec122b18a79acbe6ae42b6
|
7
|
+
data.tar.gz: b29c30f1beff1a30702513955ebcfc711acbb6677786f2eb28072845593f2824fee3a14ab8490f0c4d86f048bdc8b9ea7348b9c81e66aa5e39b0f20d64bf8f2b
|
data/lib/skylight/core/fanout.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Skylight
|
2
2
|
module Core
|
3
3
|
module Fanout
|
4
|
-
|
5
4
|
def self.registered
|
6
5
|
@registered ||= []
|
7
6
|
end
|
@@ -21,10 +20,11 @@ module Skylight
|
|
21
20
|
def self.instrument(*args)
|
22
21
|
if block_given?
|
23
22
|
spans = instrument(*args)
|
23
|
+
meta = {}
|
24
24
|
begin
|
25
25
|
yield spans
|
26
26
|
ensure
|
27
|
-
done(spans)
|
27
|
+
done(spans, meta)
|
28
28
|
end
|
29
29
|
else
|
30
30
|
registered.map do |r|
|
@@ -42,6 +42,18 @@ module Skylight
|
|
42
42
|
def self.broken!
|
43
43
|
registered.each(&:broken!)
|
44
44
|
end
|
45
|
+
|
46
|
+
def self.endpoint=(endpoint)
|
47
|
+
each_trace { |t| t.endpoint = endpoint }
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.each_trace
|
51
|
+
return to_enum(__method__) unless block_given?
|
52
|
+
registered.each do |r|
|
53
|
+
next unless r.instrumenter && (trace = r.instrumenter.current_trace)
|
54
|
+
yield trace
|
55
|
+
end
|
56
|
+
end
|
45
57
|
end
|
46
58
|
end
|
47
59
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Skylight::Core
|
2
|
+
module Probes
|
3
|
+
module ActionDispatch
|
4
|
+
module Routing
|
5
|
+
module RouteSet
|
6
|
+
class Probe
|
7
|
+
def install
|
8
|
+
::ActionDispatch::Routing::RouteSet.class_eval do
|
9
|
+
alias call_without_sk call
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
Skylight::Core::Fanout.endpoint = self.class.name
|
13
|
+
Skylight::Core::Fanout.instrument(title: self.class.name, category: 'rack.app') do
|
14
|
+
call_without_sk(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
register(:rails_router, "ActionDispatch::Routing::RouteSet", "action_dispatch/routing/route_set", ActionDispatch::Routing::RouteSet::Probe.new)
|
26
|
+
end
|
27
|
+
end
|
@@ -22,10 +22,7 @@ module Skylight::Core
|
|
22
22
|
def call(*args, &block)
|
23
23
|
return call_without_sk(*args, &block) if Skylight::Core::Probes::Middleware::Probe.disabled?
|
24
24
|
|
25
|
-
traces = Skylight::Core::Fanout.
|
26
|
-
r.instrumenter ? r.instrumenter.current_trace : nil
|
27
|
-
end.compact
|
28
|
-
|
25
|
+
traces = Skylight::Core::Fanout.each_trace.to_a
|
29
26
|
return call_without_sk(*args, &block) if traces.empty?
|
30
27
|
|
31
28
|
begin
|
@@ -57,26 +54,6 @@ module Skylight::Core
|
|
57
54
|
end
|
58
55
|
|
59
56
|
def install
|
60
|
-
::ActionDispatch::MiddlewareStack.class_eval do
|
61
|
-
alias build_without_sk build
|
62
|
-
|
63
|
-
if ::ActionPack.gem_version >= Gem::Version.new('5.x')
|
64
|
-
# Rails 5
|
65
|
-
def build(app = Proc.new)
|
66
|
-
Skylight::Core::Probes::Middleware::Probe.add_instrumentation(app, default_name: "Rack App", category: "rack.app")
|
67
|
-
build_without_sk(app)
|
68
|
-
end
|
69
|
-
else
|
70
|
-
# Rails 3 and 4
|
71
|
-
def build(app, &block)
|
72
|
-
app ||= block
|
73
|
-
raise "MiddlewareStack#build requires an app" unless app
|
74
|
-
Skylight::Core::Probes::Middleware::Probe.add_instrumentation(app, default_name: "Rack App", category: "rack.app")
|
75
|
-
build_without_sk(app)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
57
|
::ActionDispatch::MiddlewareStack::Middleware.class_eval do
|
81
58
|
alias build_without_sk build
|
82
59
|
def build(*args)
|
@@ -34,12 +34,7 @@ module Skylight::Core
|
|
34
34
|
|
35
35
|
def dispatch!(*args, &block)
|
36
36
|
dispatch_without_sk!(*args, &block).tap do
|
37
|
-
Skylight::Core::Fanout.
|
38
|
-
instrumenter = target.instrumenter
|
39
|
-
next unless instrumenter
|
40
|
-
trace = instrumenter.current_trace
|
41
|
-
next unless trace
|
42
|
-
|
37
|
+
Skylight::Core::Fanout.each_trace do |trace|
|
43
38
|
# Set the endpoint name to the route name
|
44
39
|
route = env['sinatra.route']
|
45
40
|
trace.endpoint = route if route
|
data/lib/skylight/core/trace.rb
CHANGED
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: 3.0.
|
4
|
+
version: 3.1.0.beta
|
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-09-
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- lib/skylight/core/probes/action_controller.rb
|
207
207
|
- lib/skylight/core/probes/action_dispatch.rb
|
208
208
|
- lib/skylight/core/probes/action_dispatch/request_id.rb
|
209
|
+
- lib/skylight/core/probes/action_dispatch/routing/route_set.rb
|
209
210
|
- lib/skylight/core/probes/action_view.rb
|
210
211
|
- lib/skylight/core/probes/active_job_enqueue.rb
|
211
212
|
- lib/skylight/core/probes/active_model_serializers.rb
|
@@ -260,9 +261,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
261
|
version: 2.2.7
|
261
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
263
|
requirements:
|
263
|
-
- - "
|
264
|
+
- - ">"
|
264
265
|
- !ruby/object:Gem::Version
|
265
|
-
version:
|
266
|
+
version: 1.3.1
|
266
267
|
requirements: []
|
267
268
|
rubyforge_project:
|
268
269
|
rubygems_version: 2.7.6
|