skylight-core 3.1.5 → 4.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/skylight/core/config.rb +103 -108
  3. data/lib/skylight/core/deprecation.rb +3 -3
  4. data/lib/skylight/core/fanout.rb +3 -3
  5. data/lib/skylight/core/formatters/http.rb +1 -2
  6. data/lib/skylight/core/gc.rb +31 -36
  7. data/lib/skylight/core/instrumentable.rb +17 -16
  8. data/lib/skylight/core/instrumenter.rb +25 -23
  9. data/lib/skylight/core/middleware.rb +11 -10
  10. data/lib/skylight/core/normalizers/action_controller/process_action.rb +9 -9
  11. data/lib/skylight/core/normalizers/action_controller/send_file.rb +16 -16
  12. data/lib/skylight/core/normalizers/action_view/render_collection.rb +2 -2
  13. data/lib/skylight/core/normalizers/action_view/render_partial.rb +2 -2
  14. data/lib/skylight/core/normalizers/action_view/render_template.rb +2 -2
  15. data/lib/skylight/core/normalizers/active_job/perform.rb +11 -23
  16. data/lib/skylight/core/normalizers/active_model_serializers/render.rb +6 -6
  17. data/lib/skylight/core/normalizers/active_record/instantiation.rb +2 -3
  18. data/lib/skylight/core/normalizers/active_record/sql.rb +1 -2
  19. data/lib/skylight/core/normalizers/active_support/cache.rb +12 -10
  20. data/lib/skylight/core/normalizers/active_support/cache_clear.rb +2 -2
  21. data/lib/skylight/core/normalizers/active_support/cache_decrement.rb +3 -3
  22. data/lib/skylight/core/normalizers/active_support/cache_delete.rb +3 -3
  23. data/lib/skylight/core/normalizers/active_support/cache_exist.rb +3 -3
  24. data/lib/skylight/core/normalizers/active_support/cache_fetch_hit.rb +3 -3
  25. data/lib/skylight/core/normalizers/active_support/cache_generate.rb +3 -3
  26. data/lib/skylight/core/normalizers/active_support/cache_increment.rb +3 -3
  27. data/lib/skylight/core/normalizers/active_support/cache_read.rb +3 -3
  28. data/lib/skylight/core/normalizers/active_support/cache_read_multi.rb +3 -3
  29. data/lib/skylight/core/normalizers/active_support/cache_write.rb +3 -3
  30. data/lib/skylight/core/normalizers/coach/handler_finish.rb +6 -6
  31. data/lib/skylight/core/normalizers/coach/middleware_finish.rb +2 -2
  32. data/lib/skylight/core/normalizers/couch_potato/query.rb +20 -0
  33. data/lib/skylight/core/normalizers/data_mapper/sql.rb +1 -1
  34. data/lib/skylight/core/normalizers/default.rb +1 -4
  35. data/lib/skylight/core/normalizers/elasticsearch/request.rb +5 -5
  36. data/lib/skylight/core/normalizers/grape/endpoint.rb +6 -5
  37. data/lib/skylight/core/normalizers/grape/endpoint_render.rb +3 -4
  38. data/lib/skylight/core/normalizers/grape/endpoint_run.rb +2 -3
  39. data/lib/skylight/core/normalizers/grape/endpoint_run_filters.rb +1 -2
  40. data/lib/skylight/core/normalizers/grape/format_response.rb +1 -2
  41. data/lib/skylight/core/normalizers/moped/query.rb +38 -43
  42. data/lib/skylight/core/normalizers/render.rb +26 -25
  43. data/lib/skylight/core/normalizers/sequel/sql.rb +1 -1
  44. data/lib/skylight/core/normalizers/sql.rb +5 -5
  45. data/lib/skylight/core/normalizers.rb +11 -12
  46. data/lib/skylight/core/probes/action_controller.rb +15 -14
  47. data/lib/skylight/core/probes/action_dispatch/request_id.rb +2 -3
  48. data/lib/skylight/core/probes/action_dispatch/routing/route_set.rb +2 -3
  49. data/lib/skylight/core/probes/action_dispatch.rb +2 -2
  50. data/lib/skylight/core/probes/action_view.rb +11 -17
  51. data/lib/skylight/core/probes/active_job.rb +8 -4
  52. data/lib/skylight/core/probes/active_job_enqueue.rb +2 -2
  53. data/lib/skylight/core/probes/active_model_serializers.rb +7 -6
  54. data/lib/skylight/core/probes/delayed_job.rb +46 -0
  55. data/lib/skylight/core/probes/elasticsearch.rb +3 -4
  56. data/lib/skylight/core/probes/excon/middleware.rb +4 -7
  57. data/lib/skylight/core/probes/excon.rb +2 -2
  58. data/lib/skylight/core/probes/faraday.rb +1 -2
  59. data/lib/skylight/core/probes/httpclient.rb +4 -4
  60. data/lib/skylight/core/probes/middleware.rb +1 -1
  61. data/lib/skylight/core/probes/mongo.rb +29 -34
  62. data/lib/skylight/core/probes/mongoid.rb +2 -3
  63. data/lib/skylight/core/probes/moped.rb +10 -11
  64. data/lib/skylight/core/probes/net_http.rb +5 -5
  65. data/lib/skylight/core/probes/redis.rb +3 -4
  66. data/lib/skylight/core/probes/sequel.rb +4 -4
  67. data/lib/skylight/core/probes/sinatra.rb +6 -11
  68. data/lib/skylight/core/probes/tilt.rb +1 -1
  69. data/lib/skylight/core/probes.rb +16 -17
  70. data/lib/skylight/core/railtie.rb +120 -119
  71. data/lib/skylight/core/sidekiq.rb +8 -4
  72. data/lib/skylight/core/subscriber.rb +25 -29
  73. data/lib/skylight/core/test.rb +13 -17
  74. data/lib/skylight/core/trace.rb +76 -76
  75. data/lib/skylight/core/user_config.rb +9 -11
  76. data/lib/skylight/core/util/allocation_free.rb +0 -1
  77. data/lib/skylight/core/util/clock.rb +16 -16
  78. data/lib/skylight/core/util/gzip.rb +1 -2
  79. data/lib/skylight/core/util/inflector.rb +5 -4
  80. data/lib/skylight/core/util/logging.rb +11 -14
  81. data/lib/skylight/core/util/platform.rb +52 -49
  82. data/lib/skylight/core/util/proxy.rb +3 -3
  83. data/lib/skylight/core/util.rb +5 -5
  84. data/lib/skylight/core/version.rb +1 -2
  85. data/lib/skylight/core/vm/gc.rb +1 -3
  86. data/lib/skylight/core.rb +21 -21
  87. metadata +47 -44
