exception_handling 2.13.0 → 2.14.0.pre.gk.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: 1125ae1526cff9890e52497ac1a8b8d93a62a481afa49a74709c5f286f53b912
4
- data.tar.gz: 3f882364adfb48ee837fc178cb3adcb85ab6c43b90bde5e04f96aea07559efc6
3
+ metadata.gz: d1f9171a98555a6b8c48908ca1c26f6c9d9f05e966030d0f7c62598378c955b4
4
+ data.tar.gz: ca9e28ace18d2dd3db9abd173184c638eac5540873cdcabe5b267813ca276909
5
5
  SHA512:
6
- metadata.gz: efbe4b3c2843a4e07daf38a83606d504714b1bfa2dedc406070fc6a1e68a66ccf379cb459f5364c0c8c8ac43b9265474ab50d9dce7f31ec78de5791ff166c195
7
- data.tar.gz: 1a69645d781332b9e7882921dbaded4d001c87ead47a40902b55e385c21e419ed48d9c3790cb38c38392a0fe2c872e05d003814bcd57b54e6cb27b38c3828772
6
+ metadata.gz: a9bf483a26054a430fb78a08e1eaf9bd963ea17da9e4df422c7ef25e8033a355d4e2c6296a552a903a2c965c42f32d16b8734d047bb2739fb14f0b84e9da6c78
7
+ data.tar.gz: b39e222737fb25d12e8070e693f7b092e6f2841f0d1eefdfa728e6ba0b3f17d825480b499c283c6dcb282aa6e94d16fdf9cddf3a32e42d2e6fab483dd838e625
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.14.0] - 2022-12-23
8
+ ### Added
9
+ - Added support for plumbing tags through to honeybadger via the `honeybadger_tags` log context parameter
10
+
7
11
  ## [2.13.0] - 2022-09-15
8
12
  ### Added
9
13
  - Added an option for removing the 'exception_handling.' prefix from metric names in ExceptionHandling::default_metric_name
@@ -99,6 +103,7 @@ Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0
99
103
  ### Changed
100
104
  - No longer depends on hobo_support. Uses invoca-utils 0.3 instead.
101
105
 
106
+ [2.14.0]: https://github.com/Invoca/exception_handling/compare/v2.13.0...v2.14.0
102
107
  [2.13.0]: https://github.com/Invoca/exception_handling/compare/v2.12.0...v2.13.0
103
108
  [2.12.0]: https://github.com/Invoca/exception_handling/compare/v2.11.3...v2.12.0
104
109
  [2.11.3]: https://github.com/Invoca/exception_handling/compare/v2.11.2...v2.11.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exception_handling (2.13.0)
4
+ exception_handling (2.14.0.pre.gk.0)
5
5
  actionmailer (>= 5.2, < 7.0)
6
6
  actionpack (>= 5.2, < 7.0)
7
7
  activesupport (>= 5.2, < 7.0)
@@ -49,7 +49,7 @@ module ExceptionHandling
49
49
  HONEYBADGER_CONTEXT_SECTIONS = [:timestamp, :error_class, :exception_context, :server, :scm_revision, :notes,
50
50
  :user_details, :request, :session, :environment, :backtrace, :event_response, :log_context].freeze
51
51
 
52
- attr_reader :exception, :controller, :exception_context, :timestamp
52
+ attr_reader :exception, :controller, :exception_context, :timestamp, :honeybadger_tags
53
53
 
54
54
  def initialize(exception, exception_context, timestamp, controller: nil, data_callback: nil, log_context: nil)
55
55
  @exception = exception
@@ -59,6 +59,7 @@ module ExceptionHandling
59
59
  @data_callback = data_callback
60
60
  # merge into the surrounding context just like ContextualLogger does when logging
61
61
  @merged_log_context = ExceptionHandling.logger.current_context_for_thread.deep_merge(log_context || {})
62
+ @honeybadger_tags = [@merged_log_context[:honeybadger_tags]].flatten.compact
62
63
  end
63
64
 
64
65
  def data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExceptionHandling
