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
@@ -1,4 +1,4 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
 
3
3
  module Skylight::Core
4
4
  # @api private
@@ -19,7 +19,6 @@ module Skylight::Core
19
19
  end
20
20
 
21
21
  class << self
22
-
23
22
  def paths
24
23
  @paths ||= []
25
24
  end
@@ -27,7 +26,7 @@ module Skylight::Core
27
26
  def add_path(path)
28
27
  root = Pathname.new(path)
29
28
  Pathname.glob(root.join("./**/*.rb")).each do |f|
30
- name = f.relative_path_from(root).sub_ext('').to_s
29
+ name = f.relative_path_from(root).sub_ext("").to_s
31
30
  if available.key?(name)
32
31
  raise "duplicate probe name: #{name}; original=#{available[name]}; new=#{f}"
33
32
  end
@@ -58,14 +57,14 @@ module Skylight::Core
58
57
  @installed ||= {}
59
58
  end
60
59
 
61
- def is_available?(klass_name)
60
+ def available?(klass_name)
62
61
  !!Skylight::Core::Util::Inflector.safe_constantize(klass_name)
63
62
  end
64
63
 
65
64
  def register(name, *args)
66
65
  registration = ProbeRegistration.new(name, *args)
67
66
 
68
- if is_available?(registration.klass_name)
67
+ if available?(registration.klass_name)
69
68
  installed[registration.klass_name] = registration
70
69
  registration.install
71
70
  else
@@ -78,7 +77,7 @@ module Skylight::Core
78
77
  return unless registration
79
78
 
80
79
  # Double check constant is available
81
- if is_available?(registration.klass_name)
80
+ if available?(registration.klass_name)
82
81
  installed[registration.klass_name] = registration
83
82
  registration.install
84
83
 
@@ -113,17 +112,17 @@ end
113
112
  module ::Kernel
114
113
  private
115
114
 
116
- alias require_without_sk require
115
+ alias require_without_sk require
117
116
 
118
- def require(name)
119
- ret = require_without_sk(name)
117
+ def require(name)
118
+ ret = require_without_sk(name)
120
119
 
121
- begin
122
- Skylight::Core::Probes.require_hook(name)
123
- rescue Exception
124
- # FIXME: Log these errors
125
- end
120
+ begin
121
+ Skylight::Core::Probes.require_hook(name)
122
+ rescue Exception
123
+ # FIXME: Log these errors
124
+ end
126
125
 
127
- ret
128
- end
129
- end
126
+ ret
127
+ end
128
+ end
@@ -1,5 +1,5 @@
1
- require 'skylight/core'
2
- require 'rails'
1
+ require "skylight/core"
2
+ require "rails"
3
3
 
4
4
  module Skylight::Core
5
5
  # @api private
@@ -7,160 +7,161 @@ module Skylight::Core
7
7
  extend ActiveSupport::Concern
8
8
 
9
9
  included do
10
+ # rubocop:disable Style/SingleLineMethods, Layout/EmptyLineBetweenDefs
10
11
  def self.root_key; :skylight end
11
12
  def self.config_class; Config end
12
13
  def self.middleware_class; Middleware end
13
- def self.gem_name; 'Skylight' end
14
- def self.log_file_name; 'skylight' end
14
+ def self.gem_name; "Skylight" end
15
+ def self.log_file_name; "skylight" end
15
16
  def self.namespace; Skylight end
16
17
  def self.version; Skylight::Core::VERSION end
18
+ # rubocop:enable Style/SingleLineMethods, Layout/EmptyLineBetweenDefs
17
19
  end
18
20
 
19
- private
21
+ private
20
22
 
21
- def log_prefix
22
- "[#{self.class.gem_name.upcase}] [#{self.class.version}]"
23
- end
24
-
25
- def development_warning
26
- "#{log_prefix} Running #{self.class.gem_name} in development mode. No data will be reported until you deploy your app."
27
- end
28
-
29
- def run_initializer(app)
30
- # Load probes even when agent is inactive to catch probe related bugs sooner
31
- load_probes
23
+ def log_prefix
24
+ "[#{self.class.gem_name.upcase}] [#{self.class.version}]"
25
+ end
32
26
 
