appsignal 2.11.0.beta.2-java → 2.11.1.beta.2-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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +57 -1
  3. data/CHANGELOG.md +28 -0
  4. data/README.md +11 -5
  5. data/Rakefile +27 -9
  6. data/appsignal.gemspec +1 -1
  7. data/build_matrix.yml +2 -2
  8. data/ext/Rakefile +2 -0
  9. data/ext/agent.yml +17 -25
  10. data/ext/appsignal_extension.c +1 -1
  11. data/ext/base.rb +7 -0
  12. data/ext/extconf.rb +2 -0
  13. data/lib/appsignal.rb +1 -0
  14. data/lib/appsignal/auth_check.rb +4 -2
  15. data/lib/appsignal/cli/diagnose.rb +1 -1
  16. data/lib/appsignal/config.rb +82 -17
  17. data/lib/appsignal/extension.rb +6 -5
  18. data/lib/appsignal/extension/jruby.rb +6 -5
  19. data/lib/appsignal/hooks.rb +24 -0
  20. data/lib/appsignal/hooks/action_mailer.rb +22 -0
  21. data/lib/appsignal/hooks/active_job.rb +53 -5
  22. data/lib/appsignal/hooks/active_support_notifications.rb +72 -0
  23. data/lib/appsignal/hooks/puma.rb +0 -1
  24. data/lib/appsignal/hooks/sidekiq.rb +1 -2
  25. data/lib/appsignal/integrations/delayed_job_plugin.rb +1 -1
  26. data/lib/appsignal/probes.rb +7 -0
  27. data/lib/appsignal/probes/puma.rb +1 -1
  28. data/lib/appsignal/probes/sidekiq.rb +3 -1
  29. data/lib/appsignal/utils/deprecation_message.rb +1 -1
  30. data/lib/appsignal/version.rb +1 -1
  31. data/spec/lib/appsignal/auth_check_spec.rb +23 -0
  32. data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
  33. data/spec/lib/appsignal/capistrano3_spec.rb +1 -1
  34. data/spec/lib/appsignal/cli/diagnose_spec.rb +42 -0
  35. data/spec/lib/appsignal/config_spec.rb +39 -1
  36. data/spec/lib/appsignal/extension/jruby_spec.rb +31 -28
  37. data/spec/lib/appsignal/extension_install_failure_spec.rb +23 -0
  38. data/spec/lib/appsignal/hooks/action_mailer_spec.rb +54 -0
  39. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +35 -0
  40. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +145 -0
  41. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +69 -0
  42. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +9 -137
  43. data/spec/lib/appsignal/hooks/activejob_spec.rb +143 -10
  44. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +3 -14
  45. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +7 -5
  46. data/spec/lib/appsignal/hooks_spec.rb +57 -0
  47. data/spec/lib/appsignal/marker_spec.rb +1 -1
  48. data/spec/spec_helper.rb +5 -0
  49. data/spec/support/helpers/config_helpers.rb +3 -2
  50. data/spec/support/helpers/dependency_helper.rb +4 -0
  51. data/spec/support/helpers/transaction_helpers.rb +1 -1
  52. data/spec/support/testing.rb +19 -19
  53. metadata +19 -7
@@ -78,6 +78,63 @@ describe Appsignal::Hooks do
78
78
  expect(Appsignal::Hooks.hooks[:mock_error_hook].installed?).to be_falsy
79
79
  Appsignal::Hooks.hooks.delete(:mock_error_hook)
80
80
  end
81
+
82
+ describe "missing constants" do
83
+ let(:err_stream) { std_stream }
84
+ let(:stderr) { err_stream.read }
85
+ let(:log_stream) { std_stream }
86
+ let(:log) { log_contents(log_stream) }
87
+ before do
88
+ Appsignal.logger = test_logger(log_stream)
89
+ end
90
+
91
+ def call_constant(&block)
92
+ capture_std_streams(std_stream, err_stream, &block)
93
+ end
94
+
95
+ describe "SidekiqProbe" do
96
+ it "logs a deprecation message and returns the new constant" do
97
+ constant = call_constant { Appsignal::Hooks::SidekiqProbe }
98
+
99
+ expect(constant).to eql(Appsignal::Probes::SidekiqProbe)
100
+ expect(constant.name).to eql("Appsignal::Probes::SidekiqProbe")
101
+
102
+ deprecation_message =
103
+ "The constant Appsignal::Hooks::SidekiqProbe has been deprecated. " \
104
+ "Please update the constant name to Appsignal::Probes::SidekiqProbe " \
105
+ "in the following file to remove this message.\n#{__FILE__}:"
106
+ expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
107
+ expect(log).to contains_log :warn, deprecation_message
108
+ end
109
+ end
110
+
111
+ describe "PumaProbe" do
112
+ it "logs a deprecation message and returns the new constant" do
113
+ constant = call_constant { Appsignal::Hooks::PumaProbe }
114
+
115
+ expect(constant).to eql(Appsignal::Probes::PumaProbe)
116
+ expect(constant.name).to eql("Appsignal::Probes::PumaProbe")
117
+
118
+ deprecation_message =
119
+ "The constant Appsignal::Hooks::PumaProbe has been deprecated. " \
120
+ "Please update the constant name to Appsignal::Probes::PumaProbe " \
121
+ "in the following file to remove this message.\n#{__FILE__}:"
122
+ expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
123
+ expect(log).to contains_log :warn, deprecation_message
124
+ end
125
+ end
126
+
127
+ describe "other constant" do
128
+ it "raises a NameError like Ruby normally does" do
129
+ expect do
130
+ call_constant { Appsignal::Hooks::Unknown }
131
+ end.to raise_error(NameError)
132
+
133
+ expect(stderr).to be_empty
134
+ expect(log).to be_empty
135
+ end
136
+ end
137
+ end
81
138
  end
