raygun-apm 0.0.24-universal-darwin → 0.0.25-universal-darwin
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/Gemfile.lock +2 -2
- data/README.rdoc +2 -2
- data/lib/raygun/2.5/raygun_ext.bundle +0 -0
- data/lib/raygun/2.6/raygun_ext.bundle +0 -0
- data/lib/raygun/apm/blacklist.rb +3 -0
- data/lib/raygun/apm/hooks/net_http.rb +46 -0
- data/lib/raygun/apm/version.rb +1 -1
- data/lib/raygun/apm.rb +0 -1
- metadata +3 -3
- data/lib/raygun/apm/middleware.rb +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cbd4a4849aec64aaad3b41b0871d38f125fc09515cc98f81d1e7d0aebbef610
|
4
|
+
data.tar.gz: 20ea68ad7d939efdf2a5d07252d3a9c304d511c53558826781a369ca56656650
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10a914762f1e0e88f2f72f633731ab600ab3e8111e2b531341dacc5247b3d3a708407f252e20c2e5d7d6bbf1a6a8e8a8aed27dfa4c9b1330a367bb047961ee81
|
7
|
+
data.tar.gz: 4ddb191526ebeafa89dadb4c29ecc18243a2269b40b7bf8b3e1ac1dc0c6ff5cbc349c7c332e9c6f20f0c4ec7e681e8f266451f635a5fe75722e9cbdb43c3e4b6
|
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -75,7 +75,7 @@ Extended events can be sent where appropiate
|
|
75
75
|
event = Raygun::Apm::Event::HttpIn.new
|
76
76
|
event[:pid] = Process.pid
|
77
77
|
event[:tid] = 0
|
78
|
-
event[:timestamp] =
|
78
|
+
event[:timestamp] = tracer.now
|
79
79
|
event[:url] = 'https://google.com/'
|
80
80
|
event[:verb] = 'GET'
|
81
81
|
event[:status] = 200
|
@@ -87,7 +87,7 @@ Extended events can be sent where appropiate
|
|
87
87
|
event = Raygun::Apm::Event::Sql.new
|
88
88
|
event[:pid] = Process.pid
|
89
89
|
event[:tid] = 0
|
90
|
-
event[:timestamp] =
|
90
|
+
event[:timestamp] = tracer.now
|
91
91
|
event[:provider] = 'postgres'
|
92
92
|
event[:host] = 'localhost'
|
93
93
|
event[:database] = 'rails'
|
Binary file
|
Binary file
|
data/lib/raygun/apm/blacklist.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Raygun
|
4
|
+
module Apm
|
5
|
+
module Hooks
|
6
|
+
module Net
|
7
|
+
module HTTP
|
8
|
+
private
|
9
|
+
|
10
|
+
def transport_request(request)
|
11
|
+
if tracer = raygun_apm_tracer
|
12
|
+
started = tracer.now
|
13
|
+
response = super
|
14
|
+
ended = tracer.now
|
15
|
+
event = raygun_apm_http_out_event
|
16
|
+
event[:url] = request.uri.to_s
|
17
|
+
event[:verb] = request.method
|
18
|
+
event[:status] = response.code.to_i
|
19
|
+
event[:duration] = ended - started
|
20
|
+
event[:timestamp] = started
|
21
|
+
event[:tid] = tracer.get_thread_id(Thread.current)
|
22
|
+
tracer.emit(event)
|
23
|
+
response
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def raygun_apm_http_out_event
|
30
|
+
@_raygun_apm_http_out_event ||= begin
|
31
|
+
event = Raygun::Apm::Event::HttpOut.new
|
32
|
+
event[:pid] = Process.pid
|
33
|
+
event
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def raygun_apm_tracer
|
38
|
+
Thread.current.thread_variable_get(:_raygun_apm_tracer)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
::Net::HTTP.prepend(Raygun::Apm::Hooks::Net::HTTP)
|
data/lib/raygun/apm/version.rb
CHANGED
data/lib/raygun/apm.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: universal-darwin
|
6
6
|
authors:
|
7
7
|
- Erkki Eilonen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase-ruby_core_source
|
@@ -127,7 +127,7 @@ files:
|
|
127
127
|
- lib/raygun/apm/blacklist.rb
|
128
128
|
- lib/raygun/apm/config.rb
|
129
129
|
- lib/raygun/apm/event.rb
|
130
|
-
- lib/raygun/apm/
|
130
|
+
- lib/raygun/apm/hooks/net_http.rb
|
131
131
|
- lib/raygun/apm/tracer.rb
|
132
132
|
- lib/raygun/apm/version.rb
|
133
133
|
- raygun-apm.gemspec
|
@@ -1,104 +0,0 @@
|
|
1
|
-
module Raygun
|
2
|
-
module Apm
|
3
|
-
class Middleware
|
4
|
-
def initialize(app)
|
5
|
-
@app = app
|
6
|
-
@tracer = Raygun::Apm::Tracer.new
|
7
|
-
@tracer.udp_sink!
|
8
|
-
@tracer.process_started
|
9
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@tracer))
|
10
|
-
|
11
|
-
@http_in_subscriber = ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args|
|
12
|
-
http_in_handler(args)
|
13
|
-
end
|
14
|
-
@sql_subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
15
|
-
sql_handler(args)
|
16
|
-
end
|
17
|
-
|
18
|
-
# If any kamikaze errors on init, shutdown the tracer
|
19
|
-
rescue Raygun::Apm::FatalError => e
|
20
|
-
kamikaze_handler(e)
|
21
|
-
end
|
22
|
-
|
23
|
-
def call(env)
|
24
|
-
@status, @headers, @response = instrument(env)
|
25
|
-
[@status, @headers, @response]
|
26
|
-
end
|
27
|
-
|
28
|
-
def instrument(env)
|
29
|
-
res = nil
|
30
|
-
# Can be nil if we had a kamikaze error
|
31
|
-
@tracer.start_trace if @tracer
|
32
|
-
res = @app.call(env)
|
33
|
-
# Can be nil if we had a kamikaze error
|
34
|
-
@tracer.end_trace if @tracer
|
35
|
-
res
|
36
|
-
rescue Raygun::Apm::FatalError => e
|
37
|
-
kamikaze_handler(e)
|
38
|
-
end
|
39
|
-
|
40
|
-
def kamikaze_handler(exception)
|
41
|
-
warn "Raygun APM shutting down due to error - %s", e.message
|
42
|
-
# Kill extended event subcriptions
|
43
|
-
ActiveSupport::Notifications.unsubscribe(@http_in_subscriber)
|
44
|
-
ActiveSupport::Notifications.unsubscribe(@sql_subscriber)
|
45
|
-
# Shutdown the tracepoint if enabled to reduce any overhead and stall emission
|
46
|
-
@tracer.tracepoint.stop if @tracer.tracepoint.enabled?
|
47
|
-
# Let the GC clean up the sink thread through the finalizer below
|
48
|
-
@tracer = nil
|
49
|
-
end
|
50
|
-
|
51
|
-
def http_in_handler(args)
|
52
|
-
notification = ActiveSupport::Notifications::Event.new *args
|
53
|
-
if notification.payload[:exception]
|
54
|
-
# XXX notify?
|
55
|
-
return
|
56
|
-
end
|
57
|
-
req = Rack::Request.new notification.payload[:headers].env
|
58
|
-
event = Raygun::Apm::Event::HttpIn.new
|
59
|
-
event[:url] = req.url
|
60
|
-
event[:verb] = req.request_method
|
61
|
-
event[:status] = notification.payload[:status]
|
62
|
-
# XXX constant milliseconds to microseconds
|
63
|
-
event[:duration] = notification.duration * 1000
|
64
|
-
event[:timestamp] = notification.time.to_f*1000000
|
65
|
-
event[:pid] = Process.pid
|
66
|
-
event[:tid] = @tracer.get_thread_id(Thread.current)
|
67
|
-
@tracer.emit(event)
|
68
|
-
rescue => e
|
69
|
-
# XXX report
|
70
|
-
end
|
71
|
-
|
72
|
-
def sql_handler(args)
|
73
|
-
notification = ActiveSupport::Notifications::Event.new *args
|
74
|
-
connection = if notification.payload[:connection]
|
75
|
-
notification.payload[:connection]
|
76
|
-
else
|
77
|
-
ObjectSpace._id2ref(notification.payload[:connection_id])
|
78
|
-
end
|
79
|
-
event = Raygun::Apm::Event::Sql.new
|
80
|
-
event[:query] = notification.payload[:sql]
|
81
|
-
|
82
|
-
# XXX this is hacky
|
83
|
-
if config = connection.instance_variable_get('@config')
|
84
|
-
event[:provider] = config[:adapter]
|
85
|
-
event[:host] = config[:host]
|
86
|
-
event[:database] = config[:database]
|
87
|
-
end
|
88
|
-
|
89
|
-
# XXX constant milliseconds to microseconds
|
90
|
-
event[:duration] = notification.duration * 1000
|
91
|
-
event[:timestamp] = notification.time.to_f*1000000
|
92
|
-
event[:pid] = Process.pid
|
93
|
-
event[:tid] = @tracer.get_thread_id(Thread.current)
|
94
|
-
@tracer.emit(event)
|
95
|
-
rescue => e
|
96
|
-
# XXX report
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.finalize(tracer)
|
100
|
-
proc {tracer.process_ended}
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|