skylight 4.2.3 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +420 -331
- data/CLA.md +1 -1
- data/CONTRIBUTING.md +2 -8
- data/ERRORS.md +3 -0
- data/LICENSE.md +7 -17
- data/README.md +1 -1
- data/ext/extconf.rb +61 -56
- data/ext/libskylight.yml +8 -6
- data/ext/skylight_native.c +26 -100
- data/lib/skylight/api.rb +32 -21
- data/lib/skylight/cli/doctor.rb +64 -65
- data/lib/skylight/cli/helpers.rb +19 -19
- data/lib/skylight/cli/merger.rb +142 -138
- data/lib/skylight/cli.rb +48 -46
- data/lib/skylight/config.rb +640 -201
- data/lib/skylight/data/cacert.pem +730 -1023
- data/lib/skylight/deprecation.rb +17 -0
- data/lib/skylight/errors.rb +26 -9
- 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 +81 -36
- data/lib/skylight/instrumenter.rb +336 -18
- data/lib/skylight/middleware.rb +147 -1
- data/lib/skylight/native.rb +60 -12
- data/lib/skylight/native_ext_fetcher.rb +13 -14
- 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 +36 -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 +156 -0
- data/lib/skylight/probes/mongoid.rb +13 -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 +51 -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 +173 -0
- data/lib/skylight/railtie.rb +166 -28
- data/lib/skylight/sidekiq.rb +47 -0
- data/lib/skylight/sinatra.rb +1 -1
- data/lib/skylight/subscriber.rb +130 -0
- data/lib/skylight/test.rb +147 -0
- data/lib/skylight/trace.rb +325 -22
- data/lib/skylight/user_config.rb +58 -0
- data/lib/skylight/util/allocation_free.rb +26 -0
- data/lib/skylight/util/clock.rb +57 -0
- data/lib/skylight/util/component.rb +22 -22
- data/lib/skylight/util/deploy.rb +19 -24
- data/lib/skylight/util/gzip.rb +20 -0
- data/lib/skylight/util/http.rb +106 -113
- 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 +3 -7
- data/lib/skylight/util/ssl.rb +1 -25
- 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 +201 -14
- metadata +134 -18
data/lib/skylight/cli.rb
CHANGED
@@ -28,12 +28,13 @@ module Skylight
|
|
28
28
|
Visit your app at https://www.skylight.io/app or remove config/skylight.yml
|
29
29
|
to set it up as a new app in Skylight.
|
30
30
|
OUT
|
31
|
+
|
31
32
|
return
|
32
33
|
end
|
33
34
|
|
34
35
|
res = api.create_app(app_name, token)
|
35
36
|
|
36
|
-
config[:application]
|
37
|
+
config[:application] = res.get("app.id")
|
37
38
|
config[:authentication] = res.get("app.token")
|
38
39
|
config.write(config_path)
|
39
40
|
|
@@ -60,7 +61,7 @@ module Skylight
|
|
60
61
|
rescue Api::CreateFailed => e
|
61
62
|
say "Could not create the application. Please run `bundle exec skylight doctor` for diagnostics.", :red
|
62
63
|
say e.to_s, :yellow
|
63
|
-
rescue Interrupt
|
64
|
+
rescue Interrupt # rubocop:disable Lint/SuppressedException
|
64
65
|
end
|
65
66
|
|
66
67
|
desc "disable_dev_warning", "Disables warning about running Skylight in development mode for all local apps"
|
@@ -71,7 +72,9 @@ module Skylight
|
|
71
72
|
say "Development mode warning disabled", :green
|
72
73
|
end
|
73
74
|
|
74
|
-
desc "disable_env_warning",
|
75
|
+
desc "disable_env_warning",
|
76
|
+
"Disables warning about running Skylight in environments not defined in " \
|
77
|
+
"config.skylight.environments"
|
75
78
|
def disable_env_warning
|
76
79
|
user_config.disable_env_warning = true
|
77
80
|
user_config.save
|
@@ -81,57 +84,56 @@ module Skylight
|
|
81
84
|
|
82
85
|
private
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
ensure
|
106
|
-
namefile.close
|
107
|
-
namefile.unlink
|
108
|
-
end
|
109
|
-
|
110
|
-
unless name
|
111
|
-
warn "Unable to determine Rails application name. Using directory name."
|
87
|
+
def app_name
|
88
|
+
@app_name ||=
|
89
|
+
begin
|
90
|
+
name = nil
|
91
|
+
|
92
|
+
if rails?
|
93
|
+
# Get the name in a process so that we don't pollute our environment here
|
94
|
+
# This is especially important since users may have things like WebMock that
|
95
|
+
# will prevent us from communicating with the Skylight API
|
96
|
+
begin
|
97
|
+
namefile = Tempfile.new("skylight-app-name")
|
98
|
+
|
99
|
+
# Windows appears to need double quotes for `rails runner`
|
100
|
+
`rails runner "File.open('#{namefile.path}', 'w') {|f| f.write(Rails.application.class.name) rescue '' }"`
|
101
|
+
name = namefile.read.split("::").first.underscore.titleize
|
102
|
+
name = nil if name.empty?
|
103
|
+
rescue StandardError => e
|
104
|
+
if ENV["DEBUG"]
|
105
|
+
puts e.class.name
|
106
|
+
puts e.to_s
|
107
|
+
puts e.backtrace.join("\n")
|
112
108
|
end
|
109
|
+
ensure
|
110
|
+
namefile.close
|
111
|
+
namefile.unlink
|
113
112
|
end
|
114
113
|
|
115
|
-
name
|
114
|
+
warn "Unable to determine Rails application name. Using directory name." unless name
|
116
115
|
end
|
117
|
-
end
|
118
116
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
117
|
+
name || File.basename(File.expand_path(".")).titleize
|
118
|
+
end
|
119
|
+
end
|
123
120
|
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
# Is this duplicated?
|
122
|
+
def relative_config_path
|
123
|
+
"config/skylight.yml"
|
124
|
+
end
|
127
125
|
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
def config_path
|
127
|
+
File.expand_path(relative_config_path)
|
128
|
+
end
|
131
129
|
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
def api
|
131
|
+
@api ||= Api.new(config)
|
132
|
+
end
|
133
|
+
|
134
|
+
def user_config
|
135
|
+
config.user_config
|
136
|
+
end
|
135
137
|
end
|
136
138
|
end
|
137
139
|
end
|