raygun-apm-rails 1.0.18 → 1.0.23

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: 715626f8f9976fa6af04de7e06b2977e1dc261f48e50e27b01edd4772af08be9
4
- data.tar.gz: a25c402d9238165a0664047bfe15a5074e3c4c7088ccb28af2fddb5cdacc09b8
3
+ metadata.gz: 9c01afbb158b12686bc5f07ef0898e963c6d7c3419a7fd990bcd19c46081d8ca
4
+ data.tar.gz: 067553cff98ea3b72bb142d69e6877697998f5ad632a5e4b5c2d95fb17e5210c
5
5
  SHA512:
6
- metadata.gz: 6d86b7b853a306a61b9993f417abce9a861b2c41ac2a68129e003b2e4d9f5e7cd90d1dfb4027bd1ceee5ed9cc2df98ef652e9abf98045cd13169cc95061dcb28
7
- data.tar.gz: 610ff0610f8b9176fa747b97c9bf6e6db312c8fc9df06e4e87cd55e94c16939a9e6c11d4889a3c0561984e4dd90ae565b48e98a636a9da9fcef912d06565e55e
6
+ metadata.gz: fd5dc7e6043bd9bd7923f867d804205fc437aae4f5edfeeee61740ac0915c3bb111b5f6f9d2e1ae864f580f3da99892a883c803065a6d797d14af494eddf6be7
7
+ data.tar.gz: d21f5e5f0e336636aabc9037c938106b981152f092921c582fe210d8f179bfd875cfb1f3cf3a202d59330aa82f612c8751581b0ba3f29fc681bdb0415cf2aea0
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,26 @@
1
1
  = Changelog
2
2
 
3
+ == 1.0.23 (March 25, 2020)
4
+
5
+ * Do not cache PID on HTTP IN and SQL event initializers
6
+
7
+ == 1.0.22 (March 24, 2020)
8
+
9
+ * Fix local variable typo in the Rails middleware
10
+ * Blacklist TZInfo
11
+
12
+ == 1.0.21 (March 19, 2020)
13
+
14
+ * Further improvements of emitting exceptions and other error status codes for apps with and without raygun4ruby installed
15
+
16
+ == 1.0.20 (March 18, 2020)
17
+
18
+ * Introduce support for detecting the presence of raygun4ruby and integrate better with the exception tracker
19
+
20
+ == 1.0.19 (March 16, 2020)
21
+
22
+ * Improve trace emission of unhandled exceptions in a request context
23
+
3
24
  == 1.0.18 (March 15, 2020)
4
25
 
5
26
  * Ensure a better experience with raygun4ruby with only Raygun::track_exception whitelisted
@@ -68,6 +68,14 @@ 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
71
79
  Raygun::Breadcrumbs
72
80
  Raygun::Configuration
73
81
  Raygun::config
@@ -75,6 +83,10 @@ module Raygun
75
83
  +Raygun::Apm::Rails::Middleware::Ruby_APM_request_error
76
84
  +Raygun::track_exception
77
85
  }
86
+
87
+ def self.raygun4ruby?
88
+ defined?(Raygun) && Raygun.respond_to?(:configured?) && Raygun.configured?
89
+ end
78
90
  end
79
91
  end
80
92
  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
- rescue
32
- exceptional_http_in_handler(env, 500)
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
42
+ rescue => e
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 (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)
@@ -81,6 +95,7 @@ module Raygun
81
95
  end
82
96
  req = Rack::Request.new notification.payload[:headers].env
83
97
  event = http_in_event
98
+ event[:pid] = Process.pid
84
99
  event[:url] = req.url
85
100
  event[:verb] = req.request_method
86
101
  event[:status] = notification.payload[:status]
@@ -98,6 +113,7 @@ module Raygun
98
113
  def exceptional_http_in_handler(env, status)
99
114
  req = Rack::Request.new env
100
115
  event = http_in_event
116
+ event[:pid] = Process.pid
101
117
  event[:url] = req.url
102
118
  event[:verb] = req.request_method
103
119
  event[:status] = status
@@ -111,11 +127,7 @@ module Raygun
111
127
  end
112
128
 
113
129
  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
130
+ @http_in_event ||= Raygun::Apm::Event::HttpIn.new
119
131
  end
120
132
 
121
133
  def sql_handler(args)
@@ -126,6 +138,7 @@ module Raygun
126
138
  ObjectSpace._id2ref(notification.payload[:connection_id])
127
139
  end
128
140
  event = sql_event
141
+ event[:pid] = Process.pid
129
142
  event[:query] = notification.payload[:sql]
130
143
 
131
144
  # XXX this is hacky
@@ -146,11 +159,7 @@ module Raygun
146
159
  end
147
160
 
148
161
  def sql_event
149
- @sql_event ||= begin
150
- event = Raygun::Apm::Event::Sql.new
151
- event[:pid] = Process.pid
152
- event
153
- end
162
+ @sql_event ||= Raygun::Apm::Event::Sql.new
154
163
  end
155
164
 
156
165
  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.18"
4
+ VERSION = "1.0.23"
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.18
4
+ version: 1.0.23
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-15 00:00:00.000000000 Z
12
+ date: 2020-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: raygun-apm