skylight 3.1.4 → 5.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +465 -294
- data/CLA.md +1 -1
- data/CONTRIBUTING.md +11 -3
- data/ERRORS.md +3 -0
- data/LICENSE.md +8 -18
- data/README.md +1 -2
- data/bin/skylight +1 -1
- data/ext/extconf.rb +118 -122
- data/ext/libskylight.yml +8 -6
- data/ext/skylight_native.c +56 -100
- data/lib/skylight/api.rb +41 -27
- data/lib/skylight/cli/doctor.rb +68 -70
- data/lib/skylight/cli/helpers.rb +3 -5
- data/lib/skylight/cli/merger.rb +99 -92
- data/lib/skylight/cli.rb +40 -43
- data/lib/skylight/config.rb +656 -201
- data/lib/skylight/data/cacert.pem +730 -1023
- data/lib/skylight/deprecation.rb +17 -0
- data/lib/skylight/errors.rb +34 -16
- data/lib/skylight/extensions/source_location.rb +291 -0
- data/lib/skylight/extensions.rb +95 -0
- data/lib/skylight/formatters/http.rb +18 -0
- data/lib/skylight/gc.rb +99 -0
- data/lib/skylight/helpers.rb +82 -39
- data/lib/skylight/instrumenter.rb +339 -9
- data/lib/skylight/middleware.rb +147 -1
- data/lib/skylight/native.rb +71 -23
- data/lib/skylight/native_ext_fetcher.rb +39 -47
- data/lib/skylight/normalizers/action_controller/process_action.rb +68 -0
- data/lib/skylight/normalizers/action_controller/send_file.rb +51 -0
- data/lib/skylight/normalizers/action_dispatch/process_middleware.rb +22 -0
- data/lib/skylight/normalizers/action_dispatch/route_set.rb +27 -0
- data/lib/skylight/normalizers/action_view/render_collection.rb +24 -0
- data/lib/skylight/normalizers/action_view/render_layout.rb +25 -0
- data/lib/skylight/normalizers/action_view/render_partial.rb +23 -0
- data/lib/skylight/normalizers/action_view/render_template.rb +23 -0
- data/lib/skylight/normalizers/active_job/perform.rb +87 -0
- data/lib/skylight/normalizers/active_model_serializers/render.rb +32 -0
- data/lib/skylight/normalizers/active_record/instantiation.rb +16 -0
- data/lib/skylight/normalizers/active_record/sql.rb +20 -0
- data/lib/skylight/normalizers/active_storage.rb +28 -0
- data/lib/skylight/normalizers/active_support/cache.rb +11 -0
- data/lib/skylight/normalizers/active_support/cache_clear.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_decrement.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_delete.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_exist.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_fetch_hit.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_generate.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_increment.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_read.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_read_multi.rb +16 -0
- data/lib/skylight/normalizers/active_support/cache_write.rb +16 -0
- data/lib/skylight/normalizers/coach/handler_finish.rb +44 -0
- data/lib/skylight/normalizers/coach/middleware_finish.rb +33 -0
- data/lib/skylight/normalizers/couch_potato/query.rb +20 -0
- data/lib/skylight/normalizers/data_mapper/sql.rb +12 -0
- data/lib/skylight/normalizers/default.rb +24 -0
- data/lib/skylight/normalizers/elasticsearch/request.rb +20 -0
- data/lib/skylight/normalizers/faraday/request.rb +38 -0
- data/lib/skylight/normalizers/grape/endpoint.rb +28 -0
- data/lib/skylight/normalizers/grape/endpoint_render.rb +25 -0
- data/lib/skylight/normalizers/grape/endpoint_run.rb +39 -0
- data/lib/skylight/normalizers/grape/endpoint_run_filters.rb +20 -0
- data/lib/skylight/normalizers/grape/format_response.rb +20 -0
- data/lib/skylight/normalizers/graphiti/render.rb +22 -0
- data/lib/skylight/normalizers/graphiti/resolve.rb +31 -0
- data/lib/skylight/normalizers/graphql/base.rb +127 -0
- data/lib/skylight/normalizers/render.rb +79 -0
- data/lib/skylight/normalizers/sequel/sql.rb +12 -0
- data/lib/skylight/normalizers/shrine.rb +32 -0
- data/lib/skylight/normalizers/sql.rb +41 -0
- data/lib/skylight/normalizers.rb +157 -0
- data/lib/skylight/probes/action_controller.rb +52 -0
- data/lib/skylight/probes/action_dispatch/request_id.rb +33 -0
- data/lib/skylight/probes/action_dispatch/routing/route_set.rb +30 -0
- data/lib/skylight/probes/action_dispatch.rb +2 -0
- data/lib/skylight/probes/action_view.rb +42 -0
- data/lib/skylight/probes/active_job.rb +27 -0
- data/lib/skylight/probes/active_job_enqueue.rb +35 -0
- data/lib/skylight/probes/active_model_serializers.rb +50 -0
- data/lib/skylight/probes/active_record_async.rb +96 -0
- data/lib/skylight/probes/delayed_job.rb +144 -0
- data/lib/skylight/probes/elasticsearch.rb +45 -0
- data/lib/skylight/probes/excon/middleware.rb +65 -0
- data/lib/skylight/probes/excon.rb +25 -0
- data/lib/skylight/probes/faraday.rb +23 -0
- data/lib/skylight/probes/graphql.rb +38 -0
- data/lib/skylight/probes/httpclient.rb +44 -0
- data/lib/skylight/probes/middleware.rb +135 -0
- data/lib/skylight/probes/mongo.rb +169 -0
- data/lib/skylight/probes/mongoid.rb +6 -0
- data/lib/skylight/probes/net_http.rb +54 -0
- data/lib/skylight/probes/rack_builder.rb +37 -0
- data/lib/skylight/probes/redis.rb +68 -0
- data/lib/skylight/probes/sequel.rb +29 -0
- data/lib/skylight/probes/sinatra.rb +66 -0
- data/lib/skylight/probes/sinatra_add_middleware.rb +10 -10
- data/lib/skylight/probes/tilt.rb +25 -0
- data/lib/skylight/probes.rb +172 -0
- data/lib/skylight/railtie.rb +172 -15
- data/lib/skylight/sidekiq.rb +47 -0
- data/lib/skylight/sinatra.rb +2 -2
- data/lib/skylight/subscriber.rb +130 -0
- data/lib/skylight/test.rb +147 -0
- data/lib/skylight/trace.rb +331 -15
- data/lib/skylight/user_config.rb +60 -0
- data/lib/skylight/util/allocation_free.rb +26 -0
- data/lib/skylight/util/clock.rb +57 -0
- data/lib/skylight/util/component.rb +47 -9
- data/lib/skylight/util/deploy.rb +24 -40
- data/lib/skylight/util/gzip.rb +20 -0
- data/lib/skylight/util/hostname.rb +4 -4
- data/lib/skylight/util/http.rb +62 -71
- data/lib/skylight/util/instrumenter_method.rb +26 -0
- data/lib/skylight/util/logging.rb +136 -0
- data/lib/skylight/util/lru_cache.rb +36 -0
- data/lib/skylight/util/platform.rb +74 -0
- data/lib/skylight/util/proxy.rb +13 -0
- data/lib/skylight/util/ssl.rb +4 -28
- data/lib/skylight/util.rb +12 -0
- data/lib/skylight/vendor/cli/thor/rake_compat.rb +1 -1
- data/lib/skylight/version.rb +5 -1
- data/lib/skylight/vm/gc.rb +60 -0
- data/lib/skylight.rb +213 -24
- metadata +171 -53
data/CLA.md
CHANGED
@@ -6,4 +6,4 @@ right (whether now known or hereinafter invented), title, and interest,
|
|
6
6
|
throughout the world, including any copyrights and renewals or extensions
|
7
7
|
thereto, in the contributions to Skylight made by Assignor.
|
8
8
|
|
9
|
-
IN WITNESS THEREOF, Assignor has duly executed this Agreement.
|
9
|
+
IN WITNESS THEREOF, Assignor has duly executed this Agreement.
|
data/CONTRIBUTING.md
CHANGED
@@ -8,8 +8,16 @@ Before contributing, please [sign the CLA](https://docs.google.com/spreadsheet/v
|
|
8
8
|
|
9
9
|
In general, we recommend that you speak with us about any new features you'd like to add so we can make sure we're on the same page.
|
10
10
|
|
11
|
-
## Emulating
|
11
|
+
## Emulating Gitlab CI Builds
|
12
12
|
|
13
|
-
We have many
|
13
|
+
We have many CI build configurations that must pass in order to merge a pull request. You can run these individual configurations locally by running e.g., `gitlab-runner exec docker ruby23-rails42`. The only prerequisites are that you have both [Gitlab Runner](https://docs.gitlab.com/runner/) and [Docker](https://www.docker.com/) installed (most recent versions are best). Configuration names may be found in the `.gitlab.yml` file.
|
14
14
|
|
15
|
-
|
15
|
+
If you prefer to run tests in your own environment, you may do so as follows:
|
16
|
+
|
17
|
+
```shell
|
18
|
+
# Select a gemfile and bundle install
|
19
|
+
export BUNDLE_GEMFILE=$PWD/gemfiles/rails-5.2.x/Gemfile
|
20
|
+
bundle install
|
21
|
+
# Run the test suite (takes 5-10 minutes)
|
22
|
+
bundle exec rspec
|
23
|
+
```
|
data/ERRORS.md
CHANGED
@@ -2,4 +2,7 @@ E0001 - Spans were closed out of order
|
|
2
2
|
E0002 - Exceeded the number of unique span descriptions
|
3
3
|
E0003 - Exceeded maximum number of spans
|
4
4
|
E0004 - Failed to lex SQL query
|
5
|
+
E0005 - Instrumenter is not running
|
6
|
+
E0006 - Invalid UTF-8
|
7
|
+
E0007 - Failed to connect to gRPC server
|
5
8
|
E9999 - Unknown
|
data/LICENSE.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
All other components of this product, except where otherwise noted, are
|
2
|
-
Copyright (c) 2013-
|
2
|
+
Copyright (c) 2013-2019 Tilde, Inc.
|
3
3
|
All rights reserved.
|
4
4
|
|
5
5
|
Certain inventions disclosed in this file may be claimed within patents
|
@@ -28,19 +28,15 @@ brand (if any) provided by Tilde.
|
|
28
28
|
Unless otherwise expressly agreed by Tilde in a separate written
|
29
29
|
license agreement, these files are provided AS IS, WITHOUT WARRANTY OF
|
30
30
|
ANY KIND, including without any implied warranties of MERCHANTABILITY,
|
31
|
-
FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT.
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a
|
32
32
|
condition to your use of these files, you are solely responsible for
|
33
33
|
such use. Tilde will have no liability to you for direct,
|
34
34
|
indirect, consequential, incidental, special, or punitive damages or
|
35
35
|
for lost profits or data.
|
36
36
|
|
37
|
+
# Other Licenses
|
37
38
|
|
38
|
-
|
39
|
-
Other Licenses
|
40
|
-
==============
|
41
|
-
|
42
|
-
Ruby on Rails
|
43
|
-
-------------
|
39
|
+
## Ruby on Rails
|
44
40
|
|
45
41
|
Copyright (c) 2005-2016 David Heinemeier Hansson
|
46
42
|
|
@@ -48,9 +44,7 @@ Released under the MIT License.
|
|
48
44
|
|
49
45
|
Original source at https://github.com/rails/rails.
|
50
46
|
|
51
|
-
|
52
|
-
HighLine
|
53
|
-
--------
|
47
|
+
## HighLine
|
54
48
|
|
55
49
|
Copyright (c) 2014 James Edward Gray II, Gregory Brown, et al.
|
56
50
|
|
@@ -58,9 +52,7 @@ Distributed under the user's choice of the GPL Version 2 or the Ruby software li
|
|
58
52
|
|
59
53
|
Original source at https://github.com/JEG2/highline.
|
60
54
|
|
61
|
-
|
62
|
-
Thor
|
63
|
-
----
|
55
|
+
## Thor
|
64
56
|
|
65
57
|
Copyright (c) 2008 Yehuda Katz, Eric Hodel, et al.
|
66
58
|
|
@@ -68,12 +60,10 @@ Released under the MIT License.
|
|
68
60
|
|
69
61
|
Original source at https://github.com/erikhuda/thor.
|
70
62
|
|
71
|
-
|
72
|
-
ThreadSafe
|
73
|
-
----------
|
63
|
+
## ThreadSafe
|
74
64
|
|
75
65
|
Copyright (c) 2014 Charles Oliver Nutter, thedarkone, et al.
|
76
66
|
|
77
67
|
Distributed under Apache License, Version 2.0, January 2004
|
78
68
|
|
79
|
-
Original source at https://github.com/ruby-concurrency/thread_safe.
|
69
|
+
Original source at https://github.com/ruby-concurrency/thread_safe.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Skylight Ruby Agent
|
2
2
|
|
3
|
-
![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/skylight.svg)](https://badge.fury.io/rb/skylight)
|
4
4
|
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=skylight&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=skylight&package-manager=bundler&version-scheme=semver)
|
5
5
|
|
6
6
|
Instrument your ruby application and send the data to the Skylight
|
@@ -10,7 +10,6 @@ Sign up at https://www.skylight.io.
|
|
10
10
|
|
11
11
|
For more documentation see https://www.skylight.io/support.
|
12
12
|
|
13
|
-
|
14
13
|
## Bug Reports and Feature Requests
|
15
14
|
|
16
15
|
If you've got a bug report or have a feature you'd like to request, please contact us at support@skylight.io or use the built-in messenger in the Skylight web interface. We'll be much quicker to respond that way :)
|
data/bin/skylight
CHANGED
data/ext/extconf.rb
CHANGED
@@ -1,34 +1,38 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
require "rbconfig"
|
2
|
+
require "mkmf"
|
3
|
+
require "yaml"
|
4
|
+
require "logger"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
|
8
|
+
|
9
|
+
require "skylight/native_ext_fetcher"
|
10
|
+
require "skylight/util/platform"
|
11
|
+
|
12
|
+
GLIBC_MIN = 2.23
|
13
|
+
GLIBC_V4_MIN = 2.15
|
14
|
+
|
15
|
+
ldd_output =
|
16
|
+
begin
|
17
|
+
`ldd --version`
|
18
|
+
rescue Errno::ENOENT
|
19
|
+
nil
|
20
|
+
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
if ldd_output =~ /GLIBC (\d+(\.\d+)+)/ && ($1.to_f < GLIBC_MIN)
|
23
|
+
message = "glibc #{GLIBC_MIN}+ is required but you have #{$1} installed."
|
24
|
+
message << "\nYou may be able to use Skylight v4 instead." if $1.to_f >= GLIBC_V4_MIN
|
25
|
+
fail message
|
26
|
+
end
|
22
27
|
|
23
28
|
# Util allowing proxying writes to multiple location
|
24
29
|
class MultiIO
|
25
|
-
|
26
30
|
def initialize(*targets)
|
27
|
-
|
31
|
+
@targets = targets
|
28
32
|
end
|
29
33
|
|
30
34
|
def write(*args)
|
31
|
-
@targets.each {|t| t.write(*args)}
|
35
|
+
@targets.each { |t| t.write(*args) }
|
32
36
|
end
|
33
37
|
|
34
38
|
def close
|
@@ -36,30 +40,31 @@ class MultiIO
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
|
-
include Skylight::
|
43
|
+
include Skylight::Util
|
40
44
|
|
41
|
-
SKYLIGHT_INSTALL_LOG = File.expand_path("
|
42
|
-
SKYLIGHT_REQUIRED
|
43
|
-
SKYLIGHT_FETCH_LIB
|
45
|
+
SKYLIGHT_INSTALL_LOG = File.expand_path("install.log", __dir__)
|
46
|
+
SKYLIGHT_REQUIRED = ENV.key?("SKYLIGHT_REQUIRED") && ENV.fetch("SKYLIGHT_REQUIRED", nil) !~ /^false$/i
|
47
|
+
SKYLIGHT_FETCH_LIB = !ENV.key?("SKYLIGHT_FETCH_LIB") || ENV.fetch("SKYLIGHT_FETCH_LIB", nil) !~ /^false$/i
|
44
48
|
|
45
49
|
# Directory where skylight.h exists
|
46
|
-
SKYLIGHT_HDR_PATH = ENV
|
47
|
-
SKYLIGHT_LIB_PATH =
|
50
|
+
SKYLIGHT_HDR_PATH = ENV.fetch("SKYLIGHT_HDR_PATH") { ENV.fetch("SKYLIGHT_LIB_PATH", ".") }
|
51
|
+
SKYLIGHT_LIB_PATH =
|
52
|
+
ENV.fetch("SKYLIGHT_LIB_PATH") { File.expand_path("../../lib/skylight/native/#{Platform.tuple}", __FILE__) }
|
48
53
|
|
49
|
-
SKYLIGHT_SOURCE_URL = ENV
|
50
|
-
SKYLIGHT_VERSION = ENV
|
51
|
-
SKYLIGHT_CHECKSUM = ENV
|
54
|
+
SKYLIGHT_SOURCE_URL = ENV.fetch("SKYLIGHT_SOURCE_URL", nil)
|
55
|
+
SKYLIGHT_VERSION = ENV.fetch("SKYLIGHT_VERSION", nil)
|
56
|
+
SKYLIGHT_CHECKSUM = ENV.fetch("SKYLIGHT_CHECKSUM", nil)
|
52
57
|
|
53
|
-
SKYLIGHT_EXT_STRICT = ENV.key?("SKYLIGHT_EXT_STRICT") && ENV
|
58
|
+
SKYLIGHT_EXT_STRICT = ENV.key?("SKYLIGHT_EXT_STRICT") && ENV.fetch("SKYLIGHT_EXT_STRICT", nil) =~ /^true$/i
|
54
59
|
|
55
60
|
# Setup logger
|
56
|
-
LOG = Logger.new(MultiIO.new(
|
61
|
+
LOG = Logger.new(MultiIO.new($stdout, File.open(SKYLIGHT_INSTALL_LOG, "a")))
|
57
62
|
|
58
63
|
# Handles terminating in the case of a failure. If we have a bug, we do not
|
59
64
|
# want to break our customer's deploy, but extconf.rb requires a Makefile to be
|
60
65
|
# present upon a successful exit. To satisfy this requirement, we create a
|
61
66
|
# dummy Makefile.
|
62
|
-
def fail(msg, type
|
67
|
+
def fail(msg, type = :error)
|
63
68
|
LOG.send type, msg
|
64
69
|
|
65
70
|
if SKYLIGHT_REQUIRED
|
@@ -77,94 +82,89 @@ end
|
|
77
82
|
# Check that Xcode license has been approved
|
78
83
|
# Based on Homebrew's implementation
|
79
84
|
# https://github.com/Homebrew/homebrew/blob/03708b016755847facc4f19a43ee9f7a44141ed7/Library/Homebrew/cmd/doctor.rb#L1183
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
# If the user installs Xcode-only, they have to approve the
|
86
|
+
# license or no "xc*" tool will work.
|
87
|
+
|
88
|
+
# prettier-ignore
|
89
|
+
if Platform::OS == "darwin" && (`/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?)
|
90
|
+
fail <<~MESSAGE
|
91
|
+
You have not agreed to the Xcode license and so we are unable to build the native agent.
|
92
|
+
To resolve this, you can agree to the license by opening Xcode.app or running:
|
93
|
+
sudo xcodebuild -license
|
94
|
+
MESSAGE
|
90
95
|
end
|
91
96
|
|
92
97
|
#
|
93
98
|
# === Setup paths
|
94
99
|
#
|
95
|
-
root
|
96
|
-
hdrpath
|
97
|
-
libpath
|
98
|
-
libskylight
|
99
|
-
libskylight_yml
|
100
|
+
root = File.expand_path(__dir__)
|
101
|
+
hdrpath = File.expand_path(SKYLIGHT_HDR_PATH)
|
102
|
+
libpath = File.expand_path(SKYLIGHT_LIB_PATH)
|
103
|
+
libskylight = File.expand_path("libskylight.#{Platform.libext}", libpath)
|
104
|
+
libskylight_yml = File.expand_path("libskylight.yml", root)
|
100
105
|
skylight_dlopen_h = File.expand_path("skylight_dlopen.h", hdrpath)
|
101
106
|
skylight_dlopen_c = File.expand_path("skylight_dlopen.c", hdrpath)
|
102
107
|
|
103
108
|
LOG.info "SKYLIGHT_HDR_PATH=#{hdrpath}; SKYLIGHT_LIB_PATH=#{libpath}"
|
104
109
|
|
105
|
-
LOG.info "file exists; path=#{libskylight}" if File.
|
106
|
-
LOG.info "file exists; path=#{skylight_dlopen_c}" if File.
|
107
|
-
LOG.info "file exists; path=#{skylight_dlopen_h}" if File.
|
110
|
+
LOG.info "file exists; path=#{libskylight}" if File.exist?(libskylight)
|
111
|
+
LOG.info "file exists; path=#{skylight_dlopen_c}" if File.exist?(skylight_dlopen_c)
|
112
|
+
LOG.info "file exists; path=#{skylight_dlopen_h}" if File.exist?(skylight_dlopen_h)
|
108
113
|
|
109
114
|
# If libskylight is not present, fetch it
|
110
115
|
if !File.exist?(libskylight) && !File.exist?(skylight_dlopen_c) && !File.exist?(skylight_dlopen_h)
|
111
|
-
|
112
|
-
fail "libskylight.#{LIBEXT} not found -- remote download disabled; aborting install"
|
113
|
-
end
|
116
|
+
fail "libskylight.#{LIBEXT} not found -- remote download disabled; aborting install" unless SKYLIGHT_FETCH_LIB
|
114
117
|
|
115
118
|
# Ensure that libskylight.yml is present and load it
|
116
|
-
unless File.exist?(libskylight_yml)
|
117
|
-
fail "`#{libskylight_yml}` does not exist"
|
118
|
-
end
|
119
|
+
fail "`#{libskylight_yml}` does not exist" unless File.exist?(libskylight_yml)
|
119
120
|
|
120
|
-
unless libskylight_info = YAML.load_file(libskylight_yml)
|
121
|
+
unless (libskylight_info = YAML.load_file(libskylight_yml))
|
121
122
|
fail "`#{libskylight_yml}` does not contain data"
|
122
123
|
end
|
123
124
|
|
124
|
-
if version = SKYLIGHT_VERSION
|
125
|
-
unless checksum = SKYLIGHT_CHECKSUM
|
125
|
+
if (version = SKYLIGHT_VERSION)
|
126
|
+
unless (checksum = SKYLIGHT_CHECKSUM)
|
126
127
|
fail "no checksum provided when using custom version"
|
127
128
|
end
|
129
|
+
elsif (platform_info = libskylight_info[Platform.tuple])
|
130
|
+
unless (version = platform_info["version"])
|
131
|
+
fail "libskylight version missing from `#{libskylight_yml}`; platform=#{Platform.tuple}"
|
132
|
+
end
|
133
|
+
|
134
|
+
unless (checksum = platform_info["checksum"])
|
135
|
+
fail "checksum missing from `#{libskylight_yml}`; platform=#{Platform.tuple}"
|
136
|
+
end
|
128
137
|
else
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
unless checksums = libskylight_info["checksums"]
|
143
|
-
fail "libskylight checksums missing from `#{libskylight_yml}`"
|
144
|
-
end
|
145
|
-
|
146
|
-
unless checksum = checksums[Platform.tuple]
|
147
|
-
fail "no checksum entry for requested architecture -- " \
|
148
|
-
"this probably means the requested architecture is not supported; " \
|
149
|
-
"platform=#{Platform.tuple}; available=#{checksums.keys}", :info
|
150
|
-
end
|
138
|
+
unless (version = libskylight_info["version"])
|
139
|
+
fail "libskylight version missing from `#{libskylight_yml}`"
|
140
|
+
end
|
141
|
+
|
142
|
+
unless (checksums = libskylight_info["checksums"])
|
143
|
+
fail "libskylight checksums missing from `#{libskylight_yml}`"
|
144
|
+
end
|
145
|
+
|
146
|
+
unless (checksum = checksums[Platform.tuple])
|
147
|
+
fail "no checksum entry for requested architecture -- " \
|
148
|
+
"this probably means the requested architecture is not supported; " \
|
149
|
+
"platform=#{Platform.tuple}; available=#{checksums.keys}",
|
150
|
+
:info
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
154
|
begin
|
155
|
-
res =
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
155
|
+
res =
|
156
|
+
Skylight::NativeExtFetcher.fetch(
|
157
|
+
source: SKYLIGHT_SOURCE_URL,
|
158
|
+
version: version,
|
159
|
+
target: hdrpath,
|
160
|
+
checksum: checksum,
|
161
|
+
arch: Platform.tuple,
|
162
|
+
required: SKYLIGHT_REQUIRED,
|
163
|
+
platform: Platform.tuple,
|
164
|
+
logger: LOG
|
165
|
+
)
|
166
|
+
|
167
|
+
fail "could not fetch archive -- aborting skylight native extension build" unless res
|
168
168
|
|
169
169
|
# Move skylightd & libskylight to appropriate directory
|
170
170
|
if hdrpath != libpath
|
@@ -172,15 +172,11 @@ if !File.exist?(libskylight) && !File.exist?(skylight_dlopen_c) && !File.exist?(
|
|
172
172
|
FileUtils.mkdir_p libpath
|
173
173
|
|
174
174
|
# Move
|
175
|
-
FileUtils.mv "#{hdrpath}/libskylight.#{Platform.libext}",
|
176
|
-
"#{libpath}/libskylight.#{Platform.libext}",
|
177
|
-
:force => true
|
175
|
+
FileUtils.mv "#{hdrpath}/libskylight.#{Platform.libext}", "#{libpath}/libskylight.#{Platform.libext}", force: true
|
178
176
|
|
179
|
-
FileUtils.mv "#{hdrpath}/skylightd",
|
180
|
-
"#{libpath}/skylightd",
|
181
|
-
:force => true
|
177
|
+
FileUtils.mv "#{hdrpath}/skylightd", "#{libpath}/skylightd", force: true
|
182
178
|
end
|
183
|
-
rescue => e
|
179
|
+
rescue StandardError => e
|
184
180
|
fail "unable to fetch native extension; msg=#{e.message}\n#{e.backtrace.join("\n")}"
|
185
181
|
end
|
186
182
|
end
|
@@ -192,35 +188,33 @@ end
|
|
192
188
|
#
|
193
189
|
|
194
190
|
def find_file(file, root = nil)
|
195
|
-
path = File.expand_path(file, root ||
|
191
|
+
path = File.expand_path(file, root || ".")
|
196
192
|
|
197
|
-
unless File.exist?(path)
|
198
|
-
fail "#{file} missing; path=#{root}"
|
199
|
-
end
|
193
|
+
fail "#{file} missing; path=#{root}" unless File.exist?(path)
|
200
194
|
end
|
201
195
|
|
202
|
-
$VPATH
|
196
|
+
$VPATH << libpath
|
203
197
|
|
204
198
|
# Where the ruby binding src is
|
205
|
-
SRC_PATH = File.expand_path(
|
199
|
+
SRC_PATH = File.expand_path(__dir__)
|
206
200
|
|
207
201
|
$srcs = Dir[File.expand_path("*.c", SRC_PATH)].map { |f| File.basename(f) }
|
208
202
|
|
209
203
|
# If the native agent support files were downloaded to a different directory,
|
210
204
|
# explicitly the file to the list of sources.
|
211
|
-
unless $srcs.include?(
|
205
|
+
unless $srcs.include?("skylight_dlopen.c")
|
212
206
|
$srcs << "skylight_dlopen.c" # From libskylight dist
|
213
207
|
end
|
214
208
|
|
215
209
|
# Make sure that the files are present
|
216
|
-
find_file
|
217
|
-
find_file
|
218
|
-
find_header
|
219
|
-
|
210
|
+
find_file "skylight_dlopen.h", hdrpath
|
211
|
+
find_file "skylight_dlopen.c", hdrpath
|
212
|
+
find_header "skylight_dlopen.h", hdrpath
|
213
|
+
fail "could not create Makefile; dlfcn.h missing" unless have_header "dlfcn.h"
|
220
214
|
|
221
215
|
# For escaping the GVL
|
222
|
-
unless have_func(
|
223
|
-
|
216
|
+
unless have_func("rb_thread_call_without_gvl", "ruby/thread.h")
|
217
|
+
abort "Ruby is unexpectedly missing rb_thread_call_without_gvl. This should not happen."
|
224
218
|
end
|
225
219
|
|
226
220
|
# Previous comment stated:
|
@@ -230,11 +224,9 @@ end
|
|
230
224
|
# flag can cause issues for some customers we're turning it off by default. However,
|
231
225
|
# in development and CI, we still have the option of turning it back on to help catch
|
232
226
|
# potential issues.
|
233
|
-
if SKYLIGHT_EXT_STRICT
|
234
|
-
$CFLAGS << " -Werror"
|
235
|
-
end
|
227
|
+
$CFLAGS << " -Werror" if SKYLIGHT_EXT_STRICT
|
236
228
|
|
237
|
-
checking_for
|
229
|
+
checking_for "fast thread local storage" do
|
238
230
|
if try_compile("__thread int foo;")
|
239
231
|
$defs << "-DHAVE_FAST_TLS"
|
240
232
|
true
|
@@ -247,7 +239,11 @@ $CFLAGS << " -std=c99 -Wall -fno-strict-aliasing"
|
|
247
239
|
# Allow stricter checks to be turned on for development or debugging
|
248
240
|
if SKYLIGHT_EXT_STRICT
|
249
241
|
$CFLAGS << " -Wextra"
|
242
|
+
|
243
|
+
# Enabling unused-parameter causes failures in Ruby 2.6+
|
244
|
+
# ruby/ruby.h:2186:35: error: unused parameter 'allow_transient'
|
245
|
+
$CFLAGS << " -Wno-error=unused-parameter"
|
250
246
|
end
|
251
247
|
|
252
248
|
# TODO: Compute the relative path to the location
|
253
|
-
create_makefile
|
249
|
+
create_makefile "skylight_native", File.expand_path(__dir__) # or fail "could not create makefile"
|
data/ext/libskylight.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
version: "
|
1
|
+
version: "5.1.0-cd7d6af"
|
2
2
|
checksums:
|
3
|
-
x86-linux:
|
4
|
-
x86_64-linux:
|
5
|
-
x86_64-linux-musl:
|
6
|
-
x86_64-darwin:
|
7
|
-
|
3
|
+
x86-linux: "921381c014b87e67fa2049e9891377f737b5abb10963228ddcd65caede7b58d2"
|
4
|
+
x86_64-linux: "e89f0ec3f39ecca060b757fcd1b9d8f38e5846f65579785454bb69a968e8528f"
|
5
|
+
x86_64-linux-musl: "78239bc7581c124c2a00cfbc42ec6cf73e7ed280ed1a27d85bb915531a683f1a"
|
6
|
+
x86_64-darwin: "faa7363ada4bf476511f6700856fd91b9d61fed055297417ce41d83aa11fe07c"
|
7
|
+
aarch64-linux: "e172515a6f7923552e842d21319b3630bdc6e264b6a434b43d2db682dcde18cc"
|
8
|
+
aarch64-linux-musl: "1665adf149bd2c12e409f387de5d796ef9e55d4cfd9a886f69c42cab59a51926"
|
9
|
+
aarch64-darwin: "027bec103668e89f318b55ddc2a48ca5c84c7a6dcd1dd273cc9b7b46d918ef12"
|