33
- config = load_skylight_config(app)
27
+ def development_warning
28
+ "#{log_prefix} Running #{self.class.gem_name} in development mode. No data will be reported until you deploy your app."
29
+ end
34
30
 
35
- if activate?
36
- if config
37
- begin
38
- if self.class.namespace.start!(config)
39
- set_middleware_position(app, config)
40
- Rails.logger.info "#{log_prefix} #{self.class.gem_name} agent enabled"
41
- else
42
- Rails.logger.info "#{log_prefix} Unable to start, see the #{self.class.gem_name} logs for more details"
31
+ def run_initializer(app)
32
+ # Load probes even when agent is inactive to catch probe related bugs sooner
33
+ load_probes
34
+
35
+ config = load_skylight_config(app)
36
+
37
+ if activate?(config)
38
+ if config
39
+ begin
40
+ if self.class.namespace.start!(config)
41
+ set_middleware_position(app, config)
42
+ Rails.logger.info "#{log_prefix} #{self.class.gem_name} agent enabled"
43
+ else
44
+ Rails.logger.info "#{log_prefix} Unable to start, see the #{self.class.gem_name} logs for more details"
45
+ end
46
+ rescue ConfigError => e
47
+ Rails.logger.error "#{log_prefix} #{e.message}; disabling #{self.class.gem_name} agent"
43
48
  end
44
- rescue ConfigError => e
45
- Rails.logger.error "#{log_prefix} #{e.message}; disabling #{self.class.gem_name} agent"
46
49
  end
47
- end
48
- elsif Rails.env.development?
49
- # FIXME: The CLI isn't part of core so we should change this message
50
- unless config.user_config.disable_dev_warning?
51
- log_warning config, development_warning
52
- end
53
- elsif !Rails.env.test?
54
- unless config.user_config.disable_env_warning?
55
- log_warning config, "#{log_prefix} You are running in the #{Rails.env} environment but haven't added it to config.#{self.class.root_key}.environments, so no data will be sent to #{config.class.service_name} servers."
50
+ elsif Rails.env.development?
51
+ # FIXME: The CLI isn't part of core so we should change this message
52
+ unless config.user_config.disable_dev_warning?
53
+ log_warning config, development_warning
54
+ end
55
+ elsif !Rails.env.test?
56
+ unless config.user_config.disable_env_warning?
57
+ log_warning config, "#{log_prefix} You are running in the #{Rails.env} environment but haven't added it to config.#{self.class.root_key}.environments, so no data will be sent to #{config.class.service_name} servers."
58
+ end
56
59
  end
57
60
  end
58
- end
59
61
 
60
- def log_warning(config, msg)
61
- if config
62
- config.alert_logger.warn(msg)
63
- else
64
- Rails.logger.warn(msg)
62
+ def log_warning(config, msg)
63
+ if config
64
+ config.alert_logger.warn(msg)
65
+ else
66
+ Rails.logger.warn(msg)
67
+ end
65
68
  end
66
- end
67
69
 
68
- def existent_paths(paths)
69
- paths.respond_to?(:existent) ? paths.existent : paths.select { |f| File.exists?(f) }
70
- end
70
+ def existent_paths(paths)
71
+ paths.respond_to?(:existent) ? paths.existent : paths.select { |f| File.exist?(f) }
72
+ end
71
73
 
72
- def load_skylight_config(app)
73
- path = config_path(app)
74
- path = nil unless File.exist?(path)
74
+ def load_skylight_config(app)
75
+ path = config_path(app)
76
+ path = nil unless File.exist?(path)
75
77
 
76
- unless tmp = app.config.paths['tmp'].first
77
- Rails.logger.error "#{log_prefix} tmp directory missing from rails configuration"
78
- return nil
79
- end
78
+ unless (tmp = app.config.paths["tmp"].first)
79
+ Rails.logger.error "#{log_prefix} tmp directory missing from rails configuration"
80
+ return nil
81
+ end
80
82
 
81
- config = self.class.config_class.load(file: path, environment: Rails.env.to_s)
82
- config[:root] = Rails.root
83
+ config = self.class.config_class.load(file: path, environment: Rails.env.to_s)
84
+ config[:root] = Rails.root
83
85
 
