raygun-apm-rails 1.0.9 → 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: 9836a784a74b690dfe2f7729ebaf4ddfd8f534963ee2117794cc05e2e9ed8205
4
- data.tar.gz: 4cd2142598b702d6f094ad21216b84dc22a6e49a29be7ece1047ac426cc4ab38
3
+ metadata.gz: 56652e1a7f4025972adeff71e48d15e0c9de9160b594c317a0542cbbb755dd68
4
+ data.tar.gz: 9d5ecc225f6ff015b355847336b536a6c753b86b376f7a0122d31beaa1501103
5
5
  SHA512:
6
- metadata.gz: b944c4997eec11f05c88787a1d249ae9d53d5553bbd07491bccec30a18645a9998cb27afea1e05f0bd6d423692424929caf461ca1eb787cd1ce2c32b3bbb23eb
7
- data.tar.gz: 8177f0bb4c0f24bfcf4f17816c95d5c21d9df361fe3ef4cdbc8e4753e516a792ba796efb52ec91451b4eac734b6ff7e6c6912fe059d6037c949663afa45f236e
6
+ metadata.gz: 9920374e2efa710d18f2bd877ef3a9a583eda90fb3b6e5cb1f0cfc2f6cf4c84ea0876c67a0cc4714488d6658db3865e5d8716755941b15abe2cfe73cd5f92371
7
+ data.tar.gz: a5da42a667bf6affb31abb3d9e9390ed1dd9bb7164b6d1d63e7dd263d218377228ff98e955617fb3eea10c25d194339cd34e01c98d2d8a458f317f866232f653
@@ -60,6 +60,13 @@ module Raygun
60
60
  ConnectionPool
61
61
  CoffeeScript
62
62
  ApplicationRecord
63
+ Zeitwerk
64
+ SassC
65
+ Webpacker
66
+ DidYouMean
67
+ Nokogiri
68
+ Loofah
69
+ WebConsole
63
70
  +Raygun::Apm::Rails::Middleware::Ruby_APM_profiler_trace
64
71
  }
65
72
  end
@@ -23,10 +23,13 @@ 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
29
-
30
+
31
+ GC.stress = true if ENV['RAYGUN_STRESS_GC']
32
+
30
33
  # If any fatal errors on init, shutdown the tracer
31
34
  rescue Raygun::Apm::FatalError => e
32
35
  raygun_shutdown_handler(e)
@@ -37,10 +40,15 @@ module Raygun
37
40
  @tracer_initialized ||= initialize_tracer
38
41
  # Can be nil if we had a fatal error
39
42
  if @tracer
43
+ # For the exceptional HTTP IN handler
44
+ @request_started = @tracer.now
40
45
  Thread.current.thread_variable_set(:_raygun_apm_tracer, @tracer)
41
46
  @tracer.start_trace
42
47
  end
43
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
44
52
  # Can be nil if we had a fatal error
45
53
  @tracer.end_trace if @tracer
46
54
  res
@@ -49,13 +57,11 @@ module Raygun
49
57
  end
50
58
 
51
59
  def raygun_shutdown_handler(exception)
52
- 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")}",
53
61
  # Kill extended event subcriptions
54
62
  ActiveSupport::Notifications.unsubscribe(@http_in_subscriber)
55
63
  ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
56
64
  warn "[Raygun APM] notification hooks unsubscribed"
57
- # Shutdown the tracepoints if enabled to reduce any overhead and stall emission
58
- @tracer.stop_tracepoints
59
65
  # Let the GC clean up the sink thread through the finalizer below
60
66
  @tracer = nil
61
67
  Thread.current.thread_variable_set(:_raygun_apm_tracer, nil)
@@ -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.9"
4
+ VERSION = "1.0.14"
5
5
  end
6
6
  end
7
7
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "raygun-apm", "~> 1.0.7"
23
+ spec.add_dependency "raygun-apm", "~> 1.0.15"
24
24
  spec.add_development_dependency "bundler", "~> 1.17"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
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.9
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-02-29 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
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.7
20
+ version: 1.0.15
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.0.7
27
+ version: 1.0.15
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement