skylight 4.2.2 → 5.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/CONTRIBUTING.md +1 -7
- data/ext/extconf.rb +6 -5
- data/ext/libskylight.yml +5 -6
- data/ext/skylight_native.c +24 -100
- data/lib/skylight.rb +204 -14
- data/lib/skylight/api.rb +7 -3
- data/lib/skylight/cli.rb +4 -3
- data/lib/skylight/cli/doctor.rb +13 -14
- data/lib/skylight/cli/merger.rb +6 -4
- data/lib/skylight/config.rb +604 -127
- data/lib/skylight/deprecation.rb +17 -0
- data/lib/skylight/errors.rb +17 -2
- data/lib/skylight/extensions.rb +107 -0
- data/lib/skylight/extensions/source_location.rb +280 -0
- data/lib/skylight/formatters/http.rb +19 -0
- data/lib/skylight/gc.rb +109 -0
- data/lib/skylight/helpers.rb +18 -2
- data/lib/skylight/instrumenter.rb +326 -15
- data/lib/skylight/middleware.rb +138 -1
- data/lib/skylight/native.rb +51 -1
- data/lib/skylight/native_ext_fetcher.rb +4 -3
- data/lib/skylight/normalizers.rb +151 -0
- data/lib/skylight/normalizers/action_controller/process_action.rb +69 -0
- data/lib/skylight/normalizers/action_controller/send_file.rb +50 -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 +86 -0
- data/lib/skylight/normalizers/active_model_serializers/render.rb +28 -0
- data/lib/skylight/normalizers/active_record/instantiation.rb +16 -0
- data/lib/skylight/normalizers/active_record/sql.rb +12 -0
- data/lib/skylight/normalizers/active_storage.rb +30 -0
- data/lib/skylight/normalizers/active_support/cache.rb +22 -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 +46 -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 +32 -0
- data/lib/skylight/normalizers/elasticsearch/request.rb +20 -0
- data/lib/skylight/normalizers/faraday/request.rb +40 -0
- data/lib/skylight/normalizers/grape/endpoint.rb +34 -0
- data/lib/skylight/normalizers/grape/endpoint_render.rb +25 -0
- data/lib/skylight/normalizers/grape/endpoint_run.rb +41 -0
- data/lib/skylight/normalizers/grape/endpoint_run_filters.rb +22 -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 +132 -0
- data/lib/skylight/normalizers/render.rb +81 -0
- data/lib/skylight/normalizers/sequel/sql.rb +12 -0
- data/lib/skylight/normalizers/sql.rb +45 -0
- data/lib/skylight/probes.rb +181 -0
- data/lib/skylight/probes/action_controller.rb +48 -0
- data/lib/skylight/probes/action_dispatch.rb +2 -0
- data/lib/skylight/probes/action_dispatch/request_id.rb +29 -0
- data/lib/skylight/probes/action_dispatch/routing/route_set.rb +28 -0
- data/lib/skylight/probes/action_view.rb +43 -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/delayed_job.rb +148 -0
- data/lib/skylight/probes/elasticsearch.rb +38 -0
- data/lib/skylight/probes/excon.rb +25 -0
- data/lib/skylight/probes/excon/middleware.rb +66 -0
- data/lib/skylight/probes/faraday.rb +23 -0
- data/lib/skylight/probes/graphql.rb +43 -0
- data/lib/skylight/probes/httpclient.rb +44 -0
- data/lib/skylight/probes/middleware.rb +126 -0
- data/lib/skylight/probes/mongo.rb +163 -0
- data/lib/skylight/probes/mongoid.rb +13 -0
- data/lib/skylight/probes/net_http.rb +54 -0
- data/lib/skylight/probes/redis.rb +60 -0
- data/lib/skylight/probes/sequel.rb +33 -0
- data/lib/skylight/probes/sinatra.rb +63 -0
- data/lib/skylight/probes/sinatra_add_middleware.rb +10 -10
- data/lib/skylight/probes/tilt.rb +27 -0
- data/lib/skylight/railtie.rb +162 -18
- data/lib/skylight/sidekiq.rb +48 -0
- data/lib/skylight/subscriber.rb +110 -0
- data/lib/skylight/test.rb +146 -0
- data/lib/skylight/trace.rb +305 -10
- data/lib/skylight/user_config.rb +61 -0
- data/lib/skylight/util.rb +12 -0
- data/lib/skylight/util/allocation_free.rb +26 -0
- data/lib/skylight/util/clock.rb +56 -0
- data/lib/skylight/util/component.rb +5 -2
- data/lib/skylight/util/deploy.rb +7 -10
- data/lib/skylight/util/gzip.rb +20 -0
- data/lib/skylight/util/http.rb +5 -11
- data/lib/skylight/util/instrumenter_method.rb +26 -0
- data/lib/skylight/util/logging.rb +138 -0
- data/lib/skylight/util/lru_cache.rb +40 -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 +68 -0
- metadata +117 -19
@@ -0,0 +1,40 @@
|
|
1
|
+
# Based on code by Sam Saffron: https://stackoverflow.com/a/16161783/181916
|
2
|
+
module Skylight
|
3
|
+
module Util
|
4
|
+
class LruCache
|
5
|
+
def initialize(max_size)
|
6
|
+
@max_size = max_size
|
7
|
+
@data = {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def max_size=(size)
|
11
|
+
raise ArgumentError, :max_size if @max_size < 1
|
12
|
+
|
13
|
+
@max_size = size
|
14
|
+
@data.shift while @data.size > @max_size
|
15
|
+
end
|
16
|
+
|
17
|
+
# Individual hash operations here are atomic in MRI.
|
18
|
+
def fetch(key)
|
19
|
+
found = true
|
20
|
+
value = @data.delete(key) { found = false }
|
21
|
+
|
22
|
+
if !found && block_given?
|
23
|
+
value = yield
|
24
|
+
end
|
25
|
+
|
26
|
+
@data[key] = value if value
|
27
|
+
|
28
|
+
if !found && value && @data.length > @max_size
|
29
|
+
@data.shift
|
30
|
+
end
|
31
|
+
|
32
|
+
value
|
33
|
+
end
|
34
|
+
|
35
|
+
def clear
|
36
|
+
@data.clear
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/skylight/version.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
1
|
module Skylight
|
2
|
-
|
2
|
+
# pre-release versions should be given here as "5.0.0-alpha"
|
3
|
+
# for compatibility with semver when it is parsed by the rust agent.
|
4
|
+
# This string will be transformed in the gemspec to "5.0.0.alpha"
|
5
|
+
# to conform with rubygems.
|
6
|
+
VERSION = "5.0.0-beta2".freeze
|
3
7
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Skylight
|
2
|
+
# @api private
|
3
|
+
module VM
|
4
|
+
if defined?(JRUBY_VERSION)
|
5
|
+
|
6
|
+
# This doesn't quite work as we would like it. I believe that the GC
|
7
|
+
# statistics includes time that is not stop-the-world, this does not
|
8
|
+
# necessarily take time away from the application.
|
9
|
+
#
|
10
|
+
# require 'java'
|
11
|
+
# class GC
|
12
|
+
# def initialize
|
13
|
+
# @factory = Java::JavaLangManagement::ManagementFactory
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# def enable
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def total_time
|
20
|
+
# res = 0.0
|
21
|
+
#
|
22
|
+
# @factory.garbage_collector_mx_beans.each do |mx|
|
23
|
+
# res += (mx.collection_time.to_f / 1_000.0)
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# res
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
elsif defined?(::GC::Profiler)
|
31
|
+
|
32
|
+
class GC
|
33
|
+
def initialize
|
34
|
+
@total = 0
|
35
|
+
end
|
36
|
+
|
37
|
+
def enable
|
38
|
+
::GC::Profiler.enable
|
39
|
+
end
|
40
|
+
|
41
|
+
def total_time
|
42
|
+
# Reported in seconds
|
43
|
+
run = (::GC::Profiler.total_time * 1_000_000).to_i
|
44
|
+
|
45
|
+
if run > 0
|
46
|
+
::GC::Profiler.clear
|
47
|
+
end
|
48
|
+
|
49
|
+
@total += run
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
# Fallback
|
56
|
+
unless defined?(VM::GC)
|
57
|
+
|
58
|
+
class GC
|
59
|
+
def enable; end
|
60
|
+
|
61
|
+
def total_time
|
62
|
+
0
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skylight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tilde, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: beefcake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 13.0.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 13.0.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake-compiler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.1.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.1.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.79.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.79.0
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: timecop
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +178,7 @@ dependencies:
|
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
180
|
version: '0'
|
167
|
-
description:
|
181
|
+
description:
|
168
182
|
email:
|
169
183
|
- engineering@tilde.io
|
170
184
|
executables:
|
@@ -193,20 +207,103 @@ files:
|
|
193
207
|
- lib/skylight/cli/merger.rb
|
194
208
|
- lib/skylight/config.rb
|
195
209
|
- lib/skylight/data/cacert.pem
|
210
|
+
- lib/skylight/deprecation.rb
|
196
211
|
- lib/skylight/errors.rb
|
212
|
+
- lib/skylight/extensions.rb
|
213
|
+
- lib/skylight/extensions/source_location.rb
|
214
|
+
- lib/skylight/formatters/http.rb
|
215
|
+
- lib/skylight/gc.rb
|
197
216
|
- lib/skylight/helpers.rb
|
198
217
|
- lib/skylight/instrumenter.rb
|
199
218
|
- lib/skylight/middleware.rb
|
200
219
|
- lib/skylight/native.rb
|
201
220
|
- lib/skylight/native_ext_fetcher.rb
|
221
|
+
- lib/skylight/normalizers.rb
|
222
|
+
- lib/skylight/normalizers/action_controller/process_action.rb
|
223
|
+
- lib/skylight/normalizers/action_controller/send_file.rb
|
224
|
+
- lib/skylight/normalizers/action_dispatch/process_middleware.rb
|
225
|
+
- lib/skylight/normalizers/action_dispatch/route_set.rb
|
226
|
+
- lib/skylight/normalizers/action_view/render_collection.rb
|
227
|
+
- lib/skylight/normalizers/action_view/render_layout.rb
|
228
|
+
- lib/skylight/normalizers/action_view/render_partial.rb
|
229
|
+
- lib/skylight/normalizers/action_view/render_template.rb
|
230
|
+
- lib/skylight/normalizers/active_job/perform.rb
|
231
|
+
- lib/skylight/normalizers/active_model_serializers/render.rb
|
232
|
+
- lib/skylight/normalizers/active_record/instantiation.rb
|
233
|
+
- lib/skylight/normalizers/active_record/sql.rb
|
234
|
+
- lib/skylight/normalizers/active_storage.rb
|
235
|
+
- lib/skylight/normalizers/active_support/cache.rb
|
236
|
+
- lib/skylight/normalizers/active_support/cache_clear.rb
|
237
|
+
- lib/skylight/normalizers/active_support/cache_decrement.rb
|
238
|
+
- lib/skylight/normalizers/active_support/cache_delete.rb
|
239
|
+
- lib/skylight/normalizers/active_support/cache_exist.rb
|
240
|
+
- lib/skylight/normalizers/active_support/cache_fetch_hit.rb
|
241
|
+
- lib/skylight/normalizers/active_support/cache_generate.rb
|
242
|
+
- lib/skylight/normalizers/active_support/cache_increment.rb
|
243
|
+
- lib/skylight/normalizers/active_support/cache_read.rb
|
244
|
+
- lib/skylight/normalizers/active_support/cache_read_multi.rb
|
245
|
+
- lib/skylight/normalizers/active_support/cache_write.rb
|
246
|
+
- lib/skylight/normalizers/coach/handler_finish.rb
|
247
|
+
- lib/skylight/normalizers/coach/middleware_finish.rb
|
248
|
+
- lib/skylight/normalizers/couch_potato/query.rb
|
249
|
+
- lib/skylight/normalizers/data_mapper/sql.rb
|
250
|
+
- lib/skylight/normalizers/default.rb
|
251
|
+
- lib/skylight/normalizers/elasticsearch/request.rb
|
252
|
+
- lib/skylight/normalizers/faraday/request.rb
|
253
|
+
- lib/skylight/normalizers/grape/endpoint.rb
|
254
|
+
- lib/skylight/normalizers/grape/endpoint_render.rb
|
255
|
+
- lib/skylight/normalizers/grape/endpoint_run.rb
|
256
|
+
- lib/skylight/normalizers/grape/endpoint_run_filters.rb
|
257
|
+
- lib/skylight/normalizers/grape/format_response.rb
|
258
|
+
- lib/skylight/normalizers/graphiti/render.rb
|
259
|
+
- lib/skylight/normalizers/graphiti/resolve.rb
|
260
|
+
- lib/skylight/normalizers/graphql/base.rb
|
261
|
+
- lib/skylight/normalizers/render.rb
|
262
|
+
- lib/skylight/normalizers/sequel/sql.rb
|
263
|
+
- lib/skylight/normalizers/sql.rb
|
264
|
+
- lib/skylight/probes.rb
|
265
|
+
- lib/skylight/probes/action_controller.rb
|
266
|
+
- lib/skylight/probes/action_dispatch.rb
|
267
|
+
- lib/skylight/probes/action_dispatch/request_id.rb
|
268
|
+
- lib/skylight/probes/action_dispatch/routing/route_set.rb
|
269
|
+
- lib/skylight/probes/action_view.rb
|
270
|
+
- lib/skylight/probes/active_job.rb
|
271
|
+
- lib/skylight/probes/active_job_enqueue.rb
|
272
|
+
- lib/skylight/probes/active_model_serializers.rb
|
273
|
+
- lib/skylight/probes/delayed_job.rb
|
274
|
+
- lib/skylight/probes/elasticsearch.rb
|
275
|
+
- lib/skylight/probes/excon.rb
|
276
|
+
- lib/skylight/probes/excon/middleware.rb
|
277
|
+
- lib/skylight/probes/faraday.rb
|
278
|
+
- lib/skylight/probes/graphql.rb
|
279
|
+
- lib/skylight/probes/httpclient.rb
|
280
|
+
- lib/skylight/probes/middleware.rb
|
281
|
+
- lib/skylight/probes/mongo.rb
|
282
|
+
- lib/skylight/probes/mongoid.rb
|
283
|
+
- lib/skylight/probes/net_http.rb
|
284
|
+
- lib/skylight/probes/redis.rb
|
285
|
+
- lib/skylight/probes/sequel.rb
|
286
|
+
- lib/skylight/probes/sinatra.rb
|
202
287
|
- lib/skylight/probes/sinatra_add_middleware.rb
|
288
|
+
- lib/skylight/probes/tilt.rb
|
203
289
|
- lib/skylight/railtie.rb
|
290
|
+
- lib/skylight/sidekiq.rb
|
204
291
|
- lib/skylight/sinatra.rb
|
292
|
+
- lib/skylight/subscriber.rb
|
293
|
+
- lib/skylight/test.rb
|
205
294
|
- lib/skylight/trace.rb
|
295
|
+
- lib/skylight/user_config.rb
|
296
|
+
- lib/skylight/util.rb
|
297
|
+
- lib/skylight/util/allocation_free.rb
|
298
|
+
- lib/skylight/util/clock.rb
|
206
299
|
- lib/skylight/util/component.rb
|
207
300
|
- lib/skylight/util/deploy.rb
|
301
|
+
- lib/skylight/util/gzip.rb
|
208
302
|
- lib/skylight/util/hostname.rb
|
209
303
|
- lib/skylight/util/http.rb
|
304
|
+
- lib/skylight/util/instrumenter_method.rb
|
305
|
+
- lib/skylight/util/logging.rb
|
306
|
+
- lib/skylight/util/lru_cache.rb
|
210
307
|
- lib/skylight/util/platform.rb
|
211
308
|
- lib/skylight/util/proxy.rb
|
212
309
|
- lib/skylight/util/ssl.rb
|
@@ -250,11 +347,12 @@ files:
|
|
250
347
|
- lib/skylight/vendor/cli/thor/util.rb
|
251
348
|
- lib/skylight/vendor/cli/thor/version.rb
|
252
349
|
- lib/skylight/version.rb
|
350
|
+
- lib/skylight/vm/gc.rb
|
253
351
|
homepage: https://www.skylight.io
|
254
352
|
licenses:
|
255
353
|
- Nonstandard
|
256
354
|
metadata: {}
|
257
|
-
post_install_message:
|
355
|
+
post_install_message:
|
258
356
|
rdoc_options: []
|
259
357
|
require_paths:
|
260
358
|
- lib
|
@@ -262,15 +360,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
360
|
requirements:
|
263
361
|
- - ">="
|
264
362
|
- !ruby/object:Gem::Version
|
265
|
-
version: '2.
|
363
|
+
version: '2.5'
|
266
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
365
|
requirements:
|
268
|
-
- - "
|
366
|
+
- - ">"
|
269
367
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
368
|
+
version: 1.3.1
|
271
369
|
requirements: []
|
272
|
-
rubygems_version: 3.
|
273
|
-
signing_key:
|
370
|
+
rubygems_version: 3.1.2
|
371
|
+
signing_key:
|
274
372
|
specification_version: 4
|
275
373
|
summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.
|
276
374
|
test_files: []
|