84
- configure_logging(config, app)
86
+ configure_logging(config, app)
85
87
 
86
- config[:'daemon.sockdir_path'] ||= tmp
87
- config[:'normalizers.render.view_paths'] = existent_paths(app.config.paths["app/views"]) + [Rails.root.to_s]
88
- config
89
- end
88
+ config[:'daemon.sockdir_path'] ||= tmp
89
+ config[:'normalizers.render.view_paths'] = existent_paths(app.config.paths["app/views"]) + [Rails.root.to_s]
90
+ config
91
+ end
90
92
 
91
- def configure_logging(config, app)
92
- if logger = skylight_config(app).logger
93
- config.logger = logger
94
- else
95
- # Configure the log file destination
96
- if log_file = skylight_config(app).log_file
97
- config['log_file'] = log_file
98
- elsif !config.key?('log_file') && !config.on_heroku?
99
- config['log_file'] = File.join(Rails.root, "log/#{self.class.log_file_name}.log")
100
- end
93
+ def configure_logging(config, app)
94
+ if (logger = sk_rails_config(app).logger)
95
+ config.logger = logger
96
+ else
97
+ # Configure the log file destination
98
+ if (log_file = sk_rails_config(app).log_file)
99
+ config["log_file"] = log_file
100
+ elsif !config.key?("log_file") && !config.on_heroku?
101
+ config["log_file"] = File.join(Rails.root, "log/#{self.class.log_file_name}.log")
102
+ end
101
103
 
102
- # Configure the log level
103
- if level = skylight_config(app).log_level
104
- config['log_level'] = level
105
- elsif !config.key?('log_level')
106
- if level = app.config.log_level
107
- config['log_level'] = level
104
+ # Configure the log level
105
+ if (level = sk_rails_config(app).log_level)
106
+ config["log_level"] = level
107
+ elsif !config.key?("log_level")
108
+ if (level = app.config.log_level)
109
+ config["log_level"] = level
110
+ end
108
111
  end
109
112
  end
110
113
  end
111
- end
112
-
113
- def config_path(app)
114
- File.expand_path(skylight_config.config_path, app.root)
115
- end
116
114
 
117
- def environments
118
- Array(skylight_config.environments).map { |e| e && e.to_s }.compact
119
- end
115
+ def config_path(app)
116
+ File.expand_path(sk_rails_config.config_path, app.root)
117
+ end
120
118
 
121
- def activate?
122
- key = "#{self.class.config_class.env_prefix}ENABLED"
123
- if ENV.key?(key)
124
- ENV[key] !~ /^false$/i
125
- else
126
- environments.include?(Rails.env.to_s)
119
+ def environments
120
+ Array(sk_rails_config.environments).map { |e| e && e.to_s }.compact
127
121
  end
128
- end
129
122
 
130
- def load_probes
131
- probes = skylight_config.probes || []
132
- Probes.probe(*probes)
133
- end
123
+ def activate?(_sk_config)
124
+ key = "#{self.class.config_class.env_prefix}ENABLED"
125
+ if ENV.key?(key)
126
+ ENV[key] !~ /^false$/i
127
+ else
128
+ environments.include?(Rails.env.to_s)
129
+ end
130
+ end
134
131
 
135
- def middleware_position
136
- skylight_config.middleware_position.is_a?(Hash) ? skylight_config.middleware_position.symbolize_keys : skylight_config.middleware_position
137
- end
132
+ def load_probes
133
+ probes = sk_rails_config.probes || []
134
+ Probes.probe(*probes)
135
+ end
138
136
 
139
- def insert_middleware(app, config)
140
- if middleware_position.has_key?(:after)
141
- app.middleware.insert_after(middleware_position[:after], self.class.middleware_class, config: config)
142
- elsif middleware_position.has_key?(:before)
143
- app.middleware.insert_before(middleware_position[:before], self.class.middleware_class, config: config)
144
- else
145
- raise "The middleware position you have set is invalid. Please be sure `config.#{self.class.root_key}.middleware_position` is set up correctly."
137
+ def middleware_position
138
+ sk_rails_config.middleware_position.is_a?(Hash) ? sk_rails_config.middleware_position.symbolize_keys : sk_rails_config.middleware_position
146
139
  end
