skylight-core 4.2.2 → 4.2.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/core/probes/graphql.rb +22 -54
- data/lib/skylight/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98240d4732a290ffb184fdc3b682f74fd167eb6061558febaef8139ac6aa4fd3
|
4
|
+
data.tar.gz: 81099a9f8a59907ebf44024645f537fca06b2e758ec65ca68253046b1d4a90e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b46e299d48abd8d2cb5ff4a543d324145cd55a8c2b9d9fd8413a0738aedc111bb0979f1b989aabbae2b9b894cf0b98c1f1b701390146519674165bedbe7736
|
7
|
+
data.tar.gz: 7ff7cc95fef0289039a7b2df226d0bfafcb0c9cbca53d2cbd89099c19b9a735806e2701747f002252ad387e666029718639d9001c8be3cf13abd8816ab1450cd
|
@@ -3,68 +3,36 @@
|
|
3
3
|
module Skylight::Core
|
4
4
|
module Probes
|
5
5
|
module GraphQL
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
::GraphQL::Schema.instance_eval do
|
10
|
-
class << self
|
11
|
-
alias_method :multiplex_without_sk, :multiplex # rubocop:disable Style/Alias
|
12
|
-
end
|
13
|
-
|
14
|
-
# Schema#execute also delegates to multiplex, so this is the only method
|
15
|
-
# we need to override.
|
16
|
-
def multiplex(*args, **kwargs)
|
17
|
-
sk_add_tracer
|
18
|
-
multiplex_without_sk(*args, **kwargs)
|
19
|
-
end
|
6
|
+
module Instrumentation
|
7
|
+
def initialize(*, **)
|
8
|
+
super
|
20
9
|
|
21
|
-
|
22
|
-
Skylight::Core::Config::MUTEX.synchronize do
|
23
|
-
graphql_tracer = ::GraphQL::Tracing::ActiveSupportNotificationsTracing
|
24
|
-
unless tracers.include?(graphql_tracer)
|
25
|
-
$stdout.puts "[SKYLIGHT::CORE] Adding tracer 'GraphQL::Tracing::ActiveSupportNotificationsTracing' to schema" # rubocop:disable Metrics/LineLength
|
26
|
-
tracer(graphql_tracer)
|
27
|
-
end
|
10
|
+
return unless defined?(@tracers)
|
28
11
|
|
29
|
-
|
30
|
-
|
31
|
-
# after the tracer has been added
|
32
|
-
alias_method :multiplex, :multiplex_without_sk # rubocop:disable Style/Alias
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
12
|
+
unless @tracers.include?(::GraphQL::Tracing::ActiveSupportNotificationsTracing)
|
13
|
+
@tracers << ::GraphQL::Tracing::ActiveSupportNotificationsTracing
|
37
14
|
end
|
38
|
-
|
39
|
-
|
40
|
-
::GraphQL::Schema.class_eval do
|
41
|
-
alias_method :multiplex_without_sk, :multiplex
|
15
|
+
end
|
16
|
+
end
|
42
17
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
18
|
+
class Probe
|
19
|
+
def install
|
20
|
+
tracing_klass_name = "::GraphQL::Tracing::ActiveSupportNotificationsTracing"
|
21
|
+
klasses_to_probe = %w(
|
22
|
+
::GraphQL::Execution::Multiplex
|
23
|
+
::GraphQL::Query
|
24
|
+
)
|
49
25
|
|
50
|
-
|
51
|
-
Skylight::Core::Config::MUTEX.synchronize do
|
52
|
-
graphql_tracer = ::GraphQL::Tracing::ActiveSupportNotificationsTracing
|
53
|
-
unless tracers.include?(graphql_tracer)
|
54
|
-
$stdout.puts "[SKYLIGHT::CORE] Adding tracer 'GraphQL::Tracing::ActiveSupportNotificationsTracing' to schema" # rubocop:disable Metrics/LineLength
|
55
|
-
tracers << graphql_tracer
|
56
|
-
end
|
26
|
+
return unless ([tracing_klass_name] + klasses_to_probe).all?(&method(:safe_constantize))
|
57
27
|
|
58
|
-
|
59
|
-
|
60
|
-
# after the tracer has been added
|
61
|
-
alias_method :multiplex, :multiplex_without_sk
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
28
|
+
klasses_to_probe.each do |klass_name|
|
29
|
+
safe_constantize(klass_name).prepend(Instrumentation)
|
66
30
|
end
|
67
31
|
end
|
32
|
+
|
33
|
+
def safe_constantize(klass_name)
|
34
|
+
Skylight::Core::Util::Inflector.safe_constantize(klass_name)
|
35
|
+
end
|
68
36
|
end
|
69
37
|
end
|
70
38
|
|
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.
|
4
|
+
version: 4.2.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: 2020-
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|