appsignal 3.12.0-java → 3.12.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 +11 -5
- data/lib/appsignal/helpers/instrumentation.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/transaction_spec.rb +57 -68
- data/spec/lib/appsignal_spec.rb +6 -0
- data/spec/support/matchers/transaction.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444ef21c052b54cf0691be97d913fd6c3faa7e54219a570a6aae4117b7c83dea
|
4
|
+
data.tar.gz: '095b571b4b2bb8d2e8f413d10f75ec07be08306472b2182cba69d2e628305b72'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d506f968e386e6a195b9f30f9c0a10f7860105d88e120a021917fc6c8e57595eb4199778a6a57b5f2d058770f79125b36e8c0b6b9abd757027a397ec35791d
|
7
|
+
data.tar.gz: b60993c16502163d34dd7352a7636cea2fd4f7b572b241282d819be0e4a4d21dc739f52a615f2e4dd5ed28197b8873631b3288abfb29671fcd52b1f7cc2a6b3e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.12.1
|
4
|
+
|
5
|
+
_Published on 2024-07-25._
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Fix `Appsignal.monitor_and_stop` block passing. It would error with a `LocalJumpError`. Thanks to @cwaider. (patch [150569ff](https://github.com/appsignal/appsignal-ruby/commit/150569ff49e54ab743ed3db16d109abcf5719e30))
|
10
|
+
|
3
11
|
## 3.12.0
|
4
12
|
|
5
13
|
_Published on 2024-07-22._
|
@@ -28,11 +36,9 @@ _Published on 2024-07-22._
|
|
28
36
|
```ruby
|
29
37
|
# config/initializers/appsignal.rb
|
30
38
|
|
31
|
-
Appsignal.
|
32
|
-
|
33
|
-
|
34
|
-
:ignore_actions => ["My action"]
|
35
|
-
)
|
39
|
+
Appsignal.configure do |config|
|
40
|
+
config.ignore_actions = ["My action"]
|
41
|
+
end
|
36
42
|
```
|
37
43
|
|
38
44
|
Be aware that when `start_at` is set to `after_initialize`, AppSignal will not track any errors that occur when the initializers are run and the app fails to start.
|
@@ -154,8 +154,8 @@ module Appsignal
|
|
154
154
|
# documentation.
|
155
155
|
#
|
156
156
|
# @see monitor
|
157
|
-
def monitor_and_stop(action:, namespace: nil)
|
158
|
-
monitor(:namespace => namespace, :action => action)
|
157
|
+
def monitor_and_stop(action:, namespace: nil, &block)
|
158
|
+
monitor(:namespace => namespace, :action => action, &block)
|
159
159
|
ensure
|
160
160
|
Appsignal.stop("monitor_and_stop")
|
161
161
|
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -1499,54 +1499,53 @@ describe Appsignal::Transaction do
|
|
1499
1499
|
describe "#set_error" do
|
1500
1500
|
let(:transaction) { new_transaction }
|
1501
1501
|
let(:env) { http_request_env_with_data }
|
1502
|
-
let(:error)
|
1503
|
-
e = ExampleStandardError.new("test message")
|
1504
|
-
allow(e).to receive(:backtrace).and_return(["line 1"])
|
1505
|
-
e
|
1506
|
-
end
|
1502
|
+
let(:error) { ExampleStandardError.new("test message") }
|
1507
1503
|
|
1508
|
-
it "
|
1504
|
+
it "responds to add_exception for backwards compatibility" do
|
1509
1505
|
expect(transaction).to respond_to(:add_exception)
|
1510
1506
|
end
|
1511
1507
|
|
1512
|
-
it "
|
1508
|
+
it "does not add the error if not active" do
|
1513
1509
|
allow(Appsignal).to receive(:active?).and_return(false)
|
1514
|
-
expect(transaction.ext).to_not receive(:set_error)
|
1515
1510
|
|
1516
1511
|
transaction.set_error(error)
|
1512
|
+
|
1513
|
+
expect(transaction).to_not have_error
|
1517
1514
|
end
|
1518
1515
|
|
1519
|
-
context "when error is not an error" do
|
1516
|
+
context "when error argument is not an error" do
|
1520
1517
|
let(:error) { Object.new }
|
1521
1518
|
|
1522
1519
|
it "does not add the error" do
|
1523
|
-
|
1520
|
+
logs = capture_logs { transaction.set_error(error) }
|
1521
|
+
|
1522
|
+
expect(transaction).to_not have_error
|
1523
|
+
expect(logs).to contains_log(
|
1524
|
+
:error,
|
1524
1525
|
"Appsignal::Transaction#set_error: Cannot set error. " \
|
1525
1526
|
"The given value is not an exception: #{error.inspect}"
|
1526
1527
|
)
|
1527
|
-
expect(transaction.ext).to_not receive(:set_error)
|
1528
|
-
|
1529
|
-
transaction.set_error(error)
|
1530
1528
|
end
|
1531
1529
|
end
|
1532
1530
|
|
1533
1531
|
context "for a http request" do
|
1534
|
-
it "
|
1535
|
-
|
1532
|
+
it "sets an error on the transaction" do
|
1533
|
+
allow(error).to receive(:backtrace).and_return(["line 1"])
|
1534
|
+
transaction.set_error(error)
|
1535
|
+
|
1536
|
+
expect(transaction).to have_error(
|
1536
1537
|
"ExampleStandardError",
|
1537
1538
|
"test message",
|
1538
|
-
|
1539
|
+
["line 1"]
|
1539
1540
|
)
|
1540
|
-
|
1541
|
-
transaction.set_error(error)
|
1542
1541
|
end
|
1543
1542
|
end
|
1544
1543
|
|
1545
1544
|
context "when the error has no causes" do
|
1546
|
-
it "
|
1547
|
-
expect(transaction.ext).to_not receive(:set_sample_data)
|
1548
|
-
|
1545
|
+
it "does not set the causes information as sample data" do
|
1549
1546
|
transaction.set_error(error)
|
1547
|
+
|
1548
|
+
expect(transaction).to_not include_error_causes
|
1550
1549
|
end
|
1551
1550
|
end
|
1552
1551
|
|
@@ -1562,31 +1561,25 @@ describe Appsignal::Transaction do
|
|
1562
1561
|
end
|
1563
1562
|
|
1564
1563
|
it "sends the causes information as sample data" do
|
1565
|
-
|
1564
|
+
transaction.set_error(error)
|
1565
|
+
|
1566
|
+
expect(transaction).to have_error(
|
1566
1567
|
"ExampleStandardError",
|
1567
1568
|
"test message",
|
1568
|
-
|
1569
|
+
["line 1"]
|
1569
1570
|
)
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
:message => "cause message 2"
|
1582
|
-
}
|
1583
|
-
]
|
1584
|
-
)
|
1571
|
+
expect(transaction).to include_error_causes(
|
1572
|
+
[
|
1573
|
+
{
|
1574
|
+
"name" => "RuntimeError",
|
1575
|
+
"message" => "cause message"
|
1576
|
+
},
|
1577
|
+
{
|
1578
|
+
"name" => "StandardError",
|
1579
|
+
"message" => "cause message 2"
|
1580
|
+
}
|
1581
|
+
]
|
1585
1582
|
)
|
1586
|
-
|
1587
|
-
expect(Appsignal.internal_logger).to_not receive(:debug)
|
1588
|
-
|
1589
|
-
transaction.set_error(error)
|
1590
1583
|
end
|
1591
1584
|
end
|
1592
1585
|
|
@@ -1605,33 +1598,29 @@ describe Appsignal::Transaction do
|
|
1605
1598
|
end
|
1606
1599
|
|
1607
1600
|
it "sends only the first causes as sample data" do
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
:name => "ExampleStandardError",
|
1617
|
-
:message => "wrapper error #{9 - i}"
|
1618
|
-
}
|
1619
|
-
end
|
1601
|
+
expected_error_causes =
|
1602
|
+
Array.new(10) do |i|
|
1603
|
+
{
|
1604
|
+
"name" => "ExampleStandardError",
|
1605
|
+
"message" => "wrapper error #{9 - i}"
|
1606
|
+
}
|
1607
|
+
end
|
1608
|
+
expected_error_causes.last["is_root_cause"] = false
|
1620
1609
|
|
1621
|
-
|
1610
|
+
logs = capture_logs { transaction.set_error(error) }
|
1622
1611
|
|
1623
|
-
expect(transaction
|
1624
|
-
"
|
1625
|
-
|
1612
|
+
expect(transaction).to have_error(
|
1613
|
+
"ExampleStandardError",
|
1614
|
+
"wrapper error 10",
|
1615
|
+
["line 1"]
|
1626
1616
|
)
|
1627
|
-
|
1628
|
-
expect(
|
1617
|
+
expect(transaction).to include_error_causes(expected_error_causes)
|
1618
|
+
expect(logs).to contains_log(
|
1619
|
+
:debug,
|
1629
1620
|
"Appsignal::Transaction#set_error: Error has more " \
|
1630
1621
|
"than 10 error causes. Only the first 10 " \
|
1631
1622
|
"will be reported."
|
1632
1623
|
)
|
1633
|
-
|
1634
|
-
transaction.set_error(error)
|
1635
1624
|
end
|
1636
1625
|
end
|
1637
1626
|
|
@@ -1643,18 +1632,18 @@ describe Appsignal::Transaction do
|
|
1643
1632
|
e
|
1644
1633
|
end
|
1645
1634
|
|
1646
|
-
it "
|
1635
|
+
it "does not raise an error" do
|
1647
1636
|
transaction.set_error(error)
|
1648
1637
|
end
|
1649
1638
|
|
1650
|
-
it "
|
1651
|
-
|
1639
|
+
it "sets an error on the transaction without an error message" do
|
1640
|
+
transaction.set_error(error)
|
1641
|
+
|
1642
|
+
expect(transaction).to have_error(
|
1652
1643
|
"ExampleStandardError",
|
1653
1644
|
"",
|
1654
|
-
|
1645
|
+
["line 1"]
|
1655
1646
|
)
|
1656
|
-
|
1657
|
-
transaction.set_error(error)
|
1658
1647
|
end
|
1659
1648
|
end
|
1660
1649
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -745,6 +745,12 @@ describe Appsignal do
|
|
745
745
|
|
746
746
|
expect(Appsignal).to have_received(:stop).with("monitor_and_stop")
|
747
747
|
end
|
748
|
+
|
749
|
+
it "passes the block to Appsignal.monitor" do
|
750
|
+
expect do |blk|
|
751
|
+
Appsignal.monitor_and_stop(:action => "My action", &blk)
|
752
|
+
end.to yield_control
|
753
|
+
end
|
748
754
|
end
|
749
755
|
|
750
756
|
describe ".monitor_transaction" do
|
@@ -59,6 +59,7 @@ define_transaction_sample_matcher_for(:environment)
|
|
59
59
|
define_transaction_sample_matcher_for(:session_data)
|
60
60
|
define_transaction_sample_matcher_for(:tags)
|
61
61
|
define_transaction_sample_matcher_for(:custom_data)
|
62
|
+
define_transaction_sample_matcher_for(:error_causes)
|
62
63
|
|
63
64
|
RSpec::Matchers.define :be_completed do
|
64
65
|
match(:notify_expectation_failures => true) do |transaction|
|
@@ -66,14 +67,14 @@ RSpec::Matchers.define :be_completed do
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
69
|
-
RSpec::Matchers.define :have_error do |error_class, error_message|
|
70
|
+
RSpec::Matchers.define :have_error do |error_class, error_message, error_backtrace|
|
70
71
|
match(:notify_expectation_failures => true) do |transaction|
|
71
72
|
transaction_error = transaction.to_h["error"]
|
72
73
|
if error_class && error_message
|
73
74
|
expect(transaction_error).to include(
|
74
75
|
"name" => error_class,
|
75
76
|
"message" => error_message,
|
76
|
-
"backtrace" => kind_of(String)
|
77
|
+
"backtrace" => error_backtrace ? JSON.dump(error_backtrace) : kind_of(String)
|
77
78
|
)
|
78
79
|
else
|
79
80
|
expect(transaction_error).to be_any
|
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.12.
|
4
|
+
version: 3.12.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: 2024-07-
|
13
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|