skylight 5.1.0.beta2 → 5.2.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -4
- data/ext/libskylight.yml +9 -9
- data/lib/skylight/cli/doctor.rb +1 -1
- data/lib/skylight/config.rb +37 -37
- data/lib/skylight/middleware.rb +16 -3
- data/lib/skylight/normalizers/grape/endpoint.rb +1 -1
- data/lib/skylight/probes/middleware.rb +2 -2
- data/lib/skylight/probes/rack_builder.rb +37 -0
- data/lib/skylight/probes/sinatra_add_middleware.rb +2 -2
- data/lib/skylight/railtie.rb +2 -2
- data/lib/skylight/sinatra.rb +1 -1
- data/lib/skylight/util/deploy.rb +4 -4
- data/lib/skylight/util/platform.rb +2 -2
- data/lib/skylight/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b66ffaaf8386f9d50b7fd82087d0fb04e5326701e027f640912e16a9238908e9
|
4
|
+
data.tar.gz: 8318788b892615da50939c6d4e760b65be8c1842ec403a0886f0c78f99a38f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c4222c14f45e9129a8fe0a61e1d895d2d5d1996b29879b106ffa89ee190ffc7c84d41513e56954467ad502304ac94488ce7ded24271e96630bd49e0cc4b34e
|
7
|
+
data.tar.gz: fd8105a613dd0b44aaa3d23580a83aa3b92ca665b08c47cadb87c87368b77834957730c5eef5a83a9794f92153e5b329301fbd6d7655c2e765dd0ebd157f8e0b
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,23 @@
|
|
1
|
-
## 5.
|
1
|
+
## 5.2.0-beta (7 September 2021)
|
2
2
|
|
3
|
-
- [IMPROVEMENT]
|
4
|
-
- [
|
3
|
+
- [IMPROVEMENT] Add Rack::Builder probe to better instrument middlewares in Sinatra and other Builder-based apps
|
4
|
+
- [BUGFIX] Fix an issue in which trace logging could output the incorrect request ID.
|
5
|
+
- [BUGFIX] fix native extension configuration for arm64 hosts
|
6
|
+
|
7
|
+
## 5.1.1 (May 27, 2021)
|
5
8
|
|
6
|
-
|
9
|
+
- [BUGFIX] Correct ruby version requirement in skylight.gemspec
|
10
|
+
|
11
|
+
## 5.1.0 (May 24, 2021)
|
7
12
|
|
8
13
|
- [FEATURE] Add experimental tcp-based `skylightd` (may be enabled with `SKYLIGHT_ENABLE_TCP=true`)
|
9
14
|
|
10
15
|
- [IMPROVEMENT] Support aarch64-darwin targets (Apple M1)
|
11
16
|
- [IMPROVEMENT] Support aarch64-linux-gnu targets
|
12
17
|
- [IMPROVEMENT] Support aarch64-linux-musl targets
|
18
|
+
- [IMPROVEMENT] Prevent large traces from shutting down the instrumenter
|
19
|
+
- [IMPROVEMENT] Avoid 'invalid option' warnings when instrumenting certain Tilt templates in Sinatra
|
20
|
+
- [IMPROVEMENT] Decrease verbosity of source locations logs in the debug level.
|
13
21
|
|
14
22
|
- [BREAKING] Remove `SKYLIGHT_SSL_CERT_DIR` config
|
15
23
|
- [BREAKING] Drop support for Ruby 2.5
|
data/ext/libskylight.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# commit
|
1
|
+
# commit fd0d58cc393e044e5b80ab419e61ebbaec902181
|
2
2
|
---
|
3
|
-
version: "5.1.0-
|
3
|
+
version: "5.1.0-ab315e7"
|
4
4
|
checksums:
|
5
|
-
x86-linux: "
|
6
|
-
x86_64-linux: "
|
7
|
-
x86_64-linux-musl: "
|
8
|
-
x86_64-darwin: "
|
9
|
-
aarch64-linux: "
|
10
|
-
aarch64-linux-musl: "
|
11
|
-
aarch64-darwin: "
|
5
|
+
x86-linux: "4ea5ab2ed7789e6d041ce4cc0384d3fbd8bb7462e8eca879d6c2b242c35eb3b4"
|
6
|
+
x86_64-linux: "8edb5247e982c3571d19e7e607f01c69b5eb657ae310e3bf00e83c1330fdb794"
|
7
|
+
x86_64-linux-musl: "35c4ae1c66b529750358c0acb36d33da1d3ffaf17336ff882ce6ce9a632d9be6"
|
8
|
+
x86_64-darwin: "5d0b3a210931714ad17b8226aac59a39760d7fe8f86a13460dda517bc2886193"
|
9
|
+
aarch64-linux: "1ce0d0f1e7bf9c6c92052080b18738c2f775a01d2004ee434cef74b557a3cafd"
|
10
|
+
aarch64-linux-musl: "f186576b4164d0a4135d5fde3202a3e95c38fc0ea35413288de6bb28c9fc9ac4"
|
11
|
+
aarch64-darwin: "a4f7fb9e483933c194ade230381e3da2f4e6f4dee76550f6f098fc6b46967b3d"
|
data/lib/skylight/cli/doctor.rb
CHANGED
data/lib/skylight/config.rb
CHANGED
@@ -32,9 +32,9 @@ module Skylight
|
|
32
32
|
-"COMPONENT" => :component,
|
33
33
|
-"REPORT_RAILS_ENV" => :report_rails_env,
|
34
34
|
# == Deploy settings ==
|
35
|
-
-"DEPLOY_ID" => :
|
36
|
-
-"DEPLOY_GIT_SHA" => :
|
37
|
-
-"DEPLOY_DESCRIPTION" => :
|
35
|
+
-"DEPLOY_ID" => :"deploy.id",
|
36
|
+
-"DEPLOY_GIT_SHA" => :"deploy.git_sha",
|
37
|
+
-"DEPLOY_DESCRIPTION" => :"deploy.description",
|
38
38
|
# == Logging ==
|
39
39
|
-"LOG_FILE" => :log_file,
|
40
40
|
-"LOG_LEVEL" => :log_level,
|
@@ -69,35 +69,35 @@ module Skylight
|
|
69
69
|
-"REPORT_HTTP_DISABLED" => :report_http_disabled,
|
70
70
|
# == Native agent settings ==
|
71
71
|
#
|
72
|
-
-"LAZY_START" => :
|
73
|
-
-"DAEMON_EXEC_PATH" => :
|
74
|
-
-"DAEMON_LIB_PATH" => :
|
75
|
-
-"PIDFILE_PATH" => :
|
76
|
-
-"SOCKDIR_PATH" => :
|
77
|
-
-"BATCH_QUEUE_DEPTH" => :
|
78
|
-
-"BATCH_SAMPLE_SIZE" => :
|
79
|
-
-"BATCH_FLUSH_INTERVAL" => :
|
80
|
-
-"DAEMON_TICK_INTERVAL" => :
|
81
|
-
-"DAEMON_LOCK_CHECK_INTERVAL" => :
|
82
|
-
-"DAEMON_INACTIVITY_TIMEOUT" => :
|
83
|
-
-"CLIENT_MAX_TRIES" => :
|
84
|
-
-"CLIENT_CONN_TRY_WIN" => :
|
85
|
-
-"MAX_PRESPAWN_JITTER" => :
|
86
|
-
-"DAEMON_WAIT_TIMEOUT" => :
|
87
|
-
-"CLIENT_CHECK_INTERVAL" => :
|
88
|
-
-"CLIENT_QUEUE_DEPTH" => :
|
89
|
-
-"CLIENT_WRITE_TIMEOUT" => :
|
90
|
-
-"SSL_CERT_PATH" => :
|
91
|
-
-"ENABLE_TCP" => :
|
92
|
-
-"TCP_PORT" => :
|
72
|
+
-"LAZY_START" => :"daemon.lazy_start",
|
73
|
+
-"DAEMON_EXEC_PATH" => :"daemon.exec_path",
|
74
|
+
-"DAEMON_LIB_PATH" => :"daemon.lib_path",
|
75
|
+
-"PIDFILE_PATH" => :"daemon.pidfile_path",
|
76
|
+
-"SOCKDIR_PATH" => :"daemon.sockdir_path",
|
77
|
+
-"BATCH_QUEUE_DEPTH" => :"daemon.batch_queue_depth",
|
78
|
+
-"BATCH_SAMPLE_SIZE" => :"daemon.batch_sample_size",
|
79
|
+
-"BATCH_FLUSH_INTERVAL" => :"daemon.batch_flush_interval",
|
80
|
+
-"DAEMON_TICK_INTERVAL" => :"daemon.tick_interval",
|
81
|
+
-"DAEMON_LOCK_CHECK_INTERVAL" => :"daemon.lock_check_interval",
|
82
|
+
-"DAEMON_INACTIVITY_TIMEOUT" => :"daemon.inactivity_timeout",
|
83
|
+
-"CLIENT_MAX_TRIES" => :"daemon.max_connect_tries",
|
84
|
+
-"CLIENT_CONN_TRY_WIN" => :"daemon.connect_try_window",
|
85
|
+
-"MAX_PRESPAWN_JITTER" => :"daemon.max_prespawn_jitter",
|
86
|
+
-"DAEMON_WAIT_TIMEOUT" => :"daemon.wait_timeout",
|
87
|
+
-"CLIENT_CHECK_INTERVAL" => :"daemon.client_check_interval",
|
88
|
+
-"CLIENT_QUEUE_DEPTH" => :"daemon.client_queue_depth",
|
89
|
+
-"CLIENT_WRITE_TIMEOUT" => :"daemon.client_write_timeout",
|
90
|
+
-"SSL_CERT_PATH" => :"daemon.ssl_cert_path",
|
91
|
+
-"ENABLE_TCP" => :"daemon.enable_tcp",
|
92
|
+
-"TCP_PORT" => :"daemon.tcp_port",
|
93
93
|
# == Legacy env vars ==
|
94
94
|
#
|
95
|
-
-"AGENT_LOCKFILE" => :
|
96
|
-
-"AGENT_SOCKFILE_PATH" => :
|
95
|
+
-"AGENT_LOCKFILE" => :"agent.lockfile",
|
96
|
+
-"AGENT_SOCKFILE_PATH" => :"agent.sockfile_path",
|
97
97
|
# == User config settings ==
|
98
98
|
-"USER_CONFIG_PATH" => :user_config_path,
|
99
99
|
# == Heroku settings ==
|
100
|
-
-"HEROKU_DYNO_INFO_PATH" => :
|
100
|
+
-"HEROKU_DYNO_INFO_PATH" => :"heroku.dyno_info_path",
|
101
101
|
# == Source Location ==
|
102
102
|
-"SOURCE_LOCATION_IGNORED_GEMS" => :source_location_ignored_gems,
|
103
103
|
-"SOURCE_LOCATION_CACHE_SIZE" => :source_location_cache_size
|
@@ -135,22 +135,22 @@ module Skylight
|
|
135
135
|
sinatra_route_prefixes: false,
|
136
136
|
enable_source_locations: true,
|
137
137
|
# Deploys
|
138
|
-
|
138
|
+
"heroku.dyno_info_path": -"/etc/heroku/dyno",
|
139
139
|
report_rails_env: true,
|
140
140
|
# Daemon
|
141
|
-
|
141
|
+
"daemon.lazy_start": true,
|
142
142
|
hostname: Util::Hostname.default_hostname,
|
143
143
|
report_max_spans_exceeded: false,
|
144
144
|
prune_large_traces: true
|
145
145
|
}
|
146
146
|
|
147
|
-
ret[:
|
147
|
+
ret[:"daemon.ssl_cert_path"] = Util::SSL.ca_cert_file_or_default unless Util::Platform::OS == -"darwin"
|
148
148
|
|
149
149
|
if Skylight.native?
|
150
150
|
native_path = Skylight.libskylight_path
|
151
151
|
|
152
|
-
ret[:
|
153
|
-
ret[:
|
152
|
+
ret[:"daemon.lib_path"] = native_path
|
153
|
+
ret[:"daemon.exec_path"] = File.join(native_path, "skylightd")
|
154
154
|
end
|
155
155
|
|
156
156
|
ret
|
@@ -211,12 +211,12 @@ module Skylight
|
|
211
211
|
|
212
212
|
# Maps legacy config keys to new config keys
|
213
213
|
def self.legacy_keys
|
214
|
-
@legacy_keys ||= {
|
214
|
+
@legacy_keys ||= { "agent.sockfile_path": :"daemon.sockdir_path", "agent.lockfile": :"daemon.pidfile_path" }
|
215
215
|
end
|
216
216
|
|
217
217
|
def self.validators
|
218
218
|
@validators ||=
|
219
|
-
{
|
219
|
+
{ "agent.interval": [->(v, _c) { v.is_a?(Integer) && v > 0 }, "must be an integer greater than 0"] }
|
220
220
|
end
|
221
221
|
|
222
222
|
# @api private
|
@@ -334,8 +334,8 @@ module Skylight
|
|
334
334
|
# TODO: Move this out of the validate! method: https://github.com/tildeio/direwolf-agent/issues/273
|
335
335
|
# FIXME: Why not set the sockdir_path and pidfile_path explicitly?
|
336
336
|
# That way we don't have to keep this in sync with the Rust repo.
|
337
|
-
sockdir_path = File.expand_path(self[:
|
338
|
-
pidfile_path = File.expand_path(self[:
|
337
|
+
sockdir_path = File.expand_path(self[:"daemon.sockdir_path"] || ".", root)
|
338
|
+
pidfile_path = File.expand_path(self[:"daemon.pidfile_path"] || "skylight.pid", sockdir_path)
|
339
339
|
|
340
340
|
check_file_permissions(pidfile_path, "daemon.pidfile_path or daemon.sockdir_path")
|
341
341
|
check_sockdir_permissions(sockdir_path)
|
@@ -588,7 +588,7 @@ module Skylight
|
|
588
588
|
end
|
589
589
|
|
590
590
|
def on_heroku?
|
591
|
-
File.exist?(get(:
|
591
|
+
File.exist?(get(:"heroku.dyno_info_path"))
|
592
592
|
end
|
593
593
|
|
594
594
|
private
|
data/lib/skylight/middleware.rb
CHANGED
@@ -3,6 +3,8 @@ require "securerandom"
|
|
3
3
|
module Skylight
|
4
4
|
# @api private
|
5
5
|
class Middleware
|
6
|
+
SKYLIGHT_REQUEST_ID = "skylight.request_id".freeze
|
7
|
+
|
6
8
|
class BodyProxy
|
7
9
|
def initialize(body, &block)
|
8
10
|
@body = body
|
@@ -81,7 +83,8 @@ module Skylight
|
|
81
83
|
set_request_id(env)
|
82
84
|
|
83
85
|
if Skylight.tracing?
|
84
|
-
|
86
|
+
debug "Already instrumenting. Make sure the Skylight Rack Middleware hasn't been added more than once."
|
87
|
+
return @app.call(env)
|
85
88
|
end
|
86
89
|
|
87
90
|
if env["REQUEST_METHOD"] == "HEAD"
|
@@ -108,7 +111,7 @@ module Skylight
|
|
108
111
|
|
109
112
|
def log_context
|
110
113
|
# Don't cache this, it will change
|
111
|
-
{ request_id:
|
114
|
+
{ request_id: current_request_id, inst: Skylight.instrumenter&.uuid }
|
112
115
|
end
|
113
116
|
|
114
117
|
# Allow for overwriting
|
@@ -122,8 +125,10 @@ module Skylight
|
|
122
125
|
|
123
126
|
# Request ID code based on ActionDispatch::RequestId
|
124
127
|
def set_request_id(env)
|
128
|
+
return if env[SKYLIGHT_REQUEST_ID]
|
129
|
+
|
125
130
|
existing_request_id = env["action_dispatch.request_id"] || env["HTTP_X_REQUEST_ID"]
|
126
|
-
|
131
|
+
self.current_request_id = env[SKYLIGHT_REQUEST_ID] = make_request_id(existing_request_id)
|
127
132
|
end
|
128
133
|
|
129
134
|
def make_request_id(request_id)
|
@@ -133,5 +138,13 @@ module Skylight
|
|
133
138
|
def internal_request_id
|
134
139
|
SecureRandom.uuid
|
135
140
|
end
|
141
|
+
|
142
|
+
def current_request_id
|
143
|
+
Thread.current[SKYLIGHT_REQUEST_ID]
|
144
|
+
end
|
145
|
+
|
146
|
+
def current_request_id=(request_id)
|
147
|
+
Thread.current[SKYLIGHT_REQUEST_ID] = request_id
|
148
|
+
end
|
136
149
|
end
|
137
150
|
end
|
@@ -20,7 +20,7 @@ module Skylight
|
|
20
20
|
|
21
21
|
def get_namespace(endpoint)
|
22
22
|
# slice off preceding slash for data continuity
|
23
|
-
::Grape::Namespace.joined_space_path(endpoint.namespace_stackable(:namespace)).to_s[1
|
23
|
+
::Grape::Namespace.joined_space_path(endpoint.namespace_stackable(:namespace)).to_s[1..]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -25,10 +25,10 @@ module Skylight
|
|
25
25
|
# for Rails <= 5.2 ActionDispatch::MiddlewareStack::Middleware
|
26
26
|
module Instrumentation
|
27
27
|
def build(*)
|
28
|
-
sk_instrument_middleware(super)
|
28
|
+
Instrumentation.sk_instrument_middleware(super)
|
29
29
|
end
|
30
30
|
|
31
|
-
def sk_instrument_middleware(middleware)
|
31
|
+
def self.sk_instrument_middleware(middleware)
|
32
32
|
return middleware if middleware.is_a?(Skylight::Middleware)
|
33
33
|
|
34
34
|
# Not sure how this would actually happen
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Skylight
|
2
|
+
module Probes
|
3
|
+
module Rack
|
4
|
+
module Builder
|
5
|
+
module Instrumentation
|
6
|
+
def use(middleware, *args, &block)
|
7
|
+
if @map
|
8
|
+
mapping = @map
|
9
|
+
@map = nil
|
10
|
+
@use << proc { |app| generate_map(app, mapping) }
|
11
|
+
end
|
12
|
+
@use << proc do |app|
|
13
|
+
middleware
|
14
|
+
.new(app, *args, &block)
|
15
|
+
.tap do |middleware_instance|
|
16
|
+
Skylight::Probes::Middleware::Instrumentation.sk_instrument_middleware(middleware_instance)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
ruby2_keywords(:use) if respond_to?(:ruby2_keywords, true)
|
21
|
+
end
|
22
|
+
|
23
|
+
class Probe
|
24
|
+
def install
|
25
|
+
if defined?(::Rack.release) && Gem::Version.new(::Rack.release) >= ::Gem::Version.new("1.4") &&
|
26
|
+
defined?(::Rack::Builder)
|
27
|
+
require "skylight/probes/middleware"
|
28
|
+
::Rack::Builder.prepend(Instrumentation)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
register(:rack_builder, "Rack::Builder", "rack/builder", Skylight::Probes::Rack::Builder::Probe.new)
|
36
|
+
end
|
37
|
+
end
|
data/lib/skylight/railtie.rb
CHANGED
@@ -99,8 +99,8 @@ module Skylight
|
|
99
99
|
|
100
100
|
configure_logging(config, app)
|
101
101
|
|
102
|
-
config[:
|
103
|
-
config[:
|
102
|
+
config[:"daemon.sockdir_path"] ||= tmp
|
103
|
+
config[:"normalizers.render.view_paths"] = existent_paths(app.config.paths["app/views"]) + [Rails.root.to_s]
|
104
104
|
|
105
105
|
config[:env] ||= Rails.env.to_s if config[:report_rails_env]
|
106
106
|
|
data/lib/skylight/sinatra.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "skylight"
|
2
|
-
Skylight.probe(:sinatra_add_middleware, :sinatra, :tilt, :sequel)
|
2
|
+
Skylight.probe(:sinatra_add_middleware, :sinatra, :tilt, :sequel, :rack_builder)
|
data/lib/skylight/util/deploy.rb
CHANGED
@@ -52,15 +52,15 @@ module Skylight
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def id
|
55
|
-
config.get(:
|
55
|
+
config.get(:"deploy.id") || git_sha
|
56
56
|
end
|
57
57
|
|
58
58
|
def git_sha
|
59
|
-
config.get(:
|
59
|
+
config.get(:"deploy.git_sha")
|
60
60
|
end
|
61
61
|
|
62
62
|
def description
|
63
|
-
config.get(:
|
63
|
+
config.get(:"deploy.description")
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -85,7 +85,7 @@ module Skylight
|
|
85
85
|
private
|
86
86
|
|
87
87
|
def get_info
|
88
|
-
info_path = config[:
|
88
|
+
info_path = config[:"heroku.dyno_info_path"]
|
89
89
|
|
90
90
|
if File.exist?(info_path) && (info = JSON.parse(File.read(info_path)))
|
91
91
|
info["release"]
|
data/lib/skylight/version.rb
CHANGED
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: 5.
|
4
|
+
version: 5.2.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: 2021-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.20.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.20.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: simplecov
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,6 +296,7 @@ files:
|
|
296
296
|
- lib/skylight/probes/mongo.rb
|
297
297
|
- lib/skylight/probes/mongoid.rb
|
298
298
|
- lib/skylight/probes/net_http.rb
|
299
|
+
- lib/skylight/probes/rack_builder.rb
|
299
300
|
- lib/skylight/probes/redis.rb
|
300
301
|
- lib/skylight/probes/sequel.rb
|
301
302
|
- lib/skylight/probes/sinatra.rb
|
@@ -375,7 +376,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
375
376
|
requirements:
|
376
377
|
- - ">="
|
377
378
|
- !ruby/object:Gem::Version
|
378
|
-
version: '2.
|
379
|
+
version: '2.6'
|
379
380
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
380
381
|
requirements:
|
381
382
|
- - ">"
|