raygun-apm 1.0.49-universal-darwin → 1.0.78-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/README.rdoc +1 -1
- data/bin/{diagnostics → raygun-diagnostics} +1 -2
- data/ext/raygun/extconf.rb +10 -1
- data/lib/raygun/2.5/raygun_ext.bundle +0 -0
- data/lib/raygun/2.6/raygun_ext.bundle +0 -0
- data/lib/raygun/2.7/raygun_ext.bundle +0 -0
- data/lib/raygun/apm.rb +13 -0
- data/lib/raygun/apm/blacklist.rb +37 -3
- data/lib/raygun/apm/config.rb +15 -6
- data/lib/raygun/apm/diagnostics.rb +26 -9
- data/lib/raygun/apm/event.rb +10 -0
- data/lib/raygun/apm/hooks/excon.rb +36 -0
- data/lib/raygun/apm/hooks/httpclient.rb +41 -0
- data/lib/raygun/apm/hooks/internals.rb +95 -0
- data/lib/raygun/apm/hooks/mongodb.rb +45 -0
- data/lib/raygun/apm/tracer.rb +15 -8
- data/lib/raygun/apm/version.rb +2 -1
- data/raygun-apm.gemspec +3 -2
- metadata +23 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 719d575376def984b9272af488de8721f12f1c11a64494b090424da040481a52
|
4
|
+
data.tar.gz: 8c9911a839ba022601bf32e9883c999095d44ea19b2e6cb2185e236a83bf9259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c428b9e5d79b60057d3b0ebf9eaf92a7bc0022b5c0325ad0839354cd3cf4870ea5c72de88b94e68ca56527ded0411a269fe02099992d101a1965446afc9b1e5e
|
7
|
+
data.tar.gz: 2c42086154108ef5286439306fdfe81e7ad14b71310ac0de7280a81dc2bda35c1fdeb6bbfc9c579b6b3d920711e002fa273d5e5c94837c6f7c4c4112000e4a3a
|
data/README.rdoc
CHANGED
@@ -49,7 +49,7 @@ The Linux version can be installed either using {systemd}[https://raygun.com/doc
|
|
49
49
|
|
50
50
|
On windows the agent can be installed either via {MSI installer}[https://raygun.com/documentation/product-guides/apm/agent/installation/#installing-on-linux-using-terminal] or on {.NET core}[https://raygun.com/documentation/product-guides/apm/agent/installation/#installing-on-windows-net-core]
|
51
51
|
|
52
|
-
== Ruby on Rails
|
52
|
+
== Ruby on Rails
|
53
53
|
|
54
54
|
For Rails support see {documentation}[https://www.rubydoc.info/gems/raygun-apm-rails/0.1.0] of the railgun-apm-rails gem.
|
55
55
|
|
data/ext/raygun/extconf.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
# Makefile generator helper - from standard library
|
3
4
|
require 'mkmf'
|
5
|
+
# References core headers extracted by Ruby minor version in https://github.com/os97673/debase-ruby_core_source . Required for some of the lower level profiler features
|
4
6
|
require 'debase/ruby_core_source'
|
5
7
|
|
6
8
|
headers = proc do
|
@@ -10,10 +12,16 @@ headers = proc do
|
|
10
12
|
end
|
11
13
|
|
12
14
|
dir_config('raygun')
|
15
|
+
|
16
|
+
# To allow for swapping out the compiler - clang in favour of gcc for example
|
17
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
18
|
+
|
19
|
+
# Pendatic about all the things
|
13
20
|
append_cflags '-pedantic'
|
14
21
|
append_cflags '-Wall'
|
15
22
|
append_cflags '-Werror=switch'
|
16
23
|
append_cflags '-std=c99'
|
24
|
+
# Enables additional flags, stack protection and debug symbols
|
17
25
|
if ENV['DEBUG']
|
18
26
|
have_library 'ssp'
|
19
27
|
have_func '__stack_chk_guard'
|
@@ -27,10 +35,10 @@ if ENV['DEBUG']
|
|
27
35
|
append_cflags '-fstack-protector-all'
|
28
36
|
append_cflags '-DRB_RG_DEBUG'
|
29
37
|
else
|
30
|
-
#append_cflags '-DRAX_DEBUG_MSG'
|
31
38
|
append_cflags '-O3'
|
32
39
|
end
|
33
40
|
|
41
|
+
# Renders an ASCII presentation of the shadow stack at runtime
|
34
42
|
if ENV['DEBUG_SHADOW_STACK']
|
35
43
|
append_cflags '-DRB_RG_DEBUG_SHADOW_STACK'
|
36
44
|
end
|
@@ -40,6 +48,7 @@ unless create_header
|
|
40
48
|
exit(1)
|
41
49
|
end
|
42
50
|
|
51
|
+
# Check for the presence of headers in ruby_core_headers for the version currently compiled for
|
43
52
|
unless Debase::RubyCoreSource.create_makefile_with_core(headers, 'raygun_ext')
|
44
53
|
STDERR.print("Makefile creation failed\n")
|
45
54
|
STDERR.print("One or more ruby headers not found\n")
|
Binary file
|
Binary file
|
Binary file
|
data/lib/raygun/apm.rb
CHANGED
@@ -1,14 +1,27 @@
|
|
1
1
|
require "raygun/apm/version"
|
2
|
+
|
2
3
|
begin
|
4
|
+
# Attempt to load a precompiled shared object (released gem)
|
3
5
|
RUBY_VERSION =~ /(\d+\.\d+)/
|
4
6
|
require "raygun/#{$1}/raygun_ext"
|
5
7
|
rescue LoadError
|
8
|
+
# Attempt to load the development specific extension (non-released gem, local dev)
|
6
9
|
require "raygun/raygun_ext"
|
7
10
|
end
|
11
|
+
|
8
12
|
require "raygun/apm/config"
|
9
13
|
require "raygun/apm/diagnostics"
|
10
14
|
require "raygun/apm/blacklist/parser"
|
11
15
|
require "raygun/apm/blacklist/translator"
|
12
16
|
require "raygun/apm/tracer"
|
13
17
|
require "raygun/apm/event"
|
18
|
+
require "raygun/apm/hooks/internals"
|
14
19
|
require "raygun/apm/hooks/net_http"
|
20
|
+
# conditionally required - may not be bundled
|
21
|
+
conditional_hooks = %w(httpclient excon mongodb)
|
22
|
+
conditional_hooks.each do |hook|
|
23
|
+
begin
|
24
|
+
require "raygun/apm/hooks/#{hook}"
|
25
|
+
rescue LoadError
|
26
|
+
end
|
27
|
+
end
|
data/lib/raygun/apm/blacklist.rb
CHANGED
@@ -26,6 +26,7 @@ module Raygun
|
|
26
26
|
Continuation#
|
27
27
|
Data#
|
28
28
|
Dir#
|
29
|
+
Dir::
|
29
30
|
ENV#
|
30
31
|
EOFError#
|
31
32
|
Encoding#
|
@@ -66,6 +67,10 @@ module Raygun
|
|
66
67
|
Method#
|
67
68
|
Module#
|
68
69
|
Mutex#
|
70
|
+
+Thread::Mutex#synchronize
|
71
|
+
+Thread::Mutex#lock
|
72
|
+
+Thread::Mutex#unlock
|
73
|
+
+Thread::Mutex#sleep
|
69
74
|
NameError#
|
70
75
|
NilClass#
|
71
76
|
NoMemoryError#
|
@@ -94,6 +99,8 @@ module Raygun
|
|
94
99
|
SecurityError#
|
95
100
|
Set#
|
96
101
|
SimpleDelegator#
|
102
|
+
Singleton#
|
103
|
+
Singleton::
|
97
104
|
Signal#
|
98
105
|
SignalException#
|
99
106
|
SizedQueue#
|
@@ -140,6 +147,9 @@ module Raygun
|
|
140
147
|
Delegator#
|
141
148
|
PrettyPrint#
|
142
149
|
PP#
|
150
|
+
PP::
|
151
|
+
PrettyPrint#
|
152
|
+
PrettyPrint::
|
143
153
|
Minitest
|
144
154
|
Psych
|
145
155
|
Mutex_m#
|
@@ -149,8 +159,28 @@ module Raygun
|
|
149
159
|
Gem::
|
150
160
|
FileUtils#
|
151
161
|
FileUtils::
|
152
|
-
|
153
|
-
|
162
|
+
Tempfile#
|
163
|
+
Tempfile::
|
164
|
+
Logger#
|
165
|
+
Logger::
|
166
|
+
}
|
167
|
+
|
168
|
+
INTERNALS = %w{
|
169
|
+
+Object#sleep
|
170
|
+
+Object#exec
|
171
|
+
+Object#fork
|
172
|
+
+Object#system
|
173
|
+
+Object#spawn
|
174
|
+
+Continuation#callcc
|
175
|
+
+IO#syscall
|
176
|
+
+IO#open
|
177
|
+
+IO#puts
|
178
|
+
+IO#gets
|
179
|
+
+IO#readline
|
180
|
+
+IO#readlines
|
181
|
+
+Random#srand
|
182
|
+
+Random#rand
|
183
|
+
+Signal#trap
|
154
184
|
}
|
155
185
|
|
156
186
|
HTTP_OUT = %w{
|
@@ -225,6 +255,10 @@ module Raygun
|
|
225
255
|
}
|
226
256
|
|
227
257
|
QUERIES = %w{
|
258
|
+
#mongodb
|
259
|
+
Mongo
|
260
|
+
BSON
|
261
|
+
+Mongo::Operation::Executable#do_execute
|
228
262
|
#redis
|
229
263
|
Redis
|
230
264
|
+Redis#auth
|
@@ -432,7 +466,7 @@ module Raygun
|
|
432
466
|
end
|
433
467
|
|
434
468
|
def self.resolve_entries
|
435
|
-
DEFAULT_RUBY + PROFILER + HTTP_OUT + QUERIES + RAYGUN4RUBY + self.extended_blacklist.flatten
|
469
|
+
DEFAULT_RUBY + PROFILER + INTERNALS + HTTP_OUT + QUERIES + RAYGUN4RUBY + self.extended_blacklist.flatten
|
436
470
|
end
|
437
471
|
end
|
438
472
|
end
|
data/lib/raygun/apm/config.rb
CHANGED
@@ -18,6 +18,9 @@ module Raygun
|
|
18
18
|
"production" => Tracer::ENV_PRODUCTION
|
19
19
|
}
|
20
20
|
|
21
|
+
DEFAULT_BLACKLIST_PATH_UNIX = "/usr/share/Raygun/Blacklist"
|
22
|
+
DEFAULT_BLACKLIST_PATH_WINDOWS = "C:\\ProgramData\\Raygun\\Blacklist"
|
23
|
+
|
21
24
|
attr_accessor :env
|
22
25
|
def initialize(env=ENV)
|
23
26
|
@env = env
|
@@ -62,19 +65,18 @@ module Raygun
|
|
62
65
|
config_var 'PROTON_FILE_IPC_FOLDER', as: String
|
63
66
|
config_var 'PROTON_USE_MULTICAST', as: String, default: 'False'
|
64
67
|
config_var 'PROTON_BATCH_IDLE_COUNTER', as: Integer, default: 500
|
68
|
+
## New - Ruby profiler
|
69
|
+
config_var 'PROTON_UDP_HOST', as: String, default: UDP_SINK_HOST
|
70
|
+
config_var 'PROTON_UDP_PORT', as: Integer, default: UDP_SINK_PORT
|
65
71
|
|
66
|
-
def
|
72
|
+
def proton_udp_host
|
67
73
|
if proton_use_multicast == 'True'
|
68
74
|
UDP_SINK_MULTICAST_HOST
|
69
75
|
else
|
70
|
-
UDP_SINK_HOST
|
76
|
+
env['PROTON_UDP_HOST'] ? env['PROTON_UDP_HOST'].to_s : UDP_SINK_HOST
|
71
77
|
end
|
72
78
|
end
|
73
79
|
|
74
|
-
def udp_port
|
75
|
-
UDP_SINK_PORT
|
76
|
-
end
|
77
|
-
|
78
80
|
def loglevel
|
79
81
|
LOGLEVELS[proton_debug_loglevel] || raise(ArgumentError, "invalid log level")
|
80
82
|
end
|
@@ -83,6 +85,13 @@ module Raygun
|
|
83
85
|
environment = env['RACK_ENV'] || env['RAILS_ENV'] || 'production'
|
84
86
|
ENVIRONMENTS[environment] || Tracer::ENV_PRODUCTION
|
85
87
|
end
|
88
|
+
|
89
|
+
# Prefer what is set by PROTON_USER_OVERRIDES_FILE env
|
90
|
+
def blacklist_file
|
91
|
+
return proton_user_overrides_file if proton_user_overrides_file
|
92
|
+
path = Gem.win_platform? ? DEFAULT_BLACKLIST_PATH_WINDOWS : DEFAULT_BLACKLIST_PATH_UNIX
|
93
|
+
"#{File.join(path, proton_api_key)}.txt"
|
94
|
+
end
|
86
95
|
end
|
87
96
|
end
|
88
97
|
end
|
@@ -4,23 +4,31 @@ require "json"
|
|
4
4
|
module Raygun
|
5
5
|
module Apm
|
6
6
|
class Diagnostics
|
7
|
-
AGENT_STATE_DOWN = "
|
8
|
-
AGENT_STATE_UNKNOWN = "Unable to determine the state of the
|
9
|
-
AGENT_STATE_UP_MISCONFIGURED = "
|
10
|
-
AGENT_STATE_UP_CONFIGURED = "
|
7
|
+
AGENT_STATE_DOWN = "\nThe Raygun APM Agent appears to not be running on the current host.\nIf not already installed, please consult https://raygun.com/documentation/product-guides/apm/agent/downloads/\nOtherwise refer to https://raygun.com/documentation/product-guides/apm/agent/installation/ for starting the Agent."
|
8
|
+
AGENT_STATE_UNKNOWN = "\nThe Raygun APM Agent is reachable, but Unable to determine the state of the Agent at the moment."
|
9
|
+
AGENT_STATE_UP_MISCONFIGURED = "\nThe Raygun APM Agent is running, but misconfigured.\nThe API Key needs to be set through the Raygun_ApiKey environment variable.\nThe API key can be found under 'Application Settings' in the Raygun UI"
|
10
|
+
AGENT_STATE_UP_CONFIGURED = "\nThe Raygun APM Agent is configured properly!"
|
11
|
+
AGENT_MINIMUM_VERSION_NOT_MET = "\nVersion #{Raygun::Apm::VERSION} of the Raygun APM Profiler requires a minimum Agent version #{Raygun::Apm::MINIMUM_AGENT_VERSION}\nPlease download the latest Agent from https://raygun.com/documentation/product-guides/apm/agent/downloads/"
|
12
|
+
PROFILER_NOOPED = "Profiler loaded in noop mode and will be disabled due to the minimum Agent version not met"
|
11
13
|
|
12
14
|
def initialize(host: Apm::Config::TCP_MANAGEMENT_HOST, port: Apm::Config::TCP_MANAGEMENT_PORT)
|
13
15
|
@host = host
|
14
16
|
@port = port
|
15
17
|
end
|
16
18
|
|
17
|
-
def verify_agent
|
19
|
+
def verify_agent(tracer)
|
18
20
|
socket.write "GetAgentInfo"
|
19
21
|
response = JSON.parse(socket.gets)
|
20
|
-
if response['
|
21
|
-
puts
|
22
|
-
|
23
|
-
puts
|
22
|
+
if minimum_agent_version_not_met?(response['Version'])
|
23
|
+
puts AGENT_MINIMUM_VERSION_NOT_MET
|
24
|
+
tracer.noop!
|
25
|
+
puts PROFILER_NOOPED
|
26
|
+
else
|
27
|
+
if response['Status'] == 1
|
28
|
+
puts AGENT_STATE_UP_CONFIGURED
|
29
|
+
elsif response['Status'] == 0
|
30
|
+
puts AGENT_STATE_UP_MISCONFIGURED
|
31
|
+
end
|
24
32
|
end
|
25
33
|
rescue Errno::ECONNREFUSED
|
26
34
|
puts AGENT_STATE_DOWN
|
@@ -32,6 +40,15 @@ module Raygun
|
|
32
40
|
def socket
|
33
41
|
@socket ||= s = TCPSocket.new(@host, @port)
|
34
42
|
end
|
43
|
+
|
44
|
+
def minimum_agent_version_not_met?(version)
|
45
|
+
# Legacy path
|
46
|
+
if String === version
|
47
|
+
version < Raygun::Apm::MINIMUM_AGENT_VERSION
|
48
|
+
else
|
49
|
+
"#{version['Major']}.#{version['Minor']}.#{version['Build']}.#{version['Revision']}" < Raygun::Apm::MINIMUM_AGENT_VERSION
|
50
|
+
end
|
51
|
+
end
|
35
52
|
end
|
36
53
|
end
|
37
54
|
end
|
data/lib/raygun/apm/event.rb
CHANGED
@@ -4,6 +4,11 @@ module Raygun
|
|
4
4
|
def inspect
|
5
5
|
"#<#{self.class.name}:#{self.object_id}> length:#{self.length} pid:#{self[:pid]} tid:#{self[:tid]} timestamp:#{self[:timestamp]}"
|
6
6
|
end
|
7
|
+
class ExceptionThrown < Event
|
8
|
+
def inspect
|
9
|
+
super + " class:#{self[:class_name]}"
|
10
|
+
end
|
11
|
+
end
|
7
12
|
class ThreadStarted < Event
|
8
13
|
def inspect
|
9
14
|
super + " parent_tid:#{self[:parent_tid]}"
|
@@ -29,6 +34,11 @@ module Raygun
|
|
29
34
|
super + " url:#{self[:url]} verb:#{self[:verb]} status:#{self[:status]} duration:#{self[:duration]}"
|
30
35
|
end
|
31
36
|
end
|
37
|
+
class Sql < Event
|
38
|
+
def inspect
|
39
|
+
super + " provider:#{self[:provider]} host:#{self[:host]} query:#{self[:query]} database:#{self[:database]} duration:#{self[:duration]}"
|
40
|
+
end
|
41
|
+
end
|
32
42
|
class BeginTransaction < Event
|
33
43
|
def inspect
|
34
44
|
super + " api_key:#{self[:api_key]} technology_type:#{self[:technology_type]} process_type:#{self[:process_type]}"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'excon'
|
2
|
+
|
3
|
+
module Raygun
|
4
|
+
module Apm
|
5
|
+
module Hooks
|
6
|
+
module Excon
|
7
|
+
def request(params={}, &block)
|
8
|
+
if tracer = Raygun::Apm::Tracer.instance
|
9
|
+
started = tracer.now
|
10
|
+
response = super
|
11
|
+
ended = tracer.now
|
12
|
+
event = raygun_apm_http_out_event
|
13
|
+
event[:pid] = Process.pid
|
14
|
+
event[:url] = "#{@data[:scheme]}://#{@data[:host]}/#{params[:path]}"
|
15
|
+
event[:verb] = params[:method].to_s.upcase
|
16
|
+
event[:status] = response.status
|
17
|
+
event[:duration] = ended - started
|
18
|
+
event[:timestamp] = started
|
19
|
+
event[:tid] = tracer.get_thread_id(Thread.current)
|
20
|
+
tracer.emit(event)
|
21
|
+
response
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def raygun_apm_http_out_event
|
29
|
+
@_raygun_apm_http_out_event ||= Raygun::Apm::Event::HttpOut.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Excon::Connection.prepend(Raygun::Apm::Hooks::Excon)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'httpclient'
|
2
|
+
|
3
|
+
module Raygun
|
4
|
+
module Apm
|
5
|
+
module Hooks
|
6
|
+
module HTTPClient
|
7
|
+
private
|
8
|
+
|
9
|
+
def do_request(method, uri, query, body, header, &filtered_block)
|
10
|
+
if tracer = Raygun::Apm::Tracer.instance
|
11
|
+
started = tracer.now
|
12
|
+
response = super
|
13
|
+
ended = tracer.now
|
14
|
+
event = raygun_apm_http_out_event
|
15
|
+
event[:pid] = Process.pid
|
16
|
+
event[:url] = raygun_apm_url(uri, query)
|
17
|
+
event[:verb] = method.to_s.upcase
|
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_url(uri, query)
|
30
|
+
query && uri ? URI.join(uri, query).to_s : uri.to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
def raygun_apm_http_out_event
|
34
|
+
@_raygun_apm_http_out_event ||= Raygun::Apm::Event::HttpOut.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
HTTPClient.prepend(Raygun::Apm::Hooks::HTTPClient)
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'thread'
|
2
|
+
|
3
|
+
module Raygun
|
4
|
+
module Apm
|
5
|
+
module Hooks
|
6
|
+
module Object
|
7
|
+
def system(*args)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def sleep(*args)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def exec(*args)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def spawn(*args)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def fork(*args)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module IO
|
29
|
+
def sycall(*args)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def open(*args)
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
def puts(*args)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def gets(*args)
|
42
|
+
super
|
43
|
+
end
|
44
|
+
|
45
|
+
def readline(*args)
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
49
|
+
def readlines(*args)
|
50
|
+
super
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module Random
|
55
|
+
def srand(*args)
|
56
|
+
super
|
57
|
+
end
|
58
|
+
|
59
|
+
def rand(*args)
|
60
|
+
super
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
module Signal
|
65
|
+
def trap(*args)
|
66
|
+
super
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
module Mutex
|
71
|
+
def synchronize(*args)
|
72
|
+
super
|
73
|
+
end
|
74
|
+
|
75
|
+
def lock(*args)
|
76
|
+
super
|
77
|
+
end
|
78
|
+
|
79
|
+
def unlock(*args)
|
80
|
+
super
|
81
|
+
end
|
82
|
+
|
83
|
+
def sleep(*args)
|
84
|
+
super
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Object.prepend Raygun::Apm::Hooks::Object
|
92
|
+
IO.prepend Raygun::Apm::Hooks::IO
|
93
|
+
Random.prepend Raygun::Apm::Hooks::Random
|
94
|
+
Signal.prepend Raygun::Apm::Hooks::Signal
|
95
|
+
Thread::Mutex.prepend Raygun::Apm::Hooks::Mutex
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'mongo'
|
2
|
+
|
3
|
+
module Raygun
|
4
|
+
module Apm
|
5
|
+
module Hooks
|
6
|
+
module MongoDB
|
7
|
+
def do_execute(connection, client, options = {})
|
8
|
+
result = nil
|
9
|
+
if tracer = Raygun::Apm::Tracer.instance
|
10
|
+
started = tracer.now
|
11
|
+
result = super
|
12
|
+
ended = tracer.now
|
13
|
+
event = raygun_apm_sql_event
|
14
|
+
event[:pid] = Process.pid
|
15
|
+
event[:query] = raygun_format_query(connection)
|
16
|
+
event[:provider] = "mongodb"
|
17
|
+
event[:host] = connection.address.to_s
|
18
|
+
event[:database] = client.database.name
|
19
|
+
event[:duration] = ended - started
|
20
|
+
event[:timestamp] = started
|
21
|
+
event[:tid] = tracer.get_thread_id(Thread.current)
|
22
|
+
tracer.emit(event)
|
23
|
+
result
|
24
|
+
else
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
def raygun_format_query(connection)
|
31
|
+
payload = message(connection).payload
|
32
|
+
return "#{payload["database_name"]}.#{payload["command_name"]} #{payload["command"]}}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def raygun_apm_sql_event
|
36
|
+
@_raygun_apm_sql_event ||= Raygun::Apm::Event::Sql.new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Mongo::Operation.constants.each do |operation|
|
44
|
+
Mongo::Operation.const_get(operation).prepend(Raygun::Apm::Hooks::MongoDB) rescue nil
|
45
|
+
end
|
data/lib/raygun/apm/tracer.rb
CHANGED
@@ -36,8 +36,8 @@ module Raygun
|
|
36
36
|
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, Tracer::BATCH_PACKET_SIZE)
|
37
37
|
self.udp_sink(
|
38
38
|
socket: sock,
|
39
|
-
host: config.
|
40
|
-
port: config.
|
39
|
+
host: config.proton_udp_host,
|
40
|
+
port: config.proton_udp_port,
|
41
41
|
receive_buffer_size: sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int
|
42
42
|
)
|
43
43
|
# Any fails here is kamikaze for the tracer
|
@@ -57,24 +57,31 @@ module Raygun
|
|
57
57
|
|
58
58
|
def initialize_blacklist
|
59
59
|
@blacklist_parser = Raygun::Apm::Blacklist::Parser.new(self)
|
60
|
-
|
61
|
-
|
60
|
+
file = @config.blacklist_file
|
61
|
+
@blacklist = if file && File.exist?(file)
|
62
|
+
File.readlines(file)
|
62
63
|
else
|
63
64
|
[]
|
64
65
|
end
|
65
|
-
# From file
|
66
|
-
@blacklist_parser.add_filters @blacklist
|
67
66
|
# Defaults
|
68
67
|
@blacklist_parser.add_filters Raygun::Apm::Blacklist.resolve_entries
|
68
|
+
# From file
|
69
|
+
@blacklist_parser.add_filters @blacklist
|
69
70
|
end
|
70
71
|
|
71
72
|
def register_known_library_paths
|
72
|
-
|
73
|
+
if defined?(Bundler)
|
74
|
+
libs = Bundler.load.specs.map(&:full_gem_path).sort << RbConfig::CONFIG['rubylibdir']
|
75
|
+
libs.delete(Dir.getwd)
|
76
|
+
self.register_libraries libs
|
77
|
+
else
|
78
|
+
self.register_libraries [RbConfig::CONFIG['rubylibdir']]
|
79
|
+
end
|
73
80
|
end
|
74
81
|
|
75
82
|
def run_agent_connectivity_diagnostics
|
76
83
|
check = Raygun::Apm::Diagnostics.new
|
77
|
-
check.verify_agent
|
84
|
+
check.verify_agent(self)
|
78
85
|
end
|
79
86
|
end
|
80
87
|
end
|
data/lib/raygun/apm/version.rb
CHANGED
data/raygun-apm.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = "https://raygun.com/platform/apm"
|
13
13
|
#spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files =
|
15
|
+
spec.files = Dir['README.rdoc', 'raygun-apm.gemspec', 'lib/**/*', 'bin/**/*'].reject { |f| f.match(/raygun_ext\./) }
|
16
16
|
spec.files += Dir['lib/raygun/**/{2}*/raygun_ext.*']
|
17
|
-
spec.bindir = "
|
17
|
+
spec.bindir = "bin"
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib", "ext"]
|
20
20
|
|
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "excon", "~> 0.73.0"
|
37
37
|
spec.add_development_dependency "httparty", "~> 0.18.0"
|
38
38
|
spec.add_development_dependency "httpclient", "~> 2.8.3"
|
39
|
+
spec.add_development_dependency "mongoid", "~> 7.1.2"
|
39
40
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raygun-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.78
|
5
5
|
platform: universal-darwin
|
6
6
|
authors:
|
7
7
|
- Raygun
|
8
8
|
- Erkki Eilonen
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: debase-ruby_core_source
|
@@ -193,6 +193,20 @@ dependencies:
|
|
193
193
|
- - "~>"
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: 2.8.3
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
name: mongoid
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - "~>"
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 7.1.2
|
203
|
+
type: :development
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 7.1.2
|
196
210
|
description:
|
197
211
|
email:
|
198
212
|
- support@raygun.com
|
@@ -203,7 +217,7 @@ extra_rdoc_files: []
|
|
203
217
|
files:
|
204
218
|
- README.rdoc
|
205
219
|
- bin/console
|
206
|
-
- bin/diagnostics
|
220
|
+
- bin/raygun-diagnostics
|
207
221
|
- bin/setup
|
208
222
|
- ext/raygun/extconf.rb
|
209
223
|
- lib/raygun/2.5/raygun_ext.bundle
|
@@ -216,6 +230,10 @@ files:
|
|
216
230
|
- lib/raygun/apm/config.rb
|
217
231
|
- lib/raygun/apm/diagnostics.rb
|
218
232
|
- lib/raygun/apm/event.rb
|
233
|
+
- lib/raygun/apm/hooks/excon.rb
|
234
|
+
- lib/raygun/apm/hooks/httpclient.rb
|
235
|
+
- lib/raygun/apm/hooks/internals.rb
|
236
|
+
- lib/raygun/apm/hooks/mongodb.rb
|
219
237
|
- lib/raygun/apm/hooks/net_http.rb
|
220
238
|
- lib/raygun/apm/hooks/redis.rb
|
221
239
|
- lib/raygun/apm/tracer.rb
|
@@ -243,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
261
|
- !ruby/object:Gem::Version
|
244
262
|
version: '0'
|
245
263
|
requirements: []
|
246
|
-
rubygems_version: 3.1.
|
264
|
+
rubygems_version: 3.1.4
|
247
265
|
signing_key:
|
248
266
|
specification_version: 4
|
249
267
|
summary: Raygun application performance monitoring core Profiler
|