scout_apm 5.4.0 → 5.5.0

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: 6e125a347fd3bbfa0b52f6dde597daf1dc95d97ba95cb6c44553bc36fae71b82
4
- data.tar.gz: 9f0c708e386be527f255582195a791938c1663b418999816b79f25e4f7caaf6f
3
+ metadata.gz: b3dfd72cdc46892ac46a974e4e3947f81ac2ee6580bee96c0cc6ad845ce50ee7
4
+ data.tar.gz: 560fb31452b8c5b526bf77723d121d561096c759640c0266ba894ffe71901d99
5
5
  SHA512:
6
- metadata.gz: d7e079bde40861cf673834ec606f8a09fc84bd4416eddccd22abd29d5cd64dbf071347d832549f840dd3b07026c8a3d4e6788f458587128482a1b44682479ec4
7
- data.tar.gz: e20c7d5fadbfe008f1febb62e3e31e5aa23cc4410f02634329493b10159603fb467e4ae66d504709f247ff457b0bf5d386f62baa0835010e7e5a0954160f7b97
6
+ metadata.gz: 3958265f12804e22dbb4c75d3b03a6d4ad9f87ff989e5382f8d0b890d55c2c2505828cd4022fa7a965092bb7c0948a12baea760b0d15fd05f5ceef6d1a23f962
7
+ data.tar.gz: cb45c1255f16f299e7a8cc67c93efd21fd7912682c4d4ed2030498be069022f2cf8811a987bbec0c22ff28150d57ff95222ed0771e0c2758bbba057b1805d4a8
@@ -19,13 +19,6 @@ jobs:
19
19
  fail-fast: false
20
20
  matrix:
21
21
  include:
22
- - ruby: 2.1
23
- gemfile: gems/rails3.gemfile
24
- - ruby: 2.2
25
- - ruby: 2.3
26
- gemfile: gems/sqlite3-1.3.gemfile
27
- - ruby: 2.4
28
- gemfile: gems/sqlite3-1.3.gemfile
29
22
  - ruby: 2.5
30
23
  - ruby: 2.6
31
24
  - ruby: 2.6
@@ -51,13 +44,15 @@ jobs:
51
44
  test_features: "sidekiq_install"
52
45
  - ruby: 3.1
53
46
  - ruby: 3.2
47
+ gemfile: gems/sqlite3-v2.gemfile
48
+ - ruby: 3.3
49
+ gemfile: gems/sqlite3-v2.gemfile
54
50
  env:
55
51
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
56
52
  SCOUT_TEST_FEATURES: ${{ matrix.test_features }}
57
53
  SCOUT_USE_PREPEND: ${{ matrix.prepend }}
58
54
 
59
- # https://github.com/ruby/setup-ruby/issues/496
60
- runs-on: ${{ matrix.ruby == '2.2' && 'ubuntu-20.04' || 'ubuntu-latest' }}
55
+ runs-on: ubuntu-latest
61
56
 
62
57
  steps:
63
58
  - uses: actions/checkout@v4
data/CHANGELOG.markdown CHANGED
@@ -1,5 +1,10 @@
1
1
  # Unreleased
2
2
 
3
+ # 5.5.0
4
+ - Fix undeclared logger in grape instruments (#510)
5
+ - Drop guaranteed support for Rubies <= 2.4
6
+ - Instrument Resque without relying on forking per job (#514)
7
+
3
8
  # 5.4.0
4
9
  * Add support for GoodJob (#506)
5
10
  * Add support for Solid Queue (#508)
@@ -668,7 +673,7 @@ reusing that version number to avoid confusion.
668
673
 
669
674
  # 1.2.12
670
675
 
671
- * Add uri_reporting option to report bare path (as opposed to fullpath). Default is 'fullpath'; set to 'path' to avoid exposing URL parameters.
676
+ * Add uri_reporting option to report bare path (as opposed to fullpath). Default is 'fullpath'; set to 'path' to avoid exposing URL parameters.
672
677
 
673
678
  # 1.2.11
674
679
 
@@ -1,3 +1,3 @@
1
1
  eval_gemfile("../Gemfile")
2
2
 
3
- gem "sqlite3", "~> 1.3.5"
3
+ gem "sqlite3", ">= 2.1"
@@ -208,7 +208,7 @@ module ScoutApm
208
208
 
209
209
  @error_service_background_worker = ScoutApm::BackgroundWorker.new(context, ERROR_SEND_FREQUENCY)
210
210
  @error_service_background_worker_thread = Thread.new do
211
- @error_service_background_worker.start {
211
+ @error_service_background_worker.start {
212
212
  periodic_work.run
213
213
  }
214
214
  end
@@ -7,8 +7,7 @@ module ScoutApm
7
7
 
8
8
  def present?
9
9
  defined?(::Resque) &&
10
- ::Resque.respond_to?(:before_first_fork) &&
11
- ::Resque.respond_to?(:after_fork)
10
+ ::Resque.respond_to?(:before_first_fork)
12
11
  end
13
12
 
14
13
  # Lies. This forks really aggressively, but we have to do handling
@@ -19,13 +18,14 @@ module ScoutApm
19
18
  end
20
19
 
21
20
  def install
22
- install_before_fork
23
- install_after_fork
21
+ install_before_first_fork
22
+ install_instruments
24
23
  end
25
24
 
26
- def install_before_fork
25
+ def install_before_first_fork
27
26
  ::Resque.before_first_fork do
28
27
  begin
28
+ # Don't check fork_per_job here in case some workers fork_per_job and some don't.
29
29
  if ScoutApm::Agent.instance.context.config.value('start_resque_server_instrument')
30
30
  ScoutApm::Agent.instance.start
31
31
  ScoutApm::Agent.instance.context.start_remote_server!(bind, port)
@@ -33,31 +33,14 @@ module ScoutApm
33
33
  logger.info("Not starting remote server due to 'start_resque_server_instrument' setting")
34
34
  end
35
35
  rescue Errno::EADDRINUSE
36
- ScoutApm::Agent.instance.context.logger.warn "Error while Installing Resque Instruments, Port #{port} already in use. Set via the `remote_agent_port` configuration option"
36
+ logger.warn "Error while Installing Resque Instruments, Port #{port} already in use. Set via the `remote_agent_port` configuration option"
37
37
  rescue => e
38
- ScoutApm::Agent.instance.context.logger.warn "Error while Installing Resque before_first_fork: #{e.inspect}"
38
+ logger.warn "Error while Installing Resque before_first_fork: #{e.inspect}"
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
- def install_after_fork
44
- ::Resque.after_fork do
45
- begin
46
- ScoutApm::Agent.instance.context.become_remote_client!(bind, port)
47
- inject_job_instrument
48
- rescue => e
49
- ScoutApm::Agent.instance.context.logger.warn "Error while Installing Resque after_fork: #{e.inspect}"
50
- end
51
- end
52
- end
53
-
54
- # Insert ourselves into the point when resque turns a string "TestJob"
55
- # into the class constant TestJob, and insert our instrumentation plugin
56
- # into that constantized class
57
- #
58
- # This automates away any need for the user to insert our instrumentation into
59
- # each of their jobs
60
- def inject_job_instrument
43
+ def install_instruments
61
44
  ::Resque::Job.class_eval do
62
45
  def payload_class_with_scout_instruments
63
46
  klass = payload_class_without_scout_instruments
@@ -80,9 +63,12 @@ module ScoutApm
80
63
  end
81
64
 
82
65
  def config
83
- @config || ScoutApm::Agent.instance.context.config
66
+ @config ||= ScoutApm::Agent.instance.context.config
67
+ end
68
+
69
+ def logger
70
+ @logger ||= ScoutApm::Agent.instance.context.logger
84
71
  end
85
72
  end
86
73
  end
87
74
  end
88
-
@@ -53,7 +53,7 @@ module ScoutApm
53
53
  self.options[:path].first,
54
54
  ].compact.map{ |n| n.to_s }.join("/")
55
55
  rescue => e
56
- logger.info("Error getting Grape Endpoint Name. Error: #{e.message}. Options: #{self.options.inspect}")
56
+ ScoutApm::Agent.instance.context.logger.info("Error getting Grape Endpoint Name. Error: #{e.message}. Options: #{self.options.inspect}")
57
57
  name = "Grape/Unknown"
58
58
  end
59
59
 
@@ -1,6 +1,15 @@
1
1
  module ScoutApm
2
2
  module Instruments
3
3
  module Resque
4
+ def before_perform_become_client(*args)
5
+ # Don't become remote client if explicitly disabled or if forking is disabled to force synchronous recording.
6
+ if config.value('start_resque_server_instrument') && forking?
7
+ ScoutApm::Agent.instance.context.become_remote_client!(bind, port)
8
+ else
9
+ logger.debug("Not becoming remote client due to 'start_resque_server_instrument' setting or 'fork_per_job' setting")
10
+ end
11
+ end
12
+
4
13
  def around_perform_with_scout_instruments(*args)
5
14
  job_name = self.to_s
6
15
  queue = find_queue
@@ -17,7 +26,6 @@ module ScoutApm
17
26
  started_queue = true
18
27
  req.start_layer(ScoutApm::Layer.new('Job', job_name))
19
28
  started_job = true
20
-
21
29
  yield
22
30
  rescue => e
23
31
  req.error!
@@ -33,7 +41,28 @@ module ScoutApm
33
41
  return queue if self.respond_to?(:queue)
34
42
  return "unknown"
35
43
  end
44
+
45
+ private
46
+
47
+ def bind
48
+ config.value("remote_agent_host")
49
+ end
50
+
51
+ def port
52
+ config.value("remote_agent_port")
53
+ end
54
+
55
+ def config
56
+ @config ||= ScoutApm::Agent.instance.context.config
57
+ end
58
+
59
+ def logger
60
+ @logger ||= ScoutApm::Agent.instance.context.logger
61
+ end
62
+
63
+ def forking?
64
+ @forking ||= ENV["FORK_PER_JOB"] != "false"
65
+ end
36
66
  end
37
67
  end
38
68
  end
39
-
@@ -12,7 +12,8 @@ module ScoutApm
12
12
  end
13
13
 
14
14
  def run
15
- Bundler.rubygems.all_specs.map {|spec| [spec.name, spec.version.to_s] }
15
+ specs = Bundler.rubygems.public_send(Bundler.rubygems.respond_to?(:installed_specs) ? :installed_specs : :all_specs)
16
+ specs.map { |spec| [spec.name, spec.version.to_s] }
16
17
  rescue => e
17
18
  logger.warn("Couldn't fetch Gem information: #{e.message}")
18
19
  []
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "5.4.0"
2
+ VERSION = "5.5.0"
3
3
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
8
8
  - Andre Lewis
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-09-10 00:00:00.000000000 Z
11
+ date: 2025-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: minitest
@@ -240,7 +239,7 @@ files:
240
239
  - gems/rails5.gemfile
241
240
  - gems/rails6.gemfile
242
241
  - gems/sidekiq.gemfile
243
- - gems/sqlite3-1.3.gemfile
242
+ - gems/sqlite3-v2.gemfile
244
243
  - gems/typhoeus.gemfile
245
244
  - lib/scout_apm.rb
246
245
  - lib/scout_apm/agent.rb
@@ -489,7 +488,6 @@ homepage: https://github.com/scoutapp/scout_apm_ruby
489
488
  licenses:
490
489
  - MIT
491
490
  metadata: {}
492
- post_install_message:
493
491
  rdoc_options: []
494
492
  require_paths:
495
493
  - lib
@@ -505,8 +503,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
503
  - !ruby/object:Gem::Version
506
504
  version: '0'
507
505
  requirements: []
508
- rubygems_version: 3.5.16
509
- signing_key:
506
+ rubygems_version: 3.6.2
510
507
  specification_version: 4
511
508
  summary: Ruby application performance monitoring
512
509
  test_files: []