skylight 5.0.0.beta5 → 5.1.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +401 -369
  3. data/CLA.md +1 -1
  4. data/CONTRIBUTING.md +1 -1
  5. data/LICENSE.md +7 -17
  6. data/README.md +1 -1
  7. data/ext/extconf.rb +42 -54
  8. data/ext/libskylight.yml +9 -6
  9. data/lib/skylight.rb +20 -30
  10. data/lib/skylight/api.rb +22 -18
  11. data/lib/skylight/cli.rb +47 -46
  12. data/lib/skylight/cli/doctor.rb +50 -50
  13. data/lib/skylight/cli/helpers.rb +19 -19
  14. data/lib/skylight/cli/merger.rb +141 -139
  15. data/lib/skylight/config.rb +267 -310
  16. data/lib/skylight/deprecation.rb +4 -4
  17. data/lib/skylight/errors.rb +3 -4
  18. data/lib/skylight/extensions.rb +17 -29
  19. data/lib/skylight/extensions/source_location.rb +128 -128
  20. data/lib/skylight/formatters/http.rb +1 -3
  21. data/lib/skylight/gc.rb +30 -40
  22. data/lib/skylight/helpers.rb +46 -26
  23. data/lib/skylight/instrumenter.rb +25 -18
  24. data/lib/skylight/middleware.rb +31 -35
  25. data/lib/skylight/native.rb +8 -10
  26. data/lib/skylight/native_ext_fetcher.rb +10 -12
  27. data/lib/skylight/normalizers.rb +43 -39
  28. data/lib/skylight/normalizers/action_controller/process_action.rb +24 -25
  29. data/lib/skylight/normalizers/action_controller/send_file.rb +7 -6
  30. data/lib/skylight/normalizers/action_dispatch/route_set.rb +7 -7
  31. data/lib/skylight/normalizers/active_job/perform.rb +48 -44
  32. data/lib/skylight/normalizers/active_model_serializers/render.rb +7 -3
  33. data/lib/skylight/normalizers/active_storage.rb +11 -13
  34. data/lib/skylight/normalizers/active_support/cache.rb +1 -12
  35. data/lib/skylight/normalizers/coach/handler_finish.rb +1 -3
  36. data/lib/skylight/normalizers/default.rb +1 -9
  37. data/lib/skylight/normalizers/faraday/request.rb +1 -3
  38. data/lib/skylight/normalizers/grape/endpoint.rb +13 -19
  39. data/lib/skylight/normalizers/grape/endpoint_run.rb +16 -18
  40. data/lib/skylight/normalizers/grape/endpoint_run_filters.rb +1 -3
  41. data/lib/skylight/normalizers/graphql/base.rb +23 -28
  42. data/lib/skylight/normalizers/render.rb +19 -21
  43. data/lib/skylight/normalizers/shrine.rb +15 -17
  44. data/lib/skylight/normalizers/sql.rb +4 -4
  45. data/lib/skylight/probes.rb +38 -46
  46. data/lib/skylight/probes/action_controller.rb +32 -28
  47. data/lib/skylight/probes/action_dispatch/request_id.rb +9 -5
  48. data/lib/skylight/probes/action_dispatch/routing/route_set.rb +7 -5
  49. data/lib/skylight/probes/action_view.rb +9 -10
  50. data/lib/skylight/probes/active_job_enqueue.rb +3 -9
  51. data/lib/skylight/probes/active_model_serializers.rb +8 -8
  52. data/lib/skylight/probes/delayed_job.rb +37 -42
  53. data/lib/skylight/probes/elasticsearch.rb +3 -5
  54. data/lib/skylight/probes/excon.rb +1 -1
  55. data/lib/skylight/probes/excon/middleware.rb +22 -23
  56. data/lib/skylight/probes/graphql.rb +2 -7
  57. data/lib/skylight/probes/middleware.rb +14 -5
  58. data/lib/skylight/probes/mongo.rb +83 -91
  59. data/lib/skylight/probes/net_http.rb +1 -1
  60. data/lib/skylight/probes/redis.rb +5 -17
  61. data/lib/skylight/probes/sequel.rb +7 -11
  62. data/lib/skylight/probes/sinatra.rb +8 -5
  63. data/lib/skylight/probes/tilt.rb +2 -4
  64. data/lib/skylight/railtie.rb +121 -135
  65. data/lib/skylight/sidekiq.rb +4 -5
  66. data/lib/skylight/subscriber.rb +31 -33
  67. data/lib/skylight/test.rb +89 -84
  68. data/lib/skylight/trace.rb +121 -115
  69. data/lib/skylight/user_config.rb +14 -17
  70. data/lib/skylight/util/clock.rb +1 -0
  71. data/lib/skylight/util/component.rb +18 -21
  72. data/lib/skylight/util/deploy.rb +11 -13
  73. data/lib/skylight/util/http.rb +104 -105
  74. data/lib/skylight/util/logging.rb +4 -6
  75. data/lib/skylight/util/lru_cache.rb +2 -6
  76. data/lib/skylight/util/platform.rb +2 -6
  77. data/lib/skylight/util/ssl.rb +1 -25
  78. data/lib/skylight/version.rb +1 -1
  79. data/lib/skylight/vm/gc.rb +1 -9
  80. metadata +19 -5