@@ -13,21 +13,21 @@ module Skylight::Core
13
13
  # handler name.
14
14
  #
15
15
  # We can expect the payload to have the :middleware key.
16
- def normalize(trace, name, payload)
16
+ def normalize(trace, _name, payload)
17
17
  trace.endpoint = payload[:middleware]
18
- [ CAT, payload[:middleware], nil ]
18
+ [CAT, payload[:middleware], nil]
19
19
  end
20
20
 
21
- def normalize_after(trace, span, name, payload)
21
+ def normalize_after(trace, _span, _name, payload)
22
22
  return unless config.enable_segments?
23
23
 
24
24
  segments = []
25
25
 
26
- response_status = payload.fetch(:response, {}).fetch(:status, '').to_s
27
- segments << "error" if response_status.start_with?('4', '5')
26
+ response_status = payload.fetch(:response, {}).fetch(:status, "").to_s
27
+ segments << "error" if response_status.start_with?("4", "5")
28
28
 
29
29
  if segments.any?
30
- trace.endpoint += "<sk-segment>#{segments.join("+")}</sk-segment>"
30
+ trace.segment = segments.join("+")
31
31
  end
32
32
  end
33
33
  end
@@ -13,9 +13,9 @@ module Skylight::Core
13
13
  # within a Coach::Handler.
14
14
  #
15
15
  # We can expect the payload to have the :middleware key.
16
- def normalize(trace, name, payload)
16
+ def normalize(trace, _name, payload)
17
17
  trace.endpoint = payload[:middleware]
18
- [ CAT, payload[:middleware], nil ]
18
+ [CAT, payload[:middleware], nil]
19
19
  end
20
20
  end
21
21
  end
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ module Skylight::Core
4
+ module Normalizers
5
+ module CouchPotato
6
+ class Query < Normalizer
7
+ register "couch_potato.load"
8
+ register "couch_potato.view"
9
+
10
+ CAT = "db.couch_db.query".freeze
11
+
12
+ def normalize(_trace, name, payload)
13
+ description = payload[:name] if payload
14
+ name = name.sub("couch_potato.", "")
15
+ [CAT, name, description]
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- require 'skylight/core/normalizers/sql'
1
+ require "skylight/core/normalizers/sql"
2
2
 
3
3
  module Skylight::Core
4
4
  module Normalizers
@@ -1,16 +1,14 @@
1
1
  module Skylight::Core
2
2
  module Normalizers
3
-
4
3
  # The default normalizer, used if no other is found.
5
4
  class Default
6
-
7
5
  # @param trace [Skylight::Messages::Trace::Builder] ignored, only present to match API
8
6
  # @param name [String]
9
7
  # @param payload [Hash]
10
8
  # @option payload [String] :title
11
9
  # @option payload [String] :description
12
10
  # @return [Array, :skip] the normalized array or `:skip` if `name` is not part of a known {Skylight::TIERS tier}
13
- def normalize(trace, name, payload)
11
+ def normalize(_trace, name, payload)
14
12
  if name =~ Skylight::TIER_REGEX
15
13
  [
16
14
  name,
@@ -21,7 +19,6 @@ module Skylight::Core
21
19
  :skip
22
20
  end
23
21
  end
24
-
25
22
  end
26
23
  end
27
24
  end
@@ -6,13 +6,13 @@ module Skylight::Core
6
6
 
7
7
  CAT = "db.elasticsearch.request".freeze
8
8
 
9
- def normalize(trace, name, payload)
10
- path = payload[:path].split('/')
11
- title = [payload[:method], path[0]].compact.join(' ')
9
+ def normalize(_trace, _name, payload)
10
+ path = payload[:path].split("/")
11
+ title = [payload[:method], path[0]].compact.join(" ")
12
12
  desc = {}
13
13
  desc[:type] = path[1] if path[1]
14
- desc[:id] = '?' if path[2]
15
- [ CAT, title, desc.empty? ? nil : desc.to_json ]
14
+ desc[:id] = "?" if path[2]
15
+ [CAT, title, desc.empty? ? nil : desc.to_json]
16
16
  end
17
17
  end
18
18
  end
@@ -2,13 +2,15 @@ module Skylight::Core
2
2
  module Normalizers
3
3
  module Grape
4
4
  class Endpoint < Normalizer
5
- %w(run
6
- render
7
- run_filters).each do |type|
5
+ %w[
6
+ run
7
+ render
8
+ run_filters
9
+ ].each do |type|
8
10
  require "skylight/core/normalizers/grape/endpoint_#{type}"
9
11
  end
10
12
 
11
- require 'skylight/core/normalizers/grape/format_response'
13
+ require "skylight/core/normalizers/grape/format_response"
12
14
 
13
15
  private
14
16
 
@@ -25,7 +27,6 @@ module Skylight::Core
25
27
  def get_namespace(endpoint)
26
28
  ::Grape::Namespace.joined_space(endpoint.namespace_stackable(:namespace))
27
29
  end
28
-
29
30
  end
30
31
  end
31
32
  end
@@ -6,20 +6,19 @@ module Skylight::Core
6
6
 
7
7
  CAT = "app.grape.endpoint".freeze
8
8
 
9
- def normalize(trace, name, payload)
10
- if endpoint = payload[:endpoint]
9
+ def normalize(_trace, _name, payload)
10
+ if (endpoint = payload[:endpoint])
11
11
  path = get_path(endpoint)
12
12
  namespace = get_namespace(endpoint)
13
13
  method = get_method(endpoint)
14
14
 
15
- title = [method, namespace, path].join(' ').gsub(/\s+/, ' ')
15
+ title = [method, namespace, path].join(" ").gsub(/\s+/, " ")
16
16
 
17
17
  [CAT, title, nil]
18
18
  else
19
19
  :skip
20
20
  end
21
21
  end
22
-
23
22
  end
24
23
  end
25
24
  end
@@ -4,7 +4,7 @@ module Skylight::Core
4
4
  class EndpointRun < Endpoint
5
5
  register "endpoint_run.grape"
6
6
 
7
- def normalize(trace, name, payload)
7
+ def normalize(trace, _name, payload)
8
8
  trace.endpoint = get_endpoint_name(payload[:endpoint]) if payload[:endpoint]
9
9
 
10
10
  # We don't necessarily want this to be all instrumented since it's fairly internal.
@@ -20,7 +20,7 @@ module Skylight::Core
20
20
  namespace = get_namespace(endpoint)
21
21
 
22
22
  if namespace && !namespace.empty?
23
- path = "/#{path}" if path[0] != '/'
23
+ path = "/#{path}" if path[0] != "/"
24
24
  path = "#{namespace}#{path}"
25
25
  end
26
26
 
@@ -35,7 +35,6 @@ module Skylight::Core
35
35
  ep.base.name
36
36
  end
37
37
  end
38
-
39
38
  end
40
39
  end
41
40
  end
@@ -6,7 +6,7 @@ module Skylight::Core
6
6
 
7
7
  CAT = "app.grape.filters".freeze
8
8
 
9
- def normalize(trace, name, payload)
9
+ def normalize(_trace, _name, payload)
10
10
  filters = payload[:filters]
11
11
  type = payload[:type]
12
12
 
@@ -16,7 +16,6 @@ module Skylight::Core
16
16
 
17
17
  [CAT, "#{type.to_s.capitalize} Filters", nil]
18
18
  end
19
-
20
19
  end
21
20
  end
22
21
  end
@@ -8,13 +8,12 @@ module Skylight::Core
8
8
 
9
9
  def normalize(_trace, _name, payload)
10
10
  if (formatter = payload[:formatter])
11
- title = formatter.is_a?(Module) ? formatter.to_s : formatter.class.to_s
11
+ title = formatter.is_a?(Module) ? formatter.to_s : formatter.class.to_s
12
12
  [CAT, title, nil]
13
13
  else
14
14
  :skip
15
15
  end
16
16
  end
17
-
18
17
  end
19
18
  end
20
19
  end
@@ -15,7 +15,7 @@ module Skylight::Core
15
15
  # `Query`, `GetMore`, `Insert`, `Update`, and `Delete`.
16
16
  # @option payload [String] :prefix ignored, provided by Moped
17
17
  # @return [Array, :skip] the normalized array or `:skip` if not a known operation type
18
- def normalize(trace, name, payload)
18
+ def normalize(_trace, _name, payload)
19
19
  # payload: { prefix: " MOPED: #{address.resolved}", ops: operations }
20
20
 
21
21
  # We can sometimes have multiple operations. However, it seems like this only happens when doing things
@@ -33,67 +33,62 @@ module Skylight::Core
33
33
  end
34
34
  end
35
35
 
36
- private
36
+ private
37
37
 
38
- def normalize_query(operation)
39
- title = normalize_title("QUERY".freeze, operation)
38
+ def normalize_query(operation)
39
+ title = normalize_title("QUERY".freeze, operation)
40
40
 
41
- hash = extract_binds(operation.selector)
42
- description = hash.to_json
41
+ hash = extract_binds(operation.selector)
42
+ description = hash.to_json
43
43
 
44
- [CAT, title, description, { database: operation.database }]
45
- end
44
+ [CAT, title, description, { database: operation.database }]
45
+ end
46
46
 
47
- def normalize_get_more(operation)
48
- title = normalize_title("GET_MORE".freeze, operation)
47
+ def normalize_get_more(operation)
48
+ title = normalize_title("GET_MORE".freeze, operation)
49
49
 
50
- [CAT, title, nil, { database: operation.database }]
51
- end
50
+ [CAT, title, nil, { database: operation.database }]
51
+ end
52
52
 
53
- def normalize_insert(operation)
54
- title = normalize_title("INSERT".freeze, operation)
53
+ def normalize_insert(operation)
54
+ title = normalize_title("INSERT".freeze, operation)
55
55
 
56
- [CAT, title, nil, { database: operation.database }]
57
- end
56
+ [CAT, title, nil, { database: operation.database }]
57
+ end
58
58
 
59
- def normalize_update(operation)
60
- title = normalize_title("UPDATE".freeze, operation)
59
+ def normalize_update(operation)
60
+ title = normalize_title("UPDATE".freeze, operation)
61
61
 
62
- selector_hash = extract_binds(operation.selector)
63
- update_hash = extract_binds(operation.update)
62
+ selector_hash = extract_binds(operation.selector)
63
+ update_hash = extract_binds(operation.update)
64
64
 
65
- description = { selector: selector_hash, update: update_hash }.to_json
65
+ description = { selector: selector_hash, update: update_hash }.to_json
66
66
 
67
- [CAT, title, description, { database: operation.database }]
68
- end
67
+ [CAT, title, description, { database: operation.database }]
68
+ end
69
69
 
70
- def normalize_delete(operation)
71
- title = normalize_title("DELETE".freeze, operation)
70
+ def normalize_delete(operation)
71
+ title = normalize_title("DELETE".freeze, operation)
72
72
 
73
- hash = extract_binds(operation.selector)
74
- description = hash.to_json
73
+ hash = extract_binds(operation.selector)
74
+ description = hash.to_json
75
75
 
76
- [CAT, title, description, { database: operation.database }]
77
- end
76
+ [CAT, title, description, { database: operation.database }]
77
+ end
78
78
 
79
- def normalize_title(type, operation)
80
- "#{type} #{operation.collection}"
81
- end
79
+ def normalize_title(type, operation)
80
+ "#{type} #{operation.collection}"
81
+ end
82
82
 
83
- def extract_binds(hash)
84
- ret = {}
83
+ def extract_binds(hash)
84
+ ret = {}
85
85
 
86
- hash.each do |k,v|
87
- if v.is_a?(Hash)
88
- ret[k] = extract_binds(v)
89
- else
90
- ret[k] = '?'.freeze
86
+ hash.each do |k, v|
87
+ ret[k] = v.is_a?(Hash) ? extract_binds(v) : "?".freeze
91
88
  end
92
- end
93
-
94
- ret
95
- end
96
89
 
90
+ ret
91
+ end
97
92
  end
98
93
  end
99
94
  end
@@ -5,7 +5,7 @@ module Skylight::Core
5
5
  include Util::AllocationFree
6
6
 
7
7
  def setup
8
- @paths = config['normalizers.render.view_paths'] || []
8
+ @paths = config["normalizers.render.view_paths"] || []
9
9
  end
10
10
 
11
11
  # Generic normalizer for renders
@@ -14,12 +14,11 @@ module Skylight::Core
14
14
  # @option payload [String] :identifier
15
15
  # @return [Array]
16
16
  def normalize_render(category, payload)
17
- if path = payload[:identifier]
17
+ if (path = payload[:identifier])
18
18
  title = relative_path(path)
19
- path = nil if path == title
20
19
  end
21
20
 
22
- [ category, title, nil ]
21
+ [category, title, nil]
23
22
  end
24
23
 
25
24
  def relative_path(path)
@@ -46,32 +45,34 @@ module Skylight::Core
46
45
  end
47
46
  end
48
47
 
49
- private
50
- def relative_path?(path)
51
- !absolute_path?(path)
52
- end
48
+ private
49
+
50
+ def relative_path?(path)
51
+ !absolute_path?(path)
52
+ end
53
53
 
54
- SEPARATOR_BYTE = File::SEPARATOR.ord
54
+ SEPARATOR_BYTE = File::SEPARATOR.ord
55
55
 
56
- if File.const_defined?(:NULL) ? File::NULL == "NUL" : RbConfig::CONFIG['host_os'] =~ /mingw|mswin32/
57
- # This is a DOSish environment
58
- ALT_SEPARATOR_BYTE = File::ALT_SEPARATOR && File::ALT_SEPARATOR.ord
59
- COLON_BYTE = ":".ord
60
- def absolute_path?(path)
61
- if alpha?(path.getbyte(0)) && path.getbyte(1) == COLON_BYTE
62
- byte2 = path.getbyte(2)
63
- byte2 == SEPARATOR_BYTE || byte2 == ALT_SEPARATOR_BYTE
56
+ if File.const_defined?(:NULL) ? File::NULL == "NUL" : RbConfig::CONFIG["host_os"] =~ /mingw|mswin32/
57
+ # This is a DOSish environment
58
+ ALT_SEPARATOR_BYTE = File::ALT_SEPARATOR && File::ALT_SEPARATOR.ord
59
+ COLON_BYTE = ":".ord
60
+ SEPARATOR_BYTES = [SEPARATOR_BYTE, ALT_SEPARATOR_BYTE].freeze
61
+
62
+ def absolute_path?(path)
63
+ if alpha?(path.getbyte(0)) && path.getbyte(1) == COLON_BYTE
64
+ SEPARATOR_BYTES.include?(path.getbyte(2))
65
+ end
64
66
  end
65
- end
66
67
 
67
- def alpha?(byte)
68
- byte >= 65 and byte <= 90 || byte >= 97 and byte <= 122
69
- end
70
- else
71
- def absolute_path?(path)
72
- path.getbyte(0) == SEPARATOR_BYTE
68
+ def alpha?(byte)
69
+ (byte >= 65 && byte <= 90) || (byte >= 97 && byte <= 122)
70
+ end
71
+ else
72
+ def absolute_path?(path)
73
+ path.getbyte(0) == SEPARATOR_BYTE
74
+ end
73
75
  end
74
- end
75
76
  end
76
77
  end
77
78
  end
@@ -1,4 +1,4 @@
1
- require 'skylight/core/normalizers/sql'
1
+ require "skylight/core/normalizers/sql"
2
2
 
3
3
  module Skylight::Core
4
4
  module Normalizers
@@ -29,7 +29,7 @@ module Skylight::Core
29
29
 
30
30
  begin
31
31
  extracted_title, sql = extract_binds(trace.instrumenter, payload, binds)
32
- [ name, extracted_title || title, sql ]
32
+ [name, extracted_title || title, sql]
33
33
  rescue => e
34
34
  if defined?(Skylight::SqlLexError) && e.is_a?(Skylight::SqlLexError)
35
35
  if config[:log_sql_parse_errors]
@@ -41,15 +41,15 @@ module Skylight::Core
41
41
  config.logger.error "Failed to extract binds in SQL; sql=#{payload[:sql].inspect}; exception=#{e.inspect}"
42
42
  end
43
43
 
44
- [ name, title, nil ]
44
+ [name, title, nil]
45
45
  end
46
46
  end
47
47
 
48
48
  private
49
49
 
50
- def extract_binds(instrumenter, payload, _precalculated)
51
- instrumenter.process_sql(payload[:sql])
52
- end
50
+ def extract_binds(instrumenter, payload, _precalculated)
51
+ instrumenter.process_sql(payload[:sql])
52
+ end
53
53
  end
54
54
  end
55
55
  end
@@ -1,17 +1,16 @@
1
- require 'skylight/core/normalizers/default'
1
+ require "skylight/core/normalizers/default"
2
2
 
3
3
  module Skylight::Core
4
4
  # @api private
5
5
  # Convert AS::N events to Skylight events
6
6
  module Normalizers
7
-
8
7
  DEFAULT = Default.new
9
8
 
10
9
  def self.registry
11
10
  @registry ||= {}
12
11
  end
13
12
 
14
- def self.register(name, klass, opts={})
13
+ def self.register(name, klass, opts = {})
15
14
  enabled = opts[:enabled] != false
16
15
  registry[name] = [klass, enabled]
17
16
  end
@@ -22,9 +21,9 @@ module Skylight::Core
22
21
 
23
22
  def self.enable(*names, enabled: true)
24
23
  names.each do |name|
25
- matches = registry.select{|n,_| n =~ /(^|\.)#{name}$/ }
24
+ matches = registry.select { |n, _| n =~ /(^|\.)#{name}$/ }
26
25
  raise ArgumentError, "no normalizers match #{name}" if matches.empty?
27
- matches.values.each{|v| v[1] = enabled }
26
+ matches.values.each { |v| v[1] = enabled }
28
27
  end
29
28
  end
30
29
 
@@ -36,7 +35,7 @@ module Skylight::Core
36
35
  normalizers = {}
37
36
 
38
37
  registry.each do |key, (klass, enabled)|
39
- next if !enabled
38
+ next unless enabled
40
39
 
41
40
  unless klass.method_defined?(:normalize)
42
41
  # TODO: Warn
@@ -50,7 +49,7 @@ module Skylight::Core
50
49
  end
51
50
 
52
51
  class Normalizer
53
- def self.register(name, opts={})
52
+ def self.register(name, opts = {})
54
53
  Normalizers.register(name, self, opts)
55
54
  end
56
55
 
@@ -61,12 +60,11 @@ module Skylight::Core
61
60
  setup if respond_to?(:setup)
62
61
  end
63
62
 
64
- def normalize(trace, name, payload)
63
+ def normalize(_trace, _name, _payload)
65
64
  :skip
66
65
  end
67
66
 
68
- def normalize_after(trace, span, name, payload)
69
- end
67
+ def normalize_after(trace, span, name, payload); end
70
68
  end
71
69
 
72
70
  class Container
@@ -94,7 +92,7 @@ module Skylight::Core
94
92
  end
95
93
  end
96
94
 
97
- %w( action_controller/process_action
95
+ %w[ action_controller/process_action
98
96
  action_controller/send_file
99
97
  action_view/render_collection
100
98
  action_view/render_partial
@@ -106,12 +104,13 @@ module Skylight::Core
106
104
  active_support/cache
107
105
  coach/handler_finish
108
106
  coach/middleware_finish
107
+ couch_potato/query
109
108
  data_mapper/sql
110
109
  elasticsearch/request
111
110
  faraday/request
112
111
  grape/endpoint
113
112
  moped/query
114
- sequel/sql).each do |file|
113
+ sequel/sql].each do |file|
115
114
  require "skylight/core/normalizers/#{file}"
116
115
  end
117
116
  end
@@ -5,22 +5,23 @@ module Skylight::Core
5
5
  def install
6
6
  ::ActionController::Instrumentation.class_eval do
7
7
  private
8
- alias append_info_to_payload_without_sk append_info_to_payload
9
- def append_info_to_payload(payload)
10
- append_info_to_payload_without_sk(payload)
11
- rendered_mime = begin
12
- if respond_to?(:rendered_format)
13
- rendered_format
14
- elsif content_type.is_a?(Mime::Type)
15
- content_type
16
- elsif content_type.respond_to?(:to_s)
17
- type_str = content_type.to_s.split(';').first
18
- Mime::Type.lookup(type_str) unless type_str.blank?
8
+
9
+ alias_method :append_info_to_payload_without_sk, :append_info_to_payload
10
+ def append_info_to_payload(payload)
11
+ append_info_to_payload_without_sk(payload)
12
+ rendered_mime = begin
13
+ if respond_to?(:rendered_format)
14
+ rendered_format
15
+ elsif content_type.is_a?(Mime::Type)
16
+ content_type
17
+ elsif content_type.respond_to?(:to_s)
18
+ type_str = content_type.to_s.split(";").first
19
+ Mime::Type.lookup(type_str) unless type_str.blank?
20
+ end
19
21
  end
22
+ payload[:rendered_format] = rendered_mime.try(:ref)
23
+ payload[:variant] = request.respond_to?(:variant) ? request.variant : nil
20
24
  end
21
- payload[:rendered_format] = rendered_mime.try(:ref)
22
- payload[:variant] = request.respond_to?(:variant) ? request.variant : nil
23
- end
24
25
  end
25
26
  end
26
27
  end
@@ -5,7 +5,7 @@ module Skylight::Core
5
5
  class Probe
6
6
  def install
7
7
  ::ActionDispatch::RequestId.class_eval do
8
- alias call_without_sk call
8
+ alias_method :call_without_sk, :call
9
9
 
10
10
  def call(env)
11
11
  @skylight_request_id = env["skylight.request_id"]
@@ -14,12 +14,11 @@ module Skylight::Core
14
14
 
15
15
  private
16
16
 
17
- alias internal_request_id_without_sk internal_request_id
17
+ alias_method :internal_request_id_without_sk, :internal_request_id
18
18
 
19
19
  def internal_request_id
20
20
  @skylight_request_id || internal_request_id_without_sk
21
21
  end
22
-
23
22
  end
24
23
  end
25
24
  end
@@ -6,11 +6,11 @@ module Skylight::Core
6
6
  class Probe
7
7
  def install
8
8
  ::ActionDispatch::Routing::RouteSet.class_eval do
9
- alias call_without_sk call
9
+ alias_method :call_without_sk, :call
10
10
 
11
11
  def call(env)
12
12
  Skylight::Core::Fanout.endpoint = self.class.name
13
- Skylight::Core::Fanout.instrument(title: self.class.name, category: 'rack.app') do
13
+ Skylight::Core::Fanout.instrument(title: self.class.name, category: "rack.app") do
14
14
  call_without_sk(env)
15
15
  end
16
16
  end
@@ -19,7 +19,6 @@ module Skylight::Core
19
19
  end
20
20
  end
21
21
  end
22
-
23
22
  end
24
23
 
25
24
  register(:rails_router, "ActionDispatch::Routing::RouteSet", "action_dispatch/routing/route_set", ActionDispatch::Routing::RouteSet::Probe.new)
@@ -1,2 +1,2 @@
1
- Skylight::Core::Probes.probe('action_dispatch/request_id')
2
- Skylight::Core::Probes.probe('action_dispatch/routing/route_set')
1
+ Skylight::Core::Probes.probe("action_dispatch/request_id")
2
+ Skylight::Core::Probes.probe("action_dispatch/routing/route_set")