appsignal 2.11.0.alpha.2-java → 2.11.0.beta.5-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.semaphore/semaphore.yml +94 -10
- data/CHANGELOG.md +31 -1
- data/README.md +4 -4
- data/Rakefile +16 -4
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +7 -3
- data/ext/Rakefile +2 -0
- data/ext/agent.yml +19 -19
- data/ext/base.rb +7 -0
- data/ext/extconf.rb +2 -0
- data/gemfiles/rails-4.2.gemfile +9 -2
- data/gemfiles/rails-5.0.gemfile +1 -0
- data/gemfiles/rails-5.1.gemfile +1 -0
- data/gemfiles/rails-5.2.gemfile +1 -0
- data/gemfiles/rails-6.0.gemfile +1 -0
- data/gemfiles/resque-1.gemfile +7 -0
- data/gemfiles/{resque.gemfile → resque-2.gemfile} +1 -1
- data/lib/appsignal.rb +1 -0
- data/lib/appsignal/auth_check.rb +4 -2
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/config.rb +35 -2
- data/lib/appsignal/extension.rb +6 -5
- data/lib/appsignal/extension/jruby.rb +6 -5
- data/lib/appsignal/hooks.rb +25 -0
- data/lib/appsignal/hooks/active_job.rb +137 -0
- data/lib/appsignal/hooks/puma.rb +0 -1
- data/lib/appsignal/hooks/resque.rb +60 -0
- data/lib/appsignal/hooks/sidekiq.rb +17 -94
- data/lib/appsignal/integrations/delayed_job_plugin.rb +1 -1
- data/lib/appsignal/integrations/que.rb +1 -1
- data/lib/appsignal/integrations/resque.rb +9 -12
- data/lib/appsignal/integrations/resque_active_job.rb +9 -32
- data/lib/appsignal/probes.rb +7 -0
- data/lib/appsignal/probes/puma.rb +1 -1
- data/lib/appsignal/probes/sidekiq.rb +3 -1
- data/lib/appsignal/transaction.rb +10 -0
- data/lib/appsignal/utils/deprecation_message.rb +6 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +23 -0
- data/spec/lib/appsignal/capistrano2_spec.rb +1 -1
- data/spec/lib/appsignal/capistrano3_spec.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +42 -0
- data/spec/lib/appsignal/config_spec.rb +21 -0
- data/spec/lib/appsignal/extension/jruby_spec.rb +31 -28
- data/spec/lib/appsignal/extension_install_failure_spec.rb +23 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +591 -0
- data/spec/lib/appsignal/hooks/delayed_job_spec.rb +3 -14
- data/spec/lib/appsignal/hooks/resque_spec.rb +185 -0
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +222 -268
- data/spec/lib/appsignal/hooks_spec.rb +57 -0
- data/spec/lib/appsignal/integrations/que_spec.rb +25 -6
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +20 -179
- data/spec/lib/appsignal/integrations/resque_spec.rb +20 -85
- data/spec/lib/appsignal/marker_spec.rb +1 -1
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +10 -7
- data/spec/lib/appsignal/transaction_spec.rb +5 -7
- data/spec/spec_helper.rb +5 -0
- data/spec/support/helpers/action_mailer_helpers.rb +25 -0
- data/spec/support/helpers/config_helpers.rb +3 -2
- data/spec/support/helpers/dependency_helper.rb +9 -2
- data/spec/support/helpers/transaction_helpers.rb +6 -0
- data/spec/support/stubs/sidekiq/api.rb +1 -1
- data/spec/support/testing.rb +19 -19
- metadata +16 -4
@@ -7,7 +7,7 @@ describe Appsignal::Probes::SidekiqProbe do
|
|
7
7
|
let(:expected_default_tags) { { :hostname => "localhost" } }
|
8
8
|
before do
|
9
9
|
Appsignal.config = project_fixture_config
|
10
|
-
module
|
10
|
+
module SidekiqMock
|
11
11
|
def self.redis_info
|
12
12
|
{
|
13
13
|
"connected_clients" => 2,
|
@@ -88,15 +88,14 @@ describe Appsignal::Probes::SidekiqProbe do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
+
stub_const("Sidekiq", SidekiqMock)
|
91
92
|
end
|
92
|
-
after { Object.send(:remove_const,
|
93
|
+
after { Object.send(:remove_const, :SidekiqMock) }
|
93
94
|
|
94
95
|
describe ".dependencies_present?" do
|
95
96
|
before do
|
96
|
-
|
97
|
-
Redis.const_set(:VERSION, version)
|
97
|
+
stub_const("Redis::VERSION", version)
|
98
98
|
end
|
99
|
-
after { Object.send(:remove_const, "Redis") }
|
100
99
|
|
101
100
|
context "when Redis version is < 3.3.5" do
|
102
101
|
let(:version) { "3.3.4" }
|
@@ -116,9 +115,13 @@ describe Appsignal::Probes::SidekiqProbe do
|
|
116
115
|
end
|
117
116
|
|
118
117
|
it "loads Sidekiq::API" do
|
119
|
-
|
118
|
+
# Hide the Sidekiq constant if it was already loaded. It will be
|
119
|
+
# redefined by loading "sidekiq/api" in the probe.
|
120
|
+
hide_const "Sidekiq::Stats"
|
121
|
+
|
122
|
+
expect(defined?(Sidekiq::Stats)).to be_falsy
|
120
123
|
probe
|
121
|
-
expect(defined?(Sidekiq::
|
124
|
+
expect(defined?(Sidekiq::Stats)).to be_truthy
|
122
125
|
end
|
123
126
|
|
124
127
|
it "logs config on initialize" do
|
@@ -473,22 +473,20 @@ describe Appsignal::Transaction do
|
|
473
473
|
end
|
474
474
|
end
|
475
475
|
|
476
|
-
describe "set_queue_start" do
|
477
|
-
it "
|
478
|
-
expect(transaction.ext).to receive(:set_queue_start).with(
|
479
|
-
10.0
|
480
|
-
).once
|
476
|
+
describe "#set_queue_start" do
|
477
|
+
it "sets the queue start in extension" do
|
478
|
+
expect(transaction.ext).to receive(:set_queue_start).with(10.0).once
|
481
479
|
|
482
480
|
transaction.set_queue_start(10.0)
|
483
481
|
end
|
484
482
|
|
485
|
-
it "
|
483
|
+
it "does not set the queue start in extension when value is nil" do
|
486
484
|
expect(transaction.ext).to_not receive(:set_queue_start)
|
487
485
|
|
488
486
|
transaction.set_queue_start(nil)
|
489
487
|
end
|
490
488
|
|
491
|
-
it "
|
489
|
+
it "does not raise an error when the queue start is too big" do
|
492
490
|
expect(transaction.ext).to receive(:set_queue_start).and_raise(RangeError)
|
493
491
|
|
494
492
|
expect(Appsignal.logger).to receive(:warn).with("Queue start value 10 is too big")
|
data/spec/spec_helper.rb
CHANGED
@@ -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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ActionMailerHelpers
|
2
|
+
def perform_action_mailer(mailer, method, args = nil)
|
3
|
+
if DependencyHelper.rails_version >= Gem::Version.new("5.2.0")
|
4
|
+
case args
|
5
|
+
when Array
|
6
|
+
mailer.send(method, *args).deliver_later
|
7
|
+
when Hash
|
8
|
+
mailer.with(args).send(method).deliver_later
|
9
|
+
when NilClass
|
10
|
+
mailer.send(method).deliver_later
|
11
|
+
else
|
12
|
+
raise "Unknown scenario for arguments: #{args}"
|
13
|
+
end
|
14
|
+
else
|
15
|
+
# Rails 5.1 and lower
|
16
|
+
mailer_object =
|
17
|
+
if args
|
18
|
+
mailer.send(method, *args)
|
19
|
+
else
|
20
|
+
mailer.send(method)
|
21
|
+
end
|
22
|
+
mailer_object.deliver_later
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -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
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module DependencyHelper
|
2
2
|
module_function
|
3
3
|
|
4
|
+
def ruby_version
|
5
|
+
Gem::Version.new(RUBY_VERSION)
|
6
|
+
end
|
7
|
+
|
4
8
|
def running_jruby?
|
5
9
|
defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
6
10
|
end
|
@@ -10,8 +14,11 @@ module DependencyHelper
|
|
10
14
|
end
|
11
15
|
|
12
16
|
def rails6_present?
|
13
|
-
rails_present? &&
|
14
|
-
|
17
|
+
rails_present? && rails_version >= Gem::Version.new("6.0.0")
|
18
|
+
end
|
19
|
+
|
20
|
+
def rails_version
|
21
|
+
Gem.loaded_specs["rails"].version
|
15
22
|
end
|
16
23
|
|
17
24
|
def sequel_present?
|
@@ -44,6 +44,12 @@ module TransactionHelpers
|
|
44
44
|
created_transactions.last
|
45
45
|
end
|
46
46
|
|
47
|
+
# Set current transaction manually.
|
48
|
+
# Cleared by {clear_current_transaction!}
|
49
|
+
def set_current_transaction(transaction) # rubocop:disable Naming/AccessorMethodName
|
50
|
+
Thread.current[:appsignal_transaction] = transaction
|
51
|
+
end
|
52
|
+
|
47
53
|
# Use when {Appsignal::Transaction.clear_current_transaction!} is stubbed to
|
48
54
|
# clear the current transaction on the current thread.
|
49
55
|
def clear_current_transaction!
|
data/spec/support/testing.rb
CHANGED
@@ -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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.0.
|
4
|
+
version: 2.11.0.beta.5
|
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: 2020-07-
|
13
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -186,7 +186,8 @@ files:
|
|
186
186
|
- gemfiles/rails-5.1.gemfile
|
187
187
|
- gemfiles/rails-5.2.gemfile
|
188
188
|
- gemfiles/rails-6.0.gemfile
|
189
|
-
- gemfiles/resque.gemfile
|
189
|
+
- gemfiles/resque-1.gemfile
|
190
|
+
- gemfiles/resque-2.gemfile
|
190
191
|
- gemfiles/sequel-435.gemfile
|
191
192
|
- gemfiles/sequel.gemfile
|
192
193
|
- gemfiles/sinatra.gemfile
|
@@ -220,6 +221,7 @@ files:
|
|
220
221
|
- lib/appsignal/helpers/metrics.rb
|
221
222
|
- lib/appsignal/hooks.rb
|
222
223
|
- lib/appsignal/hooks/action_cable.rb
|
224
|
+
- lib/appsignal/hooks/active_job.rb
|
223
225
|
- lib/appsignal/hooks/active_support_notifications.rb
|
224
226
|
- lib/appsignal/hooks/celluloid.rb
|
225
227
|
- lib/appsignal/hooks/data_mapper.rb
|
@@ -231,6 +233,7 @@ files:
|
|
231
233
|
- lib/appsignal/hooks/que.rb
|
232
234
|
- lib/appsignal/hooks/rake.rb
|
233
235
|
- lib/appsignal/hooks/redis.rb
|
236
|
+
- lib/appsignal/hooks/resque.rb
|
234
237
|
- lib/appsignal/hooks/sequel.rb
|
235
238
|
- lib/appsignal/hooks/shoryuken.rb
|
236
239
|
- lib/appsignal/hooks/sidekiq.rb
|
@@ -255,6 +258,7 @@ files:
|
|
255
258
|
- lib/appsignal/logger.rb
|
256
259
|
- lib/appsignal/marker.rb
|
257
260
|
- lib/appsignal/minutely.rb
|
261
|
+
- lib/appsignal/probes.rb
|
258
262
|
- lib/appsignal/probes/puma.rb
|
259
263
|
- lib/appsignal/probes/sidekiq.rb
|
260
264
|
- lib/appsignal/rack/generic_instrumentation.rb
|
@@ -301,10 +305,12 @@ files:
|
|
301
305
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
302
306
|
- spec/lib/appsignal/event_formatter_spec.rb
|
303
307
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
308
|
+
- spec/lib/appsignal/extension_install_failure_spec.rb
|
304
309
|
- spec/lib/appsignal/extension_spec.rb
|
305
310
|
- spec/lib/appsignal/garbage_collection_profiler_spec.rb
|
306
311
|
- spec/lib/appsignal/hooks/action_cable_spec.rb
|
307
312
|
- spec/lib/appsignal/hooks/active_support_notifications_spec.rb
|
313
|
+
- spec/lib/appsignal/hooks/activejob_spec.rb
|
308
314
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
309
315
|
- spec/lib/appsignal/hooks/data_mapper_spec.rb
|
310
316
|
- spec/lib/appsignal/hooks/delayed_job_spec.rb
|
@@ -315,6 +321,7 @@ files:
|
|
315
321
|
- spec/lib/appsignal/hooks/que_spec.rb
|
316
322
|
- spec/lib/appsignal/hooks/rake_spec.rb
|
317
323
|
- spec/lib/appsignal/hooks/redis_spec.rb
|
324
|
+
- spec/lib/appsignal/hooks/resque_spec.rb
|
318
325
|
- spec/lib/appsignal/hooks/sequel_spec.rb
|
319
326
|
- spec/lib/appsignal/hooks/shoryuken_spec.rb
|
320
327
|
- spec/lib/appsignal/hooks/sidekiq_spec.rb
|
@@ -362,6 +369,7 @@ files:
|
|
362
369
|
- spec/support/fixtures/projects/valid/config/environments/test.rb
|
363
370
|
- spec/support/fixtures/projects/valid/log/.gitkeep
|
364
371
|
- spec/support/fixtures/uploaded_file.txt
|
372
|
+
- spec/support/helpers/action_mailer_helpers.rb
|
365
373
|
- spec/support/helpers/api_request_helper.rb
|
366
374
|
- spec/support/helpers/cli_helpers.rb
|
367
375
|
- spec/support/helpers/config_helpers.rb
|
@@ -396,7 +404,7 @@ licenses:
|
|
396
404
|
- MIT
|
397
405
|
metadata:
|
398
406
|
bug_tracker_uri: https://github.com/appsignal/appsignal-ruby/issues
|
399
|
-
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/
|
407
|
+
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md
|
400
408
|
documentation_uri: https://docs.appsignal.com/ruby/
|
401
409
|
homepage_uri: https://docs.appsignal.com/ruby/
|
402
410
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
@@ -445,10 +453,12 @@ test_files:
|
|
445
453
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
446
454
|
- spec/lib/appsignal/event_formatter_spec.rb
|
447
455
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
456
|
+
- spec/lib/appsignal/extension_install_failure_spec.rb
|
448
457
|
- spec/lib/appsignal/extension_spec.rb
|
449
458
|
- spec/lib/appsignal/garbage_collection_profiler_spec.rb
|
450
459
|
- spec/lib/appsignal/hooks/action_cable_spec.rb
|
451
460
|
- spec/lib/appsignal/hooks/active_support_notifications_spec.rb
|
461
|
+
- spec/lib/appsignal/hooks/activejob_spec.rb
|
452
462
|
- spec/lib/appsignal/hooks/celluloid_spec.rb
|
453
463
|
- spec/lib/appsignal/hooks/data_mapper_spec.rb
|
454
464
|
- spec/lib/appsignal/hooks/delayed_job_spec.rb
|
@@ -459,6 +469,7 @@ test_files:
|
|
459
469
|
- spec/lib/appsignal/hooks/que_spec.rb
|
460
470
|
- spec/lib/appsignal/hooks/rake_spec.rb
|
461
471
|
- spec/lib/appsignal/hooks/redis_spec.rb
|
472
|
+
- spec/lib/appsignal/hooks/resque_spec.rb
|
462
473
|
- spec/lib/appsignal/hooks/sequel_spec.rb
|
463
474
|
- spec/lib/appsignal/hooks/shoryuken_spec.rb
|
464
475
|
- spec/lib/appsignal/hooks/sidekiq_spec.rb
|
@@ -506,6 +517,7 @@ test_files:
|
|
506
517
|
- spec/support/fixtures/projects/valid/config/environments/test.rb
|
507
518
|
- spec/support/fixtures/projects/valid/log/.gitkeep
|
508
519
|
- spec/support/fixtures/uploaded_file.txt
|
520
|
+
- spec/support/helpers/action_mailer_helpers.rb
|
509
521
|
- spec/support/helpers/api_request_helper.rb
|
510
522
|
- spec/support/helpers/cli_helpers.rb
|
511
523
|
- spec/support/helpers/config_helpers.rb
|