skylight 5.3.2 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f70688b41eae2aba12100dfdc0fa2376de752498b870b951a215779dfab6f402
4
- data.tar.gz: 07141a17727dd08c96059361ce86168ac45a34ff222ef8ebb77aa29ad6effce9
3
+ metadata.gz: eff8fe1dc5d710696a97b5e2a3cfe53eba04e34a9ded8c9b550bc82538b6dfbb
4
+ data.tar.gz: a1236552d1cee17eaf0c0aee7371e7f6f201ab6810c4721a7ac67dcfe1f70177
5
5
  SHA512:
6
- metadata.gz: 4cae620358ed7fa0eabad6464346899217813cdccacc68980a0abd6a4b31c0416b0b65b0d66b6cf7f7746f73ca0ff00e689b72011990d1482c012b22b8f5fdb5
7
- data.tar.gz: 75cfe4636a13c3fa194788f5153b114c816b249c2f57e3a7358df44a9fef4818fa452fe02268f4a01c4b4a7703bacff5394dd256c194de1c586cd5a38802c3e2
6
+ metadata.gz: e7a91c535de86e475c325c9a287c92754603e186e583691f4db240557a1d3fc9393ea0180c0e18273e86350c16562097b6040d709f91692340788b13c605a858
7
+ data.tar.gz: c0bbf8d365bf386a7e1a0ae858b8007cb4046416e91b69862b250c21938a72b725ad0b0f5f0d25ffc73fc4fb435dff705bcb50c00c416fcdf0bb58e9dbcf8cfc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 5.3.4 (October 17, 2022)
2
+
3
+ - [BUGFIX] Fix a middleware response method that was incompatible with Puma >= 6.
4
+ - [IMPROVEMENT] Improved support for Redis v5
5
+
6
+ ## 5.3.3 (July 13, 2022)
7
+
8
+ - [IMPROVEMENT] Track the original class/method name for Sidekiq delayed object proxies
9
+ - [BUGFIX] Fix `mongoid` probe not activating correctly
10
+ - [BUGFIX] Fix `mongo` probe not instrumenting clients created before Skylight initialization
11
+
1
12
  ## 5.3.2 (April 6, 2022)
2
13
 
3
14
  - [BUGFIX] Fix case-sensitivity issue when computing relative paths
data/ext/extconf.rb CHANGED
@@ -43,19 +43,19 @@ end
43
43
  include Skylight::Util
44
44
 
45
45
  SKYLIGHT_INSTALL_LOG = File.expand_path("install.log", __dir__)
46
- SKYLIGHT_REQUIRED = ENV.key?("SKYLIGHT_REQUIRED") && ENV["SKYLIGHT_REQUIRED"] !~ /^false$/i
47
- SKYLIGHT_FETCH_LIB = !ENV.key?("SKYLIGHT_FETCH_LIB") || ENV["SKYLIGHT_FETCH_LIB"] !~ /^false$/i
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
48
48
 
49
49
  # Directory where skylight.h exists
50
- SKYLIGHT_HDR_PATH = ENV["SKYLIGHT_HDR_PATH"] || ENV["SKYLIGHT_LIB_PATH"] || "."
50
+ SKYLIGHT_HDR_PATH = ENV.fetch("SKYLIGHT_HDR_PATH") { ENV.fetch("SKYLIGHT_LIB_PATH", ".") }
51
51
  SKYLIGHT_LIB_PATH =
52
- ENV["SKYLIGHT_LIB_PATH"] || File.expand_path("../../lib/skylight/native/#{Platform.tuple}", __FILE__)
52
+ ENV.fetch("SKYLIGHT_LIB_PATH") { File.expand_path("../../lib/skylight/native/#{Platform.tuple}", __FILE__) }
53
53
 
54
- SKYLIGHT_SOURCE_URL = ENV["SKYLIGHT_SOURCE_URL"]
55
- SKYLIGHT_VERSION = ENV["SKYLIGHT_VERSION"]
56
- SKYLIGHT_CHECKSUM = ENV["SKYLIGHT_CHECKSUM"]
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)
57
57
 
58
- SKYLIGHT_EXT_STRICT = ENV.key?("SKYLIGHT_EXT_STRICT") && ENV["SKYLIGHT_EXT_STRICT"] =~ /^true$/i
58
+ SKYLIGHT_EXT_STRICT = ENV.key?("SKYLIGHT_EXT_STRICT") && ENV.fetch("SKYLIGHT_EXT_STRICT", nil) =~ /^true$/i
59
59
 
60
60
  # Setup logger
61
61
  LOG = Logger.new(MultiIO.new($stdout, File.open(SKYLIGHT_INSTALL_LOG, "a")))
@@ -13,7 +13,7 @@ module Skylight
13
13
  end
14
14
 
15
15
  def respond_to_missing?(name, include_all = false)
16
- return false if name.to_s !~ /^to_ary$/
16
+ return false if name.to_s =~ /^to_ary$/
17
17
 
18
18
  @body.respond_to?(name, include_all)
19
19
  end
@@ -59,13 +59,13 @@ module Skylight
59
59
  end
60
60
 
61
61
  def self.libskylight_path
62
- ENV["SKYLIGHT_LIB_PATH"] || File.expand_path("../native/#{Util::Platform.tuple}", __FILE__)
62
+ ENV.fetch("SKYLIGHT_LIB_PATH") { File.expand_path("../native/#{Util::Platform.tuple}", __FILE__) }
63
63
  end
64
64
 
65
- skylight_required = ENV.key?("SKYLIGHT_REQUIRED") && ENV["SKYLIGHT_REQUIRED"] !~ /^false$/i
65
+ skylight_required = ENV.key?("SKYLIGHT_REQUIRED") && ENV.fetch("SKYLIGHT_REQUIRED", nil) !~ /^false$/i
66
66
 
67
67
  begin
68
- unless ENV.key?("SKYLIGHT_DISABLE_AGENT") && ENV["SKYLIGHT_DISABLE_AGENT"] !~ /^false$/i
68
+ unless ENV.key?("SKYLIGHT_DISABLE_AGENT") && ENV.fetch("SKYLIGHT_DISABLE_AGENT", nil) !~ /^false$/i
69
69
  lib = "#{libskylight_path}/libskylight.#{Util::Platform.libext}"
70
70
 
71
71
  if File.exist?(lib)
@@ -5,7 +5,20 @@ module Skylight
5
5
 
6
6
  class Probe
7
7
  def install
8
- ::Mongo::Monitoring::Global.subscribe(::Mongo::Monitoring::COMMAND, Subscriber.new)
8
+ subscriber = Subscriber.new
9
+
10
+ # From the mongo driver:
11
+ #
12
+ # > Global subscriptions must be established prior to creating
13
+ # > clients. When a client is constructed it copies subscribers from
14
+ # > the Global module; subsequent subscriptions or unsubscriptions
15
+ # > on the Global module have no effect on already created clients.
16
+ #
17
+ # So, for existing clients created before the Skylight initializer
18
+ # runs, we'll have to subscribe to those individually.
19
+ ::Mongoid::Clients.clients.each { |_name, client| client.subscribe(::Mongo::Monitoring::COMMAND, subscriber) }
20
+
21
+ ::Mongo::Monitoring::Global.subscribe(::Mongo::Monitoring::COMMAND, subscriber)
9
22
  end
10
23
  end
11
24
 
@@ -1,13 +1,6 @@
1
- module Skylight
2
- module Probes
3
- module Mongoid
4
- class Probe
5
- def install
6
- Skylight::Probes.probe(:mongo)
7
- end
8
- end
9
- end
10
-
11
- register(:mongoid, "Mongoid", "mongoid", Mongoid::Probe.new)
12
- end
13
- end
1
+ # Older versions of the mongoid uses the moped under-the-hood, while newer
2
+ # verions uses the official driver. It used to be that the the mongoid probe
3
+ # exists to detect and enable either one of those underlying probes, but at
4
+ # this point we no longer support moped, so this is now just an alias for the
5
+ # mongo probe.
6
+ require_relative "mongo"
@@ -20,6 +20,18 @@ module Skylight
20
20
  end
