skylight-core 4.2.0.beta → 4.2.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skylight/core/config.rb +6 -0
- data/lib/skylight/core/probes/graphql.rb +40 -0
- data/lib/skylight/core/probes/sinatra.rb +12 -2
- data/lib/skylight/core/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34c416285f52795281bbd430f70367601d861b0af6f1b159ea4815aafa612016
|
4
|
+
data.tar.gz: 9a2608e5e0285a90ba5531a0200e3621611cca52034e2ab717564205d4583839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 755507e9ef7779f9dc1062c1a0fe8d934510a41fd01813f5389fee8c2f0fb5803dccc5da73536dd65a5ac5c1b87fe25622e71faa25a76d952bc4d762dbfff67f
|
7
|
+
data.tar.gz: 43ad79dbd48363114759634112dcacfbe770cbaa00827cb0277a586d67154952efe47242304e4f68a6f053e59d6819189272c4c48f9c552c78b22e4d07b52954
|
data/lib/skylight/core/config.rb
CHANGED
@@ -36,6 +36,7 @@ module Skylight::Core
|
|
36
36
|
# == Instrumenter ==
|
37
37
|
"ENABLE_SEGMENTS" => :enable_segments,
|
38
38
|
"ENABLE_SIDEKIQ" => :enable_sidekiq,
|
39
|
+
"SINATRA_ROUTE_PREFIXES" => :sinatra_route_prefixes,
|
39
40
|
|
40
41
|
# == User config settings ==
|
41
42
|
"USER_CONFIG_PATH" => :user_config_path,
|
@@ -54,6 +55,7 @@ module Skylight::Core
|
|
54
55
|
log_sql_parse_errors: true,
|
55
56
|
enable_segments: true,
|
56
57
|
enable_sidekiq: false,
|
58
|
+
sinatra_route_prefixes: false,
|
57
59
|
'heroku.dyno_info_path': "/etc/heroku/dyno"
|
58
60
|
}
|
59
61
|
end
|
@@ -411,6 +413,10 @@ module Skylight::Core
|
|
411
413
|
!!get(:enable_sidekiq)
|
412
414
|
end
|
413
415
|
|
416
|
+
def sinatra_route_prefixes?
|
417
|
+
!!get(:sinatra_route_prefixes)
|
418
|
+
end
|
419
|
+
|
414
420
|
def user_config
|
415
421
|
@user_config ||= UserConfig.new(self)
|
416
422
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Skylight::Core
|
4
|
+
module Probes
|
5
|
+
module GraphQL
|
6
|
+
class Probe
|
7
|
+
def install
|
8
|
+
::GraphQL::Schema.class_eval do
|
9
|
+
alias_method :multiplex_without_sk, :multiplex
|
10
|
+
|
11
|
+
# Schema#execute also delegates to multiplex, so this is the only method
|
12
|
+
# we need to override.
|
13
|
+
def multiplex(*args, &block)
|
14
|
+
sk_add_tracer
|
15
|
+
multiplex_without_sk(*args, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def sk_add_tracer
|
19
|
+
Skylight::Core::Config::MUTEX.synchronize do
|
20
|
+
graphql_tracer = ::GraphQL::Tracing::ActiveSupportNotificationsTracing
|
21
|
+
unless tracers.include?(graphql_tracer)
|
22
|
+
$stdout.puts "[SKYLIGHT::CORE] Adding tracer 'GraphQL::Tracing::ActiveSupportNotificationsTracing' to schema"
|
23
|
+
tracers << graphql_tracer
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
# Remove the probe and reset multiplex/execute to original version
|
28
|
+
# after the tracer has been added
|
29
|
+
alias_method :multiplex, :multiplex_without_sk
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
register(:graphql, "GraphQL", "graphql", GraphQL::Probe.new)
|
39
|
+
end
|
40
|
+
end
|
@@ -36,8 +36,18 @@ module Skylight::Core
|
|
36
36
|
dispatch_without_sk!(*args, &block).tap do
|
37
37
|
Skylight::Core::Fanout.each_trace do |trace|
|
38
38
|
# Set the endpoint name to the route name
|
39
|
-
route = env["sinatra.route"]
|
40
|
-
|
39
|
+
if (route = env["sinatra.route"])
|
40
|
+
# Include the app's mount point (if available)
|
41
|
+
script_name = trace.instrumenter.config.sinatra_route_prefixes? && env["SCRIPT_NAME"]
|
42
|
+
|
43
|
+
trace.endpoint =
|
44
|
+
if script_name && !script_name.empty?
|
45
|
+
verb, path = route.split(" ", 2)
|
46
|
+
"#{verb} [#{script_name}]#{path}"
|
47
|
+
else
|
48
|
+
route
|
49
|
+
end
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
43
53
|
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.2.0.
|
4
|
+
version: 4.2.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/skylight/core/probes/excon/middleware.rb
|
225
225
|
- lib/skylight/core/probes/faraday.rb
|
226
226
|
- lib/skylight/core/probes/grape.rb
|
227
|
+
- lib/skylight/core/probes/graphql.rb
|
227
228
|
- lib/skylight/core/probes/httpclient.rb
|
228
229
|
- lib/skylight/core/probes/middleware.rb
|
229
230
|
- lib/skylight/core/probes/mongo.rb
|