appsignal 3.6.0 → 3.6.1

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: 6402d39c536a0e4fe970163c92d3207cad1af89c279d0bec8494abf90844434c
4
- data.tar.gz: c989b01ded89a0c2643ba5b4bb02d24b02012ee25383b451fee192eae59ab611
3
+ metadata.gz: 8990517cea95c50e6516636e35d845bfeab2d2fa936d356be9b3f2b976b9fc7a
4
+ data.tar.gz: 7729d6172b3f0df044241548f347e2d22bdd0b295454a9bae93cfbc6f72119db
5
5
  SHA512:
6
- metadata.gz: 65908eb0b138011eccd79c0fe0de47f3c2b150bc333eb656fde66f541529fe1801d0404a6dadfc875cbbf53b442613970dabe221fc2ae52fafd55927bb408bc8
7
- data.tar.gz: 2852aeb49f06d45606bc58a81c0e344b62326340aff7c81f363a2f081346b2147fd60eb7c38a0065c1dfed94ca4f148b1b866aafc6bada1734a4d1911746e07a
6
+ metadata.gz: b866452cb869cf8da793720d18f65927cb867eeb150b299d25c23ea6d417638735c3fc871bcf4218cabb047b93913e0051d9880b957a3c17f1ff4de93debdc09
7
+ data.tar.gz: 252ed529380e877ba34d3a5b7d921f042835e5d9baab95010fda67d195aa0ee647895f8d0c12a18a086bfc7594179155c83c3635eb3afd66ef265a3fa484a36b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.6.1
4
+
5
+ _Published on 2024-03-05._
6
+
7
+ ### Added
8
+
9
+ - [8974d201](https://github.com/appsignal/appsignal-ruby/commit/8974d20144407fce7a274ebaeb771ef76705d901) patch - Add `activejob_report_errors` config option. When set to `"none"`, ActiveJob jobs will no longer report errors. This can be used in combination with [custom exception reporting](https://docs.appsignal.com/ruby/instrumentation/exception-handling.html). By default, the config option has the value `"all"`, which reports all errors.
10
+
3
11
  ## 3.6.0
4
12
 
5
13
  _Published on 2024-02-26._
@@ -11,6 +11,7 @@ module Appsignal
11
11
  include Appsignal::Utils::DeprecationMessage
12
12
 
13
13
  DEFAULT_CONFIG = {
14
+ :activejob_report_errors => "all",
14
15
  :ca_file_path => File.expand_path(File.join("../../../resources/cacert.pem"), __FILE__),
15
16
  :debug => false,
16
17
  :dns_servers => [],
@@ -65,6 +66,7 @@ module Appsignal
65
66
 
66
67
  ENV_TO_KEY_MAPPING = {
67
68
  "APPSIGNAL_ACTIVE" => :active,
69
+ "APPSIGNAL_ACTIVE_JOB_REPORT_ERRORS" => :activejob_report_errors,
68
70
  "APPSIGNAL_APP_NAME" => :name,
69
71
  "APPSIGNAL_BIND_ADDRESS" => :bind_address,
70
72
  "APPSIGNAL_CA_FILE_PATH" => :ca_file_path,
@@ -112,6 +114,7 @@ module Appsignal
112
114
  }.freeze
113
115
  # @api private
114
116
  ENV_STRING_KEYS = %w[
117
+ APPSIGNAL_ACTIVE_JOB_REPORT_ERRORS
115
118
  APPSIGNAL_APP_NAME
116
119
  APPSIGNAL_BIND_ADDRESS
117
120
  APPSIGNAL_CA_FILE_PATH
@@ -56,7 +56,7 @@ module Appsignal
56
56
  super
57
57
  rescue Exception => exception # rubocop:disable Lint/RescueException
58
58
  job_status = :failed
59
- transaction.set_error(exception)
59
+ transaction_set_error(transaction, exception)
60
60
  raise exception
61
61
  ensure
62
62
  if transaction
@@ -82,6 +82,14 @@ module Appsignal
82
82
  tags.merge(:status => :processed)
83
83
  end
84
84
  end
85
+
86
+ private
87
+
88
+ def transaction_set_error(transaction, exception)
89
+ return if Appsignal.config[:activejob_report_errors] == "none"
90
+
91
+ transaction.set_error(exception)
92
+ end
85
93
  end
86
94
 
87
95
  module ActiveJobHelpers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.6.0"
4
+ VERSION = "3.6.1"
5
5
  end
@@ -152,6 +152,7 @@ describe Appsignal::Config do
152
152
  it "merges with the default config" do
153
153
  expect(config.config_hash).to eq(
154
154
  :active => true,
155
+ :activejob_report_errors => "all",
155
156
  :ca_file_path => File.join(resources_dir, "cacert.pem"),
156
157
  :debug => false,
157
158
  :dns_servers => [],
@@ -222,6 +222,31 @@ if DependencyHelper.active_job_present?
222
222
  expect(events).to eq(expected_perform_events)
223
223
  end
224
224
 
225
+ context "with activejob_report_errors set to none" do
226
+ it "does not report the error" do
227
+ Appsignal.config = project_fixture_config("production")
228
+ Appsignal.config[:activejob_report_errors] = "none"
229
+
230
+ # Other calls we're testing in another test
231
+ allow(Appsignal).to receive(:increment_counter)
232
+ tags = { :queue => queue }
233
+ expect(Appsignal).to receive(:increment_counter)
234
+ .with("active_job_queue_job_count", 1, tags.merge(:status => :failed))
235
+ expect(Appsignal).to receive(:increment_counter)
236
+ .with("active_job_queue_job_count", 1, tags.merge(:status => :processed))
237
+
238
+ expect do
239
+ perform_job(ActiveJobErrorTestJob)
240
+ end.to raise_error(RuntimeError, "uh oh")
241
+
242
+ transaction = last_transaction
243
+ transaction_hash = transaction.to_h
244
+ expect(transaction_hash).to include(
245
+ "error" => nil
246
+ )
247
+ end
248
+ end
249
+
225
250
  if DependencyHelper.rails_version >= Gem::Version.new("5.0.0")
226
251
  context "with priority" do
227
252
  before do
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.6.0
4
+ version: 3.6.1
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: 2024-02-26 00:00:00.000000000 Z
13
+ date: 2024-03-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack