skylight 7.0.0 → 7.1.1
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 +9 -0
- data/ext/extconf.rb +4 -4
- data/ext/skylight_memprof.c +5 -5
- data/ext/skylight_native.c +2 -3
- 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: fb1aa9e97569dad5f875188d9b9950ce95e2f760cecbf47e56d1a111a3bb3d4b
|
|
4
|
+
data.tar.gz: 077b6c9517691116e216022f9f5e810edc7173c262a66d99446b49341efbe51a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28a23bdc8e24bd10150a23d917bb669cdebfafb5422046f9c1fe7c0aebee7a12e2f31ca8aee12430e50e32956ef54581b63481f81616fdcf2edecf41ab86ddc2
|
|
7
|
+
data.tar.gz: c41a8135ee576517a9f1f4f096fc9bb30f024e45e1918a3c19ca21e480f21b9ddecba70527734a660fe9723bc25feffcaae605bc0966d4d19a488b308d66166b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 7.1.1 (April 17, 2026)
|
|
2
|
+
- BUGFIX Fix native extension build on GCC 15 by using `append_cflags` instead of mutating `$CFLAGS` directly.
|
|
3
|
+
- BUGFIX Replace K&R-style empty parameter lists (`()`) with `(void)` in C sources to build cleanly under Fedora's `-Werror=old-style-definition`.
|
|
4
|
+
|
|
5
|
+
## 7.1.0 (January 20, 2025)
|
|
6
|
+
- BREAKING end support for Rails < 7.2.
|
|
7
|
+
- IMPROVEMENT better support for Grape 3.x
|
|
8
|
+
- IMPROVEMENT better ActiveRecord instrumentation for async queries in Rails 8.2
|
|
9
|
+
|
|
1
10
|
## 7.0.0 (September 16, 2025)
|
|
2
11
|
|
|
3
12
|
- IMPROVEMENT Initial (beta) support for AWS Lambda
|
data/ext/extconf.rb
CHANGED
|
@@ -228,7 +228,7 @@ end
|
|
|
228
228
|
# flag can cause issues for some customers we're turning it off by default. However,
|
|
229
229
|
# in development and CI, we still have the option of turning it back on to help catch
|
|
230
230
|
# potential issues.
|
|
231
|
-
|
|
231
|
+
append_cflags(["-Werror"]) if SKYLIGHT_EXT_STRICT
|
|
232
232
|
|
|
233
233
|
checking_for "fast thread local storage" do
|
|
234
234
|
if try_compile("__thread int foo;")
|
|
@@ -238,15 +238,15 @@ checking_for "fast thread local storage" do
|
|
|
238
238
|
end
|
|
239
239
|
|
|
240
240
|
# Flag -std=c99 required for older build systems
|
|
241
|
-
|
|
241
|
+
append_cflags(["-std=c99", "-Wall", "-fno-strict-aliasing"])
|
|
242
242
|
|
|
243
243
|
# Allow stricter checks to be turned on for development or debugging
|
|
244
244
|
if SKYLIGHT_EXT_STRICT
|
|
245
|
-
|
|
245
|
+
append_cflags(["-Wextra"])
|
|
246
246
|
|
|
247
247
|
# Enabling unused-parameter causes failures in Ruby 2.6+
|
|
248
248
|
# ruby/ruby.h:2186:35: error: unused parameter 'allow_transient'
|
|
249
|
-
|
|
249
|
+
append_cflags(["-Wno-error=unused-parameter"])
|
|
250
250
|
end
|
|
251
251
|
|
|
252
252
|
# TODO: Compute the relative path to the location
|
data/ext/skylight_memprof.c
CHANGED
|
@@ -12,7 +12,7 @@ typedef struct {
|
|
|
12
12
|
// Use the __thread directive
|
|
13
13
|
static __thread sky_allocations_t sky_allocations;
|
|
14
14
|
|
|
15
|
-
static inline sky_allocations_t* get_allocations() {
|
|
15
|
+
static inline sky_allocations_t* get_allocations(void) {
|
|
16
16
|
return &sky_allocations;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,11 +25,11 @@ static pthread_key_t ALLOCATIONS_KEY;
|
|
|
25
25
|
|
|
26
26
|
static pthread_once_t KEY_INIT_ONCE = PTHREAD_ONCE_INIT;
|
|
27
27
|
|
|
28
|
-
static void init_allocations_key() {
|
|
28
|
+
static void init_allocations_key(void) {
|
|
29
29
|
pthread_key_create(&ALLOCATIONS_KEY, free);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
static sky_allocations_t* get_allocations() {
|
|
32
|
+
static sky_allocations_t* get_allocations(void) {
|
|
33
33
|
sky_allocations_t* ret;
|
|
34
34
|
|
|
35
35
|
// Initialize the TLS key
|
|
@@ -69,7 +69,7 @@ uint64_t sky_allocation_count(void) {
|
|
|
69
69
|
return get_allocations()->allocations;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
uint64_t sky_consume_allocations() {
|
|
72
|
+
uint64_t sky_consume_allocations(void) {
|
|
73
73
|
uint64_t ret = get_allocations()->allocations;
|
|
74
74
|
sky_clear_allocation_count();
|
|
75
75
|
return ret;
|
|
@@ -100,7 +100,7 @@ uint64_t sky_allocation_count(void) {
|
|
|
100
100
|
return 0;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
uint64_t sky_consume_allocations() {
|
|
103
|
+
uint64_t sky_consume_allocations(void) {
|
|
104
104
|
return 0;
|
|
105
105
|
}
|
|
106
106
|
|
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; \
|
|
@@ -554,7 +553,7 @@ trace_span_set_exception(VALUE self, VALUE span, VALUE exception, VALUE exceptio
|
|
|
554
553
|
return Qnil;
|
|
555
554
|
}
|
|
556
555
|
|
|
557
|
-
void Init_skylight_native() {
|
|
556
|
+
void Init_skylight_native(void) {
|
|
558
557
|
rb_mSkylight = rb_define_module("Skylight");
|
|
559
558
|
|
|
560
559
|
rb_eNativeError = rb_const_get(rb_mSkylight, rb_intern("NativeError"));
|
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.1
|
|
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: []
|