appsignal 3.0.18-java → 3.0.21-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.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +134 -0
- data/CHANGELOG.md +44 -0
- data/appsignal.gemspec +1 -0
- data/build_matrix.yml +8 -1
- data/ext/base.rb +3 -2
- data/gemfiles/rails-6.1.gemfile +7 -0
- data/gemfiles/rails-7.0.gemfile +1 -1
- data/lib/appsignal/cli/diagnose/utils.rb +0 -14
- data/lib/appsignal/cli/diagnose.rb +6 -5
- data/lib/appsignal/config.rb +54 -21
- data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +7 -18
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +24 -0
- data/lib/appsignal/system.rb +0 -4
- data/lib/appsignal/transaction.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +0 -15
- data/spec/lib/appsignal/cli/diagnose_spec.rb +14 -11
- data/spec/lib/appsignal/config_spec.rb +138 -9
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +21 -47
- data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +30 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +2 -19
- data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +5 -1
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +14 -5
- data/spec/lib/appsignal/transaction_spec.rb +2 -2
- data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -2
- data/spec/lib/appsignal_spec.rb +59 -38
- data/spec/support/helpers/activejob_helpers.rb +27 -0
- data/spec/support/helpers/dependency_helper.rb +13 -1
- data/spec/support/helpers/transaction_helpers.rb +10 -0
- metadata +10 -5
- data/spec/support/mocks/mock_extension.rb +0 -6
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -5,7 +5,6 @@ describe Appsignal do
|
|
5
5
|
# Make sure we have a clean state because we want to test
|
6
6
|
# initialization here.
|
7
7
|
Appsignal.config = nil
|
8
|
-
Appsignal.extensions.clear
|
9
8
|
end
|
10
9
|
|
11
10
|
let(:transaction) { http_request_transaction }
|
@@ -20,14 +19,6 @@ describe Appsignal do
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
describe ".extensions" do
|
24
|
-
it "should keep a list of extensions" do
|
25
|
-
expect(Appsignal.extensions).to be_empty
|
26
|
-
Appsignal.extensions << Appsignal::MockExtension
|
27
|
-
expect(Appsignal.extensions.size).to eq(1)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
22
|
describe ".start" do
|
32
23
|
context "with no config set beforehand" do
|
33
24
|
it "should do nothing when config is not set and there is no valid config in the env" do
|
@@ -63,15 +54,6 @@ describe Appsignal do
|
|
63
54
|
Appsignal.start
|
64
55
|
end
|
65
56
|
|
66
|
-
context "with an extension" do
|
67
|
-
before { Appsignal.extensions << Appsignal::MockExtension }
|
68
|
-
|
69
|
-
it "should call the extension's initializer" do
|
70
|
-
expect(Appsignal::MockExtension).to receive(:initializer)
|
71
|
-
Appsignal.start
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
57
|
context "when allocation tracking and gc instrumentation have been enabled" do
|
76
58
|
before do
|
77
59
|
allow(GC::Profiler).to receive(:enable)
|
@@ -86,8 +68,7 @@ describe Appsignal do
|
|
86
68
|
expect_environment_metadata("ruby_gc_instrumentation_enabled", "true")
|
87
69
|
end
|
88
70
|
|
89
|
-
unless
|
90
|
-
|
71
|
+
unless DependencyHelper.running_jruby?
|
91
72
|
it "installs the allocation event hook" do
|
92
73
|
expect(Appsignal::Extension).to receive(:install_allocation_event_hook)
|
93
74
|
.and_call_original
|
@@ -428,49 +409,89 @@ describe Appsignal do
|
|
428
409
|
end
|
429
410
|
|
430
411
|
describe ".monitor_single_transaction" do
|
412
|
+
around { |example| keep_transactions { example.run } }
|
413
|
+
|
431
414
|
context "with a successful call" do
|
432
|
-
it "
|
433
|
-
expect(Appsignal).to receive(:monitor_transaction).with(
|
434
|
-
"perform_job.something",
|
435
|
-
:key => :value
|
436
|
-
).and_yield
|
415
|
+
it "calls monitor_transaction and Appsignal.stop" do
|
437
416
|
expect(Appsignal).to receive(:stop)
|
438
417
|
|
439
|
-
Appsignal.monitor_single_transaction(
|
418
|
+
Appsignal.monitor_single_transaction(
|
419
|
+
"perform_job.something",
|
420
|
+
:controller => :my_controller,
|
421
|
+
:action => :my_action
|
422
|
+
) do
|
440
423
|
# nothing
|
441
424
|
end
|
425
|
+
|
426
|
+
transaction = last_transaction
|
427
|
+
transaction_hash = transaction.to_h
|
428
|
+
expect(transaction_hash).to include(
|
429
|
+
"action" => "my_controller#my_action"
|
430
|
+
)
|
431
|
+
expect(transaction_hash["events"]).to match([
|
432
|
+
hash_including(
|
433
|
+
"name" => "perform_job.something",
|
434
|
+
"title" => "",
|
435
|
+
"body" => "",
|
436
|
+
"body_format" => Appsignal::EventFormatter::DEFAULT
|
437
|
+
)
|
438
|
+
])
|
442
439
|
end
|
443
440
|
end
|
444
441
|
|
445
442
|
context "with an erroring call" do
|
446
443
|
let(:error) { ExampleException.new }
|
447
444
|
|
448
|
-
it "
|
449
|
-
expect(Appsignal).to receive(:monitor_transaction).with(
|
450
|
-
"perform_job.something",
|
451
|
-
:key => :value
|
452
|
-
).and_yield
|
445
|
+
it "calls monitor_transaction and stop and re-raises the error" do
|
453
446
|
expect(Appsignal).to receive(:stop)
|
454
447
|
|
455
448
|
expect do
|
456
|
-
Appsignal.monitor_single_transaction(
|
449
|
+
Appsignal.monitor_single_transaction(
|
450
|
+
"perform_job.something",
|
451
|
+
:controller => :my_controller,
|
452
|
+
:action => :my_action
|
453
|
+
) do
|
457
454
|
raise error
|
458
455
|
end
|
459
456
|
end.to raise_error(error)
|
457
|
+
|
458
|
+
transaction = last_transaction
|
459
|
+
transaction_hash = transaction.to_h
|
460
|
+
expect(transaction_hash).to include(
|
461
|
+
"action" => "my_controller#my_action"
|
462
|
+
)
|
463
|
+
expect(transaction_hash["events"]).to match([
|
464
|
+
hash_including(
|
465
|
+
"name" => "perform_job.something",
|
466
|
+
"title" => "",
|
467
|
+
"body" => "",
|
468
|
+
"body_format" => Appsignal::EventFormatter::DEFAULT
|
469
|
+
)
|
470
|
+
])
|
460
471
|
end
|
461
472
|
end
|
462
473
|
end
|
463
474
|
|
464
475
|
describe ".tag_request" do
|
465
|
-
|
476
|
+
let(:transaction) { http_request_transaction }
|
477
|
+
around do |example|
|
478
|
+
start_agent
|
479
|
+
with_current_transaction transaction do
|
480
|
+
keep_transactions { example.run }
|
481
|
+
end
|
482
|
+
end
|
466
483
|
|
467
484
|
context "with transaction" do
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
end
|
485
|
+
it "calls set_tags on the current transaction" do
|
486
|
+
Appsignal.tag_request("a" => "b")
|
487
|
+
transaction.complete # Manually trigger transaction sampling
|
472
488
|
|
473
|
-
|
489
|
+
expect(transaction.to_h).to include(
|
490
|
+
"sample_data" => hash_including(
|
491
|
+
"tags" => { "a" => "b" }
|
492
|
+
)
|
493
|
+
)
|
494
|
+
end
|
474
495
|
end
|
475
496
|
|
476
497
|
context "without transaction" do
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ActiveJobHelpers
|
2
|
+
def active_job_args_wrapper(args: [], params: nil)
|
3
|
+
if (DependencyHelper.rails6_1_present? && DependencyHelper.ruby_3_1_or_newer?) || DependencyHelper.rails7_present?
|
4
|
+
wrapped_args = {}
|
5
|
+
|
6
|
+
if params
|
7
|
+
if DependencyHelper.rails7_present?
|
8
|
+
wrapped_args["_aj_ruby2_keywords"] = ["params", "args"]
|
9
|
+
wrapped_args["args"] = []
|
10
|
+
wrapped_args["params"] = {
|
11
|
+
"_aj_symbol_keys" => ["foo"]
|
12
|
+
}.merge(params)
|
13
|
+
else
|
14
|
+
wrapped_args["_aj_symbol_keys"] = ["foo"]
|
15
|
+
wrapped_args.merge!(params)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
wrapped_args["_aj_ruby2_keywords"] = ["args"]
|
19
|
+
wrapped_args["args"] = args
|
20
|
+
end
|
21
|
+
|
22
|
+
[wrapped_args]
|
23
|
+
else
|
24
|
+
params.nil? ? args : args + [params]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -9,8 +9,12 @@ module DependencyHelper
|
|
9
9
|
ruby_version.segments.take(2) == [2, 0]
|
10
10
|
end
|
11
11
|
|
12
|
+
def ruby_3_1_or_newer?
|
13
|
+
ruby_version >= Gem::Version.new("3.1.0")
|
14
|
+
end
|
15
|
+
|
12
16
|
def running_jruby?
|
13
|
-
|
17
|
+
Appsignal::System.jruby?
|
14
18
|
end
|
15
19
|
|
16
20
|
def rails_present?
|
@@ -21,6 +25,14 @@ module DependencyHelper
|
|
21
25
|
rails_present? && rails_version >= Gem::Version.new("6.0.0")
|
22
26
|
end
|
23
27
|
|
28
|
+
def rails6_1_present?
|
29
|
+
rails_present? && rails_version >= Gem::Version.new("6.1.0")
|
30
|
+
end
|
31
|
+
|
32
|
+
def rails7_present?
|
33
|
+
rails_present? && rails_version >= Gem::Version.new("7.0.0")
|
34
|
+
end
|
35
|
+
|
24
36
|
def rails_version
|
25
37
|
Gem.loaded_specs["rails"].version
|
26
38
|
end
|
@@ -56,6 +56,16 @@ module TransactionHelpers
|
|
56
56
|
Thread.current[:appsignal_transaction] = nil
|
57
57
|
end
|
58
58
|
|
59
|
+
# Set the current for the duration of the given block.
|
60
|
+
#
|
61
|
+
# Helper for {set_current_transaction} and {clear_current_transaction!}
|
62
|
+
def with_current_transaction(transaction)
|
63
|
+
set_current_transaction transaction
|
64
|
+
yield
|
65
|
+
ensure
|
66
|
+
clear_current_transaction!
|
67
|
+
end
|
68
|
+
|
59
69
|
# Track the AppSignal transaction JSON when a transaction gets completed
|
60
70
|
# ({Appsignal::Transaction.complete}).
|
61
71
|
#
|
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.
|
4
|
+
version: 3.0.21
|
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: 2022-
|
13
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- gemfiles/rails-5.1.gemfile
|
186
186
|
- gemfiles/rails-5.2.gemfile
|
187
187
|
- gemfiles/rails-6.0.gemfile
|
188
|
+
- gemfiles/rails-6.1.gemfile
|
188
189
|
- gemfiles/rails-7.0.gemfile
|
189
190
|
- gemfiles/resque-1.gemfile
|
190
191
|
- gemfiles/resque-2.gemfile
|
@@ -213,6 +214,7 @@ files:
|
|
213
214
|
- lib/appsignal/event_formatter/faraday/request_formatter.rb
|
214
215
|
- lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb
|
215
216
|
- lib/appsignal/event_formatter/moped/query_formatter.rb
|
217
|
+
- lib/appsignal/event_formatter/sequel/sql_formatter.rb
|
216
218
|
- lib/appsignal/extension.rb
|
217
219
|
- lib/appsignal/extension/jruby.rb
|
218
220
|
- lib/appsignal/garbage_collection_profiler.rb
|
@@ -311,6 +313,7 @@ files:
|
|
311
313
|
- spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
|
312
314
|
- spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
|
313
315
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
316
|
+
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
314
317
|
- spec/lib/appsignal/event_formatter_spec.rb
|
315
318
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
316
319
|
- spec/lib/appsignal/extension_install_failure_spec.rb
|
@@ -382,6 +385,7 @@ files:
|
|
382
385
|
- spec/support/fixtures/projects/valid/log/.gitkeep
|
383
386
|
- spec/support/fixtures/uploaded_file.txt
|
384
387
|
- spec/support/helpers/action_mailer_helpers.rb
|
388
|
+
- spec/support/helpers/activejob_helpers.rb
|
385
389
|
- spec/support/helpers/api_request_helper.rb
|
386
390
|
- spec/support/helpers/cli_helpers.rb
|
387
391
|
- spec/support/helpers/config_helpers.rb
|
@@ -401,7 +405,6 @@ files:
|
|
401
405
|
- spec/support/matchers/contains_log.rb
|
402
406
|
- spec/support/matchers/have_colorized_text.rb
|
403
407
|
- spec/support/mocks/fake_gc_profiler.rb
|
404
|
-
- spec/support/mocks/mock_extension.rb
|
405
408
|
- spec/support/mocks/mock_probe.rb
|
406
409
|
- spec/support/rails/my_app.rb
|
407
410
|
- spec/support/shared_examples/instrument.rb
|
@@ -415,6 +418,7 @@ homepage: https://github.com/appsignal/appsignal-ruby
|
|
415
418
|
licenses:
|
416
419
|
- MIT
|
417
420
|
metadata:
|
421
|
+
rubygems_mfa_required: 'true'
|
418
422
|
bug_tracker_uri: https://github.com/appsignal/appsignal-ruby/issues
|
419
423
|
changelog_uri: https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md
|
420
424
|
documentation_uri: https://docs.appsignal.com/ruby/
|
@@ -436,7 +440,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
436
440
|
- !ruby/object:Gem::Version
|
437
441
|
version: '0'
|
438
442
|
requirements: []
|
439
|
-
rubygems_version: 3.
|
443
|
+
rubygems_version: 3.1.6
|
440
444
|
signing_key:
|
441
445
|
specification_version: 4
|
442
446
|
summary: Logs performance and exception data from your app to appsignal.com
|
@@ -462,6 +466,7 @@ test_files:
|
|
462
466
|
- spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb
|
463
467
|
- spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb
|
464
468
|
- spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
|
469
|
+
- spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb
|
465
470
|
- spec/lib/appsignal/event_formatter_spec.rb
|
466
471
|
- spec/lib/appsignal/extension/jruby_spec.rb
|
467
472
|
- spec/lib/appsignal/extension_install_failure_spec.rb
|
@@ -533,6 +538,7 @@ test_files:
|
|
533
538
|
- spec/support/fixtures/projects/valid/log/.gitkeep
|
534
539
|
- spec/support/fixtures/uploaded_file.txt
|
535
540
|
- spec/support/helpers/action_mailer_helpers.rb
|
541
|
+
- spec/support/helpers/activejob_helpers.rb
|
536
542
|
- spec/support/helpers/api_request_helper.rb
|
537
543
|
- spec/support/helpers/cli_helpers.rb
|
538
544
|
- spec/support/helpers/config_helpers.rb
|
@@ -552,7 +558,6 @@ test_files:
|
|
552
558
|
- spec/support/matchers/contains_log.rb
|
553
559
|
- spec/support/matchers/have_colorized_text.rb
|
554
560
|
- spec/support/mocks/fake_gc_profiler.rb
|
555
|
-
- spec/support/mocks/mock_extension.rb
|
556
561
|
- spec/support/mocks/mock_probe.rb
|
557
562
|
- spec/support/rails/my_app.rb
|
558
563
|
- spec/support/shared_examples/instrument.rb
|