appsignal 3.4.16-java → 3.5.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/appsignal/cli/diagnose/paths.rb +8 -4
- data/lib/appsignal/cli/diagnose.rb +5 -0
- data/lib/appsignal/logger.rb +2 -0
- data/lib/appsignal/transaction.rb +36 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +11 -0
- data/spec/lib/appsignal/cli/diagnose_spec.rb +20 -0
- data/spec/lib/appsignal/transaction_spec.rb +93 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe4aa04040848caadc77c47f984ee7969f08a5c36a5bd598e89e5807cb48124e
|
4
|
+
data.tar.gz: b3155c076dc8f322907d1c1d6dc49a7a8b03824272f0d7fb878d5b230fa3a25b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dd1e584fc1caa6a77d719186321a27e576d57d2f534db938a7e9157a520345f58054860ad0095381c4c41710e6d709bf587a1d9685398c81b82cff0255e82e9
|
7
|
+
data.tar.gz: 46b9a9f88c2e8d121ad43f403f41a56712e38f624e75ca899185c76a8244b970bee16637ed59b4b7b0441c0417138a08578db8c0eca3ac1b5e1e65d336b9a499
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.5.1
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- [2e93182b](https://github.com/appsignal/appsignal-ruby/commit/2e93182b6ae83b16fe9885558cd8f0bfce6a9a5f) patch - Fix an error in the diagnose report when reading a file's contents results in an "Invalid seek" error. This could happen when the log path is configured to `/dev/stdout`, which is not supported.
|
8
|
+
- [ae0b779b](https://github.com/appsignal/appsignal-ruby/commit/ae0b779b3ec00cc46291bc0373d748d720231e74) patch - Fix logger compatibility with Ruby 3.3
|
9
|
+
|
10
|
+
## 3.5.0
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- [cee1676f](https://github.com/appsignal/appsignal-ruby/commit/cee1676fc5539e380c58e8a824b5c59c3c927119) minor - Nested errors are now supported. The error causes are stored as sample data on the transaction so they can be displayed in the UI.
|
15
|
+
|
3
16
|
## 3.4.16
|
4
17
|
|
5
18
|
### Changed
|
@@ -71,10 +71,14 @@ module Appsignal
|
|
71
71
|
:group => Utils.group_for_gid(path_gid)
|
72
72
|
}
|
73
73
|
if info[:type] == "file"
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
begin
|
75
|
+
info[:content] = Utils.read_file_content(
|
76
|
+
path,
|
77
|
+
BYTES_TO_READ_FOR_FILES
|
78
|
+
).split("\n")
|
79
|
+
rescue => error
|
80
|
+
info[:read_error] = "#{error.class}: #{error.message}"
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
80
84
|
end
|
data/lib/appsignal/logger.rb
CHANGED
@@ -12,6 +12,7 @@ module Appsignal
|
|
12
12
|
ALLOWED_TAG_KEY_TYPES = [Symbol, String].freeze
|
13
13
|
ALLOWED_TAG_VALUE_TYPES = [Symbol, String, Integer].freeze
|
14
14
|
BREADCRUMB_LIMIT = 20
|
15
|
+
ERROR_CAUSES_LIMIT = 10
|
15
16
|
|
16
17
|
class << self
|
17
18
|
def create(id, namespace, request, options = {})
|
@@ -374,6 +375,41 @@ module Appsignal
|
|
374
375
|
cleaned_error_message(error),
|
375
376
|
backtrace ? Appsignal::Utils::Data.generate(backtrace) : Appsignal::Extension.data_array_new
|
376
377
|
)
|
378
|
+
|
379
|
+
root_cause_missing = false
|
380
|
+
|
381
|
+
causes = []
|
382
|
+
while error
|
383
|
+
error = error.cause
|
384
|
+
|
385
|
+
break unless error
|
386
|
+
|
387
|
+
if causes.length >= ERROR_CAUSES_LIMIT
|
388
|
+
Appsignal.logger.debug "Appsignal::Transaction#set_error: Error has more " \
|
389
|
+
"than #{ERROR_CAUSES_LIMIT} error causes. Only the first #{ERROR_CAUSES_LIMIT} " \
|
390
|
+
"will be reported."
|
391
|
+
root_cause_missing = true
|
392
|
+
break
|
393
|
+
end
|
394
|
+
|
395
|
+
causes << error
|
396
|
+
end
|
397
|
+
|
398
|
+
return if causes.empty?
|
399
|
+
|
400
|
+
causes_sample_data = causes.map do |e|
|
401
|
+
{
|
402
|
+
:name => e.class.name,
|
403
|
+
:message => cleaned_error_message(e)
|
404
|
+
}
|
405
|
+
end
|
406
|
+
|
407
|
+
causes_sample_data.last[:is_root_cause] = false if root_cause_missing
|
408
|
+
|
409
|
+
set_sample_data(
|
410
|
+
"error_causes",
|
411
|
+
causes_sample_data
|
412
|
+
)
|
377
413
|
end
|
378
414
|
alias_method :add_exception, :set_error
|
379
415
|
|
data/lib/appsignal/version.rb
CHANGED
@@ -71,5 +71,16 @@ describe Appsignal::CLI::Diagnose::Utils do
|
|
71
71
|
is_expected.to eq(file_contents)
|
72
72
|
end
|
73
73
|
end
|
74
|
+
|
75
|
+
context "when reading the file raises an illegal seek error" do
|
76
|
+
let(:file_contents) { "line 1\n" }
|
77
|
+
before do
|
78
|
+
expect(File).to receive(:binread).and_raise(Errno::ESPIPE)
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns the error as the content" do
|
82
|
+
expect { subject }.to raise_error(Errno::ESPIPE)
|
83
|
+
end
|
84
|
+
end
|
74
85
|
end
|
75
86
|
end
|
@@ -1424,6 +1424,26 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
1424
1424
|
)
|
1425
1425
|
end
|
1426
1426
|
end
|
1427
|
+
|
1428
|
+
context "when reading the file returns a illegal seek error" do
|
1429
|
+
before do
|
1430
|
+
File.write(file_path, "Some content")
|
1431
|
+
allow(File).to receive(:binread).and_call_original
|
1432
|
+
expect(File).to receive(:binread).with(file_path, anything,
|
1433
|
+
anything).and_raise(Errno::ESPIPE)
|
1434
|
+
run
|
1435
|
+
end
|
1436
|
+
|
1437
|
+
it "outputs file does not exists" do
|
1438
|
+
expect(output).to include %(Read error: Errno::ESPIPE: Illegal seek)
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
it "transmits file data in report" do
|
1442
|
+
expect(received_report["paths"][filename]).to include(
|
1443
|
+
"read_error" => "Errno::ESPIPE: Illegal seek"
|
1444
|
+
)
|
1445
|
+
end
|
1446
|
+
end
|
1427
1447
|
end
|
1428
1448
|
|
1429
1449
|
describe "mkmf.log" do
|
@@ -788,6 +788,99 @@ describe Appsignal::Transaction do
|
|
788
788
|
end
|
789
789
|
end
|
790
790
|
|
791
|
+
context "when the error has no causes" do
|
792
|
+
it "should not send the causes information as sample data" do
|
793
|
+
expect(transaction.ext).to_not receive(:set_sample_data)
|
794
|
+
|
795
|
+
transaction.set_error(error)
|
796
|
+
end
|
797
|
+
end
|
798
|
+
|
799
|
+
context "when the error has multiple causes" do
|
800
|
+
let(:error) do
|
801
|
+
e = ExampleStandardError.new("test message")
|
802
|
+
e2 = RuntimeError.new("cause message")
|
803
|
+
e3 = StandardError.new("cause message 2")
|
804
|
+
allow(e).to receive(:backtrace).and_return(["line 1"])
|
805
|
+
allow(e).to receive(:cause).and_return(e2)
|
806
|
+
allow(e2).to receive(:cause).and_return(e3)
|
807
|
+
e
|
808
|
+
end
|
809
|
+
|
810
|
+
it "sends the causes information as sample data" do
|
811
|
+
expect(transaction.ext).to receive(:set_error).with(
|
812
|
+
"ExampleStandardError",
|
813
|
+
"test message",
|
814
|
+
Appsignal::Utils::Data.generate(["line 1"])
|
815
|
+
)
|
816
|
+
|
817
|
+
expect(transaction.ext).to receive(:set_sample_data).with(
|
818
|
+
"error_causes",
|
819
|
+
Appsignal::Utils::Data.generate(
|
820
|
+
[
|
821
|
+
{
|
822
|
+
:name => "RuntimeError",
|
823
|
+
:message => "cause message"
|
824
|
+
},
|
825
|
+
{
|
826
|
+
:name => "StandardError",
|
827
|
+
:message => "cause message 2"
|
828
|
+
}
|
829
|
+
]
|
830
|
+
)
|
831
|
+
)
|
832
|
+
|
833
|
+
expect(Appsignal.logger).to_not receive(:debug)
|
834
|
+
|
835
|
+
transaction.set_error(error)
|
836
|
+
end
|
837
|
+
end
|
838
|
+
|
839
|
+
context "when the error has too many causes" do
|
840
|
+
let(:error) do
|
841
|
+
e = ExampleStandardError.new("root cause error")
|
842
|
+
|
843
|
+
11.times do |i|
|
844
|
+
next_e = ExampleStandardError.new("wrapper error #{i}")
|
845
|
+
allow(next_e).to receive(:cause).and_return(e)
|
846
|
+
e = next_e
|
847
|
+
end
|
848
|
+
|
849
|
+
allow(e).to receive(:backtrace).and_return(["line 1"])
|
850
|
+
e
|
851
|
+
end
|
852
|
+
|
853
|
+
it "sends only the first causes as sample data" do
|
854
|
+
expect(transaction.ext).to receive(:set_error).with(
|
855
|
+
"ExampleStandardError",
|
856
|
+
"wrapper error 10",
|
857
|
+
Appsignal::Utils::Data.generate(["line 1"])
|
858
|
+
)
|
859
|
+
|
860
|
+
expected_error_causes = Array.new(10) do |i|
|
861
|
+
{
|
862
|
+
:name => "ExampleStandardError",
|
863
|
+
:message => "wrapper error #{9 - i}"
|
864
|
+
}
|
865
|
+
end
|
866
|
+
|
867
|
+
expected_error_causes.last[:is_root_cause] = false
|
868
|
+
|
869
|
+
expect(transaction.ext).to receive(:set_sample_data).with(
|
870
|
+
"error_causes",
|
871
|
+
Appsignal::Utils::Data.generate(expected_error_causes)
|
872
|
+
)
|
873
|
+
|
874
|
+
expect(Appsignal.logger).to receive(:debug).with(
|
875
|
+
"Appsignal::Transaction#set_error: Error has more " \
|
876
|
+
"than 10 error causes. Only the first 10 " \
|
877
|
+
"will be reported."
|
878
|
+
)
|
879
|
+
|
880
|
+
transaction.set_error(error)
|
881
|
+
end
|
882
|
+
end
|
883
|
+
|
791
884
|
context "when error message is nil" do
|
792
885
|
let(:error) do
|
793
886
|
e = ExampleStandardError.new
|
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.
|
4
|
+
version: 3.5.1
|
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: 2023-12-
|
13
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -460,7 +460,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
460
460
|
- !ruby/object:Gem::Version
|
461
461
|
version: '0'
|
462
462
|
requirements: []
|
463
|
-
rubygems_version: 3.
|
463
|
+
rubygems_version: 3.4.11
|
464
464
|
signing_key:
|
465
465
|
specification_version: 4
|
466
466
|
summary: Logs performance and exception data from your app to appsignal.com
|