82
139
 
83
140
  describe Appsignal::Hooks::Helpers do
@@ -4,7 +4,7 @@ describe Appsignal::Marker do
4
4
  described_class.new(
5
5
  {
6
6
  :revision => "503ce0923ed177a3ce000005",
7
- :repository => "master",
7
+ :repository => "main",
8
8
  :user => "batman",
9
9
  :rails_env => "production"
10
10
  },
@@ -65,6 +65,10 @@ RSpec.configure do |config|
65
65
 
66
66
  config.example_status_persistence_file_path = "spec/examples.txt"
67
67
  config.fail_if_no_examples = true
68
+ config.filter_run_excluding(
69
+ :extension_installation_failure => true,
70
+ :jruby => !DependencyHelper.running_jruby?
71
+ )
68
72
  config.mock_with :rspec do |mocks|
69
73
  mocks.syntax = :expect
70
74
  end
@@ -111,6 +115,7 @@ RSpec.configure do |config|
111
115
  # in the diagnose task, so add it manually to the list of to-be cleaned up
112
116
  # keys.
113
117
  env_keys << "_APPSIGNAL_DIAGNOSE"
118
+ env_keys << "_TEST_APPSIGNAL_EXTENSION_FAILURE"
114
119
  env_keys.each do |key|
115
120
  # First set the ENV var to an empty string and then delete the key from
116
121
  # the env. We set the env var to an empty string first as JRuby doesn't
@@ -5,12 +5,13 @@ module ConfigHelpers
5
5
  )
6
6
  end
7
7
 
8
- def project_fixture_config(env = "production", initial_config = {}, logger = Appsignal.logger)
8
+ def project_fixture_config(env = "production", initial_config = {}, logger = Appsignal.logger, config_file = nil)
9
9
  Appsignal::Config.new(
10
10
  project_fixture_path,
11
11
  env,
12
12
  initial_config,
13
- logger
13
+ logger,
14
+ config_file
14
15
  )
15
16
  end
16
17
 
@@ -37,6 +37,10 @@ module DependencyHelper
37
37
  dependency_present? "actioncable"
38
38
  end
39
39
 
40
+ def action_mailer_present?
41
+ dependency_present? "actionmailer"
42
+ end
43
+
40
44
  def active_job_present?
41
45
  dependency_present? "activejob"
42
46
  end
@@ -46,7 +46,7 @@ module TransactionHelpers
46
46
 
47
47
  # Set current transaction manually.
48
48
  # Cleared by {clear_current_transaction!}
49
- def set_current_transaction(transaction) # rubocop:disable Style/AccessorMethodName
49
+ def set_current_transaction(transaction) # rubocop:disable Naming/AccessorMethodName
50
50
  Thread.current[:appsignal_transaction] = transaction
51
51
  end
52
52
 
@@ -38,25 +38,9 @@ module Appsignal
38
38
  end
39
39
  end
40
40
 
41
- class Transaction
42
- class << self
43
- alias original_new new
44
-
45
- # Override the {Appsignal::Transaction.new} method so we can track which
46
- # transactions are created on the {Appsignal::Testing.transactions} list.
47
- #
48
- # @see TransactionHelpers#last_transaction
49
- def new(*args)
50
- transaction = original_new(*args)
51
- Appsignal::Testing.transactions << transaction
52
- transaction
53
- end
54
- end
55
- end
56
-
57
41
  class Extension
58
42
  class Transaction
59
- alias original_finish finish
43
+ alias original_finish finish if method_defined? :finish
60
44
 
61
45
  # Override default {Extension::Transaction#finish} behavior to always
62
46
  # return true, which tells the transaction to add its sample data (unless
@@ -72,7 +56,7 @@ module Appsignal
72
56
  return_value
73
57
  end
74
58
 
75
- alias original_complete complete
59
+ alias original_complete complete if method_defined? :complete
76
60
 
77
61
  # Override default {Extension::Transaction#complete} behavior to
78
62
  # store the transaction JSON before the transaction is completed
@@ -94,7 +78,7 @@ module Appsignal
94
78
  @completed || false
95
79
  end
96
80
 