21
21
  end
22
22
 
23
+ module ClientInstrumentationV5
24
+ def call_v(command)
25
+ command_name = command[0]
26
+
27
+ return super if command_name == :auth
28
+
29
+ opts = { category: "db.redis.command", title: command_name.upcase.to_s, internal: true }
30
+
31
+ Skylight.instrument(opts) { super }
32
+ end
33
+ end
34
+
23
35
  module Instrumentation
24
36
  def pipelined(*)
25
37
  Skylight.instrument(PIPELINED_OPTS) { super }
@@ -40,7 +52,12 @@ module Skylight
40
52
  return
41
53
  end
42
54
 
43
- ::Redis::Client.prepend(ClientInstrumentation)
55
+ if ::Redis::Client.method_defined?(:call_v)
56
+ ::Redis::Client.prepend(ClientInstrumentationV5)
57
+ else
58
+ ::Redis::Client.prepend(ClientInstrumentation)
59
+ end
60
+
44
61
  ::Redis.prepend(Instrumentation)
45
62
  end
46
63
  end
@@ -153,7 +153,7 @@ module Skylight
153
153
  return false unless sk_config
154
154
 
155
155
  key = "SKYLIGHT_ENABLED"
156
- activate = ENV.key?(key) ? ENV[key] !~ /^false$/i : environments.include?(Rails.env.to_s)
156
+ activate = ENV.key?(key) ? ENV.fetch(key, nil) !~ /^false$/i : environments.include?(Rails.env.to_s)
157
157
 
158
158
  show_worker_activation_warning(sk_config) if activate
159
159
 
@@ -21,7 +21,7 @@ module Skylight
21
21
 
22
22
  def call(worker, job, queue)
23
23
  t { "Sidekiq middleware beginning trace" }
24
- title = job["wrapped"] || job["class"]
24
+ title = job["display_class"] || job["wrapped"] || job["class"]
25
25
 
26
26
  # TODO: Using hints here would be ideal but requires further refactoring
27
27
  meta =
@@ -18,7 +18,9 @@ module Skylight
18
18
  @config[:user_config_path] ||
19
19
  begin
20
20
  require "etc"
21
- home_dir = ENV["HOME"] || Etc.getpwuid.dir || (ENV["USER"] && File.expand_path("~#{ENV["USER"]}"))
21
+ home_dir =
22
+ ENV.fetch("HOME", nil) || Etc.getpwuid.dir ||
23
+ (ENV.fetch("USER", nil) && File.expand_path("~#{ENV.fetch("USER", nil)}"))
22
24
  if home_dir
23
25
  File.join(home_dir, ".skylight")
24
26
  else
@@ -31,7 +33,7 @@ module Skylight
31
33
  end
32
34
 
33
35
  def disable_dev_warning?
34
- disable_dev_warning || ENV["SKYLIGHT_DISABLE_DEV_WARNING"] =~ /^true$/i
36
+ disable_dev_warning || ENV.fetch("SKYLIGHT_DISABLE_DEV_WARNING", nil) =~ /^true$/i
35
37
  end
36
38
 
37
39
  def disable_env_warning?
@@ -12,7 +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
- ENV["SKYLIGHT_MUSL"] || `ldd --version 2>&1` =~ /musl/ ? "linux-musl" : "linux"
15
+ ENV.fetch("SKYLIGHT_MUSL") { `ldd --version 2>&1` =~ /musl/ } ? "linux-musl" : "linux"
16
16
  when /darwin/
17
17
  "darwin"
18
18
  when /freebsd/
@@ -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.3.2".freeze
6
+ VERSION = "5.3.4".freeze
7
7
  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.3.2
4
+ version: 5.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-06 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.1.1
103
+ version: 1.2.0
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.1.1
110
+ version: 1.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.26.1
145
+ version: 1.31.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.26.1
152
+ version: 1.31.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement