appsignal 2.11.5-java → 2.11.10-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,27 @@ RSpec.describe "Puma plugin" do
23
23
  def self.stats
24
24
  end
25
25
 
26
+ def self.run
27
+ # Capture threads running before application is preloaded
28
+ before = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
29
+
30
+ # An abbreviated version of what happens in Puma::Cluster#run
31
+ launcher = MockPumaLauncher.new
32
+ plugin = Plugin.plugin.new
33
+ plugin.start(launcher)
34
+ launcher.events.on_booted.call
35
+
36
+ # Wait for minutely probe thread to finish starting
37
+ sleep 0.005
38
+
39
+ # Capture any new threads running after application is preloaded.
40
+ # Any threads created during the preloading phase will not be
41
+ # carried over into the forked workers. Puma warns about these
42
+ # but the minutely probe thread should only exist in the main process.
43
+ after = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
44
+ $stdout.puts "! WARNING: Detected #{after.size - before.size} Thread(s) started in app boot" if after.size > before.size
45
+ end
46
+
26
47
  class Plugin
27
48
  class << self
28
49
  attr_reader :plugin
@@ -68,6 +89,13 @@ RSpec.describe "Puma plugin" do
68
89
  wait_for("enough probe calls") { probe.calls >= 2 }
69
90
  end
70
91
 
92
+ it "marks the PumaProbe thread as fork-safe", :not_ruby19 do
93
+ out_stream = std_stream
94
+ capture_stdout(out_stream) { Puma.run }
95
+
96
+ expect(out_stream.read).not_to include("WARNING: Detected 1 Thread")
97
+ end
98
+
71
99
  context "without Puma.stats" do
72
100
  before { Puma.singleton_class.send(:remove_method, :stats) }
73
101
 
data/spec/spec_helper.rb CHANGED
@@ -131,6 +131,28 @@ RSpec.configure do |config|
131
131
  allow(Appsignal::Config).to receive(:system_tmp_dir).and_return(spec_system_tmp_dir)
132
132
  end
133
133
 
134
+ # These tests are not run by default. They require a failed extension
135
+ # installation. See the `rake test:failure` task. If a test with this tag was
136
+ # run, run `rake extension:install` again to fix the extension installation
137
+ # before running other tests.
138
+ config.before :extension_installation_failure => true do
139
+ next unless Appsignal.extension_loaded?
140
+
141
+ raise "Extension is loaded, please run the following task and rerun the test." \
142
+ "\n\n rake test:prepare_failure"
143
+ end
144
+
145
+ # Check to see if the extension is loaded before running the specs. If the
146
+ # extension is not loaded it can result in unexpected behavior.
147
+ config.before do |example|
148
+ next if Appsignal.extension_loaded?
149
+ next if example.metadata[:extension_installation_failure]
150
+
151
+ puts "\nWARNING: The AppSignal extension is not loaded, please run the "\
152
+ "following task and rerun the test." \
153
+ "\n\n rake extension:install\n"
154
+ end
155
+
134
156
  config.after do
135
157
  Appsignal::Testing.clear!
136
158
  clear_current_transaction!
@@ -1,16 +1,26 @@
1
1
  module Appsignal
2
2
  class << self
3
+ attr_writer :testing
3
4
  remove_method :testing?
4
5
 
5
6
  # @api private
6
7
  def testing?
7
- true
8
+ @testing = true unless defined?(@testing)
9
+ @testing
8
10
  end
9
11
  end
10
12
 
11
13
  # @api private
12
14
  module Testing
13
15
  class << self
16
+ def without_testing
17
+ original_testing = Appsignal.testing?
18
+ Appsignal.testing = false
19
+ yield
20
+ ensure
21
+ Appsignal.testing = original_testing
22
+ end
23
+
14
24
  def transactions
15
25
  @transactions ||= []
16
26
  end
data/support/install_deps CHANGED
@@ -9,18 +9,22 @@ fi
9
9
 
10
10
  case "${_RUBYGEMS_VERSION-"latest"}" in
11
11
  "latest")
12
+ echo "Updating rubygems"
12
13
  gem update $gem_args --system
13
14
  ;;
14
15
  *)
16
+ echo "Updating rubygems to $_RUBYGEMS_VERSION}"
15
17
  gem update $gem_args --system $_RUBYGEMS_VERSION
16
18
  ;;
17
19
  esac
18
20
 
19
21
  case "${_BUNDLER_VERSION-"latest"}" in
20
22
  "latest")
23
+ echo "Updating bundler"
21
24
  gem update bundler $gem_args
22
25
  ;;
23
26
  *)
27
+ echo "Updating bundler to $_BUNDLER_VERSION"
24
28
  gem install bundler $gem_args --version $_BUNDLER_VERSION
25
29
  ;;
26
30
  esac
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.5
4
+ version: 2.11.10
5
5
  platform: java
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-01-27 00:00:00.000000000 Z
13
+ date: 2021-07-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -432,7 +432,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
432
432
  - !ruby/object:Gem::Version
433
433
  version: '0'
434
434
  requirements: []
435
- rubygems_version: 3.2.6
435
+ rubygems_version: 3.2.17
436
436
  signing_key:
437
437
  specification_version: 4
438
438
  summary: Logs performance and exception data from your app to appsignal.com