@@ -19,15 +19,11 @@ module Skylight
19
19
  found = true
20
20
  value = @data.delete(key) { found = false }
21
21
 
22
- if !found && block_given?
23
- value = yield
24
- end
22
+ value = yield if !found && block_given?
25
23
 
26
24
  @data[key] = value if value
27
25
 
28
- if !found && value && @data.length > @max_size
29
- @data.shift
30
- end
26
+ @data.shift if !found && value && @data.length > @max_size
31
27
 
32
28
  value
33
29
  end
@@ -12,11 +12,7 @@ module Skylight
12
12
  # Ruby doesn't know that it's on a musl-based platform. `ldd` is the
13
13
  # only reliable way to detect musl that we've found.
14
14
  # See https://github.com/skylightio/skylight-ruby/issues/92
15
- if ENV["SKYLIGHT_MUSL"] || `ldd --version 2>&1` =~ /musl/
16
- "linux-musl"
17
- else
18
- "linux"
19
- end
15
+ ENV["SKYLIGHT_MUSL"] || `ldd --version 2>&1` =~ /musl/ ? "linux-musl" : "linux"
20
16
  when /darwin/
21
17
  "darwin"
22
18
  when /freebsd/
@@ -56,7 +52,7 @@ module Skylight
56
52
  "so"
57
53
  when /windows|cygwin/
58
54
  "dll"
59
- else # rubocop:disable Lint/DuplicateBranch
55
+ else
60
56
  "so"
61
57
  end
62
58
 
@@ -12,43 +12,19 @@ module Skylight
12
12
  if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
13
13
  f = OpenSSL::X509::DEFAULT_CERT_FILE
14
14
 
15
- if f && File.exist?(f)
16
- @ca_cert_file = f
17
- end
18
- end
19
- end
20
-
21
- def self.detect_ca_cert_dir!
22
- return nil if ENV["SKYLIGHT_FORCE_OWN_CERTS"]
23
-
24
- @ca_cert_dir = false
25
- if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
26
- d = OpenSSL::X509::DEFAULT_CERT_DIR
27
-
28
- if d && File.exist?(d)
29
- @ca_cert_dir = d
30
- end
15
+ @ca_cert_file = f if f && File.exist?(f)
31
16
  end
32
17
  end
33
18
 
34
19
  detect_ca_cert_file!
35
- detect_ca_cert_dir!
36
20
 
37
21
  def self.ca_cert_file?
38
22
  !!@ca_cert_file
39
23
  end
40
24
 
41
- def self.ca_cert_dir?
42
- !!@ca_cert_dir
43
- end
44
-
45
25
  def self.ca_cert_file_or_default
46
26
  @ca_cert_file || DEFAULT_CA_FILE
47
27
  end
48
-
49
- class << self
50
- attr_reader :ca_cert_dir
51
- end
52
28
  end
53
29
  end
54
30
  end
@@ -3,5 +3,5 @@ module Skylight
3
3
  # for compatibility with semver when it is parsed by the rust agent.
4
4
  # This string will be transformed in the gemspec to "5.0.0.alpha"
5
5
  # to conform with rubygems.
6
- VERSION = "5.0.0-beta5".freeze
6
+ VERSION = "5.1.0-beta3".freeze
7
7
  end
@@ -2,7 +2,6 @@ module Skylight
2
2
  # @api private
3
3
  module VM
4
4
  if defined?(JRUBY_VERSION)
5
-
6
5
  # This doesn't quite work as we would like it. I believe that the GC
7
6
  # statistics includes time that is not stop-the-world, this does not
8
7
  # necessarily take time away from the application.
@@ -26,9 +25,7 @@ module Skylight
26
25
  # res
27
26
  # end
28
27
  # end
29
-
30
28
  elsif defined?(::GC::Profiler)
31
-
32
29
  class GC
33
30
  def initialize
34
31
  @total = 0
@@ -42,19 +39,15 @@ module Skylight
42
39
  # Reported in seconds
43
40
  run = (::GC::Profiler.total_time * 1_000_000).to_i
44
41
 
45
- if run > 0
46
- ::GC::Profiler.clear
47
- end
42
+ ::GC::Profiler.clear if run > 0
48
43
 
49
44
  @total += run
50
45
  end
51
46
  end
52
-
53
47
  end
54
48
 
55
49
  # Fallback
56
50
  unless defined?(VM::GC)
57
-
58
51
  class GC
59
52
  def enable; end
60
53
 
@@ -62,7 +55,6 @@ module Skylight
62
55
  0
63
56
  end
64
57
  end
65
-
66
58
  end
67
59
  end
68
60
  end
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.0.0.beta5
4
+ version: 5.1.0.beta3
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-02-03 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -142,14 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.8.1
145
+ version: 1.15.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.8.1
152
+ version: 1.15.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.21.2
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.21.2
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: timecop
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -368,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
382
  - !ruby/object:Gem::Version
369
383
  version: 1.3.1
370
384
  requirements: []
371
- rubygems_version: 3.2.3
385
+ rubygems_version: 3.2.15
372
386
  signing_key:
373
387
  specification_version: 4
374
388
  summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.