147
- end
148
140
 
149
- def set_middleware_position(app, config)
150
- if middleware_position.is_a?(Integer)
151
- app.middleware.insert middleware_position, self.class.middleware_class, config: config
152
- elsif middleware_position.is_a?(Hash) && middleware_position.keys.count == 1
153
- insert_middleware(app, config)
154
- elsif middleware_position.nil?
155
- app.middleware.insert 0, self.class.middleware_class, config: config
156
- else
157
- raise "The middleware position you have set is invalid. Please be sure `config.#{self.class.root_key}.middleware_position` is set up correctly."
141
+ def insert_middleware(app, config)
142
+ if middleware_position.key?(:after)
143
+ app.middleware.insert_after(middleware_position[:after], self.class.middleware_class, config: config)
144
+ elsif middleware_position.key?(:before)
145
+ app.middleware.insert_before(middleware_position[:before], self.class.middleware_class, config: config)
146
+ else
147
+ raise "The middleware position you have set is invalid. Please be sure `config.#{self.class.root_key}.middleware_position` is set up correctly."
148
+ end
158
149
  end
159
- end
160
150
 
161
- def skylight_config(target=self)
162
- target.config.send(self.class.root_key)
163
- end
151
+ def set_middleware_position(app, config)
152
+ if middleware_position.is_a?(Integer)
153
+ app.middleware.insert middleware_position, self.class.middleware_class, config: config
154
+ elsif middleware_position.is_a?(Hash) && middleware_position.keys.count == 1
155
+ insert_middleware(app, config)
156
+ elsif middleware_position.nil?
157
+ app.middleware.insert 0, self.class.middleware_class, config: config
158
+ else
159
+ raise "The middleware position you have set is invalid. Please be sure `config.#{self.class.root_key}.middleware_position` is set up correctly."
160
+ end
161
+ end
164
162
 
163
+ def sk_rails_config(target = self)
164
+ target.config.send(self.class.root_key)
165
+ end
165
166
  end
166
167
  end
@@ -21,10 +21,14 @@ module Skylight
21
21
 
22
22
  def call(_worker, job, queue)
23
23
  t { "Sidekiq middleware beginning trace" }
24
- title = job['wrapped'] || job['class']
25
- segment = "<sk-segment>#{queue}</sk-segment>"
26
- @instrumentable.trace("#{title}#{segment}", 'app.sidekiq.worker', title) do
27
- yield
24
+ title = job["wrapped"] || job["class"]
25
+ @instrumentable.trace(title, "app.sidekiq.worker", title, segment: queue) do |trace|
26
+ begin
27
+ yield
28
+ rescue Exception # includes Sidekiq::Shutdown
29
+ trace.segment = "error" if trace
30
+ raise
31
+ end
28
32
  end
29
33
  end
30
34
  end
@@ -20,9 +20,7 @@ module Skylight::Core
20
20
  end
21
21
 
22
22
  def unregister!
23
- until @subscribers.empty?
24
- ActiveSupport::Notifications.unsubscribe @subscribers.shift
25
- end
23
+ ActiveSupport::Notifications.unsubscribe @subscribers.shift until @subscribers.empty?
26
24
  end
27
25
 
28
26
  #
@@ -35,13 +33,14 @@ module Skylight::Core
35
33
  attr_reader :name, :span
36
34
 
37
35
  def initialize(name, span)
38
- @name, @span = name, span
36
+ @name = name
37
+ @span = span
39
38
  end
40
39
  end
41
40
 
42
- def start(name, id, payload)
41
+ def start(name, _id, payload)
43
42
  return if @instrumenter.disabled?
44
- return unless trace = @instrumenter.current_trace
43
+ return unless (trace = @instrumenter.current_trace)
45
44
 
46
45
  result = normalize(trace, name, payload)
47
46
 
@@ -67,24 +66,22 @@ module Skylight::Core
67
66
  nil
68
67
  end
69
68
 
70
- def finish(name, id, payload)
69
+ def finish(name, _id, payload)
71
70
  return if @instrumenter.disabled?
