scout_apm 5.3.0 → 5.3.2

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: 4a454dcd926d9c3d9a9432c43ee101bfb9305b2ed181193d55a51fd8d525f3d8
4
- data.tar.gz: 9bfdbfb6852b7b933f83f947cb225fe1096083c6a4fe44a0620ff888ee01e26d
3
+ metadata.gz: c81f31cea98bcd57302e874b0efdbeee694af968f40f71a8f527f081c4b456db
4
+ data.tar.gz: 5bddaf96e0dec2e801b8625fbc8400f285a7e1d9cbd4a984429ce06e6abfa417
5
5
  SHA512:
6
- metadata.gz: 29012317cfdcb2958395ca541ec628d4f8d3d2ee5278428075930be30cb9fa445c23463cc11f32dab39649a5b34fd6caf6f981eee7c5c88ef1ade39c36e5806d
7
- data.tar.gz: a45e503bcd08fa16cbc885133efcc2bbea64bf76eff6a9de7d5c35a7ddce4ea5a059904c902de6afacba0daba5128b62ce477565aecf2512391962cfea729623
6
+ metadata.gz: '02537899ea45c1a3e12178f2d208231670ac3b5e79b993fe19b99b004ce21f0c5017d4ca57673ff6e9d69eb739e00ab147c2a31d33ca46ac058faf5728c818be'
7
+ data.tar.gz: 56cb31af74654f8cf1579cd208907cb3ea769d5e99959e6e4df5ead8a257926cd67b9901215010115bd31c5b9184177d7bd6e63e9b9d4735cecc3b53924ef6c5
data/CHANGELOG.markdown CHANGED
@@ -1,5 +1,12 @@
1
1
  # Unreleased
2
2
 
3
+ # 5.3.2
4
+
5
+ * Update redis instruments to support redis v5.0+ (#458)
6
+ # 5.3.1
7
+
8
+ * Fix typo in HTTPClient prepend instrumentation (#457)
9
+
3
10
  # 5.3.0
4
11
 
5
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)
@@ -59,7 +59,7 @@ module ScoutApm
59
59
  url = url && url.to_s[0..(max_length - 1)]
60
60
 
61
61
  self.class.instrument("HTTP", method, :desc => url) do
62
- super(request, *args, &block)
62
+ super(*args, &block)
63
63
  end
64
64
  end
65
65
  end
@@ -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.0"
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-16 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