honeybadger 4.5.1 → 4.5.2

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: eac6213788a4b8b6df635963d871e79d272be344336b0ba05fa83d341619f9cb
4
- data.tar.gz: f32791ebf4ba5e79ae3f29126854ee07afcaf30042aad4bacb4f0e02662d744f
3
+ metadata.gz: 5169640b12b57da3ce55508ceecb5d3e3ee58bd5e2885875181dc86689cba9a1
4
+ data.tar.gz: 5fd84c3728812b76fafbbbce74a9c6a31f92208e5e6ff7bb78635ede954da4b2
5
5
  SHA512:
6
- metadata.gz: a5e37eb91ad24fe3678e738a1c44fec089bb9cc0e47f723b5ff9d2cad3fcb8ca0543a5916ad8cb144c91e323f8249a53dbb1ea227b76d953d89bf50ecffb8ea6
7
- data.tar.gz: 80ee259d3caab22bd0e4709f2a4bdf53411dfb2408ebd4e5c2d6818dc8b114b4d4c945cc7037bc3eea8877a1b0be1fb4496ad70e3e4f44caa11321678b1362a3
6
+ metadata.gz: dfba149883a5d2eb840c2e9fa240e8133adc001fa4dc04d5867c5599c3377fe79bd23920e65182d09061de2c31ed50a1d9e69ddd6a5c2dc239f1eb00dfb1f62f
7
+ data.tar.gz: 7de85e33f17702f7e66ba39092e15d6c798f7d771cdc737ebae33bc4217a228c1a1fb61dd1337d02137caf060ffd60b51faaf06691f34fca036e8230851c5592
@@ -5,6 +5,15 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.5.2] - 2019-10-09
9
+ ### Changed
10
+ - Added parameter filtering to breadcrumb metadata (#329)
11
+
12
+ ### Added
13
+ - Added `lambda` plugin which forces sync mode (to make sure that we are not
14
+ sending notices in another thread) and adds extra lambda details to the
15
+ Notice. (honeybadger-ruby-internal#1)
16
+
8
17
  ## [4.5.1] - 2019-08-13
9
18
  ### Fixed
10
19
  - Logging breadcrumbs will not crash anymore when logging is done using a block
@@ -102,6 +102,7 @@ module Honeybadger
102
102
  # @option opts [Array] :backtrace The backtrace of the error (optional).
103
103
  # @option opts [String] :fingerprint The grouping fingerprint of the exception (optional).
104
104
  # @option opts [Boolean] :force (false) Always report the exception when true, even when ignored (optional).
105
+ # @option opts [Boolean] :sync (false) Send data synchronously (skips the worker) (optional).
105
106
  # @option opts [String] :tags The comma-separated list of tags (optional).
106
107
  # @option opts [Hash] :context The context to associate with the exception (optional).
107
108
  # @option opts [String] :controller The controller name (such as a Rails controller) (optional).
@@ -158,7 +159,7 @@ module Honeybadger
158
159
 
159
160
  info { sprintf('Reporting error id=%s', notice.id) }
160
161
 
161
- if opts[:sync]
162
+ if opts[:sync] || config[:sync]
162
163
  send_now(notice)
163
164
  else
164
165
  push(notice)
@@ -89,6 +89,11 @@ module Honeybadger
89
89
  default: nil,
90
90
  type: Array
91
91
  },
92
+ sync: {
93
+ description: 'Enable all notices to be sent synchronously. Default is false.',
94
+ default: false,
95
+ type: Boolean
96
+ },
92
97
  :'skipped_plugins' => {
93
98
  description: 'An optional list of plugins to skip.',
94
99
  default: nil,
@@ -136,6 +136,9 @@ module Honeybadger
136
136
  # @return [Breadcrumbs::Collector] The collection of captured breadcrumbs
137
137
  attr_accessor :breadcrumbs
138
138
 
139
+ # Custom details data
140
+ attr_accessor :details
141
+
139
142
  # @api private
140
143
  # Cache project path substitutions for backtrace lines.
141
144
  PROJECT_ROOT_CACHE = {}
@@ -200,6 +203,7 @@ module Honeybadger
200
203
  self.params = opts[:parameters] || opts[:params] || request_hash[:params] || {}
201
204
  self.session = opts[:session] || request_hash[:session] || {}
202
205
  self.cgi_data = opts[:cgi_data] || request_hash[:cgi_data] || {}
206
+ self.details = opts[:details] || {}
203
207
 
204
208
  self.session = opts[:session][:data] if opts[:session] && opts[:session][:data]
205
209
 
@@ -231,6 +235,7 @@ module Honeybadger
231
235
  tags: s(tags),
232
236
  causes: s(prepare_causes(causes))
233
237
  },
238
+ details: s(details),
234
239
  request: request,
235
240
  server: {
236
241
  project_root: s(config[:root]),
@@ -376,10 +381,15 @@ module Honeybadger
376
381
  Context(object)
377
382
  end
378
383
 
379
- # Sanitize at the depth of 4 since we are sanitizing the breadcrumb root
380
- # hash data structure.
384
+ # Sanitize metadata to keep it at a single level and remove any filtered
385
+ # parameters
381
386
  def sanitized_breadcrumbs
382
- Util::Sanitizer.new(max_depth: 4).sanitize(breadcrumbs.to_h)
387
+ sanitizer = Util::Sanitizer.new(max_depth: 1, filters: params_filters)
388
+ breadcrumbs.each do |breadcrumb|
389
+ breadcrumb.metadata = sanitizer.sanitize(breadcrumb.metadata)
390
+ end
391
+
392
+ breadcrumbs.to_h
383
393
  end
384
394
 
385
395
  def construct_context_hash(opts, exception)
@@ -0,0 +1,26 @@
1
+ require 'honeybadger/plugin'
2
+ require 'honeybadger/util/lambda'
3
+
4
+ module Honeybadger
5
+ module Plugins
6
+ # @api private
7
+ Plugin.register :lambda do
8
+ requirement { Util::Lambda.lambda_execution? }
9
+
10
+ execution do
11
+ config[:sync] = true
12
+ (config[:before_notify] ||= []) << lambda do |notice|
13
+ data = Util::Lambda.normalized_data
14
+
15
+ notice.component = data["function"]
16
+ notice.action = data["handler"]
17
+ notice.details["Lambda Details"] = data
18
+
19
+ if (trace_id = Util::Lambda.trace_id)
20
+ notice.context[:lambda_trace_id] = trace_id
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ module Honeybadger
2
+ module Util
3
+ class Lambda
4
+ AWS_ENV_MAP = {
5
+ "_HANDLER" => "handler",
6
+ "AWS_REGION" => "region",
7
+ "AWS_EXECUTION_ENV" => "runtime",
8
+ "AWS_LAMBDA_FUNCTION_NAME" => "function",
9
+ "AWS_LAMBDA_FUNCTION_MEMORY_SIZE" => "memory",
10
+ "AWS_LAMBDA_FUNCTION_VERSION" => "version",
11
+ "AWS_LAMBDA_LOG_GROUP_NAME" => "log_group",
12
+ "AWS_LAMBDA_LOG_STREAM_NAME" => "log_name"
13
+ }.freeze
14
+
15
+ class << self
16
+ def lambda_execution?
17
+ !!ENV["AWS_EXECUTION_ENV"]
18
+ end
19
+
20
+ def normalized_data
21
+ AWS_ENV_MAP.each_with_object({}) do |(k, v), memo|
22
+ memo[v] = ENV[k] if ENV[k]
23
+ end
24
+ end
25
+
26
+ def trace_id
27
+ ENV["_X_AMZN_TRACE_ID"]
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '4.5.1'.freeze
3
+ VERSION = '4.5.2'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.1
4
+ version: 4.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -65,6 +65,7 @@ files:
65
65
  - lib/honeybadger/plugins/breadcrumbs.rb
66
66
  - lib/honeybadger/plugins/delayed_job.rb
67
67
  - lib/honeybadger/plugins/delayed_job/plugin.rb
68
+ - lib/honeybadger/plugins/lambda.rb
68
69
  - lib/honeybadger/plugins/local_variables.rb
69
70
  - lib/honeybadger/plugins/passenger.rb
70
71
  - lib/honeybadger/plugins/rails.rb
@@ -82,6 +83,7 @@ files:
82
83
  - lib/honeybadger/tasks.rb
83
84
  - lib/honeybadger/templates/feedback_form.erb
84
85
  - lib/honeybadger/util/http.rb
86
+ - lib/honeybadger/util/lambda.rb
85
87
  - lib/honeybadger/util/request_hash.rb
86
88
  - lib/honeybadger/util/request_payload.rb
87
89
  - lib/honeybadger/util/revision.rb
@@ -143,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
145
  requirements:
144
146
  - - ">="
145
147
  - !ruby/object:Gem::Version
146
- version: 2.1.0
148
+ version: 2.3.0
147
149
  required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  requirements:
149
151
  - - ">="