raygun-apm-rails 1.0.19 → 1.0.24

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: dc8275346199de493a2f17471d627e1b09cbe8ddebd5d61985e3d532eb95b440
4
- data.tar.gz: c219ea0ec08978efda1ca62b5b483d032288d90f13b777d77ebe40e49572c90a
3
+ metadata.gz: b1947daa3dde5ecae7057bc878855cb674650ce9e7fc01ebb36486299f829116
4
+ data.tar.gz: 5e17a60724c045590729a95eb9b3774551a811743f55bf8540b1fce37d39383b
5
5
  SHA512:
6
- metadata.gz: 3733122e03f98a8daaff55d0bc04a8edb2ce1f0c9c9a4e74325bbec9467650250530a2dfb695be36d823dc24398f3ab468939e20d7d8040dadaaba25575a9e96
7
- data.tar.gz: c95b95fccb7f7c60181fe56683d1862899d111fbecac33c875f94a7ccda49d73df7e90e2a8376d881dc2b0f7ef61d30f307b17e1a51299ab6c867e47b3491f43
6
+ metadata.gz: 41ca05fb4218a8a11f5953ab064ade337d50cec736768adea381f9c29b707e4b763d64d8817064a2ebd5fffb3d8bc66bc23c35e87fe6d350165e045cb3639516
7
+ data.tar.gz: 4f4f6cf16b00b4db422b3055dd445253f400493edf683a721e592b08c7eae23b73934293fb8641a90ada5431bd629587861c115e60931d4c3ff6071482317705
@@ -1,5 +1,27 @@
1
1
  = Changelog
2
2
 
3
+ == 1.0.24 (April 1, 2020)
4
+
5
+ * Blacklist Enumeration
6
+ * Unsubscribe from previously registered AS::Notifications subscribers as child processes emit double HTTP IN and SQL events otherwise
7
+
8
+ == 1.0.23 (March 25, 2020)
9
+
10
+ * Do not cache PID on HTTP IN and SQL event initializers
11
+
12
+ == 1.0.22 (March 24, 2020)
13
+
14
+ * Fix local variable typo in the Rails middleware
15
+ * Blacklist TZInfo
16
+
17
+ == 1.0.21 (March 19, 2020)
18
+
19
+ * Further improvements of emitting exceptions and other error status codes for apps with and without raygun4ruby installed
20
+
21
+ == 1.0.20 (March 18, 2020)
22
+
23
+ * Introduce support for detecting the presence of raygun4ruby and integrate better with the exception tracker
24
+
3
25
  == 1.0.19 (March 16, 2020)
4
26
 
5
27
  * Improve trace emission of unhandled exceptions in a request context
@@ -1,24 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- raygun-apm-rails (0.1.0)
5
- raygun-apm (~> 0.0.8)
4
+ raygun-apm-rails (1.0.24)
5
+ raygun-apm (~> 1.0.15)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  minitest (5.13.0)
11
11
  rake (10.5.0)
12
- raygun-apm (0.0.8-x86-linux)
12
+ raygun-apm (1.0.23-universal-darwin)
13
13
 
14
14
  PLATFORMS
15
15
  ruby
16
16
 
17
17
  DEPENDENCIES
18
- bundler (~> 1.17)
18
+ bundler (~> 2.1.4)
19
19
  minitest (~> 5.0)
20
20
  rake (~> 10.0)
21
21
  raygun-apm-rails!
22
22
 
23
23
  BUNDLED WITH
24
- 1.17.3
24
+ 2.1.4
@@ -68,6 +68,15 @@ module Raygun
68
68
  Loofah
69
69
  WebConsole
70
70
  HTTParty
71
+ TZInfo
72
+ Devise
73
+ Marginalia
74
+ FastGettext
75
+ Lograge
76
+ Warden
77
+ Grape
78
+ Mustermann
79
+ Enumeration
71
80
  Raygun::Breadcrumbs
72
81
  Raygun::Configuration
73
82
  Raygun::config
@@ -75,6 +84,10 @@ module Raygun
75
84
  +Raygun::Apm::Rails::Middleware::Ruby_APM_request_error
76
85
  +Raygun::track_exception
77
86
  }
87
+
88
+ def self.raygun4ruby?
89
+ defined?(Raygun) && Raygun.respond_to?(:configured?) && Raygun.configured?
90
+ end
78
91
  end
79
92
  end
80
93
  end
@@ -17,7 +17,7 @@ module Raygun
17
17
  def instrument(env)
18
18
  res = nil
19
19
  # Can be nil if we had a fatal error
20
- @tracer ||= Raygun::Apm::Tracer.instance || init_tracer
20
+ @tracer = Raygun::Apm::Tracer.instance || init_tracer
21
21
  if @tracer
22
22
  # For the exceptional HTTP IN handler
23
23
  @request_started = @tracer.now
@@ -28,15 +28,29 @@ module Raygun
28
28
  Ruby_APM_profiler_trace do
29
29
  begin
30
30
  res = @app.call(env)
