skylight-core 4.0.2 → 4.1.0
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 +5 -1
- data/lib/skylight/core/normalizers/graphiti/render.rb +22 -0
- data/lib/skylight/core/normalizers/graphiti/resolve.rb +31 -0
- data/lib/skylight/core/normalizers/sql.rb +1 -10
- data/lib/skylight/core/normalizers.rb +2 -0
- data/lib/skylight/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9aba7caf1b79414378a74478725546371ca10f5c534286f34685a7f03786858
|
4
|
+
data.tar.gz: df547257edd36b36602caf64291224b286d1e537b211c80e224a9898ce83576a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2ee38e5ab8eaa9cf1ad588afb6a4bc8ebef890dc8ce02e3352794e6e0ef4069bff50d8518f883056bea37f099c1d587adef746e3594139761dbae5ef07a740c
|
7
|
+
data.tar.gz: 98186512b8b06e3cc4d8f557d569a96a421a4afd5c6f6bb8dae6748614341cc18aff1a46349fa5e143d1ecd2efe72b4d4c7c863504dfbb2497b074531c05f16a
|
data/lib/skylight/core/config.rb
CHANGED
@@ -130,7 +130,11 @@ module Skylight::Core
|
|
130
130
|
if path
|
131
131
|
error = nil
|
132
132
|
begin
|
133
|
-
attrs = YAML.safe_load(ERB.new(File.read(path)).result
|
133
|
+
attrs = YAML.safe_load(ERB.new(File.read(path)).result,
|
134
|
+
[], # permitted_classes
|
135
|
+
[], # permitted_symbols
|
136
|
+
true # aliases enabled
|
137
|
+
)
|
134
138
|
error = "empty file" unless attrs
|
135
139
|
error = "invalid format" if attrs && !attrs.is_a?(Hash)
|
136
140
|
rescue Exception => e
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Skylight::Core
|
4
|
+
module Normalizers
|
5
|
+
module Graphiti
|
6
|
+
class Render < Normalizer
|
7
|
+
register "render.graphiti"
|
8
|
+
|
9
|
+
CAT = "view.render.graphiti"
|
10
|
+
ANONYMOUS = "<Anonymous Resource>"
|
11
|
+
|
12
|
+
def normalize(_trace, _name, payload)
|
13
|
+
resource_class = payload[:proxy]&.resource&.class
|
14
|
+
title = "Render #{resource_class&.name || ANONYMOUS}"
|
15
|
+
desc = nil
|
16
|
+
|
17
|
+
[CAT, title, desc]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Skylight::Core
|
4
|
+
module Normalizers
|
5
|
+
module Graphiti
|
6
|
+
class Resolve < Normalizer
|
7
|
+
register "resolve.graphiti"
|
8
|
+
|
9
|
+
CAT = "app.resolve.graphiti"
|
10
|
+
|
11
|
+
ANONYMOUS_RESOURCE = "<Anonymous Resource>"
|
12
|
+
ANONYMOUS_ADAPTER = "<Anonymous Adapter>"
|
13
|
+
|
14
|
+
def normalize(_trace, _name, payload)
|
15
|
+
resource = payload[:resource]
|
16
|
+
|
17
|
+
if (sideload = payload[:sideload])
|
18
|
+
type = sideload.type.to_s.split("_").map(&:capitalize).join(" ")
|
19
|
+
desc = "Custom Scope" if sideload.class.scope_proc
|
20
|
+
else
|
21
|
+
type = "Primary"
|
22
|
+
end
|
23
|
+
|
24
|
+
title = "Resolve #{type} #{resource.class.name || ANONYMOUS_RESOURCE}"
|
25
|
+
|
26
|
+
[CAT, title, desc]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -31,16 +31,7 @@ module Skylight::Core
|
|
31
31
|
extracted_title, sql = extract_binds(trace.instrumenter, payload, binds)
|
32
32
|
[name, extracted_title || title, sql]
|
33
33
|
rescue => e
|
34
|
-
|
35
|
-
if config[:log_sql_parse_errors]
|
36
|
-
config.logger.error "[#{e.formatted_code}] Failed to extract binds from SQL query. " \
|
37
|
-
"It's likely that this query uses more advanced syntax than we currently support. " \
|
38
|
-
"sql=#{payload[:sql].inspect}"
|
39
|
-
end
|
40
|
-
else
|
41
|
-
config.logger.error "Failed to extract binds in SQL; sql=#{payload[:sql].inspect}; exception=#{e.inspect}"
|
42
|
-
end
|
43
|
-
|
34
|
+
config.logger.error "Failed to extract binds in SQL; sql=#{payload[:sql].inspect}; exception=#{e.inspect}"
|
44
35
|
[name, title, nil]
|
45
36
|
end
|
46
37
|
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
|
4
|
+
version: 4.1.0
|
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-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -202,6 +202,8 @@ files:
|
|
202
202
|
- lib/skylight/core/normalizers/grape/endpoint_run.rb
|
203
203
|
- lib/skylight/core/normalizers/grape/endpoint_run_filters.rb
|
204
204
|
- lib/skylight/core/normalizers/grape/format_response.rb
|
205
|
+
- lib/skylight/core/normalizers/graphiti/render.rb
|
206
|
+
- lib/skylight/core/normalizers/graphiti/resolve.rb
|
205
207
|
- lib/skylight/core/normalizers/moped/query.rb
|
206
208
|
- lib/skylight/core/normalizers/render.rb
|
207
209
|
- lib/skylight/core/normalizers/sequel/sql.rb
|