raygun-apm-rails 1.0.13 → 1.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af287b2e3dedf67b7ccd3c0a3db9e0ee0c4344f5301943d70cb725a5a5b9f156
4
- data.tar.gz: f1eccad409e86cfe8ce71e3328f0197c5c1569f8852a2b5c4967309f05f34a2c
3
+ metadata.gz: 56652e1a7f4025972adeff71e48d15e0c9de9160b594c317a0542cbbb755dd68
4
+ data.tar.gz: 9d5ecc225f6ff015b355847336b536a6c753b86b376f7a0122d31beaa1501103
5
5
  SHA512:
6
- metadata.gz: cf350bb96e85aae63395c8091fa6535d520c28da4a389faa1bd3b309e791c94afc57e98c51a22e0308e9e14373ab350922d267a208aa375277d23ff5b4dd4eb6
7
- data.tar.gz: 446a35a75b08293a172e4dbab7d434e176a00c761ea4696c8524537238816dc2403a758e847734179ebe737a43193631bc15e97eb7c6b70956737b167d56de5e
6
+ metadata.gz: 9920374e2efa710d18f2bd877ef3a9a583eda90fb3b6e5cb1f0cfc2f6cf4c84ea0876c67a0cc4714488d6658db3865e5d8716755941b15abe2cfe73cd5f92371
7
+ data.tar.gz: a5da42a667bf6affb31abb3d9e9390ed1dd9bb7164b6d1d63e7dd263d218377228ff98e955617fb3eea10c25d194339cd34e01c98d2d8a458f317f866232f653
@@ -63,6 +63,10 @@ module Raygun
63
63
  Zeitwerk
64
64
  SassC
65
65
  Webpacker
66
+ DidYouMean
67
+ Nokogiri
68
+ Loofah
69
+ WebConsole
66
70
  +Raygun::Apm::Rails::Middleware::Ruby_APM_profiler_trace
67
71
  }
68
72
  end
@@ -23,6 +23,7 @@ module Raygun
23
23
  @http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
24
24
  http_in_handler(args)
25
25
  end
26
+
26
27
  @sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
27
28
  sql_handler(args)
28
29
  end
@@ -39,10 +40,15 @@ module Raygun
39
40
  @tracer_initialized ||= initialize_tracer
40
41
  # Can be nil if we had a fatal error
41
42
  if @tracer
43
+ # For the exceptional HTTP IN handler
44
+ @request_started = @tracer.now
42
45
  Thread.current.thread_variable_set(:_raygun_apm_tracer, @tracer)
43
46
  @tracer.start_trace
44
47
  end
45
48
  res = Ruby_APM_profiler_trace{ @app.call(env) }
49
+ if (status = res.first) >= 400 && status < 500 || status >= 500 && status < 600
50
+ exceptional_http_in_handler(env, status)
51
+ end
46
52
  # Can be nil if we had a fatal error
47
53
  @tracer.end_trace if @tracer
48
54
  res
@@ -51,7 +57,7 @@ module Raygun
51
57
  end
52
58
 
53
59
  def raygun_shutdown_handler(exception)
54
- warn "[Raygun APM] shutting down due to error - #{exception.message}",
60
+ warn "[Raygun APM] shutting down due to error - #{exception.message} #{exception.backtrace.join("\n")}",
55
61
  # Kill extended event subcriptions
56
62
  ActiveSupport::Notifications.unsubscribe(@http_in_subscriber)
57
63
  ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
@@ -64,10 +70,6 @@ module Raygun
64
70
 
65
71
  def http_in_handler(args)
66
72
  notification = ActiveSupport::Notifications::Event.new *args
67
- if notification.payload[:exception]
68
- warn "[Raygun APM] exception in HTTP IN event: #{notification.payload[:exception]}"
69
- return
70
- end
71
73
  req = Rack::Request.new notification.payload[:headers].env
72
74
  event = http_in_event
73
75
  event[:url] = req.url
@@ -83,6 +85,22 @@ module Raygun
83
85
  raygun_shutdown_handler(e)
84
86
  end
85
87
 
88
+ # For middleware chain halts that does not trigger 'process_action.action_controller'
89
+ def exceptional_http_in_handler(env, status)
90
+ req = Rack::Request.new env
91
+ event = http_in_event
92
+ event[:url] = req.url
93
+ event[:verb] = req.request_method
94
+ event[:status] = status
95
+ event[:duration] = @tracer.now - @request_started
96
+ event[:timestamp] = @tracer.now
97
+ event[:tid] = @tracer.get_thread_id(Thread.current)
98
+ @tracer.emit(event)
99
+ rescue => e
100
+ warn "[Raygun APM] error reporting exceptional HTTP IN event"
101
+ raygun_shutdown_handler(e)
102
+ end
103
+
86
104
  def http_in_event
87
105
  @http_in_event ||= begin
88
106
  event = Raygun::Apm::Event::HttpIn.new
@@ -1,7 +1,7 @@
1
1
  module Raygun
2
2
  module Apm
3
3
  module Rails
4
- VERSION = "1.0.13"
4
+ VERSION = "1.0.14"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raygun-apm-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raygun
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-03-05 00:00:00.000000000 Z
12
+ date: 2020-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: raygun-apm
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubygems_version: 3.0.3
108
+ rubygems_version: 3.0.6
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Raygun application performance monitoring for Rails