raygun-apm 0.0.24-x86-mingw32 → 0.0.25-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.rdoc +2 -2
- data/lib/raygun/2.5/raygun_ext.so +0 -0
- data/lib/raygun/2.6/raygun_ext.so +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: 2f0136d8a6bd74be69fcbf2f0bc34ee13589e5aa2b3a47d71c0e562a8931b085
|
4
|
+
data.tar.gz: 12f2ef1d7ccad1e674fb90e3c857c10bea2f31b1dba1980c1f3d8c22c4464895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67f36ab610509f8282da94b6106b64c4c56efbe408214f944f5b69616f3a1cb0c1b4cfc2682b6f1eb37f9a5b92fde7fdb0f2ef55ee80e1da16fbaf8a258bf6de
|
7
|
+
data.tar.gz: d0e14edd11bb76b27f2ccf72d2c8ee49c09191b077c224c46a96671306a8a4520a4753bd6acf874456185c4f5e74a226278d05f161d809513776a0912bb6a271
|
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: x86-mingw32
|
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-22 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
|