appsignal 4.0.8 → 4.0.9

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: 05e742b53256b12c2f0f29eca8f595f2ec3208bce6fe8a20ebb8539fe05e3549
4
- data.tar.gz: d618aaef77d084971875a411754e27ae943f4e49920630701197e1f49dcdb7be
3
+ metadata.gz: e98be4df445350c51cb3b1d3543300257051dda917d8433a4503c9eda77d2cd6
4
+ data.tar.gz: bca5d410c1a2fb91812d2cc63b19a04b0db6cafd18c368a1ece930915bbf0a66
5
5
  SHA512:
6
- metadata.gz: 6e7bf5883a425d4bbd25d0d4707b6c1d668572217f91b0ca3df76faf9b8fb4d0ed7e2595c3e8e706c4dabbcb93f22a28d54d56ceaa7d9edf7568914777245827
7
- data.tar.gz: '0932d3a6c1e36236ae43d1de915605f852a7b1f56719f70ffdab9edad4db861b8471ea890c2851633765ad10d54b3de30f7c62a40497dffd6700c22f8ec815a7'
6
+ metadata.gz: ca0b4443929b282883b1d74f0092526bb69b3c223a6a60af1de372cf6af2acde569e57ada8b67b8aaac6645ada48b2c253ec595c1aec72bd5c812d03b577e953
7
+ data.tar.gz: 5e3d0d285a6ebf6a7b8beae27fdaceec6365aa016fa1181e1572f42054fced494771eac6fd62434efb5cd4dae7ee7ca542aa1b6ac5d680139ec7d24dfd238c55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 4.0.9
4
+
5
+ _Published on 2024-09-17._
6
+
7
+ ### Changed
8
+
9
+ - Add the logger gem as a dependency. This fixes the deprecation warning on Ruby 3.3. (patch [8c1d577e](https://github.com/appsignal/appsignal-ruby/commit/8c1d577e4790185db887d49577cedc7d614d8d98))
10
+ - Do not report errors caused by `Errno::EPIPE` (broken pipe errors) when instrumenting response bodies, to avoid reporting errors that cannot be fixed by the application. (patch [1fdccba4](https://github.com/appsignal/appsignal-ruby/commit/1fdccba4ceeb8f9bb13ae077019b2c1f7d9d4fe4))
11
+ - Normalize Rack and Rails `UploadedFile` objects. Instead of displaying the Ruby class name, it will now show object details like the filename and content type.
12
+
13
+ ```
14
+ # Before
15
+ #<Rack::Multipart::UploadedFile>
16
+ #<ActionDispatch::Http::UploadedFile>
17
+
18
+ # After
19
+ #<Rack::Multipart::UploadedFile original_filename: "uploaded_file.txt", content_type: "text/plain">
20
+ #<ActionDispatch::Http::UploadedFile original_filename: "uploaded_file.txt", content_type: "text/plain">
21
+ ```
22
+
23
+ (patch [bb50c933](https://github.com/appsignal/appsignal-ruby/commit/bb50c93387eafebe043b0e7f4083c95556b93136))
24
+
3
25
  ## 4.0.8
4
26
 
5
27
  _Published on 2024-09-13._
data/appsignal.gemspec CHANGED
@@ -17,8 +17,8 @@ IGNORED_PATHS = [
17
17
  ".yardopts",
18
18
  "benchmark.rake",
19
19
  "mono.yml",
20
- "rubocop.yml",
21
- "rubocop_todo.yml"
20
+ ".rubocop.yml",
21
+ ".rubocop_todo.yml"
22
22
  ].freeze
23
23
 
24
24
  Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
@@ -56,6 +56,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
56
56
  "source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
57
57
  }
58
58
 
59
+ gem.add_dependency "logger"
59
60
  gem.add_dependency "rack"
60
61
 
61
62
  gem.add_development_dependency "pry"
@@ -54,7 +54,7 @@ module Appsignal
54
54
  rescue *IGNORED_ERRORS # Do not report
55
55
  raise
56
56
  rescue Exception => error # rubocop:disable Lint/RescueException
57
- @transaction.set_error(error)
57
+ appsignal_report_error(error)
58
58
  raise error
59
59
  end
60
60
 
@@ -72,6 +72,19 @@ module Appsignal
72
72
  @body.__send__(method_name, *args, &block)
73
73
  end
74
74
  ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
75
+
76
+ private
77
+
78
+ def appsignal_report_error(error)
79
+ @transaction.set_error(error) if appsignal_accepted_error?(error)
80
+ end
81
+
82
+ def appsignal_accepted_error?(error)
83
+ return true unless error.cause
84
+ return false if IGNORED_ERRORS.include?(error.cause.class)
85
+
86
+ appsignal_accepted_error?(error.cause)
87
+ end
75
88
  end
76
89
 
77
90
  # The standard Rack body wrapper which exposes "each" for iterating
@@ -97,7 +110,7 @@ module Appsignal
97
110
  rescue *IGNORED_ERRORS # Do not report
98
111
  raise
99
112
  rescue Exception => error # rubocop:disable Lint/RescueException
100
- @transaction.set_error(error)
113
+ appsignal_report_error(error)
101
114
  raise error
102
115
  end
103
116
  end
@@ -118,7 +131,7 @@ module Appsignal
118
131
  rescue *IGNORED_ERRORS # Do not report
119
132
  raise
120
133
  rescue Exception => error # rubocop:disable Lint/RescueException
121
- @transaction.set_error(error)
134
+ appsignal_report_error(error)
122
135
  raise error
123
136
  end
124
137
  end
@@ -144,7 +157,7 @@ module Appsignal
144
157
  rescue *IGNORED_ERRORS # Do not report
145
158
  raise
146
159
  rescue Exception => error # rubocop:disable Lint/RescueException
147
- @transaction.set_error(error)
160
+ appsignal_report_error(error)
148
161
  raise error
149
162
  end
150
163
  end
@@ -162,7 +175,7 @@ module Appsignal
162
175
  rescue *IGNORED_ERRORS # Do not report
163
176
  raise
164
177
  rescue Exception => error # rubocop:disable Lint/RescueException
165
- @transaction.set_error(error)
178
+ appsignal_report_error(error)
166
179
  raise error
167
180
  end
168
181
  end
@@ -707,7 +707,7 @@ module Appsignal
707
707
  return unless Appsignal.config[:send_params]
708
708
 
709
709
  filter_keys = Appsignal.config[:filter_parameters] || []
710
- Appsignal::Utils::HashSanitizer.sanitize params, filter_keys
710
+ Appsignal::Utils::SampleDataSanitizer.sanitize(params, filter_keys)
711
711
  end
712
712
 
713
713
  def session_data
@@ -720,7 +720,8 @@ module Appsignal
720
720
 
721
721
  # Returns sanitized session data.
722
722
  #
723
- # The session data is sanitized by the {Appsignal::Utils::HashSanitizer}.
723
+ # The session data is sanitized by the
724
+ # {Appsignal::Utils::SampleDataSanitizer}.
724
725
  #
725
726
  # @return [nil] if `:send_session_data` config is set to `false`.
726
727
  # @return [nil] if the {#request} object doesn't respond to `#session`.
@@ -729,8 +730,9 @@ module Appsignal
729
730
  def sanitized_session_data
730
731
  return unless Appsignal.config[:send_session_data]
731
732
 
732
- Appsignal::Utils::HashSanitizer.sanitize(
733
- session_data, Appsignal.config[:filter_session_data]
733
+ Appsignal::Utils::SampleDataSanitizer.sanitize(
734
+ session_data,
735
+ Appsignal.config[:filter_session_data]
734
736
  )
735
737
  end
736
738
 
@@ -25,7 +25,7 @@ module Appsignal
25
25
  # An Integer too big for C-lang longs to fit
26
26
  bigint = 1 << 63
27
27
  if value >= bigint
28
- map.set_string(key, "bigint:#{value}")
28
+ map.set_string(key, map_bigint(value))
29
29
  else
30
30
  map.set_integer(key, value)
31
31
  end
@@ -56,7 +56,7 @@ module Appsignal
56
56
  # An Integer too big for C-lang longs to fit
57
57
  bigint = 1 << 63
58
58
  if value >= bigint
59
- array.append_string("bigint:#{value}")
59
+ array.append_string(map_bigint(value))
60
60
  else
61
61
  array.append_integer(value)
62
62
  end
@@ -76,6 +76,10 @@ module Appsignal
76
76
  end
77
77
  array
78
78
  end
79
+
80
+ def map_bigint(value)
81
+ "bigint:#{value}"
82
+ end
79
83
  end
80
84
  end
81
85
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  module Utils
5
- class HashSanitizer
5
+ class SampleDataSanitizer
6
6
  FILTERED = "[FILTERED]"
7
7
  RECURSIVE = "[RECURSIVE VALUE]"
8
8
 
@@ -26,7 +26,21 @@ module Appsignal
26
26
  when Date
27
27
  "#<Date: #{value.iso8601}>"
28
28
  else
29
- inspected(value)
29
+ if defined?(::Rack::Multipart::UploadedFile) &&
30
+ value.is_a?(::Rack::Multipart::UploadedFile)
31
+ "#<Rack::Multipart::UploadedFile " \
32
+ "original_filename: #{value.original_filename.inspect}, " \
33
+ "content_type: #{value.content_type.inspect}" \
34
+ ">"
35
+ elsif defined?(::ActionDispatch::Http::UploadedFile) &&
36
+ value.is_a?(::ActionDispatch::Http::UploadedFile)
37
+ "#<ActionDispatch::Http::UploadedFile " \
38
+ "original_filename: #{value.original_filename.inspect}, " \
39
+ "content_type: #{value.content_type.inspect}" \
40
+ ">"
41
+ else
42
+ inspected(value)
43
+ end
30
44
  end
31
45
  end
32
46
 
@@ -9,7 +9,7 @@ end
9
9
  require "appsignal/utils/integration_memory_logger"
10
10
  require "appsignal/utils/stdout_and_logger_message"
11
11
  require "appsignal/utils/data"
12
- require "appsignal/utils/hash_sanitizer"
12
+ require "appsignal/utils/sample_data_sanitizer"
13
13
  require "appsignal/utils/integration_logger"
14
14
  require "appsignal/utils/json"
15
15
  require "appsignal/utils/ndjson"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "4.0.8"
4
+ VERSION = "4.0.9"
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.0.8
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,8 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-09-13 00:00:00.000000000 Z
13
+ date: 2024-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: logger
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
15
29
  - !ruby/object:Gem::Dependency
16
30
  name: rack
17
31
  requirement: !ruby/object:Gem::Requirement
@@ -133,8 +147,6 @@ extensions:
133
147
  - ext/extconf.rb
134
148
  extra_rdoc_files: []
135
149
  files:
136
- - ".rubocop.yml"
137
- - ".rubocop_todo.yml"
138
150
  - CHANGELOG.md
139
151
  - CODE_OF_CONDUCT.md
140
152
  - Gemfile
@@ -260,13 +272,13 @@ files:
260
272
  - lib/appsignal/transmitter.rb
261
273
  - lib/appsignal/utils.rb
262
274
  - lib/appsignal/utils/data.rb
263
- - lib/appsignal/utils/hash_sanitizer.rb
264
275
  - lib/appsignal/utils/integration_logger.rb
265
276
  - lib/appsignal/utils/integration_memory_logger.rb
266
277
  - lib/appsignal/utils/json.rb
267
278
  - lib/appsignal/utils/ndjson.rb
268
279
  - lib/appsignal/utils/query_params_sanitizer.rb
269
280
  - lib/appsignal/utils/rails_helper.rb
281
+ - lib/appsignal/utils/sample_data_sanitizer.rb
270
282
  - lib/appsignal/utils/stdout_and_logger_message.rb
271
283
  - lib/appsignal/version.rb
272
284
  - lib/puma/plugin/appsignal.rb
data/.rubocop.yml DELETED
@@ -1,133 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- TargetRubyVersion: 2.7
5
- NewCops: enable
6
- Include:
7
- - "**/*.rb"
8
- - "**/*.cap"
9
- - "**/*.rake"
10
- - "**/Gemfile"
11
- - "**/Rakefile"
12
- - "appsignal.gemspec"
13
- Exclude:
14
- - "pkg/**/*"
15
- - "tmp/**/*"
16
- - "vendor/**/*"
17
- - "spec/integration/diagnose/**/*"
18
- DisplayCopNames: true
19
- UseCache: true
20
- CacheRootDirectory: ./tmp
21
-
22
- Style/RescueStandardError:
23
- Enabled: false
24
-
25
- Style/Documentation:
26
- Enabled: false
27
-
28
- Style/StringLiterals:
29
- EnforcedStyle: double_quotes
30
-
31
- Style/StringLiteralsInInterpolation:
32
- EnforcedStyle: double_quotes
33
-
34
- Style/HashSyntax:
35
- EnforcedStyle: hash_rockets
36
-
37
- Style/EmptyMethod:
38
- EnforcedStyle: expanded
39
-
40
- Style/MissingRespondToMissing:
41
- Exclude:
42
- - "lib/appsignal/extension.rb"
43
- - "lib/appsignal/transaction.rb"
44
-
45
- Style/TrailingUnderscoreVariable:
46
- Enabled: false
47
-
48
- Style/Lambda:
49
- EnforcedStyle: lambda
50
-
51
- Style/WordArray:
52
- Enabled: false
53
-
54
- Style/FrozenStringLiteralComment:
55
- Enabled: true
56
- Exclude:
57
- - "spec/**/*.rb"
58
-
59
- Style/NumericPredicate:
60
- Enabled: false
61
-
62
- Style/SymbolArray:
63
- EnforcedStyle: brackets
64
-
65
- Style/RedundantConstantBase:
66
- Enabled: false
67
-
68
- Lint/ConstantDefinitionInBlock:
69
- Exclude:
70
- - "spec/**/*.rb"
71
-
72
- Lint/EmptyClass:
73
- Exclude:
74
- - "spec/**/*.rb"
75
-
76
- Lint/EmptyFile:
77
- Exclude:
78
- - "spec/**/*.rb"
79
-
80
- Layout/HashAlignment:
81
- EnforcedLastArgumentHashStyle: ignore_implicit
82
-
83
- Layout/ArgumentAlignment:
84
- EnforcedStyle: with_fixed_indentation
85
-
86
- Layout/LineContinuationLeadingSpace:
87
- Enabled: false
88
-
89
- Layout/FirstArrayElementIndentation:
90
- EnforcedStyle: consistent
91
-
92
- Layout/LineEndStringConcatenationIndentation:
93
- EnforcedStyle: indented
94
-
95
- Layout/ParameterAlignment:
96
- EnforcedStyle: with_fixed_indentation
97
-
98
- Layout/MultilineMethodCallIndentation:
99
- EnforcedStyle: indented
100
-
101
- Layout/MultilineOperationIndentation:
102
- EnforcedStyle: indented
103
-
104
- Layout/LineLength:
105
- Max: 100
106
-
107
- Naming/FileName:
108
- Exclude:
109
- - "ext/Rakefile"
110
-
111
- Naming/AccessorMethodName:
112
- Exclude:
113
- - "lib/appsignal/helpers/instrumentation.rb"
114
- - "lib/appsignal/transaction.rb"
115
-
116
- Naming/RescuedExceptionsVariableName:
117
- Enabled: false
118
-
119
- Naming/VariableNumber:
120
- Enabled: false
121
-
122
- Metrics/ModuleLength:
123
- Enabled: false
124
-
125
- Metrics/ClassLength:
126
- Enabled: false
127
-
128
- Metrics/BlockLength:
129
- Exclude:
130
- - "Rakefile"
131
-
132
- Gemspec/DevelopmentDependencies:
133
- Enabled: false
data/.rubocop_todo.yml DELETED
@@ -1,84 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2024-06-27 09:42:06 UTC using RuboCop version 1.64.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 2
10
- # Configuration parameters: AllowedParentClasses.
11
- Lint/MissingSuper:
12
- Exclude:
13
- - 'lib/appsignal/extension.rb'
14
- - 'lib/appsignal/logger.rb'
15
-
16
- # Offense count: 1
17
- Lint/StructNewOverride:
18
- Exclude:
19
- - 'spec/lib/appsignal/probes/sidekiq_spec.rb'
20
-
21
- # Offense count: 63
22
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
23
- Metrics/AbcSize:
24
- Max: 44
25
-
26
- # Offense count: 6
27
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
28
- # AllowedMethods: refine
29
- Metrics/BlockLength:
30
- Max: 31
31
-
32
- # Offense count: 21
33
- # Configuration parameters: AllowedMethods, AllowedPatterns.
34
- Metrics/CyclomaticComplexity:
35
- Max: 11
36
-
37
- # Offense count: 139
38
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
39
- Metrics/MethodLength:
40
- Max: 56
41
-
42
- # Offense count: 18
43
- # Configuration parameters: AllowedMethods, AllowedPatterns.
44
- Metrics/PerceivedComplexity:
45
- Max: 13
46
-
47
- # Offense count: 2
48
- Security/Open:
49
- Exclude:
50
- - 'ext/base.rb'
51
-
52
- # Offense count: 2
53
- # This cop supports unsafe autocorrection (--autocorrect-all).
54
- Security/YAMLLoad:
55
- Exclude:
56
- - 'lib/appsignal/config.rb'
57
- - 'lib/appsignal/integrations/sidekiq.rb'
58
-
59
- # Offense count: 7
60
- # This cop supports safe autocorrection (--autocorrect).
61
- # Configuration parameters: EnforcedStyle.
62
- # SupportedStyles: prefer_alias, prefer_alias_method
63
- Style/Alias:
64
- Exclude:
65
- - 'lib/appsignal/helpers/instrumentation.rb'
66
- - 'lib/appsignal/transaction.rb'
67
-
68
- # Offense count: 1
69
- Style/ClassVars:
70
- Exclude:
71
- - 'spec/lib/appsignal/event_formatter_spec.rb'
72
-
73
- # Offense count: 1
74
- Style/OpenStructUse:
75
- Exclude:
76
- - 'lib/appsignal/cli/install.rb'
77
-
78
- # Offense count: 2
79
- # Configuration parameters: AllowedMethods.
80
- # AllowedMethods: respond_to_missing?
81
- Style/OptionalBooleanParameter:
82
- Exclude:
83
- - 'lib/appsignal/integrations/delayed_job_plugin.rb'
84
- - 'lib/appsignal/utils/query_params_sanitizer.rb'