skylight 5.3.5 → 6.0.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -2
- data/ext/extconf.rb +1 -1
- data/ext/libskylight.yml +9 -8
- data/lib/skylight/cli/merger.rb +2 -3
- data/lib/skylight/cli.rb +2 -0
- data/lib/skylight/config.rb +70 -75
- data/lib/skylight/extensions.rb +8 -4
- data/lib/skylight/helpers.rb +6 -8
- data/lib/skylight/instrumenter.rb +30 -9
- data/lib/skylight/middleware.rb +3 -3
- data/lib/skylight/normalizers/action_controller/process_action.rb +9 -7
- data/lib/skylight/normalizers/action_dispatch/route_set.rb +1 -1
- data/lib/skylight/normalizers/active_job/perform.rb +5 -9
- data/lib/skylight/normalizers.rb +2 -1
- data/lib/skylight/probes/action_dispatch/show_exceptions.rb +35 -0
- data/lib/skylight/probes/action_dispatch.rb +1 -0
- data/lib/skylight/probes/middleware.rb +8 -9
- data/lib/skylight/probes/sinatra.rb +2 -2
- data/lib/skylight/test.rb +4 -2
- data/lib/skylight/trace.rb +15 -14
- data/lib/skylight/util/instrumenter_method.rb +13 -13
- data/lib/skylight/util/logging.rb +2 -1
- data/lib/skylight/vendor/cli/highline.rb +1 -0
- data/lib/skylight/version.rb +1 -1
- data/lib/skylight/vm/gc.rb +2 -1
- data/lib/skylight.rb +5 -4
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff8e9cf759364d5b113994e6b12046ff5664fbf5d35bcaf54171b82d813c2458
|
4
|
+
data.tar.gz: cd673dab2a53c62e1103cdc5bba16ccecc7b2fe185247bd9593b774738de2341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 841c15efa8d3a99bc248058a01f6c644d5a16302fb964317576bc6fb2e71ad0aa47fc907961821144b5d168ba4dfdfd85d30701a8650532d04fbfdf917e6cf4b
|
7
|
+
data.tar.gz: 2471c1d1c366136312aac9c3b83a1e669400157da6a3e11437966e151f53d0ae5b449b5f4a1e4b513cd802da07d6ab2a92417cc544e9ab93a798e67f59f7e73a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
-
##
|
2
|
-
- [
|
1
|
+
## 6.0.0-beta (prerelease)
|
2
|
+
- [BREAKING] End support for Ruby 2.6
|
3
|
+
- The following libraries are no longer tested and are not guaranteed to work with Skylight 6:
|
4
|
+
- Sinatra 1.x
|
5
|
+
- GraphQL 1.7 and 1.8
|
6
|
+
- Sidekiq 4
|
7
|
+
- NOTE: There is an inconsistency in the order of application of `ruby2_keywords` and `instrument_method` in
|
8
|
+
Ruby >= 3.2. We recommend not combining these two annotations at all, but if you must, call `instrument_method`
|
9
|
+
after your method has been defined.
|
10
|
+
- [IMPROVEMENT] When Rails's `exceptions_app` (used by ActionDispatch::ShowExceptions) is set to another instrumented
|
11
|
+
responder (like a Rails router), Skylight will not set the endpoint name after exception processing has started.
|
12
|
+
This means that error traces will now be aggregated under the original endpoint that generated the error (but with
|
13
|
+
the 'error' segment), rather than under the exception handler's controller and action name.
|
3
14
|
|
4
15
|
## 5.3.4 (October 17, 2022)
|
5
16
|
|
data/ext/extconf.rb
CHANGED
@@ -85,7 +85,7 @@ end
|
|
85
85
|
# If the user installs Xcode-only, they have to approve the
|
86
86
|
# license or no "xc*" tool will work.
|
87
87
|
|
88
|
-
#
|
88
|
+
# stree-ignore
|
89
89
|
if Platform::OS == "darwin" && (`/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?)
|
90
90
|
fail <<~MESSAGE
|
91
91
|
You have not agreed to the Xcode license and so we are unable to build the native agent.
|
data/ext/libskylight.yml
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
version: "5.
|
1
|
+
version: "5.2.0-1c6ddf3"
|
2
2
|
checksums:
|
3
|
-
x86-linux: "
|
4
|
-
x86_64-linux: "
|
5
|
-
x86_64-linux-musl: "
|
6
|
-
x86_64-darwin: "
|
7
|
-
|
8
|
-
aarch64-linux
|
9
|
-
aarch64-
|
3
|
+
x86-linux: "a9a1b20d21ed0048584d1dce46aa3dee3ffd201715e30324286ea9f47c57dcd0"
|
4
|
+
x86_64-linux: "2be9ac4bf4194e2d5c9636cb5cd6e3a6d6df11f70e9daaa0f4d85feb764d6efd"
|
5
|
+
x86_64-linux-musl: "271adabefc892630be27ab2dd4d56cf055193d751d0c8fee6389e9f9602faabc"
|
6
|
+
x86_64-darwin: "4052b79c7619ca2c4577bf489d74a0531cac84356684b30ed6f62a737062d2ca"
|
7
|
+
x86_64-freebsd: "4426591f925cb97085659a0d4b975e5f8b94c83d4e101c0a7db1e530b74b03e5"
|
8
|
+
aarch64-linux: "ec41954175fc4ebef142b9e054bf4a74352d0a207de7eb8a0b1b8c7de4f9e57d"
|
9
|
+
aarch64-linux-musl: "6f2293a0d591a306964b01380abc1a06c17015f84556072eb08b2c2ef8b62325"
|
10
|
+
aarch64-darwin: "b1f25d26a6e331aadaef52bc2ca82e8701e92c61eecc7a86b72bdafbba01c0f3"
|
data/lib/skylight/cli/merger.rb
CHANGED
@@ -245,9 +245,8 @@ module Skylight
|
|
245
245
|
end
|
246
246
|
|
247
247
|
if @parent_app && parent_component_fingerprints.include?([child_app.name, child_env])
|
248
|
-
errors <<
|
249
|
-
"
|
250
|
-
"component that conflicts with this merge request. Please choose a new environment."
|
248
|
+
errors << "Sorry, `#{@parent_app.name}` already has a `#{child_env}` " \
|
249
|
+
"component that conflicts with this merge request. Please choose a new environment."
|
251
250
|
end
|
252
251
|
|
253
252
|
return child_env unless errors.any?
|
data/lib/skylight/cli.rb
CHANGED
@@ -97,7 +97,9 @@ module Skylight
|
|
97
97
|
namefile = Tempfile.new("skylight-app-name")
|
98
98
|
|
99
99
|
# Windows appears to need double quotes for `rails runner`
|
100
|
+
# rubocop:disable Layout/LineLength
|
100
101
|
`rails runner "File.open('#{namefile.path}', 'w') {|f| f.write(Rails.application.class.name) rescue '' }"`
|
102
|
+
# rubocop:enable Layout/LineLength
|
101
103
|
name = namefile.read.split("::").first.underscore.titleize
|
102
104
|
name = nil if name.empty?
|
103
105
|
rescue StandardError => e
|
data/lib/skylight/config.rb
CHANGED
@@ -167,50 +167,49 @@ module Skylight
|
|
167
167
|
}.freeze
|
168
168
|
|
169
169
|
def self.native_env_keys
|
170
|
-
@native_env_keys ||=
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
]
|
170
|
+
@native_env_keys ||= %i[
|
171
|
+
native_log_level
|
172
|
+
native_log_file
|
173
|
+
log_sql_parse_errors
|
174
|
+
version
|
175
|
+
root
|
176
|
+
proxy_url
|
177
|
+
hostname
|
178
|
+
session_token
|
179
|
+
auth_url
|
180
|
+
auth_http_deflate
|
181
|
+
auth_http_connect_timeout
|
182
|
+
auth_http_read_timeout
|
183
|
+
report_url
|
184
|
+
report_http_deflate
|
185
|
+
report_http_connect_timeout
|
186
|
+
report_http_read_timeout
|
187
|
+
report_http_disabled
|
188
|
+
report_use_grpc
|
189
|
+
report_grpc_url
|
190
|
+
daemon.lazy_start
|
191
|
+
daemon.exec_path
|
192
|
+
daemon.lib_path
|
193
|
+
daemon.pidfile_path
|
194
|
+
daemon.sockdir_path
|
195
|
+
daemon.batch_queue_depth
|
196
|
+
daemon.batch_sample_size
|
197
|
+
daemon.batch_flush_interval
|
198
|
+
daemon.tick_interval
|
199
|
+
daemon.lock_check_interval
|
200
|
+
daemon.inactivity_timeout
|
201
|
+
daemon.max_connect_tries
|
202
|
+
daemon.connect_try_window
|
203
|
+
daemon.max_prespawn_jitter
|
204
|
+
daemon.wait_timeout
|
205
|
+
daemon.client_check_interval
|
206
|
+
daemon.client_queue_depth
|
207
|
+
daemon.client_write_timeout
|
208
|
+
daemon.ssl_cert_path
|
209
|
+
daemon.ssl_cert_dir
|
210
|
+
daemon.enable_tcp
|
211
|
+
daemon.tcp_port
|
212
|
+
]
|
214
213
|
end
|
215
214
|
|
216
215
|
# Maps legacy config keys to new config keys
|
@@ -219,8 +218,9 @@ module Skylight
|
|
219
218
|
end
|
220
219
|
|
221
220
|
def self.validators
|
222
|
-
@validators ||=
|
223
|
-
|
221
|
+
@validators ||= {
|
222
|
+
"agent.interval": [->(v, _c) { v.is_a?(Integer) && v > 0 }, "must be an integer greater than 0"]
|
223
|
+
}
|
224
224
|
end
|
225
225
|
|
226
226
|
# @api private
|
@@ -301,21 +301,20 @@ module Skylight
|
|
301
301
|
next unless k =~ /^(?:SK|SKYLIGHT)_(.+)$/
|
302
302
|
next unless (key = ENV_TO_KEY[$1])
|
303
303
|
|
304
|
-
ret[key] =
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
end
|
304
|
+
ret[key] = case val
|
305
|
+
when /^false$/i
|
306
|
+
false
|
307
|
+
when /^true$/i
|
308
|
+
true
|
309
|
+
when /^(nil|null)$/i
|
310
|
+
nil
|
311
|
+
when /^\d+$/
|
312
|
+
val.to_i
|
313
|
+
when /^\d+\.\d+$/
|
314
|
+
val.to_f
|
315
|
+
else
|
316
|
+
val
|
317
|
+
end
|
319
318
|
end
|
320
319
|
|
321
320
|
ret
|
@@ -450,16 +449,13 @@ module Skylight
|
|
450
449
|
def to_native_env
|
451
450
|
ret = []
|
452
451
|
|
453
|
-
self
|
454
|
-
|
455
|
-
.
|
456
|
-
|
457
|
-
|
458
|
-
unless value.nil?
|
459
|
-
env_key = KEY_TO_NATIVE_ENV[key] || ENV_TO_KEY.key(key) || key.upcase
|
460
|
-
ret << "SKYLIGHT_#{env_key}" << cast_for_env(value)
|
461
|
-
end
|
452
|
+
self.class.native_env_keys.each do |key|
|
453
|
+
value = send_or_get(key)
|
454
|
+
unless value.nil?
|
455
|
+
env_key = KEY_TO_NATIVE_ENV[key] || ENV_TO_KEY.key(key) || key.upcase
|
456
|
+
ret << "SKYLIGHT_#{env_key}" << cast_for_env(value)
|
462
457
|
end
|
458
|
+
end
|
463
459
|
|
464
460
|
ret << "SKYLIGHT_AUTHENTICATION" << authentication_with_meta
|
465
461
|
ret << "SKYLIGHT_VALIDATE_AUTHENTICATION" << "false"
|
@@ -737,11 +733,10 @@ module Skylight
|
|
737
733
|
end
|
738
734
|
|
739
735
|
def components
|
740
|
-
@components ||=
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
}
|
736
|
+
@components ||= {
|
737
|
+
web: Util::Component.new(get(:env), Util::Component::DEFAULT_NAME),
|
738
|
+
worker: Util::Component.new(get(:env), get(:component) || get(:worker_component), force_worker: true)
|
739
|
+
}
|
745
740
|
rescue ArgumentError => e
|
746
741
|
raise ConfigError, e.message
|
747
742
|
end
|
data/lib/skylight/extensions.rb
CHANGED
@@ -77,13 +77,17 @@ module Skylight
|
|
77
77
|
@config = config
|
78
78
|
end
|
79
79
|
|
80
|
-
def process_trace_meta(_meta)
|
80
|
+
def process_trace_meta(_meta)
|
81
|
+
end
|
81
82
|
|
82
|
-
def process_instrument_options(_opts, _meta)
|
83
|
+
def process_instrument_options(_opts, _meta)
|
84
|
+
end
|
83
85
|
|
84
|
-
def process_normalizer_meta(_payload, _meta, **opts)
|
86
|
+
def process_normalizer_meta(_payload, _meta, **opts)
|
87
|
+
end
|
85
88
|
|
86
|
-
def trace_preprocess_meta(_meta)
|
89
|
+
def trace_preprocess_meta(_meta)
|
90
|
+
end
|
87
91
|
|
88
92
|
def allowed_meta_keys
|
89
93
|
[]
|
data/lib/skylight/helpers.rb
CHANGED
@@ -77,6 +77,11 @@ module Skylight
|
|
77
77
|
# do_expensive_stuff
|
78
78
|
# end
|
79
79
|
# end
|
80
|
+
#
|
81
|
+
# NOTE: On Ruby >= 3.2, there is an inconsistency in the order ruby2_keywords is applied
|
82
|
+
# when combined with instrument_method in the prefix position. We recommend not mixing
|
83
|
+
# these two annotations, but if you must, call `instrument_method` in the suffix position
|
84
|
+
# after your method has been defined, e.g. `instrument_method :my_method`
|
80
85
|
def instrument_method(*args, **opts)
|
81
86
|
if (name = args.pop)
|
82
87
|
title = "#{self}##{name}"
|
@@ -130,8 +135,6 @@ module Skylight
|
|
130
135
|
|
131
136
|
private
|
132
137
|
|
133
|
-
HAS_ARGUMENT_FORWARDING = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
|
134
|
-
|
135
138
|
def __sk_instrument_method_on(klass, name, title, **opts)
|
136
139
|
category = (opts[:category] || "app.method").to_s
|
137
140
|
title = (opts[:title] || title).to_s
|
@@ -156,12 +159,7 @@ module Skylight
|
|
156
159
|
# forward the different argument types.
|
157
160
|
is_setter_method = name.to_s.end_with?("=")
|
158
161
|
|
159
|
-
arg_string =
|
160
|
-
if HAS_ARGUMENT_FORWARDING
|
161
|
-
is_setter_method ? "*args, **kwargs, &blk" : "..."
|
162
|
-
else
|
163
|
-
"*args, &blk"
|
164
|
-
end
|
162
|
+
arg_string = is_setter_method ? "*args, **kwargs, &blk" : "..."
|
165
163
|
|
166
164
|
original_method_dispatch =
|
167
165
|
if is_setter_method
|
@@ -31,7 +31,16 @@ module Skylight
|
|
31
31
|
Thread.current[@muted_key] = val
|
32
32
|
end
|
33
33
|
|
34
|
-
def muted
|
34
|
+
def muted
|
35
|
+
Thread.current[@muted_key]
|
36
|
+
end
|
37
|
+
|
38
|
+
def tracing_muted?
|
39
|
+
Thread.current[@muted_key] == :all
|
40
|
+
end
|
41
|
+
|
42
|
+
def endpoint_assignment_muted?
|
43
|
+
# all truthy values will mute endpoint assignment.
|
35
44
|
!!Thread.current[@muted_key]
|
36
45
|
end
|
37
46
|
end
|
@@ -120,20 +129,32 @@ module Skylight
|
|
120
129
|
@trace_info.muted = val
|
121
130
|
end
|
122
131
|
|
123
|
-
def muted
|
124
|
-
@trace_info.muted
|
132
|
+
def muted
|
133
|
+
@trace_info.muted
|
134
|
+
end
|
135
|
+
|
136
|
+
def tracing_muted?
|
137
|
+
muted == :all || muted == true
|
138
|
+
end
|
139
|
+
|
140
|
+
def endpoint_assignment_muted?
|
141
|
+
tracing_muted? || muted == :endpoint_assignment
|
125
142
|
end
|
126
143
|
|
127
|
-
|
128
|
-
|
129
|
-
|
144
|
+
# possible values:
|
145
|
+
# ignore: :all
|
146
|
+
# ignore: :endpoint_assignment
|
147
|
+
# ignore: false | nil
|
148
|
+
def mute(ignore: :all)
|
149
|
+
old_muted = muted
|
150
|
+
self.muted = ignore
|
130
151
|
yield if block_given?
|
131
152
|
ensure
|
132
153
|
self.muted = old_muted
|
133
154
|
end
|
134
155
|
|
135
156
|
def unmute
|
136
|
-
old_muted = muted
|
157
|
+
old_muted = muted
|
137
158
|
self.muted = false
|
138
159
|
yield if block_given?
|
139
160
|
ensure
|
@@ -151,7 +172,7 @@ module Skylight
|
|
151
172
|
end
|
152
173
|
|
153
174
|
alias disable mute
|
154
|
-
alias disabled?
|
175
|
+
alias disabled? tracing_muted?
|
155
176
|
|
156
177
|
def start!
|
157
178
|
# We do this here since we can't report these issues via Gem install without stopping install entirely.
|
@@ -232,7 +253,7 @@ module Skylight
|
|
232
253
|
def instrument(cat, title = nil, desc = nil, meta = nil)
|
233
254
|
raise ArgumentError, "cat is required" unless cat
|
234
255
|
|
235
|
-
if
|
256
|
+
if tracing_muted?
|
236
257
|
return yield if block_given?
|
237
258
|
|
238
259
|
return
|
data/lib/skylight/middleware.rb
CHANGED
@@ -38,8 +38,8 @@ module Skylight
|
|
38
38
|
# We are applying this special case for #each only. Future bugs of this
|
39
39
|
# class will be handled by requesting users to patch their ruby
|
40
40
|
# implementation, to save adding too many methods in this class.
|
41
|
-
def each(
|
42
|
-
@body.each(
|
41
|
+
def each(...)
|
42
|
+
@body.each(...)
|
43
43
|
end
|
44
44
|
|
45
45
|
def method_missing(*args, &block)
|
@@ -132,7 +132,7 @@ module Skylight
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def make_request_id(request_id)
|
135
|
-
request_id && !request_id.empty? ? request_id.gsub(/[^\w
|
135
|
+
request_id && !request_id.empty? ? request_id.gsub(/[^\w-]/, "".freeze)[0...255] : internal_request_id
|
136
136
|
end
|
137
137
|
|
138
138
|
def internal_request_id
|
@@ -18,8 +18,9 @@ module Skylight
|
|
18
18
|
# @option payload [String] :action Action name
|
19
19
|
# @return [Array]
|
20
20
|
def normalize(trace, _name, payload)
|
21
|
-
|
22
|
-
|
21
|
+
endpoint = controller_action(payload)
|
22
|
+
trace.endpoint = endpoint
|
23
|
+
[CAT, endpoint, nil]
|
23
24
|
end
|
24
25
|
|
25
26
|
def normalize_after(trace, _span, _name, payload)
|
@@ -45,11 +46,12 @@ module Skylight
|
|
45
46
|
# Show 'error' if there's an unhandled exception or if the status is 4xx or 5xx
|
46
47
|
return "error" if payload[:exception] || payload[:exception_object]
|
47
48
|
|
48
|
-
segment_from_status(payload[:status]) ||
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
segment_from_status(payload[:status]) ||
|
50
|
+
if payload[:sk_rendered_format]
|
51
|
+
# We only show the variant if we actually have a format
|
52
|
+
# We won't have a sk_rendered_format if it's a `head` outside of a `respond_to` block.
|
53
|
+
[payload[:sk_rendered_format], payload[:sk_variant]].compact.flatten.join("+")
|
54
|
+
end
|
53
55
|
end
|
54
56
|
|
55
57
|
def segment_from_status(status)
|
@@ -8,16 +8,12 @@ module Skylight
|
|
8
8
|
DELAYED_JOB_WRAPPER = "ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper".freeze
|
9
9
|
|
10
10
|
def self.normalize_title(job_instance)
|
11
|
-
job_instance
|
12
|
-
.
|
13
|
-
|
14
|
-
|
15
|
-
.tap do |str|
|
16
|
-
if str.match(DELIVERY_JOB)
|
17
|
-
mailer_class, mailer_method, * = job_instance.arguments
|
18
|
-
return "#{mailer_class}##{mailer_method}", str if mailer_class && mailer_method
|
19
|
-
end
|
11
|
+
job_instance.class.name.to_s.tap do |str|
|
12
|
+
if str.match(DELIVERY_JOB)
|
13
|
+
mailer_class, mailer_method, * = job_instance.arguments
|
14
|
+
return "#{mailer_class}##{mailer_method}", str if mailer_class && mailer_method
|
20
15
|
end
|
16
|
+
end
|
21
17
|
end
|
22
18
|
|
23
19
|
CAT = "app.job.perform".freeze
|
data/lib/skylight/normalizers.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Skylight
|
4
|
+
module Probes
|
5
|
+
module ActionDispatch
|
6
|
+
module ShowExceptions
|
7
|
+
module Instrumentation
|
8
|
+
def initialize(...)
|
9
|
+
super
|
10
|
+
|
11
|
+
exceptions_app = @exceptions_app
|
12
|
+
@exceptions_app =
|
13
|
+
lambda do |env|
|
14
|
+
Skylight.instrumenter&.current_trace&.segment = "error"
|
15
|
+
Skylight.mute(ignore: :endpoint_assignment) { exceptions_app.call(env) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Probe
|
21
|
+
def install
|
22
|
+
::ActionDispatch::ShowExceptions.prepend(Instrumentation)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
register(
|
29
|
+
:rails_show_exceptions,
|
30
|
+
"ActionDispatch::ShowExceptions",
|
31
|
+
"action_dispatch/show_exceptions",
|
32
|
+
ActionDispatch::ShowExceptions::Probe.new
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
@@ -9,16 +9,15 @@ module Skylight
|
|
9
9
|
# NOTE: Caching here leads to better performance, but will not notice if the method is overridden
|
10
10
|
# We don't have access to the config here so we can't check whether source locations are enabled.
|
11
11
|
# However, this only happens once per middleware so it should be minimal impact.
|
12
|
-
@payload[:sk_source_location] =
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
middleware.method(:call).source_location
|
18
|
-
end
|
19
|
-
rescue StandardError
|
20
|
-
nil
|
12
|
+
@payload[:sk_source_location] = begin
|
13
|
+
if middleware.is_a?(Proc)
|
14
|
+
middleware.source_location
|
15
|
+
elsif middleware.respond_to?(:call)
|
16
|
+
middleware.method(:call).source_location
|
21
17
|
end
|
18
|
+
rescue StandardError
|
19
|
+
nil
|
20
|
+
end
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -50,8 +50,8 @@ module Skylight
|
|
50
50
|
|
51
51
|
class Probe
|
52
52
|
def install
|
53
|
-
if ::Sinatra::VERSION < "
|
54
|
-
Skylight.error "Sinatra must be version
|
53
|
+
if ::Sinatra::VERSION < "2.0.0"
|
54
|
+
Skylight.error "Sinatra must be version 2.0.0 or greater."
|
55
55
|
return
|
56
56
|
end
|
57
57
|
|
data/lib/skylight/test.rb
CHANGED
@@ -33,7 +33,8 @@ module Skylight
|
|
33
33
|
config[:mock_submission].call(trace)
|
34
34
|
end
|
35
35
|
|
36
|
-
def native_stop
|
36
|
+
def native_stop
|
37
|
+
end
|
37
38
|
end
|
38
39
|
)
|
39
40
|
|
@@ -105,7 +106,8 @@ module Skylight
|
|
105
106
|
mock_spans[span][:meta] = meta
|
106
107
|
end
|
107
108
|
|
108
|
-
def native_span_started(span)
|
109
|
+
def native_span_started(span)
|
110
|
+
end
|
109
111
|
|
110
112
|
def native_span_set_exception(span, exception_object, exception)
|
111
113
|
mock_spans[span][:exception_object] = exception_object
|
data/lib/skylight/trace.rb
CHANGED
@@ -77,19 +77,13 @@ module Skylight
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def endpoint=(value)
|
80
|
-
if
|
81
|
-
maybe_warn(:endpoint_set_muted, "tried to set endpoint name while muted")
|
82
|
-
return
|
83
|
-
end
|
80
|
+
return if endpoint_assignment_muted?
|
84
81
|
@endpoint = value
|
85
82
|
native_set_endpoint(value)
|
86
83
|
end
|
87
84
|
|
88
85
|
def segment=(value)
|
89
|
-
if
|
90
|
-
maybe_warn(:segment_set_muted, "tried to set segment name while muted")
|
91
|
-
return
|
92
|
-
end
|
86
|
+
return if endpoint_assignment_muted?
|
93
87
|
@segment = value
|
94
88
|
end
|
95
89
|
|
@@ -99,8 +93,16 @@ module Skylight
|
|
99
93
|
@instrumenter.config
|
100
94
|
end
|
101
95
|
|
102
|
-
def muted
|
103
|
-
|
96
|
+
def muted
|
97
|
+
@child_instrumentation_muted_by || @instrumenter.muted
|
98
|
+
end
|
99
|
+
|
100
|
+
def tracing_muted?
|
101
|
+
!!@child_instrumentation_muted_by || @instrumenter.tracing_muted?
|
102
|
+
end
|
103
|
+
|
104
|
+
def endpoint_assignment_muted?
|
105
|
+
tracing_muted? || @instrumenter.endpoint_assignment_muted?
|
104
106
|
end
|
105
107
|
|
106
108
|
def broken?
|
@@ -117,7 +119,7 @@ module Skylight
|
|
117
119
|
end
|
118
120
|
|
119
121
|
def instrument(cat, title = nil, desc = nil, meta = nil)
|
120
|
-
return if
|
122
|
+
return if tracing_muted?
|
121
123
|
return if broken?
|
122
124
|
|
123
125
|
t { "instrument: #{cat}, #{title}" }
|
@@ -300,9 +302,8 @@ module Skylight
|
|
300
302
|
message << "\nWe disabled the Middleware probe but unfortunately, this didn't solve the issue."
|
301
303
|
else
|
302
304
|
Skylight::Probes::Middleware::Probe.disable!
|
303
|
-
message <<
|
304
|
-
"
|
305
|
-
"to the Rack SPEC. We've disabled the Middleware probe to see if that resolves the issue."
|
305
|
+
message << "\n#{native_span_get_title(span)} may be a Middleware that doesn't fully conform " \
|
306
|
+
"to the Rack SPEC. We've disabled the Middleware probe to see if that resolves the issue."
|
306
307
|
end
|
307
308
|
end
|
308
309
|
|
@@ -1,23 +1,23 @@
|
|
1
1
|
module Skylight
|
2
2
|
module Util
|
3
3
|
module InstrumenterMethod
|
4
|
-
def instrumenter_method(name,
|
5
|
-
if
|
4
|
+
def instrumenter_method(name, wrapped_block: false)
|
5
|
+
if wrapped_block
|
6
6
|
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
7
|
-
def #{name}(
|
8
|
-
unless instrumenter
|
9
|
-
return yield if block_given?
|
10
|
-
return
|
11
|
-
end
|
12
|
-
|
13
|
-
instrumenter.#{name}(
|
14
|
-
end
|
7
|
+
def #{name}(...) # def mute(...)
|
8
|
+
unless instrumenter # unless instrumenter
|
9
|
+
return yield if block_given? # return yield if block_given?
|
10
|
+
return # return
|
11
|
+
end # end
|
12
|
+
#
|
13
|
+
instrumenter.#{name}(...) # instrumenter.mute(...)
|
14
|
+
end # end
|
15
15
|
RUBY
|
16
16
|
else
|
17
17
|
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
18
|
-
def #{name}(
|
19
|
-
instrumenter&.#{name}(
|
20
|
-
end
|
18
|
+
def #{name}(...) # def config(...)
|
19
|
+
instrumenter&.#{name}(...) # instrumenter&.config(...)
|
20
|
+
end # end
|
21
21
|
RUBY
|
22
22
|
end
|
23
23
|
end
|
data/lib/skylight/version.rb
CHANGED
data/lib/skylight/vm/gc.rb
CHANGED
data/lib/skylight.rb
CHANGED
@@ -202,9 +202,10 @@ module Skylight
|
|
202
202
|
|
203
203
|
instrumenter_method :config
|
204
204
|
|
205
|
-
instrumenter_method :mute,
|
206
|
-
instrumenter_method :unmute,
|
207
|
-
instrumenter_method :
|
205
|
+
instrumenter_method :mute, wrapped_block: true
|
206
|
+
instrumenter_method :unmute, wrapped_block: true
|
207
|
+
instrumenter_method :tracing_muted?
|
208
|
+
instrumenter_method :endpoint_assignment_muted?
|
208
209
|
|
209
210
|
# End a span
|
210
211
|
instrumenter_method :done
|
@@ -212,7 +213,7 @@ module Skylight
|
|
212
213
|
instrumenter_method :broken!
|
213
214
|
|
214
215
|
# Temporarily disable
|
215
|
-
instrumenter_method :disable,
|
216
|
+
instrumenter_method :disable, wrapped_block: true
|
216
217
|
|
217
218
|
# Runs the shutdown procedure in the background.
|
218
219
|
# This should do little more than unsubscribe from all ActiveSupport::Notifications
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.21.2
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: syntax_tree
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: timecop
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -281,6 +295,7 @@ files:
|
|
281
295
|
- lib/skylight/probes/action_dispatch.rb
|
282
296
|
- lib/skylight/probes/action_dispatch/request_id.rb
|
283
297
|
- lib/skylight/probes/action_dispatch/routing/route_set.rb
|
298
|
+
- lib/skylight/probes/action_dispatch/show_exceptions.rb
|
284
299
|
- lib/skylight/probes/action_view.rb
|
285
300
|
- lib/skylight/probes/active_job.rb
|
286
301
|
- lib/skylight/probes/active_job_enqueue.rb
|
@@ -378,14 +393,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
378
393
|
requirements:
|
379
394
|
- - ">="
|
380
395
|
- !ruby/object:Gem::Version
|
381
|
-
version: '2.
|
396
|
+
version: '2.7'
|
382
397
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
383
398
|
requirements:
|
384
|
-
- - "
|
399
|
+
- - ">"
|
385
400
|
- !ruby/object:Gem::Version
|
386
|
-
version:
|
401
|
+
version: 1.3.1
|
387
402
|
requirements: []
|
388
|
-
rubygems_version: 3.
|
403
|
+
rubygems_version: 3.4.3
|
389
404
|
signing_key:
|
390
405
|
specification_version: 4
|
391
406
|
summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.
|