31
+ if res && (status = res.first) >= 400 && status < 600
32
+ Ruby_APM_request_error do
33
+ message = Rack::Utils::HTTP_STATUS_CODES[status]
34
+ begin
35
+ raise "HTTP #{status} #{message}"
36
+ rescue => e
37
+ Raygun.track_exception(e, env) if Raygun::Apm::Rails.raygun4ruby?
38
+ end
39
+ exceptional_http_in_handler(env, status)
40
+ end
41
+ end
31
42
  rescue => e
32
- Ruby_APM_request_error { exceptional_http_in_handler(env, 500) }
43
+ Ruby_APM_request_error do
44
+ raise e rescue nil
45
+ Raygun.track_exception(e, env) if Raygun::Apm::Rails.raygun4ruby?
46
+ exceptional_http_in_handler(env, 500)
47
+ end
48
+ exception = e
33
49
  end
34
50
  end
35
- if res && (status = res.first) >= 400 && status < 600
36
- Ruby_APM_request_error { exceptional_http_in_handler(env, status) }
37
- end
38
51
  # Can be nil if we had a fatal error
39
52
  @tracer.end_trace if @tracer
53
+ raise exception if exception
40
54
  res
41
55
  rescue Raygun::Apm::FatalError => e
42
56
  raygun_shutdown_handler(e)
@@ -48,10 +62,12 @@ module Raygun
48
62
  tracer.process_started
49
63
  ObjectSpace.define_finalizer(self, self.class.finalize(tracer))
50
64
 
65
+ ActiveSupport::Notifications.unsubscribe(@http_in_subscriber) if @http_in_subscriber
51
66
  @http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
52
67
  http_in_handler(args)
53
68
  end
54
69
 
70
+ ActiveSupport::Notifications.unsubscribe(@sql_subscriber) if @sql_subscriber
55
71
  @sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
56
72
  sql_handler(args)
57
73
  end
@@ -81,6 +97,7 @@ module Raygun
81
97
  end
82
98
  req = Rack::Request.new notification.payload[:headers].env
83
99
  event = http_in_event
100
+ event[:pid] = Process.pid
84
101
  event[:url] = req.url
85
102
  event[:verb] = req.request_method
86
103
  event[:status] = notification.payload[:status]
@@ -98,6 +115,7 @@ module Raygun
98
115
  def exceptional_http_in_handler(env, status)
99
116
  req = Rack::Request.new env
100
117
  event = http_in_event
118
+ event[:pid] = Process.pid
101
119
  event[:url] = req.url
102
120
  event[:verb] = req.request_method
103
121
  event[:status] = status
@@ -111,11 +129,7 @@ module Raygun
111
129
  end
112
130
 
113
131
  def http_in_event
114
- @http_in_event ||= begin
115
- event = Raygun::Apm::Event::HttpIn.new
116
- event[:pid] = Process.pid
117
- event
118
- end
132
+ @http_in_event ||= Raygun::Apm::Event::HttpIn.new
119
133
  end
120
134
 
121
135
  def sql_handler(args)
@@ -126,6 +140,7 @@ module Raygun
126
140
  ObjectSpace._id2ref(notification.payload[:connection_id])
127
141
  end
128
142
  event = sql_event
143
+ event[:pid] = Process.pid
129
144
  event[:query] = notification.payload[:sql]
130
145
 
131
146
  # XXX this is hacky
@@ -146,11 +161,7 @@ module Raygun
146
161
  end
147
162
 
148
163
  def sql_event
149
- @sql_event ||= begin
150
- event = Raygun::Apm::Event::Sql.new
151
- event[:pid] = Process.pid
152
- event
153
- end
164
+ @sql_event ||= Raygun::Apm::Event::Sql.new
154
165
  end
155
166
 
156
167
  def Ruby_APM_profiler_trace
@@ -6,6 +6,10 @@ module Raygun
6
6
  require "raygun/apm"
7
7
  require "raygun/apm/rails/middleware"
8
8
  Raygun::Apm::Blacklist.extend_with Raygun::Apm::Rails::BLACKLIST
9
+ if Raygun::Apm::Rails.raygun4ruby?
10
+ # Remove the exception notifier because we handle it in the APM middleware now instead
11
+ app.middleware.delete Raygun::Middleware::RackExceptionInterceptor
12
+ end
9
13
  app.middleware.use Raygun::Apm::Rails::Middleware
10
14
  # Explictly enable instrumenting HTTP until a good control API is figured out
11
15
  require "raygun/apm/hooks/net_http"
@@ -1,7 +1,7 @@
1
1
  module Raygun
2
2
  module Apm
3
3
  module Rails
4
- VERSION = "1.0.19"
4
+ VERSION = "1.0.24"
5
5
  end
6
6
  end
7
7
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_dependency "raygun-apm", "~> 1.0.15"
24
- spec.add_development_dependency "bundler", "~> 1.17"
24
+ spec.add_development_dependency "bundler", "~> 2.1.4"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
27
27
  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.19
4
+ version: 1.0.24
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-17 00:00:00.000000000 Z
12
+ date: 2020-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: raygun-apm
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.17'
34
+ version: 2.1.4
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.17'
41
+ version: 2.1.4
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement