appsignal 3.0.0.beta.1-java → 3.0.3-java

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +1 -1
  3. data/.semaphore/semaphore.yml +88 -88
  4. data/CHANGELOG.md +41 -1
  5. data/Rakefile +12 -4
  6. data/appsignal.gemspec +7 -5
  7. data/build_matrix.yml +11 -11
  8. data/ext/agent.yml +17 -17
  9. data/gemfiles/no_dependencies.gemfile +0 -7
  10. data/lib/appsignal.rb +1 -2
  11. data/lib/appsignal/config.rb +1 -1
  12. data/lib/appsignal/extension.rb +50 -0
  13. data/lib/appsignal/helpers/instrumentation.rb +69 -5
  14. data/lib/appsignal/hooks.rb +16 -0
  15. data/lib/appsignal/hooks/action_cable.rb +10 -2
  16. data/lib/appsignal/hooks/sidekiq.rb +9 -142
  17. data/lib/appsignal/integrations/object.rb +21 -43
  18. data/lib/appsignal/integrations/railtie.rb +0 -4
  19. data/lib/appsignal/integrations/sidekiq.rb +171 -0
  20. data/lib/appsignal/minutely.rb +6 -0
  21. data/lib/appsignal/transaction.rb +2 -2
  22. data/lib/appsignal/version.rb +1 -1
  23. data/spec/lib/appsignal/config_spec.rb +2 -0
  24. data/spec/lib/appsignal/extension_install_failure_spec.rb +0 -7
  25. data/spec/lib/appsignal/extension_spec.rb +43 -9
  26. data/spec/lib/appsignal/hooks/action_cable_spec.rb +88 -0
  27. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +60 -458
  28. data/spec/lib/appsignal/hooks_spec.rb +41 -0
  29. data/spec/lib/appsignal/integrations/object_spec.rb +91 -4
  30. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +524 -0
  31. data/spec/lib/appsignal/transaction_spec.rb +17 -0
  32. data/spec/lib/appsignal/utils/data_spec.rb +133 -87
  33. data/spec/lib/appsignal_spec.rb +162 -47
  34. data/spec/lib/puma/appsignal_spec.rb +28 -0
  35. data/spec/spec_helper.rb +22 -0
  36. data/spec/support/testing.rb +11 -1
  37. metadata +9 -8
  38. data/gemfiles/rails-4.0.gemfile +0 -6
  39. data/gemfiles/rails-4.1.gemfile +0 -6
@@ -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" 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
@@ -117,6 +117,28 @@ RSpec.configure do |config|
117
117
  allow(Appsignal::Config).to receive(:system_tmp_dir).and_return(spec_system_tmp_dir)
118
118
  end
119
119
 
120
+ # These tests are not run by default. They require a failed extension
121
+ # installation. See the `rake test:failure` task. If a test with this tag was
122
+ # run, run `rake extension:install` again to fix the extension installation
123
+ # before running other tests.
124
+ config.before :extension_installation_failure => true do
125
+ next unless Appsignal.extension_loaded?
126
+
127
+ raise "Extension is loaded, please run the following task and rerun the test." \
128
+ "\n\n rake test:prepare_failure"
129
+ end
130
+
131
+ # Check to see if the extension is loaded before running the specs. If the
132
+ # extension is not loaded it can result in unexpected behavior.
133
+ config.before do |example|
134
+ next if Appsignal.extension_loaded?
135
+ next if example.metadata[:extension_installation_failure]
136
+
137
+ puts "\nWARNING: The AppSignal extension is not loaded, please run the "\
138
+ "following task and rerun the test." \
139
+ "\n\n rake extension:install\n"
140
+ end
141
+
120
142
  config.after do
121
143
  Appsignal::Testing.clear!
122
144
  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
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: 3.0.0.beta.1
4
+ version: 3.0.3
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-28 00:00:00.000000000 Z
13
+ date: 2021-04-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -179,8 +179,6 @@ files:
179
179
  - gemfiles/que.gemfile
180
180
  - gemfiles/que_beta.gemfile
181
181
  - gemfiles/rails-3.2.gemfile
182
- - gemfiles/rails-4.0.gemfile
183
- - gemfiles/rails-4.1.gemfile
184
182
  - gemfiles/rails-4.2.gemfile
185
183
  - gemfiles/rails-5.0.gemfile
186
184
  - gemfiles/rails-5.1.gemfile
@@ -255,6 +253,7 @@ files:
255
253
  - lib/appsignal/integrations/rake.rb
256
254
  - lib/appsignal/integrations/redis.rb
257
255
  - lib/appsignal/integrations/resque.rb
256
+ - lib/appsignal/integrations/sidekiq.rb
258
257
  - lib/appsignal/integrations/sinatra.rb
259
258
  - lib/appsignal/integrations/unicorn.rb
260
259
  - lib/appsignal/integrations/webmachine.rb
@@ -340,6 +339,7 @@ files:
340
339
  - spec/lib/appsignal/integrations/padrino_spec.rb
341
340
  - spec/lib/appsignal/integrations/que_spec.rb
342
341
  - spec/lib/appsignal/integrations/railtie_spec.rb
342
+ - spec/lib/appsignal/integrations/sidekiq_spec.rb
343
343
  - spec/lib/appsignal/integrations/sinatra_spec.rb
344
344
  - spec/lib/appsignal/integrations/webmachine_spec.rb
345
345
  - spec/lib/appsignal/logger_spec.rb
@@ -418,14 +418,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
418
418
  requirements:
419
419
  - - ">="
420
420
  - !ruby/object:Gem::Version
421
- version: '1.9'
421
+ version: '2.0'
422
422
  required_rubygems_version: !ruby/object:Gem::Requirement
423
423
  requirements:
424
- - - ">"
424
+ - - ">="
425
425
  - !ruby/object:Gem::Version
426
- version: 1.3.1
426
+ version: '0'
427
427
  requirements: []
428
- rubygems_version: 3.2.6
428
+ rubygems_version: 3.2.16
429
429
  signing_key:
430
430
  specification_version: 4
431
431
  summary: Logs performance and exception data from your app to appsignal.com
@@ -487,6 +487,7 @@ test_files:
487
487
  - spec/lib/appsignal/integrations/padrino_spec.rb
488
488
  - spec/lib/appsignal/integrations/que_spec.rb
489
489
  - spec/lib/appsignal/integrations/railtie_spec.rb
490
+ - spec/lib/appsignal/integrations/sidekiq_spec.rb
490
491
  - spec/lib/appsignal/integrations/sinatra_spec.rb
491
492
  - spec/lib/appsignal/integrations/webmachine_spec.rb
492
493
  - spec/lib/appsignal/logger_spec.rb
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.0.0'
4
- gem 'mime-types', '~> 2.6'
5
-
6
- gemspec :path => '../'
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rails', '~> 4.1.0'
4
- gem 'mime-types', '~> 2.6'
5
-
6
- gemspec :path => '../'