appsignal 3.12.0-java → 3.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f181aa2848ea0540f455f6dcd08f6e5baa6336d8c085aa261007bfff28d2b67d
4
- data.tar.gz: 34ba16eb3b7c3b464e10fb9a8533d3b230cfb73550f6a804599e02b96fb909f1
3
+ metadata.gz: 444ef21c052b54cf0691be97d913fd6c3faa7e54219a570a6aae4117b7c83dea
4
+ data.tar.gz: '095b571b4b2bb8d2e8f413d10f75ec07be08306472b2182cba69d2e628305b72'
5
5
  SHA512:
6
- metadata.gz: 706a467f0f67fc71de5e2a8281216a22ba02d5166c9b64c35451886ff4ff9abadd983e045bc16e06cee64823410612e580180b9098e56a13b55ddb9b28395d9d
7
- data.tar.gz: e83be1622f1c5d86748bc3bb93912d79ac2dd66cb6bbe61106aee8965b3aced6c31bc5e25689f52bfa7cb01da9f10e50fb76c47de1934b93cb12b6db705bb661
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.config = Appsignal::Config.new(
32
- Rails.root,
33
- Rails.env,
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.12.0"
4
+ VERSION = "3.12.1"
5
5
  end
@@ -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) do
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 "should also respond to add_exception for backwards compatibility" do
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 "should not add the error if appsignal is not active" do
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
- expect(Appsignal.internal_logger).to receive(:error).with(
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 "should set an error in the extension" do
1535
- expect(transaction.ext).to receive(:set_error).with(
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
- Appsignal::Utils::Data.generate(["line 1"])
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 "should not send the causes information as sample data" do
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
- expect(transaction.ext).to receive(:set_error).with(
1564
+ transaction.set_error(error)
1565
+
1566
+ expect(transaction).to have_error(
1566
1567
  "ExampleStandardError",
1567
1568
  "test message",
1568
- Appsignal::Utils::Data.generate(["line 1"])
1569
+ ["line 1"]
1569
1570
  )
1570
-
1571
- expect(transaction.ext).to receive(:set_sample_data).with(
1572
- "error_causes",
1573
- Appsignal::Utils::Data.generate(
1574
- [
1575
- {
1576
- :name => "RuntimeError",
1577
- :message => "cause message"
1578
- },
1579
- {
1580
- :name => "StandardError",
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
- expect(transaction.ext).to receive(:set_error).with(
1609
- "ExampleStandardError",
1610
- "wrapper error 10",
1611
- Appsignal::Utils::Data.generate(["line 1"])
1612
- )
1613
-
1614
- expected_error_causes = Array.new(10) do |i|
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
- expected_error_causes.last[:is_root_cause] = false
1610
+ logs = capture_logs { transaction.set_error(error) }
1622
1611
 
1623
- expect(transaction.ext).to receive(:set_sample_data).with(
1624
- "error_causes",
1625
- Appsignal::Utils::Data.generate(expected_error_causes)
1612
+ expect(transaction).to have_error(
1613
+ "ExampleStandardError",
1614
+ "wrapper error 10",
1615
+ ["line 1"]
1626
1616
  )
1627
-
1628
- expect(Appsignal.internal_logger).to receive(:debug).with(
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 "should not raise an error" do
1635
+ it "does not raise an error" do
1647
1636
  transaction.set_error(error)
1648
1637
  end
1649
1638
 
1650
- it "should set an error in the extension" do
1651
- expect(transaction.ext).to receive(:set_error).with(
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
- Appsignal::Utils::Data.generate(["line 1"])
1645
+ ["line 1"]
1655
1646
  )
1656
-
1657
- transaction.set_error(error)
1658
1647
  end
1659
1648
  end
1660
1649
  end
@@ -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.0
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-22 00:00:00.000000000 Z
13
+ date: 2024-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack