honeycomb-rails 0.5.1 → 0.6.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/lib/honeycomb-rails/config.rb +0 -1
- data/lib/honeycomb-rails/overrides/action_controller_instrumentation.rb +0 -19
- data/lib/honeycomb-rails/railtie.rb +2 -4
- data/lib/honeycomb-rails/subscribers/process_action.rb +30 -1
- data/lib/honeycomb-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5269a0de1a6d47dd7c0ff92bdd5e2a954369ad0f49b09ca5c23a7c3e1d4d0214
|
4
|
+
data.tar.gz: 79a58361d5f1a334f9d58f48be31f13779d243130a7ea74951547baf4147f0c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 396f9cc14e318d1795a4883b54f1906a08692d98d6040219cf1726adb418fc4793c504859da5113e2a81f9fd18a12c89e2b8b87e2ef598d90714fbac61dddeee
|
7
|
+
data.tar.gz: d472468f60e3d33fffa15b31b259edb1fdcbc0d08462a0eaf5853c61ec2cfae05b742134ab16e96ff061c0519c25c8cc1f6adfec304fdd68ce3d85fd84c434c2
|
@@ -81,24 +81,5 @@ module HoneycombRails
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
|
-
module ActionControllerFilters
|
85
|
-
def self.included(controller_class)
|
86
|
-
controller_class.around_action :honeycomb_attach_exception_metadata
|
87
|
-
end
|
88
|
-
|
89
|
-
def honeycomb_attach_exception_metadata
|
90
|
-
begin
|
91
|
-
yield
|
92
|
-
rescue StandardError => exception
|
93
|
-
honeycomb_metadata[:exception_class] = exception.class.to_s
|
94
|
-
honeycomb_metadata[:exception_message] = exception.message
|
95
|
-
if HoneycombRails.config.capture_exception_backtraces
|
96
|
-
honeycomb_metadata[:exception_source] = Rails.backtrace_cleaner.clean(exception.backtrace)
|
97
|
-
end
|
98
|
-
|
99
|
-
raise
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
84
|
end
|
104
85
|
end
|
@@ -17,6 +17,8 @@ module HoneycombRails
|
|
17
17
|
# set up libhoney after application initialization so that any config in
|
18
18
|
# the app's config/initializers has taken effect.
|
19
19
|
config.after_initialize do
|
20
|
+
HoneycombRails.config.logger ||= ::Rails.logger
|
21
|
+
|
20
22
|
writekey = HoneycombRails.config.writekey
|
21
23
|
if writekey.blank?
|
22
24
|
HoneycombRails.config.logger.warn("No write key defined! (Check your config's `writekey` value in config/initializers/honeycomb.rb) No events will be sent to Honeycomb.")
|
@@ -26,10 +28,6 @@ module HoneycombRails
|
|
26
28
|
writekey: writekey,
|
27
29
|
user_agent_addition: HoneycombRails::USER_AGENT_SUFFIX,
|
28
30
|
)
|
29
|
-
|
30
|
-
if HoneycombRails.config.capture_exceptions
|
31
|
-
::ActionController::Base.include(Overrides::ActionControllerFilters)
|
32
|
-
end
|
33
31
|
end
|
34
32
|
|
35
33
|
config.after_initialize do
|
@@ -21,13 +21,42 @@ module HoneycombRails
|
|
21
21
|
|
22
22
|
# These are the keys we're interested in! Skipping noisy keys (:headers, :params) for now.
|
23
23
|
data = event.payload.slice(:controller, :action, :method, :path, :format,
|
24
|
-
:status, :db_runtime, :view_runtime
|
24
|
+
:status, :db_runtime, :view_runtime,
|
25
|
+
:exception, :exception_object)
|
25
26
|
|
26
27
|
# Massage data to return "all" as the :format if not set
|
27
28
|
if !data[:format] || data[:format] == "format:*/*"
|
28
29
|
data[:format] = "all"
|
29
30
|
end
|
30
31
|
|
32
|
+
# strip off exception fields for more friendly formatting
|
33
|
+
exception_info = data.delete(:exception)
|
34
|
+
exception = data.delete(:exception_object)
|
35
|
+
|
36
|
+
if exception_info
|
37
|
+
exception_class, exception_message = exception_info
|
38
|
+
|
39
|
+
# Apparently these notifications don't include the `status` field if
|
40
|
+
# an exception occurred while handling the request, even though the
|
41
|
+
# response certainly does end up with a status code set. We'd like to
|
42
|
+
# report that status code, so we reuse the same status code lookup
|
43
|
+
# table that ActionController uses. This looks janky, but it's how the
|
44
|
+
# standard Rails logging does it too... :|
|
45
|
+
#
|
46
|
+
# https://github.com/rails/rails/blob/37b373a8d2a1cd132bbde51cd5a3abd4ecee433b/actionpack/lib/action_controller/log_subscriber.rb#L27
|
47
|
+
data[:status] ||= ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class)
|
48
|
+
|
49
|
+
if HoneycombRails.config.capture_exceptions
|
50
|
+
data[:exception_class] = exception_class
|
51
|
+
data[:exception_message] = exception_message
|
52
|
+
|
53
|
+
if exception && HoneycombRails.config.capture_exception_backtraces
|
54
|
+
data[:exception_source] = ::Rails.backtrace_cleaner.clean(exception.backtrace)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
31
60
|
# Pull top-level attributes off of the ActiveSupport Event.
|
32
61
|
data[:duration_ms] = event.duration
|
33
62
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeycomb-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stokes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: libhoney
|