72
- return unless trace = @instrumenter.current_trace
73
-
74
- while curr = trace.notifications.pop
75
- if curr.name == name
76
- begin
77
- normalize_after(trace, curr.span, name, payload)
78
- ensure
79
- meta = { }
80
- meta[:exception] = payload[:exception] if payload[:exception]
81
- meta[:exception_object] = payload[:exception_object] if payload[:exception_object]
82
- trace.done(curr.span, meta) if curr.span
83
- end
84
- return
71
+ return unless (trace = @instrumenter.current_trace)
72
+
73
+ while (curr = trace.notifications.pop)
74
+ next unless curr.name == name
75
+ begin
76
+ normalize_after(trace, curr.span, name, payload)
77
+ ensure
78
+ meta = {}
79
+ meta[:exception] = payload[:exception] if payload[:exception]
80
+ meta[:exception_object] = payload[:exception_object] if payload[:exception_object]
81
+ trace.done(curr.span, meta) if curr.span
85
82
  end
83
+ return
86
84
  end
87
-
88
85
  rescue Exception => e
89
86
  error "Subscriber#finish error; msg=%s", e.message
90
87
  debug "trace=%s", trace.inspect
@@ -98,15 +95,14 @@ module Skylight::Core
98
95
  # Ignored for now because nothing in rails uses it
99
96
  end
100
97
 
101
- private
102
-
103
- def normalize(*args)
104
- @normalizers.normalize(*args)
105
- end
98
+ private
106
99
 
107
- def normalize_after(*args)
108
- @normalizers.normalize_after(*args)
109
- end
100
+ def normalize(*args)
101
+ @normalizers.normalize(*args)
102
+ end
110
103
 
104
+ def normalize_after(*args)
105
+ @normalizers.normalize_after(*args)
106
+ end
111
107
  end
112
108
  end
@@ -2,15 +2,14 @@ module Skylight
2
2
  module Core
3
3
  module Test
4
4
  module Mocking
5
-
6
- def mock!(config_opts={}, &callback)
5
+ def mock!(config_opts = {}, &callback)
7
6
  config_opts[:mock_submission] ||= callback || proc {}
8
7
  config = config_class.load(config_opts)
9
8
 
10
9
  unless respond_to?(:__original_instrumenter_class)
11
10
  class_eval do
12
11
  class << self
13
- alias __original_instrumenter_class instrumenter_class
12
+ alias_method :__original_instrumenter_class, :instrumenter_class
14
13
 
15
14
  def instrumenter_class
16
15
  @instrumenter_class ||= Class.new(__original_instrumenter_class) do
@@ -57,25 +56,23 @@ module Skylight
57
56
  mock_spans.index(span)
58
57
  end
59
58
 
60
- def native_span_set_title(sp, title)
61
- mock_spans[sp][:title] = title
62
-
59
+ def native_span_set_title(span, title)
60
+ mock_spans[span][:title] = title
63
61
  end
64
62
 
65
- def native_span_set_description(sp, desc)
66
- mock_spans[sp][:desc] = desc
63
+ def native_span_set_description(span, desc)
64
+ mock_spans[span][:desc] = desc
67
65
  end
68
66
 
69
- def native_span_set_meta(sp, meta)
70
- mock_spans[sp][:meta] = meta
67
+ def native_span_set_meta(span, meta)
68
+ mock_spans[span][:meta] = meta
71
69
  end
72
70
 
73
- def native_span_started(sp)
74
- end
71
+ def native_span_started(span); end
75
72
 
76
- def native_span_set_exception(sp, exception_object, exception)
77
- mock_spans[sp][:exception_object] = exception_object
78
- mock_spans[sp][:exception] = exception
73
+ def native_span_set_exception(span, exception_object, exception)
74
+ mock_spans[span][:exception_object] = exception_object
75
+ mock_spans[span][:exception] = exception
79
76
  end
80
77
 
81
78
  def native_stop_span(span, time)
@@ -94,8 +91,7 @@ module Skylight
94
91
  config[:mock_submission].call(trace)
95
92
  end
96
93
 
97
- def native_stop
98
- end
94
+ def native_stop; end
99
95
 
100
96
  def limited_description(description)
101
97
  description