appsignal 4.3.3 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0ba9c95d270a611f4b26314db6d6a62a5ffb59e76bd8b797e4f272557ec70d8
4
- data.tar.gz: 2318a7c02f13fe76b5d2c9c054eb900f9e3342c4b5e5d8108285b709a3610a74
3
+ metadata.gz: 5597f989bd9be686cd47741ae75bb370268037d2d3806df3a3b525cc52f7afd1
4
+ data.tar.gz: b00945131c58201641865769f29b2cc356ed01798a5a32db5a9f6f1665223c55
5
5
  SHA512:
6
- metadata.gz: 55b25b22f9a2d60c4973c547bd63aa8de67d6fcb83ac5aa47a63b8c0bf19e368bf09c4f09c1362c7552a133de41321e93957f1ed965973fcd818c0ecce0889fa
7
- data.tar.gz: cd0c243ee29a67648b3bb397ae2699b16982395501d43b16821e91a063eec6d6f5f3551e190ad7f7ade12c5b264581aede02e83186f69ceeccf89fc29e509e6f
6
+ metadata.gz: 875215fa3f29741c484c8facd6ab4ffc24d486decc2f2f2c7f741ec379422406192655d7fe4f2911d0cfef001329fe562b9c8cc533f6981e729c3d0cf304a2d2
7
+ data.tar.gz: ec8ca247cfad7a0e32ef75c8bfa4613ade8f74011c8f84c6b3b69b8d1b35c903401c978de27f0b9b7e5dbdb453cdbfcbd5d309d757a8ae29488bc07519abf45b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 4.4.0
4
+
5
+ _Published on 2025-02-06._
6
+
7
+ ### Changed
8
+
9
+ - Do not report error causes if the wrapper error has already been reported. This deduplicates errors and prevents the error wrapper and error cause to be reported separately, as long as the error wrapper is reported first.
10
+
11
+ ```ruby
12
+ error_wrapper = nil
13
+ error_cause = nil
14
+ begin
15
+ begin
16
+ raise StandardError, "error cause"
17
+ rescue => e
18
+ error_cause = e
19
+ raise Exception, "error wrapper"
20
+ end
21
+ rescue Exception => e
22
+ error_wrapper = e
23
+ end
24
+
25
+ Appsignal.report_error(error_wrapper) # Reports error
26
+ Appsignal.report_error(error_cause) # Doesn't report error
27
+ ```
28
+
29
+ (minor [af02b8b3](https://github.com/appsignal/appsignal-ruby/commit/af02b8b356f03b23efe83511970de62281837054))
30
+
31
+ ### Fixed
32
+
33
+ - Fix an issue where the HTTP.rb gem integration would raise an error when a string containing non-ASCII characters is passed to the gem as the URL. (patch [fce0acdf](https://github.com/appsignal/appsignal-ruby/commit/fce0acdfe0a7f807c846c3f90fd79f994c44db0b))
34
+
3
35
  ## 4.3.3
4
36
 
5
37
  _Published on 2025-01-17._
@@ -5,7 +5,8 @@ module Appsignal
5
5
  # @api private
6
6
  module HttpIntegration
7
7
  def request(verb, uri, opts = {})
8
- parsed_request_uri = uri.is_a?(URI) ? uri : URI.parse(uri.to_s)
8
+ uri_module = defined?(HTTP::URI) ? HTTP::URI : URI
9
+ parsed_request_uri = uri.is_a?(URI) ? uri : uri_module.parse(uri.to_s)
9
10
  request_uri = "#{parsed_request_uri.scheme}://#{parsed_request_uri.host}"
10
11
 
11
12
  Appsignal.instrument("request.http_rb", "#{verb.upcase} #{request_uri}") do
@@ -213,7 +213,7 @@ module Appsignal
213
213
  # In the duplicate transaction for each error, set an error
214
214
  # with a block that calls all the blocks set for that error
215
215
  # in the original transaction.
216
- transaction.set_error(error) do
216
+ transaction.internal_set_error(error) do
217
217
  blocks.each { |block| block.call(transaction) }
218
218
  end
219
219
 
@@ -560,17 +560,18 @@ module Appsignal
560
560
  return unless error
561
561
  return unless Appsignal.active?
562
562
 
563
- _set_error(error) if @error_blocks.empty?
564
-
565
- if !@error_blocks.include?(error) && @error_blocks.length >= ERRORS_LIMIT
566
- Appsignal.internal_logger.warn "Appsignal::Transaction#add_error: Transaction has more " \
567
- "than #{ERRORS_LIMIT} distinct errors. Only the first " \
568
- "#{ERRORS_LIMIT} distinct errors will be reported."
563
+ if error.instance_variable_get(:@__appsignal_error_reported) && !@error_blocks.include?(error)
569
564
  return
570
565
  end
571
566
 
572
- @error_blocks[error] << block
573
- @error_blocks[error].compact!
567
+ internal_set_error(error, &block)
568
+
569
+ # Mark errors and their causes as tracked so we don't report duplicates,
570
+ # but also not error causes if the wrapper error is already reported.
571
+ while error
572
+ error.instance_variable_set(:@__appsignal_error_reported, true) unless error.frozen?
573
+ error = error.cause
574
+ end
574
575
  end
575
576
  alias :set_error :add_error
576
577
  alias_method :add_exception, :add_error
@@ -632,6 +633,19 @@ module Appsignal
632
633
  attr_writer :is_duplicate, :tags, :custom_data, :breadcrumbs, :params,
633
634
  :session_data, :headers
634
635
 
636
+ def internal_set_error(error, &block)
637
+ _set_error(error) if @error_blocks.empty?
638
+
639
+ if !@error_blocks.include?(error) && @error_blocks.length >= ERRORS_LIMIT
640
+ Appsignal.internal_logger.warn "Appsignal::Transaction#add_error: Transaction has more " \
641
+ "than #{ERRORS_LIMIT} distinct errors. Only the first " \
642
+ "#{ERRORS_LIMIT} distinct errors will be reported."
643
+ return
644
+ end
645
+ @error_blocks[error] << block
646
+ @error_blocks[error].compact!
647
+ end
648
+
635
649
  private
636
650
 
637
651
  attr_reader :breadcrumbs
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "4.3.3"
4
+ VERSION = "4.4.0"
5
5
  end
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: 4.3.3
4
+ version: 4.4.0
5
5
  platform: ruby
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: 2025-01-17 00:00:00.000000000 Z
13
+ date: 2025-02-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: logger
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubygems_version: 3.3.7
318
+ rubygems_version: 3.5.23
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: Logs performance and exception data from your app to appsignal.com