appsignal 2.11.8-java → 3.0.1-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/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +1 -1
- data/.semaphore/semaphore.yml +88 -111
- data/CHANGELOG.md +24 -0
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +11 -15
- data/lib/appsignal.rb +2 -29
- data/lib/appsignal/auth_check.rb +2 -8
- data/lib/appsignal/cli.rb +1 -23
- data/lib/appsignal/config.rb +1 -25
- data/lib/appsignal/event_formatter.rb +0 -25
- data/lib/appsignal/helpers/instrumentation.rb +69 -5
- data/lib/appsignal/hooks.rb +6 -13
- data/lib/appsignal/hooks/action_cable.rb +3 -34
- data/lib/appsignal/hooks/active_support_notifications.rb +7 -86
- data/lib/appsignal/hooks/celluloid.rb +5 -9
- data/lib/appsignal/hooks/net_http.rb +2 -12
- data/lib/appsignal/hooks/puma.rb +3 -5
- data/lib/appsignal/hooks/que.rb +1 -1
- data/lib/appsignal/hooks/rake.rb +2 -24
- data/lib/appsignal/hooks/redis.rb +2 -13
- data/lib/appsignal/hooks/resque.rb +2 -43
- data/lib/appsignal/hooks/sidekiq.rb +6 -143
- data/lib/appsignal/hooks/unicorn.rb +3 -24
- data/lib/appsignal/hooks/webmachine.rb +1 -7
- data/lib/appsignal/integrations/action_cable.rb +34 -0
- data/lib/appsignal/integrations/active_support_notifications.rb +77 -0
- data/lib/appsignal/integrations/net_http.rb +16 -0
- data/lib/appsignal/integrations/object.rb +39 -4
- data/lib/appsignal/integrations/padrino.rb +5 -7
- data/lib/appsignal/integrations/que.rb +26 -33
- data/lib/appsignal/integrations/railtie.rb +1 -4
- data/lib/appsignal/integrations/rake.rb +26 -2
- data/lib/appsignal/integrations/redis.rb +17 -0
- data/lib/appsignal/integrations/resque.rb +39 -10
- data/lib/appsignal/integrations/sidekiq.rb +171 -0
- data/lib/appsignal/integrations/unicorn.rb +28 -0
- data/lib/appsignal/integrations/webmachine.rb +22 -24
- data/lib/appsignal/minutely.rb +0 -12
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/auth_check_spec.rb +1 -24
- data/spec/lib/appsignal/cli_spec.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +2 -66
- data/spec/lib/appsignal/event_formatter_spec.rb +0 -37
- data/spec/lib/appsignal/hooks/celluloid_spec.rb +6 -1
- data/spec/lib/appsignal/hooks/rake_spec.rb +1 -2
- data/spec/lib/appsignal/hooks/redis_spec.rb +50 -15
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +12 -464
- data/spec/lib/appsignal/hooks/unicorn_spec.rb +14 -3
- data/spec/lib/appsignal/hooks/webmachine_spec.rb +2 -13
- data/spec/lib/appsignal/hooks_spec.rb +6 -22
- data/spec/lib/appsignal/integrations/object_spec.rb +91 -8
- data/spec/lib/appsignal/integrations/padrino_spec.rb +2 -3
- data/spec/lib/appsignal/integrations/railtie_spec.rb +0 -45
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +524 -0
- data/spec/lib/appsignal/integrations/webmachine_spec.rb +26 -8
- data/spec/lib/appsignal/minutely_spec.rb +0 -19
- data/spec/lib/appsignal/transaction_spec.rb +1 -14
- data/spec/lib/appsignal/transmitter_spec.rb +1 -1
- data/spec/lib/appsignal_spec.rb +162 -116
- data/spec/spec_helper.rb +1 -15
- metadata +11 -21
- data/lib/appsignal/cli/notify_of_deploy.rb +0 -131
- data/lib/appsignal/integrations/object_ruby_19.rb +0 -37
- data/lib/appsignal/integrations/object_ruby_modern.rb +0 -64
- data/lib/appsignal/integrations/resque_active_job.rb +0 -19
- data/lib/appsignal/js_exception_transaction.rb +0 -56
- data/lib/appsignal/rack/js_exception_catcher.rb +0 -80
- data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +0 -180
- data/spec/lib/appsignal/integrations/object_19_spec.rb +0 -266
- data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +0 -28
- data/spec/lib/appsignal/integrations/resque_spec.rb +0 -28
- data/spec/lib/appsignal/js_exception_transaction_spec.rb +0 -128
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -170
@@ -1,12 +1,24 @@
|
|
1
1
|
if DependencyHelper.webmachine_present?
|
2
2
|
require "appsignal/integrations/webmachine"
|
3
3
|
|
4
|
-
|
4
|
+
class Response
|
5
|
+
attr_accessor :code
|
6
|
+
|
7
|
+
def body
|
8
|
+
""
|
9
|
+
end
|
10
|
+
|
11
|
+
def headers
|
12
|
+
{}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe Appsignal::Integrations::WebmachineIntegration do
|
5
17
|
let(:request) do
|
6
18
|
Webmachine::Request.new("GET", "http://google.com:80/foo", {}, nil)
|
7
19
|
end
|
8
|
-
let(:resource) { double(:trace? => false, :handle_exception => true) }
|
9
|
-
let(:response) {
|
20
|
+
let(:resource) { double(:trace? => false, :handle_exception => true, :"code=" => nil) }
|
21
|
+
let(:response) { Response.new }
|
10
22
|
let(:transaction) { double(:set_action_if_nil => true) }
|
11
23
|
let(:fsm) { Webmachine::Decision::FSM.new(resource, request, response) }
|
12
24
|
before(:context) { start_agent }
|
@@ -18,10 +30,8 @@ if DependencyHelper.webmachine_present?
|
|
18
30
|
end
|
19
31
|
end
|
20
32
|
|
21
|
-
describe "#
|
33
|
+
describe "#run" do
|
22
34
|
before do
|
23
|
-
allow(fsm).to receive(:request).and_return(request)
|
24
|
-
allow(fsm).to receive(:run_without_appsignal).and_return(true)
|
25
35
|
allow(SecureRandom).to receive(:uuid).and_return("uuid")
|
26
36
|
allow(Appsignal::Transaction).to receive(:create).and_return(transaction)
|
27
37
|
end
|
@@ -40,7 +50,7 @@ if DependencyHelper.webmachine_present?
|
|
40
50
|
end
|
41
51
|
|
42
52
|
it "should call the original method" do
|
43
|
-
expect(fsm).to receive(:
|
53
|
+
expect(fsm).to receive(:run)
|
44
54
|
end
|
45
55
|
|
46
56
|
it "should instrument the original method" do
|
@@ -52,9 +62,17 @@ if DependencyHelper.webmachine_present?
|
|
52
62
|
end
|
53
63
|
|
54
64
|
after { fsm.run }
|
65
|
+
|
66
|
+
describe "concerning the response" do
|
67
|
+
it "sets a response code" do
|
68
|
+
expect(fsm.response.code).to be_nil
|
69
|
+
fsm.run
|
70
|
+
expect(fsm.response.code).not_to be_nil
|
71
|
+
end
|
72
|
+
end
|
55
73
|
end
|
56
74
|
|
57
|
-
describe "#
|
75
|
+
describe "#handle_exceptions" do
|
58
76
|
let(:error) { ExampleException }
|
59
77
|
|
60
78
|
it "should catch the error and send it to AppSignal" do
|
@@ -284,25 +284,6 @@ describe Appsignal::Minutely do
|
|
284
284
|
end
|
285
285
|
end
|
286
286
|
|
287
|
-
describe "#<<" do
|
288
|
-
let(:err_stream) { std_stream }
|
289
|
-
let(:stderr) { err_stream.read }
|
290
|
-
let(:log_stream) { std_stream }
|
291
|
-
let(:log) { log_contents(log_stream) }
|
292
|
-
before { Appsignal.logger = test_logger(log_stream) }
|
293
|
-
|
294
|
-
it "adds the probe, but prints a deprecation warning" do
|
295
|
-
probe = lambda {}
|
296
|
-
capture_std_streams(std_stream, err_stream) { collection << probe }
|
297
|
-
deprecation_message = "Deprecated " \
|
298
|
-
"`Appsignal::Minute.probes <<` call. Please use " \
|
299
|
-
"`Appsignal::Minutely.probes.register` instead."
|
300
|
-
expect(stderr).to include "appsignal WARNING: #{deprecation_message}"
|
301
|
-
expect(log).to contains_log :warn, deprecation_message
|
302
|
-
expect(collection[probe.object_id]).to eql(probe)
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
287
|
describe "#register" do
|
307
288
|
let(:log_stream) { std_stream }
|
308
289
|
let(:log) { log_contents(log_stream) }
|
@@ -640,7 +640,7 @@ describe Appsignal::Transaction do
|
|
640
640
|
end
|
641
641
|
|
642
642
|
context "when the data cannot be converted to JSON" do
|
643
|
-
it "does not update the sample data on the transaction"
|
643
|
+
it "does not update the sample data on the transaction" do
|
644
644
|
klass = Class.new do
|
645
645
|
def to_s
|
646
646
|
raise "foo" # Cause a deliberate error
|
@@ -652,19 +652,6 @@ describe Appsignal::Transaction do
|
|
652
652
|
expect(log_contents(log)).to contains_log :error,
|
653
653
|
"Error generating data (RuntimeError: foo) for"
|
654
654
|
end
|
655
|
-
|
656
|
-
it "does not update the sample data on the transaction", :only_ruby19 do
|
657
|
-
klass = Class.new do
|
658
|
-
def to_s
|
659
|
-
raise "foo" # Cause a deliberate error
|
660
|
-
end
|
661
|
-
end
|
662
|
-
transaction.set_sample_data("params", klass.new => 1)
|
663
|
-
|
664
|
-
expect(transaction.to_h["sample_data"]).to eq({})
|
665
|
-
expect(log_contents(log)).to contains_log :error,
|
666
|
-
"Error generating data (RuntimeError: foo). Can't inspect data."
|
667
|
-
end
|
668
655
|
end
|
669
656
|
end
|
670
657
|
|
@@ -143,7 +143,7 @@ describe Appsignal::Transmitter do
|
|
143
143
|
context "with a proxy" do
|
144
144
|
let(:config) { project_fixture_config("production", :http_proxy => "http://localhost:8080") }
|
145
145
|
|
146
|
-
it "is of Net::HTTP class"
|
146
|
+
it "is of Net::HTTP class" do
|
147
147
|
expect(subject).to be_instance_of(Net::HTTP)
|
148
148
|
end
|
149
149
|
it { expect(subject.proxy?).to be_truthy }
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -63,11 +63,6 @@ describe Appsignal do
|
|
63
63
|
Appsignal.start
|
64
64
|
end
|
65
65
|
|
66
|
-
it "should load deprecated event formatters" do
|
67
|
-
expect(Appsignal::EventFormatter).to receive(:initialize_deprecated_formatters)
|
68
|
-
Appsignal.start
|
69
|
-
end
|
70
|
-
|
71
66
|
context "with an extension" do
|
72
67
|
before { Appsignal.extensions << Appsignal::MockExtension }
|
73
68
|
|
@@ -691,6 +686,9 @@ describe Appsignal do
|
|
691
686
|
)
|
692
687
|
end
|
693
688
|
let(:error) { ExampleException.new }
|
689
|
+
let(:err_stream) { std_stream }
|
690
|
+
let(:stderr) { err_stream.read }
|
691
|
+
around { |example| keep_transactions { example.run } }
|
694
692
|
|
695
693
|
it "sends the error to AppSignal" do
|
696
694
|
expect(Appsignal::Transaction).to receive(:new).with(
|
@@ -724,30 +722,60 @@ describe Appsignal do
|
|
724
722
|
|
725
723
|
context "with tags" do
|
726
724
|
let(:tags) { { :a => "a", :b => "b" } }
|
727
|
-
before do
|
728
|
-
allow(Appsignal::Transaction).to receive(:new).and_return(transaction)
|
729
|
-
end
|
730
725
|
|
731
|
-
it "
|
732
|
-
|
733
|
-
|
726
|
+
it "prints a deprecation warning and tags the transaction" do
|
727
|
+
logs = capture_logs do
|
728
|
+
expect do
|
729
|
+
capture_std_streams(std_stream, err_stream) do
|
730
|
+
Appsignal.send_error(error, tags)
|
731
|
+
end
|
732
|
+
end.to change { created_transactions.count }.by(1)
|
733
|
+
end
|
734
|
+
|
735
|
+
transaction = last_transaction
|
736
|
+
transaction_hash = transaction.to_h
|
737
|
+
expect(transaction_hash).to include(
|
738
|
+
"sample_data" => hash_including(
|
739
|
+
"tags" => { "a" => "a", "b" => "b" }
|
740
|
+
)
|
741
|
+
)
|
734
742
|
|
735
|
-
Appsignal.send_error
|
743
|
+
message = "The tags argument for `Appsignal.send_error` is deprecated. " \
|
744
|
+
"Please use the block method to set tags instead.\n\n" \
|
745
|
+
" Appsignal.send_error(error) do |transaction|\n" \
|
746
|
+
" transaction.set_tags(#{tags.inspect})\n" \
|
747
|
+
" end\n\n" \
|
748
|
+
"Appsignal.send_error called on location: #{__FILE__}:"
|
749
|
+
expect(stderr).to include("appsignal WARNING: #{message}")
|
750
|
+
expect(logs).to include(message)
|
736
751
|
end
|
737
752
|
end
|
738
753
|
|
739
754
|
context "with namespace" do
|
740
755
|
let(:namespace) { "admin" }
|
741
756
|
|
742
|
-
it "sets the namespace on the transaction" do
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
757
|
+
it "prints a deprecation warning and sets the namespace on the transaction" do
|
758
|
+
logs = capture_logs do
|
759
|
+
expect do
|
760
|
+
capture_std_streams(std_stream, err_stream) do
|
761
|
+
Appsignal.send_error(error, nil, namespace)
|
762
|
+
end
|
763
|
+
end.to change { created_transactions.count }.by(1)
|
764
|
+
end
|
765
|
+
|
766
|
+
transaction = last_transaction
|
767
|
+
transaction_hash = transaction.to_h
|
768
|
+
expect(transaction_hash).to include("namespace" => namespace)
|
749
769
|
|
750
|
-
|
770
|
+
message = "The namespace argument for `Appsignal.send_error` is deprecated. " \
|
771
|
+
"Please use the block method to set the namespace instead.\n\n" \
|
772
|
+
" Appsignal.send_error(error) do |transaction|\n" \
|
773
|
+
" transaction.namespace(#{namespace.inspect})\n" \
|
774
|
+
" end\n\n" \
|
775
|
+
"Appsignal.send_error called on location: #{__FILE__}:"
|
776
|
+
expect(stderr).to include("appsignal WARNING: #{message}")
|
777
|
+
expect(logs).to include(message)
|
778
|
+
end
|
751
779
|
end
|
752
780
|
|
753
781
|
context "when given a block" do
|
@@ -774,53 +802,85 @@ describe Appsignal do
|
|
774
802
|
end
|
775
803
|
|
776
804
|
describe ".listen_for_error" do
|
805
|
+
around { |example| keep_transactions { example.run } }
|
806
|
+
|
777
807
|
it "records the error and re-raise it" do
|
778
|
-
expect(Appsignal).to receive(:send_error).with(
|
779
|
-
kind_of(ExampleException),
|
780
|
-
nil,
|
781
|
-
Appsignal::Transaction::HTTP_REQUEST
|
782
|
-
)
|
783
808
|
expect do
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
809
|
+
expect do
|
810
|
+
Appsignal.listen_for_error do
|
811
|
+
raise ExampleException, "I am an exception"
|
812
|
+
end
|
813
|
+
end.to raise_error(ExampleException, "I am an exception")
|
814
|
+
end.to change { created_transactions.count }.by(1)
|
815
|
+
|
816
|
+
expect(last_transaction.to_h).to include(
|
817
|
+
"error" => {
|
818
|
+
"name" => "ExampleException",
|
819
|
+
"message" => "I am an exception",
|
820
|
+
"backtrace" => kind_of(String)
|
821
|
+
},
|
822
|
+
"namespace" => Appsignal::Transaction::HTTP_REQUEST, # Default namespace
|
823
|
+
"sample_data" => hash_including(
|
824
|
+
"tags" => {}
|
825
|
+
)
|
826
|
+
)
|
788
827
|
end
|
789
828
|
|
790
829
|
context "with tags" do
|
791
830
|
it "adds tags to the transaction" do
|
792
|
-
expect(Appsignal).to receive(:send_error).with(
|
793
|
-
kind_of(ExampleException),
|
794
|
-
{ "foo" => "bar" },
|
795
|
-
Appsignal::Transaction::HTTP_REQUEST
|
796
|
-
)
|
797
831
|
expect do
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
832
|
+
expect do
|
833
|
+
Appsignal.listen_for_error("foo" => "bar") do
|
834
|
+
raise ExampleException, "I am an exception"
|
835
|
+
end
|
836
|
+
end.to raise_error(ExampleException, "I am an exception")
|
837
|
+
end.to change { created_transactions.count }.by(1)
|
838
|
+
|
839
|
+
expect(last_transaction.to_h).to include(
|
840
|
+
"error" => {
|
841
|
+
"name" => "ExampleException",
|
842
|
+
"message" => "I am an exception",
|
843
|
+
"backtrace" => kind_of(String)
|
844
|
+
},
|
845
|
+
"namespace" => Appsignal::Transaction::HTTP_REQUEST, # Default namespace
|
846
|
+
"sample_data" => hash_including(
|
847
|
+
"tags" => { "foo" => "bar" }
|
848
|
+
)
|
849
|
+
)
|
802
850
|
end
|
803
851
|
end
|
804
852
|
|
805
853
|
context "with a custom namespace" do
|
806
854
|
it "adds the namespace to the transaction" do
|
807
|
-
expect(Appsignal).to receive(:send_error).with(
|
808
|
-
kind_of(ExampleException),
|
809
|
-
nil,
|
810
|
-
"custom_namespace"
|
811
|
-
)
|
812
855
|
expect do
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
856
|
+
expect do
|
857
|
+
Appsignal.listen_for_error(nil, "custom_namespace") do
|
858
|
+
raise ExampleException, "I am an exception"
|
859
|
+
end
|
860
|
+
end.to raise_error(ExampleException, "I am an exception")
|
861
|
+
end.to change { created_transactions.count }.by(1)
|
862
|
+
|
863
|
+
expect(last_transaction.to_h).to include(
|
864
|
+
"error" => {
|
865
|
+
"name" => "ExampleException",
|
866
|
+
"message" => "I am an exception",
|
867
|
+
"backtrace" => kind_of(String)
|
868
|
+
},
|
869
|
+
"namespace" => "custom_namespace",
|
870
|
+
"sample_data" => hash_including(
|
871
|
+
"tags" => {}
|
872
|
+
)
|
873
|
+
)
|
817
874
|
end
|
818
875
|
end
|
819
876
|
end
|
820
877
|
|
821
878
|
describe ".set_error" do
|
879
|
+
let(:err_stream) { std_stream }
|
880
|
+
let(:stderr) { err_stream.read }
|
881
|
+
let(:error) { ExampleException.new("I am an exception") }
|
822
882
|
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
823
|
-
|
883
|
+
around { |example| keep_transactions { example.run } }
|
824
884
|
|
825
885
|
context "when there is an active transaction" do
|
826
886
|
it "adds the error to the active transaction" do
|
@@ -850,24 +910,74 @@ describe Appsignal do
|
|
850
910
|
context "with tags" do
|
851
911
|
let(:tags) { { "foo" => "bar" } }
|
852
912
|
|
853
|
-
it "
|
913
|
+
it "prints a deprecation warning and tags the transaction" do
|
854
914
|
expect(transaction).to receive(:set_error).with(error)
|
855
915
|
expect(transaction).to receive(:set_tags).with(tags)
|
856
916
|
expect(transaction).to_not receive(:set_namespace)
|
857
917
|
|
858
|
-
|
918
|
+
logs = capture_logs do
|
919
|
+
capture_std_streams(std_stream, err_stream) do
|
920
|
+
Appsignal.set_error(error, tags)
|
921
|
+
end
|
922
|
+
end
|
923
|
+
|
924
|
+
message = "The tags argument for `Appsignal.set_error` is deprecated. " \
|
925
|
+
"Please use the block method to set tags instead.\n\n" \
|
926
|
+
" Appsignal.set_error(error) do |transaction|\n" \
|
927
|
+
" transaction.set_tags(#{tags.inspect})\n" \
|
928
|
+
" end\n\n" \
|
929
|
+
"Appsignal.set_error called on location: #{__FILE__}:"
|
930
|
+
expect(stderr).to include("appsignal WARNING: #{message}")
|
931
|
+
expect(logs).to include(message)
|
859
932
|
end
|
860
933
|
end
|
861
934
|
|
862
935
|
context "with namespace" do
|
863
936
|
let(:namespace) { "admin" }
|
864
937
|
|
865
|
-
it "
|
938
|
+
it "prints a deprecation warning andsets the namespace on the transaction" do
|
866
939
|
expect(transaction).to receive(:set_error).with(error)
|
867
940
|
expect(transaction).to_not receive(:set_tags)
|
868
941
|
expect(transaction).to receive(:set_namespace).with(namespace)
|
869
942
|
|
870
|
-
|
943
|
+
logs = capture_logs do
|
944
|
+
capture_std_streams(std_stream, err_stream) do
|
945
|
+
Appsignal.set_error(error, nil, namespace)
|
946
|
+
end
|
947
|
+
end
|
948
|
+
|
949
|
+
message = "The namespace argument for `Appsignal.set_error` is deprecated. " \
|
950
|
+
"Please use the block method to set the namespace instead.\n\n" \
|
951
|
+
" Appsignal.set_error(error) do |transaction|\n" \
|
952
|
+
" transaction.namespace(#{namespace.inspect})\n" \
|
953
|
+
" end\n\n" \
|
954
|
+
"Appsignal.set_error called on location: #{__FILE__}:"
|
955
|
+
expect(stderr).to include("appsignal WARNING: #{message}")
|
956
|
+
expect(logs).to include(message)
|
957
|
+
end
|
958
|
+
end
|
959
|
+
|
960
|
+
context "when given a block" do
|
961
|
+
it "yields the transaction and allows additional metadata to be set" do
|
962
|
+
captured_transaction = nil
|
963
|
+
keep_transactions do
|
964
|
+
Appsignal.set_error(StandardError.new("my_error")) do |transaction|
|
965
|
+
captured_transaction = transaction
|
966
|
+
transaction.set_action("my_action")
|
967
|
+
transaction.set_namespace("my_namespace")
|
968
|
+
end
|
969
|
+
end
|
970
|
+
|
971
|
+
expect(transaction).to eql(captured_transaction)
|
972
|
+
expect(captured_transaction.to_h).to include(
|
973
|
+
"namespace" => "my_namespace",
|
974
|
+
"action" => "my_action",
|
975
|
+
"error" => {
|
976
|
+
"name" => "StandardError",
|
977
|
+
"message" => "my_error",
|
978
|
+
"backtrace" => kind_of(String)
|
979
|
+
}
|
980
|
+
)
|
871
981
|
end
|
872
982
|
end
|
873
983
|
end
|
@@ -980,70 +1090,6 @@ describe Appsignal do
|
|
980
1090
|
end
|
981
1091
|
end
|
982
1092
|
end
|
983
|
-
|
984
|
-
describe ".is_ignored_error?" do
|
985
|
-
let(:error) { StandardError.new }
|
986
|
-
let(:err_stream) { std_stream }
|
987
|
-
let(:stderr) { err_stream.read }
|
988
|
-
before do
|
989
|
-
allow(Appsignal).to receive(:config).and_return(:ignore_errors => ["StandardError"])
|
990
|
-
end
|
991
|
-
|
992
|
-
subject do
|
993
|
-
capture_std_streams(std_stream, err_stream) do
|
994
|
-
Appsignal.is_ignored_error?(error)
|
995
|
-
end
|
996
|
-
end
|
997
|
-
|
998
|
-
it "should return true if it's in the ignored list" do
|
999
|
-
is_expected.to be_truthy
|
1000
|
-
end
|
1001
|
-
|
1002
|
-
it "outputs deprecated warning" do
|
1003
|
-
subject
|
1004
|
-
expect(stderr).to include("Appsignal.is_ignored_error? is deprecated with no replacement")
|
1005
|
-
end
|
1006
|
-
|
1007
|
-
context "when error is not in the ignored list" do
|
1008
|
-
let(:error) { Object.new }
|
1009
|
-
|
1010
|
-
it "should return false" do
|
1011
|
-
is_expected.to be_falsy
|
1012
|
-
end
|
1013
|
-
end
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
describe ".is_ignored_action?" do
|
1017
|
-
let(:action) { "TestController#isup" }
|
1018
|
-
let(:err_stream) { std_stream }
|
1019
|
-
let(:stderr) { err_stream.read }
|
1020
|
-
before do
|
1021
|
-
allow(Appsignal).to receive(:config).and_return(:ignore_actions => "TestController#isup")
|
1022
|
-
end
|
1023
|
-
|
1024
|
-
subject do
|
1025
|
-
capture_std_streams(std_stream, err_stream) do
|
1026
|
-
Appsignal.is_ignored_action?(action)
|
1027
|
-
end
|
1028
|
-
end
|
1029
|
-
|
1030
|
-
it "should return true if it's in the ignored list" do
|
1031
|
-
is_expected.to be_truthy
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
it "outputs deprecated warning" do
|
1035
|
-
subject
|
1036
|
-
expect(stderr).to include("Appsignal.is_ignored_action? is deprecated with no replacement")
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
context "when action is not in the ingore list" do
|
1040
|
-
let(:action) { "TestController#other_action" }
|
1041
|
-
|
1042
|
-
it "should return false" do
|
1043
|
-
is_expected.to be_falsy
|
1044
|
-
end
|
1045
|
-
end
|
1046
|
-
end
|
1047
1093
|
end
|
1048
1094
|
|
1049
1095
|
describe ".start_logger" do
|