97
- alias original_to_json to_json
81
+ alias original_to_json to_json if method_defined? :to_json
98
82
 
99
83
  # Override default {Extension::Transaction#to_json} behavior to
100
84
  # return the stored the transaction JSON when the transaction was
@@ -111,3 +95,19 @@ module Appsignal
111
95
  end
112
96
  end
113
97
  end
98
+
99
+ module AppsignalTest
100
+ module Transaction
101
+ # Override the {Appsignal::Transaction.new} method so we can track which
102
+ # transactions are created on the {Appsignal::Testing.transactions} list.
103
+ #
104
+ # @see TransactionHelpers#last_transaction
105
+ def new(*_args)
106
+ transaction = super
107
+ Appsignal::Testing.transactions << transaction
108
+ transaction
109
+ end
110
+ end
111
+ end
112
+
113
+ Appsignal::Transaction.extend(AppsignalTest::Transaction)
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0.beta.2
4
+ version: 2.11.1.beta.2
5
5
  platform: java
6
6
  authors:
7
7
  - Robert Beekman
8
8
  - Thijs Cadier
9
9
  - Tom de Bruijn
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-07 00:00:00.000000000 Z
13
+ date: 2020-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -221,6 +221,7 @@ files:
221
221
  - lib/appsignal/helpers/metrics.rb
222
222
  - lib/appsignal/hooks.rb
223
223
  - lib/appsignal/hooks/action_cable.rb
224
+ - lib/appsignal/hooks/action_mailer.rb
224
225
  - lib/appsignal/hooks/active_job.rb
225
226
  - lib/appsignal/hooks/active_support_notifications.rb
226
227
  - lib/appsignal/hooks/celluloid.rb
@@ -258,6 +259,7 @@ files:
258
259
  - lib/appsignal/logger.rb
259
260
  - lib/appsignal/marker.rb
260
261
  - lib/appsignal/minutely.rb
262
+ - lib/appsignal/probes.rb
261
263
  - lib/appsignal/probes/puma.rb
262
264
  - lib/appsignal/probes/sidekiq.rb
263
265
  - lib/appsignal/rack/generic_instrumentation.rb
@@ -304,9 +306,14 @@ files:
304
306
  - spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
305
307
  - spec/lib/appsignal/event_formatter_spec.rb
306
308
  - spec/lib/appsignal/extension/jruby_spec.rb
309
+ - spec/lib/appsignal/extension_install_failure_spec.rb
307
310
  - spec/lib/appsignal/extension_spec.rb
308
311
  - spec/lib/appsignal/garbage_collection_profiler_spec.rb
309
312
  - spec/lib/appsignal/hooks/action_cable_spec.rb
313
+ - spec/lib/appsignal/hooks/action_mailer_spec.rb
314
+ - spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
315
+ - spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb
316
+ - spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
310
317
  - spec/lib/appsignal/hooks/active_support_notifications_spec.rb
311
318
  - spec/lib/appsignal/hooks/activejob_spec.rb
312
319
  - spec/lib/appsignal/hooks/celluloid_spec.rb
@@ -402,11 +409,11 @@ licenses:
402
409
  - MIT
403
410
  metadata:
404
411
  bug_tracker_uri: https://github.com/appsignal/appsignal-ruby/issues
405
- changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/master/CHANGELOG.md
412
+ changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md
406
413
  documentation_uri: https://docs.appsignal.com/ruby/
407
414
  homepage_uri: https://docs.appsignal.com/ruby/
408
415
  source_code_uri: https://github.com/appsignal/appsignal-ruby
409
- post_install_message:
416
+ post_install_message:
410
417
  rdoc_options: []
411
418
  require_paths:
412
419
  - lib
@@ -422,8 +429,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
422
429
  - !ruby/object:Gem::Version
423
430
  version: 1.3.1
424
431
  requirements: []
425
- rubygems_version: 3.1.4
426
- signing_key:
432
+ rubygems_version: 3.1.2
433
+ signing_key:
427
434
  specification_version: 4
428
435
  summary: Logs performance and exception data from your app to appsignal.com
429
436
  test_files:
@@ -451,9 +458,14 @@ test_files:
451
458
  - spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
452
459
  - spec/lib/appsignal/event_formatter_spec.rb
453
460
  - spec/lib/appsignal/extension/jruby_spec.rb
461
+ - spec/lib/appsignal/extension_install_failure_spec.rb
454
462
  - spec/lib/appsignal/extension_spec.rb
455
463
  - spec/lib/appsignal/garbage_collection_profiler_spec.rb
456
464
  - spec/lib/appsignal/hooks/action_cable_spec.rb
465
+ - spec/lib/appsignal/hooks/action_mailer_spec.rb
466
+ - spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
467
+ - spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb
468
+ - spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb
457
469
  - spec/lib/appsignal/hooks/active_support_notifications_spec.rb
458
470
  - spec/lib/appsignal/hooks/activejob_spec.rb
459
471
  - spec/lib/appsignal/hooks/celluloid_spec.rb