honeybadger 5.27.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +168 -0
- data/lib/honeybadger/agent.rb +108 -33
- data/lib/honeybadger/backend/base.rb +11 -11
- data/lib/honeybadger/backend/debug.rb +4 -4
- data/lib/honeybadger/backend/null.rb +2 -2
- data/lib/honeybadger/backend/server.rb +11 -11
- data/lib/honeybadger/backend/test.rb +2 -2
- data/lib/honeybadger/backend.rb +6 -6
- data/lib/honeybadger/backtrace.rb +27 -22
- data/lib/honeybadger/breadcrumbs/active_support.rb +10 -10
- data/lib/honeybadger/breadcrumbs/breadcrumb.rb +1 -2
- data/lib/honeybadger/breadcrumbs/collector.rb +4 -4
- data/lib/honeybadger/breadcrumbs/logging.rb +13 -14
- data/lib/honeybadger/breadcrumbs.rb +3 -3
- data/lib/honeybadger/cli/deploy.rb +7 -7
- data/lib/honeybadger/cli/exec.rb +41 -41
- data/lib/honeybadger/cli/helpers.rb +18 -18
- data/lib/honeybadger/cli/heroku.rb +36 -36
- data/lib/honeybadger/cli/install.rb +44 -44
- data/lib/honeybadger/cli/main.rb +107 -107
- data/lib/honeybadger/cli/notify.rb +13 -13
- data/lib/honeybadger/cli/test.rb +109 -94
- data/lib/honeybadger/cli.rb +3 -3
- data/lib/honeybadger/config/defaults.rb +252 -216
- data/lib/honeybadger/config/env.rb +5 -5
- data/lib/honeybadger/config/ruby.rb +19 -19
- data/lib/honeybadger/config/yaml.rb +12 -12
- data/lib/honeybadger/config.rb +116 -95
- data/lib/honeybadger/const.rb +4 -4
- data/lib/honeybadger/context_manager.rb +59 -11
- data/lib/honeybadger/conversions.rb +9 -6
- data/lib/honeybadger/counter.rb +4 -4
- data/lib/honeybadger/event.rb +4 -4
- data/lib/honeybadger/events_worker.rb +34 -33
- data/lib/honeybadger/gauge.rb +2 -2
- data/lib/honeybadger/histogram.rb +4 -4
- data/lib/honeybadger/init/hanami.rb +5 -5
- data/lib/honeybadger/init/rails.rb +14 -14
- data/lib/honeybadger/init/rake.rb +19 -21
- data/lib/honeybadger/init/ruby.rb +4 -4
- data/lib/honeybadger/init/sinatra.rb +11 -12
- data/lib/honeybadger/instrumentation.rb +26 -31
- data/lib/honeybadger/instrumentation_helper.rb +11 -12
- data/lib/honeybadger/karafka.rb +64 -65
- data/lib/honeybadger/logging.rb +22 -21
- data/lib/honeybadger/metric.rb +2 -2
- data/lib/honeybadger/metrics_worker.rb +12 -10
- data/lib/honeybadger/notice.rb +55 -58
- data/lib/honeybadger/notification_subscriber.rb +74 -51
- data/lib/honeybadger/plugin.rb +16 -18
- data/lib/honeybadger/plugins/active_agent.rb +38 -0
- data/lib/honeybadger/plugins/active_job.rb +11 -9
- data/lib/honeybadger/plugins/autotuner.rb +7 -7
- data/lib/honeybadger/plugins/breadcrumbs.rb +7 -7
- data/lib/honeybadger/plugins/delayed_job/plugin.rb +36 -37
- data/lib/honeybadger/plugins/delayed_job.rb +4 -4
- data/lib/honeybadger/plugins/faktory.rb +10 -10
- data/lib/honeybadger/plugins/flipper.rb +33 -0
- data/lib/honeybadger/plugins/karafka.rb +3 -3
- data/lib/honeybadger/plugins/lambda.rb +9 -11
- data/lib/honeybadger/plugins/local_variables.rb +4 -4
- data/lib/honeybadger/plugins/net_http.rb +12 -12
- data/lib/honeybadger/plugins/passenger.rb +4 -4
- data/lib/honeybadger/plugins/rails.rb +15 -9
- data/lib/honeybadger/plugins/resque.rb +7 -7
- data/lib/honeybadger/plugins/shoryuken.rb +6 -6
- data/lib/honeybadger/plugins/sidekiq.rb +79 -65
- data/lib/honeybadger/plugins/solid_queue.rb +8 -7
- data/lib/honeybadger/plugins/sucker_punch.rb +5 -5
- data/lib/honeybadger/plugins/system.rb +3 -3
- data/lib/honeybadger/plugins/thor.rb +5 -5
- data/lib/honeybadger/plugins/warden.rb +5 -8
- data/lib/honeybadger/rack/error_notifier.rb +14 -14
- data/lib/honeybadger/rack/user_feedback.rb +11 -12
- data/lib/honeybadger/rack/user_informer.rb +6 -6
- data/lib/honeybadger/registry.rb +2 -2
- data/lib/honeybadger/registry_execution.rb +1 -1
- data/lib/honeybadger/ruby.rb +2 -2
- data/lib/honeybadger/singleton.rb +49 -46
- data/lib/honeybadger/tasks.rb +3 -3
- data/lib/honeybadger/timer.rb +1 -1
- data/lib/honeybadger/util/http.rb +27 -27
- data/lib/honeybadger/util/request_hash.rb +11 -11
- data/lib/honeybadger/util/request_payload.rb +2 -2
- data/lib/honeybadger/util/revision.rb +14 -6
- data/lib/honeybadger/util/sanitizer.rb +29 -23
- data/lib/honeybadger/util/stats.rb +6 -3
- data/lib/honeybadger/version.rb +1 -1
- data/lib/honeybadger/worker.rb +31 -29
- data/lib/honeybadger.rb +5 -5
- data/lib/puma/plugin/honeybadger.rb +14 -10
- metadata +10 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0d64d7db88ff595c07937d6f9f99c511fa7660d774117e74cdba8037754d428
|
|
4
|
+
data.tar.gz: d2b444b432dfb2641912afb6b464e4b0d92e09cd828bf3ad2e358e6d8ecb0b35
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4eb4640f40d076f316dc1e6ac86a9ba58b5de7a1c76ab15072746ab1d591921ee02a7136453da8dfb09783aa01520ab961b0eba48e82c9125ccde6c673004a3
|
|
7
|
+
data.tar.gz: d9edcfeabcae6c07b44ac289e31ba83abbf7743be7371f2d24c32ecba866bcacfcfbc5ad3c7dd5ae9e920336bda9dd3d516b5dde30a40c8925eb913f91b641a8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,174 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [6.2.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.1.3...v6.2.0) (2025-12-11)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* add Active Agent monitoring plugin ([#754](https://github.com/honeybadger-io/honeybadger-ruby/issues/754)) ([e78cd04](https://github.com/honeybadger-io/honeybadger-ruby/commit/e78cd0419eec02979872500c81b30e274396ca34))
|
|
10
|
+
* send Flipper events to Insights ([#758](https://github.com/honeybadger-io/honeybadger-ruby/issues/758)) ([12d5010](https://github.com/honeybadger-io/honeybadger-ruby/commit/12d501009033884dd77c0b4daedd12cfff1c5cae))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* handle nil messages in Breadcrumbs::LogWrapper ([#757](https://github.com/honeybadger-io/honeybadger-ruby/issues/757)) ([b141f14](https://github.com/honeybadger-io/honeybadger-ruby/commit/b141f14a873d16a8be9b087c8720a734929aca9f))
|
|
16
|
+
|
|
17
|
+
## [6.1.3](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.1.2...v6.1.3) (2025-10-28)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* replace return with next in execution blocks to prevent LocalJumpError ([#745](https://github.com/honeybadger-io/honeybadger-ruby/issues/745)) ([f49977a](https://github.com/honeybadger-io/honeybadger-ruby/commit/f49977a174c15d37c46ff6d0492790ee040778d2))
|
|
23
|
+
|
|
24
|
+
## [6.1.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.1.1...v6.1.2) (2025-10-13)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* handle invalid byte sequence in breadcrumbs ([#742](https://github.com/honeybadger-io/honeybadger-ruby/issues/742)) ([87fd97b](https://github.com/honeybadger-io/honeybadger-ruby/commit/87fd97b944d5bfcc51296bb021eed5a2db30ccf7)), closes [#741](https://github.com/honeybadger-io/honeybadger-ruby/issues/741)
|
|
30
|
+
|
|
31
|
+
## [6.1.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.1.0...v6.1.1) (2025-10-10)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* handle invalid strings when sanitizing ([#739](https://github.com/honeybadger-io/honeybadger-ruby/issues/739)) ([e707cc8](https://github.com/honeybadger-io/honeybadger-ruby/commit/e707cc84ae6503e8a2f20d362f78442d243bcdca)), closes [#733](https://github.com/honeybadger-io/honeybadger-ruby/issues/733)
|
|
37
|
+
|
|
38
|
+
## [6.1.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.6...v6.1.0) (2025-08-29)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* add cached attribute to ActiveRecordSubscriber ([#730](https://github.com/honeybadger-io/honeybadger-ruby/issues/730)) ([09d7cd6](https://github.com/honeybadger-io/honeybadger-ruby/commit/09d7cd67557d871c8930322ed0dd70e9863c19d5))
|
|
44
|
+
* add warden user to Honeybadger context ([#729](https://github.com/honeybadger-io/honeybadger-ruby/issues/729)) ([b1e5c9f](https://github.com/honeybadger-io/honeybadger-ruby/commit/b1e5c9f3ab3fef895233ae4429b96b68afc7d4d0)), closes [#728](https://github.com/honeybadger-io/honeybadger-ruby/issues/728)
|
|
45
|
+
|
|
46
|
+
## [6.0.6](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.5...v6.0.6) (2025-08-14)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* reduce Insights logging ([#725](https://github.com/honeybadger-io/honeybadger-ruby/issues/725)) ([cc4756d](https://github.com/honeybadger-io/honeybadger-ruby/commit/cc4756dc86a77856588057668774fce2e1dd408e))
|
|
52
|
+
|
|
53
|
+
## [6.0.5](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.4...v6.0.5) (2025-08-11)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* don't use as_json to collect Sidekiq stats ([#723](https://github.com/honeybadger-io/honeybadger-ruby/issues/723)) ([d389b2b](https://github.com/honeybadger-io/honeybadger-ruby/commit/d389b2bc2f8b5b7bcc5590946e5b0fa1a551719d)), closes [#722](https://github.com/honeybadger-io/honeybadger-ruby/issues/722)
|
|
59
|
+
|
|
60
|
+
## [6.0.4](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.3...v6.0.4) (2025-08-07)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
* replace context_manager mutex with a monitor ([#718](https://github.com/honeybadger-io/honeybadger-ruby/issues/718)) ([936f3eb](https://github.com/honeybadger-io/honeybadger-ruby/commit/936f3eb4e55024b55e6a1a7f3552000e5dd69eee))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Performance Improvements
|
|
69
|
+
|
|
70
|
+
* ignore more events by default ([#720](https://github.com/honeybadger-io/honeybadger-ruby/issues/720)) ([1f7c757](https://github.com/honeybadger-io/honeybadger-ruby/commit/1f7c757beac6f443fae88aa17141bc9806480b15))
|
|
71
|
+
|
|
72
|
+
## [6.0.3](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.2...v6.0.3) (2025-08-04)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* log fewer 429 responses in events worker ([#714](https://github.com/honeybadger-io/honeybadger-ruby/issues/714)) ([91c7fc2](https://github.com/honeybadger-io/honeybadger-ruby/commit/91c7fc2a0f38d16e076f03c45578afec4a536a2a)), closes [#713](https://github.com/honeybadger-io/honeybadger-ruby/issues/713)
|
|
78
|
+
|
|
79
|
+
## [6.0.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.1...v6.0.2) (2025-07-24)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
* allow jobs in active job subscriber payloads ([#710](https://github.com/honeybadger-io/honeybadger-ruby/issues/710)) ([cc22434](https://github.com/honeybadger-io/honeybadger-ruby/commit/cc224346f5a40e49fdaae75ca8206501fd8da330))
|
|
85
|
+
|
|
86
|
+
## [6.0.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v6.0.0...v6.0.1) (2025-07-23)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
* Use kwargs for .notify in plugins ([#709](https://github.com/honeybadger-io/honeybadger-ruby/issues/709)) ([9007f16](https://github.com/honeybadger-io/honeybadger-ruby/commit/9007f169b26522c4f4e293527e7cb56fdea6a0f3))
|
|
92
|
+
|
|
93
|
+
## [6.0.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.29.1...v6.0.0) (2025-07-21)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### ⚠ BREAKING CHANGES
|
|
97
|
+
|
|
98
|
+
* remove second opts argument in Honeybadger.notify ([#499](https://github.com/honeybadger-io/honeybadger-ruby/issues/499))
|
|
99
|
+
* Minimum supported Ruby version is now 3.0.0
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* enable Insights by default ([#707](https://github.com/honeybadger-io/honeybadger-ruby/issues/707)) ([ab0f35e](https://github.com/honeybadger-io/honeybadger-ruby/commit/ab0f35e648b00d40ac27b2375c85d6e0a37ad546))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Miscellaneous Chores
|
|
107
|
+
|
|
108
|
+
* use standard ([#696](https://github.com/honeybadger-io/honeybadger-ruby/issues/696)) ([795408c](https://github.com/honeybadger-io/honeybadger-ruby/commit/795408c69be4710672f696a0d4c4d2b8ad666ec3))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Code Refactoring
|
|
112
|
+
|
|
113
|
+
* remove second opts argument in Honeybadger.notify ([#499](https://github.com/honeybadger-io/honeybadger-ruby/issues/499)) ([4530fd5](https://github.com/honeybadger-io/honeybadger-ruby/commit/4530fd50d5b3f2f751cc9bdec7b0a1af13e3aa94))
|
|
114
|
+
|
|
115
|
+
## [5.29.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.29.0...v5.29.1) (2025-07-01)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
* Revert "feat: exclude insights from rake tasks config ([#697](https://github.com/honeybadger-io/honeybadger-ruby/issues/697))" ([381566c](https://github.com/honeybadger-io/honeybadger-ruby/commit/381566cf976e110ff5b55770038aac25f51ee4ea)), closes [#702](https://github.com/honeybadger-io/honeybadger-ruby/issues/702)
|
|
121
|
+
|
|
122
|
+
## [5.29.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.28.0...v5.29.0) (2025-06-27)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* add event context ([#700](https://github.com/honeybadger-io/honeybadger-ruby/issues/700)) ([36abc18](https://github.com/honeybadger-io/honeybadger-ruby/commit/36abc1826a62954b83b11b10d7e91d41f3052524))
|
|
128
|
+
* exclude insights from rake tasks config ([#697](https://github.com/honeybadger-io/honeybadger-ruby/issues/697)) ([118034c](https://github.com/honeybadger-io/honeybadger-ruby/commit/118034c8395dd79fada9979f9f519ded8e81234a))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
|
|
133
|
+
* avoid database connections during asset precompilation ([#695](https://github.com/honeybadger-io/honeybadger-ruby/issues/695)) ([14ae485](https://github.com/honeybadger-io/honeybadger-ruby/commit/14ae4858da865cb6f95d16e1a12faf3ecc2caedd))
|
|
134
|
+
|
|
135
|
+
## [5.28.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.27.4...v5.28.0) (2025-05-02)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Features
|
|
139
|
+
|
|
140
|
+
* add sampling ([#689](https://github.com/honeybadger-io/honeybadger-ruby/issues/689)) ([0692ab0](https://github.com/honeybadger-io/honeybadger-ruby/commit/0692ab07d33843dc2612c36713b0f126ecba6b35))
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
## [5.27.4](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.27.3...v5.27.4) (2025-04-30)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Documentation Updates
|
|
147
|
+
|
|
148
|
+
* shorten the gem summary ([3caacd1](https://github.com/honeybadger-io/honeybadger-ruby/commit/3caacd10fd4b605ce357a0c7eff0be37e64fcc64))
|
|
149
|
+
|
|
150
|
+
## [5.27.3](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.27.2...v5.27.3) (2025-04-30)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Documentation Updates
|
|
154
|
+
|
|
155
|
+
* update RubyGems copy ([5e7609a](https://github.com/honeybadger-io/honeybadger-ruby/commit/5e7609aa74f021ac748154c57b2f8fe530762484))
|
|
156
|
+
|
|
157
|
+
## [5.27.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.27.1...v5.27.2) (2025-04-24)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Bug Fixes
|
|
161
|
+
|
|
162
|
+
* ensure value is a string before trying to strip it ([#683](https://github.com/honeybadger-io/honeybadger-ruby/issues/683)) ([4834cf9](https://github.com/honeybadger-io/honeybadger-ruby/commit/4834cf957be8b9afc3ef6fcb6cc0e02fef3c7ce3)), closes [#682](https://github.com/honeybadger-io/honeybadger-ruby/issues/682)
|
|
163
|
+
|
|
164
|
+
## [5.27.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.27.0...v5.27.1) (2025-03-21)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Bug Fixes
|
|
168
|
+
|
|
169
|
+
* add specs for ignored events ([#677](https://github.com/honeybadger-io/honeybadger-ruby/issues/677)) ([3907ecf](https://github.com/honeybadger-io/honeybadger-ruby/commit/3907ecf7ace995b2771b07f51a42388ce82c6aed))
|
|
170
|
+
* prepend callback in Active Job plugin ([a46a668](https://github.com/honeybadger-io/honeybadger-ruby/commit/a46a6685358ffdb25d1c6446585a3e65847ac34b))
|
|
171
|
+
|
|
4
172
|
## [5.27.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.26.4...v5.27.0) (2025-03-13)
|
|
5
173
|
|
|
6
174
|
|
data/lib/honeybadger/agent.rb
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
require
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
12
|
-
require
|
|
13
|
-
require
|
|
14
|
-
require
|
|
15
|
-
require
|
|
1
|
+
require "forwardable"
|
|
2
|
+
require "zlib"
|
|
3
|
+
|
|
4
|
+
require "honeybadger/version"
|
|
5
|
+
require "honeybadger/config"
|
|
6
|
+
require "honeybadger/context_manager"
|
|
7
|
+
require "honeybadger/notice"
|
|
8
|
+
require "honeybadger/event"
|
|
9
|
+
require "honeybadger/plugin"
|
|
10
|
+
require "honeybadger/logging"
|
|
11
|
+
require "honeybadger/worker"
|
|
12
|
+
require "honeybadger/events_worker"
|
|
13
|
+
require "honeybadger/metrics_worker"
|
|
14
|
+
require "honeybadger/breadcrumbs"
|
|
15
|
+
require "honeybadger/registry"
|
|
16
|
+
require "honeybadger/registry_execution"
|
|
16
17
|
|
|
17
18
|
module Honeybadger
|
|
18
19
|
# The Honeybadger agent contains all the methods for interacting with the
|
|
@@ -62,7 +63,7 @@ module Honeybadger
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def initialize(opts = {})
|
|
65
|
-
if opts.
|
|
66
|
+
if opts.is_a?(Config)
|
|
66
67
|
@config = opts
|
|
67
68
|
opts = {}
|
|
68
69
|
end
|
|
@@ -124,14 +125,13 @@ module Honeybadger
|
|
|
124
125
|
#
|
|
125
126
|
# @return [String] UUID reference to the notice within Honeybadger.
|
|
126
127
|
# @return [false] when ignored.
|
|
127
|
-
def notify(exception_or_opts = nil, opts
|
|
128
|
-
if !config[:
|
|
129
|
-
debug {
|
|
128
|
+
def notify(exception_or_opts = nil, **opts)
|
|
129
|
+
if !config[:"exceptions.enabled"]
|
|
130
|
+
debug { "disabled feature=notices" }
|
|
130
131
|
return false
|
|
131
132
|
end
|
|
132
133
|
|
|
133
134
|
opts = opts.dup
|
|
134
|
-
opts.merge!(kwargs)
|
|
135
135
|
|
|
136
136
|
if exception_or_opts.is_a?(Exception)
|
|
137
137
|
already_reported_notice_id = exception_or_opts.instance_variable_get(:@__hb_notice_id)
|
|
@@ -145,11 +145,13 @@ module Honeybadger
|
|
|
145
145
|
|
|
146
146
|
validate_notify_opts!(opts)
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
if config[:"breadcrumbs.enabled"]
|
|
149
|
+
add_breadcrumb(
|
|
150
|
+
"Honeybadger Notice",
|
|
151
|
+
metadata: opts,
|
|
152
|
+
category: "notice"
|
|
153
|
+
)
|
|
154
|
+
end
|
|
153
155
|
|
|
154
156
|
opts[:rack_env] ||= context_manager.get_rack_env
|
|
155
157
|
opts[:global_context] ||= context_manager.get_context
|
|
@@ -163,22 +165,22 @@ module Honeybadger
|
|
|
163
165
|
with_error_handling { hook.call(notice) }
|
|
164
166
|
end
|
|
165
167
|
|
|
166
|
-
unless notice.api_key
|
|
167
|
-
error { sprintf(
|
|
168
|
+
unless NOT_BLANK.match?(notice.api_key)
|
|
169
|
+
error { sprintf("Unable to send error report: API key is missing. id=%s", notice.id) }
|
|
168
170
|
return false
|
|
169
171
|
end
|
|
170
172
|
|
|
171
173
|
if !opts[:force] && notice.ignore?
|
|
172
|
-
debug { sprintf(
|
|
174
|
+
debug { sprintf("ignore notice feature=notices id=%s", notice.id) }
|
|
173
175
|
return false
|
|
174
176
|
end
|
|
175
177
|
|
|
176
178
|
if notice.halted?
|
|
177
|
-
debug {
|
|
179
|
+
debug { "halted notice feature=notices" }
|
|
178
180
|
return false
|
|
179
181
|
end
|
|
180
182
|
|
|
181
|
-
info { sprintf(
|
|
183
|
+
info { sprintf("Reporting error id=%s", notice.id) }
|
|
182
184
|
|
|
183
185
|
if opts[:sync] || config[:sync]
|
|
184
186
|
send_now(notice)
|
|
@@ -204,7 +206,7 @@ module Honeybadger
|
|
|
204
206
|
# otherwise.
|
|
205
207
|
def check_in(id)
|
|
206
208
|
# this is to allow check ins even if a url is passed
|
|
207
|
-
check_in_id = id.to_s.strip.gsub(/\/$/,
|
|
209
|
+
check_in_id = id.to_s.strip.gsub(/\/$/, "").split("/").last
|
|
208
210
|
response = backend.check_in(check_in_id)
|
|
209
211
|
response.success?
|
|
210
212
|
end
|
|
@@ -411,7 +413,8 @@ module Honeybadger
|
|
|
411
413
|
|
|
412
414
|
extra_payload = {}.tap do |p|
|
|
413
415
|
p[:request_id] = context_manager.get_request_id if context_manager.get_request_id
|
|
414
|
-
p[:hostname] = config[:hostname].to_s if config[:
|
|
416
|
+
p[:hostname] = config[:hostname].to_s if config[:"events.attach_hostname"]
|
|
417
|
+
p.update(context_manager.get_event_context || {})
|
|
415
418
|
end
|
|
416
419
|
|
|
417
420
|
event = Event.new(event_type, extra_payload.merge(payload))
|
|
@@ -434,9 +437,61 @@ module Honeybadger
|
|
|
434
437
|
|
|
435
438
|
return if event.halted?
|
|
436
439
|
|
|
440
|
+
return unless sample_event?(event)
|
|
441
|
+
|
|
442
|
+
strip_metadata(event)
|
|
443
|
+
|
|
437
444
|
events_worker.push(event.as_json)
|
|
438
445
|
end
|
|
439
446
|
|
|
447
|
+
# Save event-specific context for the current request.
|
|
448
|
+
#
|
|
449
|
+
# @example
|
|
450
|
+
# Honeybadger.event_context({user_id: current_user.id})
|
|
451
|
+
#
|
|
452
|
+
# # Inside a Rails controller:
|
|
453
|
+
# before_action do
|
|
454
|
+
# Honeybadger.event_context({user_id: current_user.id})
|
|
455
|
+
# end
|
|
456
|
+
#
|
|
457
|
+
# # Explicit conversion
|
|
458
|
+
# class User < ActiveRecord::Base
|
|
459
|
+
# def to_honeybadger_context
|
|
460
|
+
# { user_id: id, user_email: email }
|
|
461
|
+
# end
|
|
462
|
+
# end
|
|
463
|
+
#
|
|
464
|
+
# user = User.first
|
|
465
|
+
# Honeybadger.event_context(user)
|
|
466
|
+
#
|
|
467
|
+
# # Clearing event context:
|
|
468
|
+
# Honeybadger.clear_event_context
|
|
469
|
+
#
|
|
470
|
+
# @param [Hash] context A Hash of data which will be sent to Honeybadger
|
|
471
|
+
# when an event occurs. If the object responds to +#to_honeybadger_context+,
|
|
472
|
+
# the return value of that method will be used (explicit conversion). Can
|
|
473
|
+
# include any key/value, but a few keys have a special meaning in
|
|
474
|
+
# Honeybadger.
|
|
475
|
+
#
|
|
476
|
+
# @return [Object, self] value of the block if passed, otherwise self
|
|
477
|
+
def event_context(context = nil, &block)
|
|
478
|
+
block_result = context_manager.set_event_context(context, &block) unless context.nil?
|
|
479
|
+
return block_result if block_given?
|
|
480
|
+
|
|
481
|
+
self
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
# Get event-specific context for the current request.
|
|
485
|
+
#
|
|
486
|
+
# @example
|
|
487
|
+
# Honeybadger.event_context({my_data: 'my value'})
|
|
488
|
+
# Honeybadger.get_event_context # => {my_data: 'my value'}
|
|
489
|
+
#
|
|
490
|
+
# @return [Hash, nil]
|
|
491
|
+
def get_event_context
|
|
492
|
+
context_manager.get_event_context
|
|
493
|
+
end
|
|
494
|
+
|
|
440
495
|
# @api private
|
|
441
496
|
def collect(collector)
|
|
442
497
|
return unless config.insights_enabled?
|
|
@@ -570,10 +625,30 @@ module Honeybadger
|
|
|
570
625
|
|
|
571
626
|
private
|
|
572
627
|
|
|
628
|
+
def strip_metadata(event)
|
|
629
|
+
event.delete(:_hb)
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
def sample_event?(event)
|
|
633
|
+
# Always send metrics events
|
|
634
|
+
return true if event[:event_type] == "metric.hb"
|
|
635
|
+
|
|
636
|
+
sample_rate = config[:"events.sample_rate"]
|
|
637
|
+
sample_rate = event.dig(:_hb, :sample_rate) if event.dig(:_hb, :sample_rate).is_a?(Numeric)
|
|
638
|
+
|
|
639
|
+
return true if sample_rate >= 100
|
|
640
|
+
|
|
641
|
+
if event[:request_id] # Send all events for a given request
|
|
642
|
+
Zlib.crc32(event[:request_id].to_s) % 100 < sample_rate
|
|
643
|
+
else # Otherwise just take a random sample
|
|
644
|
+
rand(100) < sample_rate
|
|
645
|
+
end
|
|
646
|
+
end
|
|
647
|
+
|
|
573
648
|
def validate_notify_opts!(opts)
|
|
574
649
|
return if opts.has_key?(:exception)
|
|
575
650
|
return if opts.has_key?(:error_message)
|
|
576
|
-
msg = sprintf(
|
|
651
|
+
msg = sprintf("`Honeybadger.notify` was called with invalid arguments. You must pass either an Exception or options Hash containing the `:error_message` key. location=%s", caller[caller.size - 1])
|
|
577
652
|
raise ArgumentError.new(msg) if config.dev?
|
|
578
653
|
warn(msg)
|
|
579
654
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
1
|
+
require "forwardable"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "json"
|
|
4
4
|
|
|
5
|
-
require
|
|
5
|
+
require "honeybadger/logging"
|
|
6
6
|
|
|
7
7
|
module Honeybadger
|
|
8
8
|
module Backend
|
|
@@ -34,7 +34,7 @@ module Honeybadger
|
|
|
34
34
|
# @param [String] message The String message returned by the server (or
|
|
35
35
|
# set by the backend in the case of an :error code).
|
|
36
36
|
def initialize(*args)
|
|
37
|
-
if (response = args.first).
|
|
37
|
+
if (response = args.first).is_a?(Net::HTTPResponse)
|
|
38
38
|
@code, @body, @message = response.code.to_i, response.body.to_s, response.message
|
|
39
39
|
else
|
|
40
40
|
@code, @body, @message = args
|
|
@@ -51,18 +51,18 @@ module Honeybadger
|
|
|
51
51
|
def error_message
|
|
52
52
|
return message if code == :error
|
|
53
53
|
return FRIENDLY_ERRORS[code] if FRIENDLY_ERRORS[code]
|
|
54
|
-
return error if error
|
|
54
|
+
return error if NOT_BLANK.match?(error)
|
|
55
55
|
msg = "The server responded with #{code}"
|
|
56
|
-
msg << ": #{message}" if message
|
|
56
|
+
msg << ": #{message}" if NOT_BLANK.match?(message)
|
|
57
57
|
msg
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
private
|
|
61
61
|
|
|
62
62
|
def parse_error(body)
|
|
63
|
-
return unless body
|
|
63
|
+
return unless NOT_BLANK.match?(body)
|
|
64
64
|
obj = JSON.parse(body)
|
|
65
|
-
|
|
65
|
+
obj["error"] if obj.is_a?(Hash)
|
|
66
66
|
rescue JSON::ParserError
|
|
67
67
|
nil
|
|
68
68
|
end
|
|
@@ -88,7 +88,7 @@ module Honeybadger
|
|
|
88
88
|
#
|
|
89
89
|
# @raise NotImplementedError
|
|
90
90
|
def notify(feature, payload)
|
|
91
|
-
raise NotImplementedError,
|
|
91
|
+
raise NotImplementedError, "must define #notify on subclass."
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# Does a check in using the input id.
|
|
@@ -97,7 +97,7 @@ module Honeybadger
|
|
|
97
97
|
#
|
|
98
98
|
# @raise NotImplementedError
|
|
99
99
|
def check_in(id)
|
|
100
|
-
raise NotImplementedError,
|
|
100
|
+
raise NotImplementedError, "must define #check_in on subclass."
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
# Track a deployment
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "honeybadger/backend/null"
|
|
2
2
|
|
|
3
3
|
module Honeybadger
|
|
4
4
|
module Backend
|
|
@@ -8,19 +8,19 @@ module Honeybadger
|
|
|
8
8
|
class Debug < Null
|
|
9
9
|
def notify(feature, payload)
|
|
10
10
|
logger.unknown("notifying debug backend of feature=#{feature}\n\t#{payload.to_json}")
|
|
11
|
-
return Response.new(ENV[
|
|
11
|
+
return Response.new(ENV["DEBUG_BACKEND_STATUS"].to_i, nil) if ENV["DEBUG_BACKEND_STATUS"]
|
|
12
12
|
super
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def check_in(id)
|
|
16
16
|
logger.unknown("checking in debug backend with id=#{id}")
|
|
17
|
-
return Response.new(ENV[
|
|
17
|
+
return Response.new(ENV["DEBUG_BACKEND_STATUS"].to_i, nil) if ENV["DEBUG_BACKEND_STATUS"]
|
|
18
18
|
super
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def event(payload)
|
|
22
22
|
logger.unknown("sending event to debug backend with event=#{payload.to_json}")
|
|
23
|
-
return Response.new(ENV[
|
|
23
|
+
return Response.new(ENV["DEBUG_BACKEND_STATUS"].to_i, nil) if ENV["DEBUG_BACKEND_STATUS"]
|
|
24
24
|
super
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "honeybadger/backend/base"
|
|
2
2
|
|
|
3
3
|
module Honeybadger
|
|
4
4
|
module Backend
|
|
5
5
|
class Null < Base
|
|
6
6
|
class StubbedResponse < Response
|
|
7
7
|
def initialize
|
|
8
|
-
super(:stubbed,
|
|
8
|
+
super(:stubbed, "{}".freeze)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def success?
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "json"
|
|
3
|
+
require "zlib"
|
|
4
|
+
require "openssl"
|
|
5
5
|
|
|
6
|
-
require
|
|
7
|
-
require
|
|
6
|
+
require "honeybadger/backend/base"
|
|
7
|
+
require "honeybadger/util/http"
|
|
8
8
|
|
|
9
9
|
module Honeybadger
|
|
10
10
|
module Backend
|
|
11
11
|
class Server < Base
|
|
12
12
|
ENDPOINTS = {
|
|
13
|
-
notices:
|
|
14
|
-
deploys:
|
|
13
|
+
notices: "/v1/notices".freeze,
|
|
14
|
+
deploys: "/v1/deploys".freeze
|
|
15
15
|
}.freeze
|
|
16
|
-
CHECK_IN_ENDPOINT =
|
|
17
|
-
EVENTS_ENDPOINT =
|
|
16
|
+
CHECK_IN_ENDPOINT = "/v1/check_in".freeze
|
|
17
|
+
EVENTS_ENDPOINT = "/v1/events".freeze
|
|
18
18
|
|
|
19
19
|
HTTP_ERRORS = Util::HTTP::ERRORS
|
|
20
20
|
|
|
@@ -64,7 +64,7 @@ module Honeybadger
|
|
|
64
64
|
def payload_headers(payload)
|
|
65
65
|
if payload.respond_to?(:api_key) && payload.api_key
|
|
66
66
|
{
|
|
67
|
-
|
|
67
|
+
"X-API-Key" => payload.api_key
|
|
68
68
|
}
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "honeybadger/backend/null"
|
|
2
2
|
|
|
3
3
|
module Honeybadger
|
|
4
4
|
module Backend
|
|
@@ -10,7 +10,7 @@ module Honeybadger
|
|
|
10
10
|
#
|
|
11
11
|
# @return [Hash] Notifications hash.
|
|
12
12
|
def self.notifications
|
|
13
|
-
@notifications ||= Hash.new {|h,k| h[k] = [] }
|
|
13
|
+
@notifications ||= Hash.new { |h, k| h[k] = [] }
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# The event list.
|
data/lib/honeybadger/backend.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "forwardable"
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
3
|
+
require "honeybadger/backend/base"
|
|
4
|
+
require "honeybadger/backend/server"
|
|
5
|
+
require "honeybadger/backend/test"
|
|
6
|
+
require "honeybadger/backend/null"
|
|
7
|
+
require "honeybadger/backend/debug"
|
|
8
8
|
|
|
9
9
|
module Honeybadger
|
|
10
10
|
# @api private
|