4
- VERSION = '2.13.0'
4
+ VERSION = '2.14.0.pre.gk.0'
5
5
  end
@@ -274,7 +274,8 @@ module ExceptionHandling # never included
274
274
  error_message: exception.message.to_s,
275
275
  exception: exception,
276
276
  context: exception_info.honeybadger_context_data,
277
- controller: exception_info.controller_name)
277
+ controller: exception_info.controller_name,
278
+ tags: exception_info.honeybadger_tags.join(', '))
278
279
  response ? :success : :failure
279
280
  rescue Exception => ex
280
281
  warn("ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\n#{exception.class}: #{exception.message}:\n#{ex.class}: #{ex.message}\n#{ex.backtrace.join("\n")}")
@@ -44,6 +44,23 @@ module ExceptionHandling
44
44
  expect(exception_info.controller).to be_nil
45
45
  end
46
46
  end
47
+
48
+ context "honeybadger_tags" do
49
+ it "retrieved from log_context" do
50
+ exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: ['Data Services'] })
51
+ expect(exception_info.honeybadger_tags).to eq(['Data Services'])
52
+ end
53
+
54
+ it "retrieved from log_context and normalized to array if a string" do
55
+ exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: 'Data Services' })
56
+ expect(exception_info.honeybadger_tags).to eq(['Data Services'])
57
+ end
58
+
59
+ it "defaults to empty array if nil" do
60
+ exception_info = ExceptionInfo.new(@exception, "string context", @timestamp)
61
+ expect(exception_info.honeybadger_tags).to eq([])
62
+ end
63
+ end
47
64
  end
48
65
 
49
66
  context "data" do
@@ -727,7 +727,7 @@ describe ExceptionHandling do
727
727
  expect(Honeybadger).to receive(:notify).with(any_args) do |data|
728
728
  honeybadger_data = data
729
729
  end
730
- ExceptionHandling.logger.global_context = { service_name: "rails", region: "AWS-us-east-1" }
730
+ ExceptionHandling.logger.global_context = { service_name: "rails", region: "AWS-us-east-1", honeybadger_tags: ['Data Services', 'web'] }
731
731
  log_context = { log_source: "gem/listen", service_name: "bin/console" }
732
732
  ExceptionHandling.log_error(@exception, @exception_context, @controller, **log_context) do |data|
733
733
  data[:scm_revision] = "5b24eac37aaa91f5784901e9aabcead36fd9df82"
@@ -741,6 +741,7 @@ describe ExceptionHandling do
741
741
  error_message: "Some Exception",
742
742
  controller: "some_controller",
743
743
  exception: @exception,
744
+ tags: "Data Services, web",
744
745
  context: {
745
746
  timestamp: Time.now.to_i,
746
747
  error_class: "StandardError",
@@ -766,7 +767,7 @@ describe ExceptionHandling do
766
767
  "spec/unit/exception_handling_spec.rb:455:in `block (4 levels) in <class:ExceptionHandlingTest>'"
767
768
  ],
768
769
  event_response: "Event successfully received",
769
- log_context: { "service_name" => "bin/console", "region" => "AWS-us-east-1", "log_source" => "gem/listen" }
770
+ log_context: { "service_name" => "bin/console", "region" => "AWS-us-east-1", "log_source" => "gem/listen", "honeybadger_tags" => ['Data Services', 'web'] }
770
771
  }
771
772
  }
772
773
  expect(honeybadger_data).to eq(expected_data)
@@ -791,6 +792,7 @@ describe ExceptionHandling do
791
792
  error_message: "Some Exception",
792
793
  controller: "some_controller",
793
794
  exception: @exception,
795
+ tags: "",
794
796
  context: {
795
797
  timestamp: Time.now.to_i,
796
798
  error_class: "StandardError",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_handling
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0.pre.gk.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-15 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -222,9 +222,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - ">="
225
+ - - ">"
226
226
  - !ruby/object:Gem::Version
227
- version: '0'
227
+ version: 1.3.1
228
228
  requirements: []
229
229
  rubygems_version: 3.1.6
230
230
  signing_key: