skylight 7.0.0 → 7.1.0
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 +5 -0
- data/ext/skylight_native.c +1 -2
- data/lib/skylight/config.rb +1 -3
- data/lib/skylight/native_ext_fetcher.rb +17 -4
- data/lib/skylight/normalizers/active_record/sql.rb +1 -1
- data/lib/skylight/normalizers/grape/endpoint.rb +7 -2
- data/lib/skylight/normalizers/grape/endpoint_run.rb +6 -1
- data/lib/skylight/probes/active_record_async.rb +48 -11
- data/lib/skylight/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 774c7246629b4496c5856c89f79c06d8f41bcbb3e57f674facc3a9dbaec02247
|
|
4
|
+
data.tar.gz: a3a0a2e50567c145b00bdcef640b9812856a2c30099c618b19c7cbbf46018432
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 897f0dbcb877701b768a18060af7b35fb691a61bb464f6dbda10ff773c5a0b0e701a341a6adaaf1b66594cef803198e66d9f609bba1c57bbcc88dfd4f430e701
|
|
7
|
+
data.tar.gz: dda53c4b01214548fd9ecdfd708eb6629a7970d74b2fadcf0be1e63d332b3d04c3d0835197cb31c5d6a422457d6f0971cb53cb9973ee97188e989d516dc5aab4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 7.1.0 (January 20, 2025)
|
|
2
|
+
- BREAKING end support for Rails < 7.2.
|
|
3
|
+
- IMPROVEMENT better support for Grape 3.x
|
|
4
|
+
- IMPROVEMENT better ActiveRecord instrumentation for async queries in Rails 8.2
|
|
5
|
+
|
|
1
6
|
## 7.0.0 (September 16, 2025)
|
|
2
7
|
|
|
3
8
|
- IMPROVEMENT Initial (beta) support for AWS Lambda
|
data/ext/skylight_native.c
CHANGED
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
#define CHECK_NUMERIC(VAL) \
|
|
23
23
|
do { \
|
|
24
|
-
if (
|
|
25
|
-
TYPE(VAL) != T_FIXNUM) { \
|
|
24
|
+
if (!RB_INTEGER_TYPE_P(VAL)) { \
|
|
26
25
|
rb_raise(rb_eArgError, "expected " #VAL " to be numeric but was '%s' (%s [%i])", \
|
|
27
26
|
TO_S(VAL), rb_obj_classname(VAL), TYPE(VAL)); \
|
|
28
27
|
return Qnil; \
|
data/lib/skylight/config.rb
CHANGED
|
@@ -19,9 +19,7 @@ module Skylight
|
|
|
19
19
|
# @api private
|
|
20
20
|
MUTEX = Mutex.new
|
|
21
21
|
|
|
22
|
-
DEFAULT_IGNORED_ENDPOINTS = %w[
|
|
23
|
-
Rails::HealthController#show
|
|
24
|
-
].freeze
|
|
22
|
+
DEFAULT_IGNORED_ENDPOINTS = %w[Rails::HealthController#show].freeze
|
|
25
23
|
|
|
26
24
|
# Map environment variable keys with Skylight configuration keys
|
|
27
25
|
ENV_TO_KEY = {
|
|
@@ -148,12 +148,25 @@ module Skylight
|
|
|
148
148
|
p_user, p_pass = uri.userinfo.split(/:/) if uri.userinfo
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
-
opts = {}
|
|
152
|
-
opts[:use_ssl] = use_ssl
|
|
151
|
+
opts = { use_ssl: use_ssl }
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
if use_ssl
|
|
154
|
+
# Create a cert store that doesn't enable CRL checking.
|
|
155
|
+
# OpenSSL 3.x may enable CRL checking by default, which fails when
|
|
156
|
+
# the CRL distribution point is unreachable.
|
|
157
|
+
begin
|
|
158
|
+
cert_store = OpenSSL::X509::Store.new
|
|
159
|
+
cert_store.set_default_paths
|
|
160
|
+
ca_file = Util::SSL.ca_cert_file_or_default
|
|
161
|
+
cert_store.add_file(ca_file) if ca_file && File.exist?(ca_file)
|
|
162
|
+
opts[:cert_store] = cert_store
|
|
163
|
+
rescue OpenSSL::X509::StoreError => e
|
|
164
|
+
log "failed to configure cert store: #{e.message}, using defaults"
|
|
165
|
+
end
|
|
166
|
+
opts[:verify_mode] = OpenSSL::SSL::VERIFY_PEER
|
|
167
|
+
end
|
|
155
168
|
|
|
156
|
-
Net::HTTP.start(host, port, p_host, p_port, p_user, p_pass,
|
|
169
|
+
Net::HTTP.start(host, port, p_host, p_port, p_user, p_pass, **opts) do |http|
|
|
157
170
|
http.request_get path do |resp|
|
|
158
171
|
case resp
|
|
159
172
|
when Net::HTTPSuccess
|
|
@@ -19,8 +19,13 @@ module Skylight
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def get_namespace(endpoint)
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if endpoint.respond_to?(:namespace_stackable)
|
|
23
|
+
# Grape 2.x
|
|
24
|
+
::Grape::Namespace.joined_space_path(endpoint.namespace_stackable(:namespace)).to_s[1..]
|
|
25
|
+
else
|
|
26
|
+
# Grape 3.x
|
|
27
|
+
endpoint.namespace.to_s[1..]
|
|
28
|
+
end
|
|
24
29
|
end
|
|
25
30
|
end
|
|
26
31
|
end
|
|
@@ -31,7 +31,12 @@ module Skylight
|
|
|
31
31
|
ep = endpoint.options[:for]
|
|
32
32
|
return ep.name if ep.name
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
if ep.respond_to?(:base) && ep.base.respond_to?(:name)
|
|
35
|
+
ep.base.name
|
|
36
|
+
elsif ep.respond_to?(:to_s)
|
|
37
|
+
# grape >= 3.1 removes the `base` attr_reader but delegates to_s to :@base
|
|
38
|
+
ep.to_s
|
|
39
|
+
end
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|
|
@@ -38,29 +38,27 @@ module Skylight
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# Applied to FutureResult
|
|
42
|
-
|
|
41
|
+
# Applied to FutureResult (Rails <= 8.1)
|
|
42
|
+
# Handles both the outer instrumentation and the execute_or_wait hook
|
|
43
|
+
module FutureResultInstrumentation
|
|
43
44
|
def result(*, **)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
45
|
+
name = @args&.[](1)
|
|
46
|
+
|
|
47
|
+
ActiveSupport::Notifications.instrument("future_result.active_record", { name: name }) { super }
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
private
|
|
51
51
|
|
|
52
52
|
def execute_or_wait(*, **)
|
|
53
|
-
# At this point we're actually waiting for the query to have finished executing.
|
|
54
|
-
|
|
55
53
|
begin
|
|
56
54
|
# If the query has already started async, the @event_buffer will be defined.
|
|
57
55
|
# We grab the events (currently only the SQL queries), extend them with our
|
|
58
56
|
# special methods and notify Skylight.
|
|
59
|
-
# We act as if the event has just
|
|
57
|
+
# We act as if the event has just started, though the query may already have been
|
|
60
58
|
# running. This means we're essentially just logging blocking time right now.
|
|
61
59
|
|
|
62
60
|
# Dup here just in case more get added somehow during the super call
|
|
63
|
-
events = @event_buffer&.instance_variable_get(:@events)
|
|
61
|
+
events = @event_buffer&.instance_variable_get(:@events)&.dup
|
|
64
62
|
|
|
65
63
|
events&.each do |event|
|
|
66
64
|
event.singleton_class.prepend(AsyncEventExtensions)
|
|
@@ -78,9 +76,48 @@ module Skylight
|
|
|
78
76
|
end
|
|
79
77
|
end
|
|
80
78
|
|
|
79
|
+
# Applied to FutureResult (Rails >= 8.2)
|
|
80
|
+
module FutureResultInstrumentationRails82
|
|
81
|
+
def result(*, **)
|
|
82
|
+
name = @intent&.name
|
|
83
|
+
|
|
84
|
+
ActiveSupport::Notifications.instrument("future_result.active_record", { name: name }) { super }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Applied to QueryIntent (Rails >= 8.2)
|
|
89
|
+
module QueryIntentInstrumentation
|
|
90
|
+
private
|
|
91
|
+
|
|
92
|
+
def execute_or_wait(*, **)
|
|
93
|
+
begin
|
|
94
|
+
# If the query has already started async, the @event_buffer will be defined.
|
|
95
|
+
events = @event_buffer&.instance_variable_get(:@events)&.dup
|
|
96
|
+
|
|
97
|
+
events&.each do |event|
|
|
98
|
+
event.singleton_class.prepend(AsyncEventExtensions)
|
|
99
|
+
event.__sk_start!
|
|
100
|
+
end
|
|
101
|
+
rescue StandardError => e
|
|
102
|
+
Skylight.error("Unable to start events for QueryIntent: #{e}")
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
super
|
|
106
|
+
ensure
|
|
107
|
+
events&.reverse_each(&:__sk_finish!)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
81
111
|
class Probe
|
|
82
112
|
def install
|
|
83
|
-
::ActiveRecord::
|
|
113
|
+
if defined?(::ActiveRecord::ConnectionAdapters::QueryIntent)
|
|
114
|
+
# Rails >= 8.2
|
|
115
|
+
::ActiveRecord::FutureResult.prepend(FutureResultInstrumentationRails82)
|
|
116
|
+
::ActiveRecord::ConnectionAdapters::QueryIntent.prepend(QueryIntentInstrumentation)
|
|
117
|
+
else
|
|
118
|
+
# Rails <= 8.1
|
|
119
|
+
::ActiveRecord::FutureResult.prepend(FutureResultInstrumentation)
|
|
120
|
+
end
|
|
84
121
|
end
|
|
85
122
|
end
|
|
86
123
|
end
|
data/lib/skylight/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skylight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tilde, Inc.
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 7.
|
|
18
|
+
version: 7.2.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 7.
|
|
25
|
+
version: 7.2.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: beefcake
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -85,14 +85,14 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 13.0
|
|
88
|
+
version: '13.0'
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 13.0
|
|
95
|
+
version: '13.0'
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: rake-compiler
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -205,6 +205,20 @@ dependencies:
|
|
|
205
205
|
- - ">="
|
|
206
206
|
- !ruby/object:Gem::Version
|
|
207
207
|
version: '0'
|
|
208
|
+
- !ruby/object:Gem::Dependency
|
|
209
|
+
name: ostruct
|
|
210
|
+
requirement: !ruby/object:Gem::Requirement
|
|
211
|
+
requirements:
|
|
212
|
+
- - ">="
|
|
213
|
+
- !ruby/object:Gem::Version
|
|
214
|
+
version: '0'
|
|
215
|
+
type: :development
|
|
216
|
+
prerelease: false
|
|
217
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
218
|
+
requirements:
|
|
219
|
+
- - ">="
|
|
220
|
+
- !ruby/object:Gem::Version
|
|
221
|
+
version: '0'
|
|
208
222
|
email:
|
|
209
223
|
- engineering@tilde.io
|
|
210
224
|
executables:
|
|
@@ -398,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
398
412
|
- !ruby/object:Gem::Version
|
|
399
413
|
version: '0'
|
|
400
414
|
requirements: []
|
|
401
|
-
rubygems_version: 3.6.
|
|
415
|
+
rubygems_version: 3.6.9
|
|
402
416
|
specification_version: 4
|
|
403
417
|
summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.
|
|
404
418
|
test_files: []
|