scout_apm 5.3.1 → 5.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3d15e4a9b9e98af3e71ba6dde0b666b8807b742f967e35fe36ebd747ae83483
4
- data.tar.gz: f8e88492777b44cdc9362500b7ccdcb68daaa756d6c98ec2e114e231e240071d
3
+ metadata.gz: c81f31cea98bcd57302e874b0efdbeee694af968f40f71a8f527f081c4b456db
4
+ data.tar.gz: 5bddaf96e0dec2e801b8625fbc8400f285a7e1d9cbd4a984429ce06e6abfa417
5
5
  SHA512:
6
- metadata.gz: bb7224bc3294417f72279a97713b9be39bd9657efa1b9c39fb969164f353cdd04c8ced4114e6b717d7ed315c86b5412d8591132f3adde543fb09f8ea908e0308
7
- data.tar.gz: 354cd7af52c07bb78380614d7aafdde9942a1b3ea973ad0616df187a2f2048b3a04fee9cff737d836c14caef142fec31aafef22e5ee4dfeb2125d31c6ea39f70
6
+ metadata.gz: '02537899ea45c1a3e12178f2d208231670ac3b5e79b993fe19b99b004ce21f0c5017d4ca57673ff6e9d69eb739e00ab147c2a31d33ca46ac058faf5728c818be'
7
+ data.tar.gz: 56cb31af74654f8cf1579cd208907cb3ea769d5e99959e6e4df5ead8a257926cd67b9901215010115bd31c5b9184177d7bd6e63e9b9d4735cecc3b53924ef6c5
data/CHANGELOG.markdown CHANGED
@@ -1,8 +1,12 @@
1
1
  # Unreleased
2
2
 
3
+ # 5.3.2
4
+
5
+ * Update redis instruments to support redis v5.0+ (#458)
3
6
  # 5.3.1
4
7
 
5
8
  * Fix typo in HTTPClient prepend instrumentation (#457)
9
+
6
10
  # 5.3.0
7
11
 
8
12
  * Add configuraiton option to use `Module#prepend` instead of `Module#alias_method` (default)
@@ -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
+
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "5.3.1"
2
+ VERSION = "5.3.2"
3
3
  end
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/redis'
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::Redis.new(@context)
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::RedisClientInstrumentationPrepend)
18
+ assert ::Redis::Client.ancestors.include?(ScoutApm::Instruments::Redis5ClientInstrumentationPrepend)
19
19
  else
20
- assert_equal false, ::Redis::Client.ancestors.include?(ScoutApm::Instruments::RedisClientInstrumentationPrepend)
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.1
4
+ version: 5.3.2
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-08-18 00:00:00.000000000 Z
12
+ date: 2022-10-12 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.7
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: []