alexb-raygun-apm 1.0.57-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +117 -0
- data/bin/console +14 -0
- data/bin/diagnostics +7 -0
- data/bin/setup +8 -0
- data/ext/raygun/extconf.rb +49 -0
- data/lib/raygun/2.5/raygun_ext.so +0 -0
- data/lib/raygun/2.6/raygun_ext.so +0 -0
- data/lib/raygun/2.7/raygun_ext.so +0 -0
- data/lib/raygun/alexb-raygun-apm.rb +25 -0
- data/lib/raygun/apm/blacklist.rb +460 -0
- data/lib/raygun/apm/blacklist/parser.rb +47 -0
- data/lib/raygun/apm/blacklist/translator.rb +73 -0
- data/lib/raygun/apm/config.rb +88 -0
- data/lib/raygun/apm/diagnostics.rb +52 -0
- data/lib/raygun/apm/event.rb +39 -0
- data/lib/raygun/apm/hooks/excon.rb +36 -0
- data/lib/raygun/apm/hooks/httpclient.rb +36 -0
- data/lib/raygun/apm/hooks/internals.rb +74 -0
- data/lib/raygun/apm/hooks/net_http.rb +44 -0
- data/lib/raygun/apm/hooks/redis.rb +46 -0
- data/lib/raygun/apm/tracer.rb +85 -0
- data/lib/raygun/apm/version.rb +6 -0
- data/raygun-apm.gemspec +39 -0
- metadata +253 -0
@@ -0,0 +1,44 @@
|
|
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.instance
|
12
|
+
started = tracer.now
|
13
|
+
response = super
|
14
|
+
ended = tracer.now
|
15
|
+
event = raygun_apm_http_out_event
|
16
|
+
event[:pid] = Process.pid
|
17
|
+
event[:url] = raygun_apm_url(request)
|
18
|
+
event[:verb] = request.method
|
19
|
+
event[:status] = response.code.to_i
|
20
|
+
event[:duration] = ended - started
|
21
|
+
event[:timestamp] = started
|
22
|
+
event[:tid] = tracer.get_thread_id(Thread.current)
|
23
|
+
tracer.emit(event)
|
24
|
+
response
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def raygun_apm_url(request)
|
31
|
+
return request.uri.to_s if request.uri
|
32
|
+
"#{use_ssl? ? "https" : "http"}://#{request["host"] || address}#{request.path}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def raygun_apm_http_out_event
|
36
|
+
@_raygun_apm_http_out_event ||= Raygun::Apm::Event::HttpOut.new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
::Net::HTTP.prepend(Raygun::Apm::Hooks::Net::HTTP)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Raygun
|
2
|
+
module Apm
|
3
|
+
module Hooks
|
4
|
+
module Redis
|
5
|
+
def process(commands)
|
6
|
+
result = nil
|
7
|
+
if tracer = Raygun::Apm::Tracer.instance
|
8
|
+
started = tracer.now
|
9
|
+
result = super
|
10
|
+
ended = tracer.now
|
11
|
+
event = raygun_apm_sql_event
|
12
|
+
event[:pid] = Process.pid
|
13
|
+
event[:query] = raygun_format_query(commands)
|
14
|
+
event[:provider] = "redis"
|
15
|
+
event[:host] = "#{host}:#{port}"
|
16
|
+
event[:database] = db.to_s
|
17
|
+
event[:duration] = ended - started
|
18
|
+
event[:timestamp] = started
|
19
|
+
event[:tid] = tracer.get_thread_id(Thread.current)
|
20
|
+
tracer.emit(event)
|
21
|
+
result
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def raygun_format_query(commands)
|
29
|
+
commands.map do |command|
|
30
|
+
command.map(&:to_s).join(" ")
|
31
|
+
end.join(", ")
|
32
|
+
end
|
33
|
+
|
34
|
+
def raygun_apm_sql_event
|
35
|
+
@_raygun_apm_sql_event ||= Raygun::Apm::Event::Sql.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def raygun_redis_call
|
39
|
+
yield
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
::Redis::Client.prepend(Raygun::Apm::Hooks::Redis)
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'raygun/apm/blacklist'
|
2
|
+
require 'rbconfig'
|
3
|
+
|
4
|
+
module Raygun
|
5
|
+
module Apm
|
6
|
+
class Tracer
|
7
|
+
@__pids ||= {}
|
8
|
+
class << self
|
9
|
+
def instance
|
10
|
+
@__pids[Process.pid]
|
11
|
+
end
|
12
|
+
|
13
|
+
def instance=(tracer)
|
14
|
+
@__pids[Process.pid] = tracer
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_accessor :config
|
19
|
+
|
20
|
+
def initialize(env=ENV)
|
21
|
+
configure(env)
|
22
|
+
initialize_blacklist
|
23
|
+
register_known_library_paths
|
24
|
+
run_agent_connectivity_diagnostics
|
25
|
+
ObjectSpace.define_finalizer(self, proc{ disable_tracepoints })
|
26
|
+
# Any fails here is kamikaze for the tracer
|
27
|
+
rescue => e
|
28
|
+
# XXX works for the middleware wrapped case, not for standalone - revisit
|
29
|
+
raise Raygun::Apm::FatalError, "Raygun APM tracer could not be initialized: #{e.message} #{e.backtrace.join("\n")}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def udp_sink!
|
33
|
+
require "socket"
|
34
|
+
sock = UDPSocket.new
|
35
|
+
# For UDP sockets, SO_SNDBUF is the max packet size and NOT send buffer as with a connection oriented transport
|
36
|
+
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, Tracer::BATCH_PACKET_SIZE)
|
37
|
+
self.udp_sink(
|
38
|
+
socket: sock,
|
39
|
+
host: config.udp_host,
|
40
|
+
port: config.udp_port,
|
41
|
+
receive_buffer_size: sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int
|
42
|
+
)
|
43
|
+
# Any fails here is kamikaze for the tracer
|
44
|
+
rescue => e
|
45
|
+
# XXX works for the middleware wrapped case, not for standalone - revisit
|
46
|
+
raise Raygun::Apm::FatalError, "Raygun APM UDP sink could not be initialized: #{e.message} #{e.backtrace.join("\n")}"
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def configure(env)
|
51
|
+
@config = Config.new(env)
|
52
|
+
# Special assignments from config to the Tracer
|
53
|
+
self.log_level = config.loglevel
|
54
|
+
self.environment = config.environment
|
55
|
+
self.api_key = config.proton_api_key
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize_blacklist
|
59
|
+
@blacklist_parser = Raygun::Apm::Blacklist::Parser.new(self)
|
60
|
+
@blacklist = if @config.proton_user_overrides_file && File.exists?(@config.proton_user_overrides_file)
|
61
|
+
File.readlines(@config.proton_user_overrides_file)
|
62
|
+
else
|
63
|
+
[]
|
64
|
+
end
|
65
|
+
# From file
|
66
|
+
@blacklist_parser.add_filters @blacklist
|
67
|
+
# Defaults
|
68
|
+
@blacklist_parser.add_filters Raygun::Apm::Blacklist.resolve_entries
|
69
|
+
end
|
70
|
+
|
71
|
+
def register_known_library_paths
|
72
|
+
if defined?(Bundler)
|
73
|
+
self.register_libraries Bundler.load.specs.map(&:full_gem_path).sort << RbConfig::CONFIG['rubylibdir']
|
74
|
+
else
|
75
|
+
self.register_libraries [RbConfig::CONFIG['rubylibdir']]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def run_agent_connectivity_diagnostics
|
80
|
+
check = Raygun::Apm::Diagnostics.new
|
81
|
+
check.verify_agent(self)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/raygun-apm.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
require File.expand_path('../lib/raygun/apm/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "alexb-raygun-apm"
|
6
|
+
spec.version = Raygun::Apm::VERSION
|
7
|
+
|
8
|
+
spec.authors = ["Raygun", "Erkki Eilonen"]
|
9
|
+
spec.email = ["support@raygun.com", "info@bearmetal.eu"]
|
10
|
+
|
11
|
+
spec.summary = %q{Raygun application performance monitoring core Profiler}
|
12
|
+
spec.homepage = "https://raygun.com/platform/apm"
|
13
|
+
#spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = Dir['README.rdoc', 'raygun-apm.gemspec', 'lib/**/*', 'bin/**/*'].reject { |f| f.match(/raygun_ext\./) }
|
16
|
+
spec.files += Dir['lib/raygun/**/{2}*/raygun_ext.*']
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib", "ext"]
|
20
|
+
|
21
|
+
spec.platform = Gem::Platform::RUBY
|
22
|
+
|
23
|
+
spec.extensions = ["ext/raygun/extconf.rb"]
|
24
|
+
spec.required_ruby_version = '>= 2.5.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency "debase-ruby_core_source", "~> 0.10.9"
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.1.2"
|
28
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
29
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
30
|
+
spec.add_development_dependency "rake-compiler", "~> 1.1.0"
|
31
|
+
spec.add_development_dependency "rake-compiler-dock", "~> 1.0.1"
|
32
|
+
spec.add_development_dependency "benchmark_driver", "~> 0.15.9"
|
33
|
+
spec.add_development_dependency "faraday", "~> 1.0.1"
|
34
|
+
spec.add_development_dependency "multipart-post", "~> 2.1.1"
|
35
|
+
spec.add_development_dependency "rest-client", "~> 2.1.0"
|
36
|
+
spec.add_development_dependency "excon", "~> 0.73.0"
|
37
|
+
spec.add_development_dependency "httparty", "~> 0.18.0"
|
38
|
+
spec.add_development_dependency "httpclient", "~> 2.8.3"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alexb-raygun-apm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.57
|
5
|
+
platform: x64-mingw32
|
6
|
+
authors:
|
7
|
+
- Raygun
|
8
|
+
- Erkki Eilonen
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: debase-ruby_core_source
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.10.9
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.10.9
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.1.2
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.1.2
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '12.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '12.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: minitest
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '5.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '5.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake-compiler
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.1.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.1.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake-compiler-dock
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.0.1
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.0.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: benchmark_driver
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.15.9
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.15.9
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: faraday
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.0.1
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.0.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: multipart-post
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 2.1.1
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 2.1.1
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rest-client
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 2.1.0
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 2.1.0
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: excon
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 0.73.0
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 0.73.0
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: httparty
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - "~>"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: 0.18.0
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 0.18.0
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: httpclient
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 2.8.3
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: 2.8.3
|
196
|
+
description:
|
197
|
+
email:
|
198
|
+
- support@raygun.com
|
199
|
+
- info@bearmetal.eu
|
200
|
+
executables: []
|
201
|
+
extensions: []
|
202
|
+
extra_rdoc_files: []
|
203
|
+
files:
|
204
|
+
- README.rdoc
|
205
|
+
- bin/console
|
206
|
+
- bin/diagnostics
|
207
|
+
- bin/setup
|
208
|
+
- ext/raygun/extconf.rb
|
209
|
+
- lib/raygun/2.5/raygun_ext.so
|
210
|
+
- lib/raygun/2.6/raygun_ext.so
|
211
|
+
- lib/raygun/2.7/raygun_ext.so
|
212
|
+
- lib/raygun/alexb-raygun-apm.rb
|
213
|
+
- lib/raygun/apm/blacklist.rb
|
214
|
+
- lib/raygun/apm/blacklist/parser.rb
|
215
|
+
- lib/raygun/apm/blacklist/translator.rb
|
216
|
+
- lib/raygun/apm/config.rb
|
217
|
+
- lib/raygun/apm/diagnostics.rb
|
218
|
+
- lib/raygun/apm/event.rb
|
219
|
+
- lib/raygun/apm/hooks/excon.rb
|
220
|
+
- lib/raygun/apm/hooks/httpclient.rb
|
221
|
+
- lib/raygun/apm/hooks/internals.rb
|
222
|
+
- lib/raygun/apm/hooks/net_http.rb
|
223
|
+
- lib/raygun/apm/hooks/redis.rb
|
224
|
+
- lib/raygun/apm/tracer.rb
|
225
|
+
- lib/raygun/apm/version.rb
|
226
|
+
- raygun-apm.gemspec
|
227
|
+
homepage: https://raygun.com/platform/apm
|
228
|
+
licenses: []
|
229
|
+
metadata: {}
|
230
|
+
post_install_message:
|
231
|
+
rdoc_options: []
|
232
|
+
require_paths:
|
233
|
+
- lib
|
234
|
+
- ext
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
+
requirements:
|
237
|
+
- - ">="
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: '2.5'
|
240
|
+
- - "<"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: 2.8.dev
|
243
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
|
+
requirements:
|
245
|
+
- - ">="
|
246
|
+
- !ruby/object:Gem::Version
|
247
|
+
version: '0'
|
248
|
+
requirements: []
|
249
|
+
rubygems_version: 3.1.2
|
250
|
+
signing_key:
|
251
|
+
specification_version: 4
|
252
|
+
summary: Raygun application performance monitoring core Profiler
|
253
|
+
test_files: []
|