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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c97eeb92d20fa41cb51d27ca04a7fd736ba6fcb0c81f7697fa89bff76666cbb
4
- data.tar.gz: 439e037bbb5e5d0e9f8262fd533b4b570e84392122ea4a9eb4e8f5bd36d5308a
3
+ metadata.gz: f9aba7caf1b79414378a74478725546371ca10f5c534286f34685a7f03786858
4
+ data.tar.gz: df547257edd36b36602caf64291224b286d1e537b211c80e224a9898ce83576a
5
5
  SHA512:
6
- metadata.gz: 3681da84f5e8bcc320de64d555b7520311c4143d593ac1df00e06991d85368b43b157d12f25b771be5dd9ef7ae2b512b8d5126c126a02b1f385180cac18fb7c8
7
- data.tar.gz: b087cdf2965947ead6ea3186fdc85a7c25f6e0fbe7402b11fa5082fc1b7919338b57eec43a7c3f8b327eb8496996414a75f249b236f907457c16cbf951ceb537
6
+ metadata.gz: b2ee38e5ab8eaa9cf1ad588afb6a4bc8ebef890dc8ce02e3352794e6e0ef4069bff50d8518f883056bea37f099c1d587adef746e3594139761dbae5ef07a740c
7
+ data.tar.gz: 98186512b8b06e3cc4d8f557d569a96a421a4afd5c6f6bb8dae6748614341cc18aff1a46349fa5e143d1ecd2efe72b4d4c7c863504dfbb2497b074531c05f16a
@@ -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
- if defined?(Skylight::SqlLexError) && e.is_a?(Skylight::SqlLexError)
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
@@ -111,6 +111,8 @@ module Skylight::Core
111
111
  elasticsearch/request
112
112
  faraday/request
113
113
  grape/endpoint
114
+ graphiti/resolve
115
+ graphiti/render
114
116
  moped/query
115
117
  sequel/sql].each do |file|
116
118
  require "skylight/core/normalizers/#{file}"
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.0.2".freeze
3
+ VERSION = "4.1.0".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.2
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-05-21 00:00:00.000000000 Z
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