scout_apm 5.3.1 → 5.3.3
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 +4 -4
- data/CHANGELOG.markdown +8 -0
- data/gems/sidekiq.gemfile +1 -1
- data/lib/scout_apm/instrument_manager.rb +1 -0
- data/lib/scout_apm/instruments/redis.rb +1 -1
- data/lib/scout_apm/instruments/redis5.rb +59 -0
- data/lib/scout_apm/server_integrations/puma.rb +29 -1
- data/lib/scout_apm/version.rb +1 -1
- data/lib/scout_apm.rb +1 -0
- data/test/unit/instruments/redis_test.rb +4 -4
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1e83c44e949efe75ec1ee2c429b0596816c2b9f8e7c5416e7f3dd7243ef69c4
|
4
|
+
data.tar.gz: 9b8a870504f4b32729ddb85f999cf7af30f6aac4215d356caefda6db2349dfb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac045625ade6b059933ce82b1eaa014be50ce2eea7db34fb1e8a1f94145810c814bb95ba4cb8b70858547a3aaddebc812c8b3986e753f2f2304a7ae477a70974
|
7
|
+
data.tar.gz: 19c81bacc7df78bbae4b6c9a03007a4ce84ce6c2de230e0e0e6b937e7b8ef4885788f70b36bebcd9cc192ae3aba3b0a7899830cf5ce20182fb95d19a4d2d1843
|
data/CHANGELOG.markdown
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 5.3.3
|
4
|
+
|
5
|
+
* Fix double firing of Puma `on_worker_boot` when preloading. (#463)
|
6
|
+
|
7
|
+
# 5.3.2
|
8
|
+
|
9
|
+
* Update redis instruments to support redis v5.0+ (#458)
|
3
10
|
# 5.3.1
|
4
11
|
|
5
12
|
* Fix typo in HTTPClient prepend instrumentation (#457)
|
13
|
+
|
6
14
|
# 5.3.0
|
7
15
|
|
8
16
|
* Add configuraiton option to use `Module#prepend` instead of `Module#alias_method` (default)
|
data/gems/sidekiq.gemfile
CHANGED
@@ -35,6 +35,7 @@ module ScoutApm
|
|
35
35
|
install_instrument(ScoutApm::Instruments::HTTP)
|
36
36
|
install_instrument(ScoutApm::Instruments::Memcached)
|
37
37
|
install_instrument(ScoutApm::Instruments::Redis)
|
38
|
+
install_instrument(ScoutApm::Instruments::Redis5)
|
38
39
|
install_instrument(ScoutApm::Instruments::InfluxDB)
|
39
40
|
install_instrument(ScoutApm::Instruments::Elasticsearch)
|
40
41
|
install_instrument(ScoutApm::Instruments::Grape)
|
@@ -17,7 +17,7 @@ module ScoutApm
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def install(prepend:)
|
20
|
-
if defined?(::Redis) && defined?(::Redis::Client)
|
20
|
+
if defined?(::Redis) && defined?(::Redis::Client) && ::Redis::Client.instance_methods(false).include?(:call)
|
21
21
|
@installed = true
|
22
22
|
|
23
23
|
logger.info "Instrumenting Redis. Prepend: #{prepend}"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module ScoutApm
|
2
|
+
module Instruments
|
3
|
+
class Redis5
|
4
|
+
attr_reader :context
|
5
|
+
|
6
|
+
def initialize(context)
|
7
|
+
@context = context
|
8
|
+
@installed = false
|
9
|
+
end
|
10
|
+
|
11
|
+
def logger
|
12
|
+
context.logger
|
13
|
+
end
|
14
|
+
|
15
|
+
def installed?
|
16
|
+
@installed
|
17
|
+
end
|
18
|
+
|
19
|
+
def install(prepend:)
|
20
|
+
if defined?(::Redis) && defined?(::Redis::Client) && ::Redis::Client.instance_methods(false).include?(:call_v)
|
21
|
+
@installed = true
|
22
|
+
|
23
|
+
logger.info "Instrumenting Redis5. Prepend: #{prepend}"
|
24
|
+
|
25
|
+
if prepend
|
26
|
+
::Redis::Client.send(:include, ScoutApm::Tracer)
|
27
|
+
::Redis::Client.send(:prepend, Redis5ClientInstrumentationPrepend)
|
28
|
+
else
|
29
|
+
::Redis::Client.class_eval do
|
30
|
+
include ScoutApm::Tracer
|
31
|
+
|
32
|
+
def call_with_scout_instruments(args, &block)
|
33
|
+
command = args.first rescue "Unknown"
|
34
|
+
|
35
|
+
self.class.instrument("Redis", command) do
|
36
|
+
call_without_scout_instruments(args, &block)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
alias_method :call_without_scout_instruments, :call_v
|
41
|
+
alias_method :call_v, :call_with_scout_instruments
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module Redis5ClientInstrumentationPrepend
|
49
|
+
def call(args, &block)
|
50
|
+
command = args.first rescue "Unknown"
|
51
|
+
|
52
|
+
self.class.instrument("Redis", command) do
|
53
|
+
super(args, &block)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
@@ -23,8 +23,36 @@ module ScoutApm
|
|
23
23
|
defined?(::Puma) && (File.basename($0) =~ /\Apuma/)
|
24
24
|
end
|
25
25
|
|
26
|
+
# Puma::UserFileDefaultOptions exposes `options` based on three underlying
|
27
|
+
# hashes: user_options, file_options, and default_options. While getting an `options`
|
28
|
+
# key consults all three underlying hashes, setting an `options` key only sets the
|
29
|
+
# user_options hash:
|
30
|
+
#
|
31
|
+
# def [](key)
|
32
|
+
# fetch(key)
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def []=(key, value)
|
36
|
+
# user_options[key] = value
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def fetch(key, default_value = nil)
|
40
|
+
# return user_options[key] if user_options.key?(key)
|
41
|
+
# return file_options[key] if file_options.key?(key)
|
42
|
+
# return default_options[key] if default_options.key?(key)
|
43
|
+
#
|
44
|
+
# default_value
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# Because of this, we can't read options[:before_worker_boot], modify, and then re-set
|
48
|
+
# options[:before_worker_boot], since doing so could cause duplication if `before_worker_boot`
|
49
|
+
# exists on the other two underlying hashes (file_options, default_options).
|
50
|
+
#
|
51
|
+
# To get around this, we explicitly read from `user_options` only, and still set using `options[]=`,
|
52
|
+
# which Puma allows for setting `user_options`.
|
53
|
+
#
|
26
54
|
def install
|
27
|
-
old = ::Puma.cli_config.options[:before_worker_boot] || []
|
55
|
+
old = ::Puma.cli_config.options.user_options[:before_worker_boot] || []
|
28
56
|
new = Array(old) + [Proc.new do
|
29
57
|
logger.info "Installing Puma worker loop."
|
30
58
|
ScoutApm::Agent.instance.start_background_worker
|
data/lib/scout_apm/version.rb
CHANGED
data/lib/scout_apm.rb
CHANGED
@@ -87,6 +87,7 @@ require 'scout_apm/instruments/moped'
|
|
87
87
|
require 'scout_apm/instruments/mongoid'
|
88
88
|
require 'scout_apm/instruments/memcached'
|
89
89
|
require 'scout_apm/instruments/redis'
|
90
|
+
require 'scout_apm/instruments/redis5'
|
90
91
|
require 'scout_apm/instruments/influxdb'
|
91
92
|
require 'scout_apm/instruments/elasticsearch'
|
92
93
|
require 'scout_apm/instruments/active_record'
|
@@ -1,23 +1,23 @@
|
|
1
1
|
if (ENV["SCOUT_TEST_FEATURES"] || "").include?("instruments")
|
2
2
|
require 'test_helper'
|
3
3
|
|
4
|
-
require 'scout_apm/instruments/
|
4
|
+
require 'scout_apm/instruments/redis5'
|
5
5
|
|
6
6
|
require 'redis'
|
7
7
|
|
8
8
|
class RedisTest < Minitest::Test
|
9
9
|
def setup
|
10
10
|
@context = ScoutApm::AgentContext.new
|
11
|
-
@instance = ScoutApm::Instruments::
|
11
|
+
@instance = ScoutApm::Instruments::Redis5.new(@context)
|
12
12
|
@instrument_manager = ScoutApm::InstrumentManager.new(@context)
|
13
13
|
@instance.install(prepend: @instrument_manager.prepend_for_instrument?(@instance.class))
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_installs_using_proper_method
|
17
17
|
if @instrument_manager.prepend_for_instrument?(@instance.class) == true
|
18
|
-
assert ::Redis::Client.ancestors.include?(ScoutApm::Instruments::
|
18
|
+
assert ::Redis::Client.ancestors.include?(ScoutApm::Instruments::Redis5ClientInstrumentationPrepend)
|
19
19
|
else
|
20
|
-
assert_equal false, ::Redis::Client.ancestors.include?(ScoutApm::Instruments::
|
20
|
+
assert_equal false, ::Redis::Client.ancestors.include?(ScoutApm::Instruments::Redis5ClientInstrumentationPrepend)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.3.
|
4
|
+
version: 5.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Haynes
|
8
8
|
- Andre Lewis
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- lib/scout_apm/instruments/process/process_memory.rb
|
320
320
|
- lib/scout_apm/instruments/rails_router.rb
|
321
321
|
- lib/scout_apm/instruments/redis.rb
|
322
|
+
- lib/scout_apm/instruments/redis5.rb
|
322
323
|
- lib/scout_apm/instruments/resque.rb
|
323
324
|
- lib/scout_apm/instruments/samplers.rb
|
324
325
|
- lib/scout_apm/instruments/sinatra.rb
|
@@ -478,7 +479,7 @@ homepage: https://github.com/scoutapp/scout_apm_ruby
|
|
478
479
|
licenses:
|
479
480
|
- MIT
|
480
481
|
metadata: {}
|
481
|
-
post_install_message:
|
482
|
+
post_install_message:
|
482
483
|
rdoc_options: []
|
483
484
|
require_paths:
|
484
485
|
- lib
|
@@ -494,8 +495,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
494
495
|
- !ruby/object:Gem::Version
|
495
496
|
version: '0'
|
496
497
|
requirements: []
|
497
|
-
rubygems_version: 3.3
|
498
|
-
signing_key:
|
498
|
+
rubygems_version: 3.0.3
|
499
|
+
signing_key:
|
499
500
|
specification_version: 4
|
500
501
|
summary: Ruby application performance monitoring
|
501
502
|
test_files: []
|