appoptics_apm 4.0.9 → 4.1.0
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/.gitignore +0 -1
- data/.travis.yml +0 -13
- data/Dockerfile_test +1 -1
- data/Gemfile +3 -11
- data/Rakefile +1 -1
- data/appoptics_apm.gemspec +4 -10
- data/examples/tracing_background_jobs.rb +1 -1
- data/ext/oboe_metal/extconf.rb +2 -5
- data/ext/oboe_metal/src/VERSION +1 -0
- data/lib/appoptics_apm/api/memcache.rb +1 -0
- data/lib/appoptics_apm/api/profiling.rb +1 -5
- data/lib/appoptics_apm/base.rb +13 -17
- data/lib/appoptics_apm/config.rb +1 -3
- data/lib/appoptics_apm/inst/curb.rb +1 -1
- data/lib/appoptics_apm/inst/dalli.rb +2 -1
- data/lib/appoptics_apm/inst/em-http-request.rb +19 -21
- data/lib/appoptics_apm/inst/excon.rb +1 -9
- data/lib/appoptics_apm/inst/mongo2.rb +1 -1
- data/lib/appoptics_apm/inst/resque.rb +1 -1
- data/lib/appoptics_apm/inst/sidekiq-client.rb +1 -1
- data/lib/appoptics_apm/inst/sidekiq-worker.rb +1 -1
- data/lib/appoptics_apm/legacy_method_profiling.rb +5 -12
- data/lib/appoptics_apm/util.rb +1 -4
- data/lib/appoptics_apm/version.rb +2 -2
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +0 -2
- data/run_tests_docker.rb +0 -1
- metadata +3 -24
- data/lib/appoptics_apm/inst/memcache.rb +0 -102
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90ed895e7d5acf3fb30fa85e0d5df0a3df0d3075
|
|
4
|
+
data.tar.gz: acf370948b698d06dfe982a322058d2bb2e227eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26c3753688ed6e8568b9c4ced5364505bde26cccfbf0b7ce53adb55ea5dd703de3427c7b68f96fe9845726d04c3049422c30feb686bd76791e5590467c70ca87
|
|
7
|
+
data.tar.gz: 8cdc020d21282e659a2fc8c82066f9975641f45a82735fc628e94e11dbf6cfc5ca0b35115e3ef3012be37daa32e05de733799d0d88f4470c03a925faeda62c00
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -9,7 +9,6 @@ rvm:
|
|
|
9
9
|
- 2.5.0
|
|
10
10
|
- 2.4.3
|
|
11
11
|
- 2.3.6
|
|
12
|
-
- 1.9.3 # soon not supported anymore
|
|
13
12
|
# - jruby-9.0.5.0
|
|
14
13
|
|
|
15
14
|
gemfile:
|
|
@@ -71,18 +70,6 @@ matrix:
|
|
|
71
70
|
- rvm: 2.4.3
|
|
72
71
|
gemfile: gemfiles/rails32.gemfile
|
|
73
72
|
|
|
74
|
-
# Rails 5 requires Ruby >= 2.2
|
|
75
|
-
- rvm: 1.9.3
|
|
76
|
-
gemfile: gemfiles/rails50.gemfile
|
|
77
|
-
- rvm: 1.9.3
|
|
78
|
-
gemfile: gemfiles/rails51.gemfile
|
|
79
|
-
|
|
80
|
-
# WebMock requires Ruby 2.0 or higher
|
|
81
|
-
- rvm: 1.9.3
|
|
82
|
-
gemfile: gemfiles/instrumentation_mocked.gemfile
|
|
83
|
-
- rvm: 1.9.3
|
|
84
|
-
gemfile: gemfiles/instrumentation_mocked_oldgems.gemfile
|
|
85
|
-
|
|
86
73
|
# - rvm: jruby-9.0.5.0
|
|
87
74
|
# gemfile: gemfiles/delayed_job.gemfile
|
|
88
75
|
|
data/Dockerfile_test
CHANGED
|
@@ -9,6 +9,7 @@ RUN apt-get update \
|
|
|
9
9
|
git-core \
|
|
10
10
|
libpcre3-dev \
|
|
11
11
|
libreadline-dev \
|
|
12
|
+
libsasl2-dev \
|
|
12
13
|
libssl-dev \
|
|
13
14
|
openjdk-8-jdk \
|
|
14
15
|
zlib1g-dev \
|
|
@@ -32,7 +33,6 @@ RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
|
|
|
32
33
|
|
|
33
34
|
# install rubies to build our gem against
|
|
34
35
|
RUN . ~/.profile \
|
|
35
|
-
&& rbenv install 1.9.3-p551 \
|
|
36
36
|
&& rbenv install 2.3.6 \
|
|
37
37
|
&& rbenv install 2.4.3 \
|
|
38
38
|
&& rbenv install 2.5.0
|
data/Gemfile
CHANGED
|
@@ -7,11 +7,7 @@ group :development, :test do
|
|
|
7
7
|
gem 'minitest-debugger', :require => false
|
|
8
8
|
gem 'rack-test'
|
|
9
9
|
gem 'puma'
|
|
10
|
-
|
|
11
|
-
gem 'bson', '<= 1.12.3'
|
|
12
|
-
else
|
|
13
|
-
gem 'bson'
|
|
14
|
-
end
|
|
10
|
+
gem 'bson'
|
|
15
11
|
gem 'webmock' if RUBY_VERSION >= '2.0.0'
|
|
16
12
|
gem 'mocha'
|
|
17
13
|
gem 'rubocop', require: false
|
|
@@ -24,12 +20,8 @@ group :development do
|
|
|
24
20
|
gem 'debugger', :platform => :mri_19
|
|
25
21
|
gem 'byebug', :platforms => [:mri_20, :mri_21, :mri_22, :mri_23, :mri_24]
|
|
26
22
|
# gem 'perftools.rb', :platforms => [ :mri_20, :mri_21 ], :require => 'perftools'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
gem 'pry-byebug', :platforms => [:mri_20, :mri_21, :mri_22, :mri_23, :mri_24]
|
|
30
|
-
else
|
|
31
|
-
gem 'pry', '~> 0.10.0'
|
|
32
|
-
end
|
|
23
|
+
gem 'pry'
|
|
24
|
+
gem 'pry-byebug', :platforms => [:mri_20, :mri_21, :mri_22, :mri_23, :mri_24]
|
|
33
25
|
end
|
|
34
26
|
|
|
35
27
|
if defined?(JRUBY_VERSION)
|
data/Rakefile
CHANGED
|
@@ -73,7 +73,7 @@ task :fetch_ext_deps do
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
# The c-lib version is different from the gem version
|
|
76
|
-
oboe_version = ENV['OBOE_VERSION'] || '
|
|
76
|
+
oboe_version = ENV['OBOE_VERSION'] || 'latest'
|
|
77
77
|
oboe_src_dir = "https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/#{oboe_version}"
|
|
78
78
|
ext_src_dir = File.expand_path('ext/oboe_metal/src')
|
|
79
79
|
|
data/appoptics_apm.gemspec
CHANGED
|
@@ -29,23 +29,17 @@ Gem::Specification.new do |s|
|
|
|
29
29
|
s.extensions = ['ext/oboe_metal/extconf.rb'] unless defined?(JRUBY_VERSION)
|
|
30
30
|
|
|
31
31
|
s.add_runtime_dependency('json', '>= 0')
|
|
32
|
-
s.add_runtime_dependency('no_proxy_fix', '~> 0.1.2', '>= 0.1.2')
|
|
33
32
|
|
|
34
33
|
# Development dependencies used in gem development & testing
|
|
35
34
|
s.add_development_dependency('rake', '>= 0.9.0')
|
|
36
35
|
|
|
37
36
|
unless defined?(JRUBY_VERSION)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
when /^2\./
|
|
42
|
-
s.add_development_dependency('byebug', '>= 8.0.0')
|
|
43
|
-
s.add_development_dependency('pry', '>= 0.10.0')
|
|
44
|
-
s.add_development_dependency('pry-byebug', '>= 3.0.0')
|
|
45
|
-
end
|
|
37
|
+
s.add_development_dependency('byebug', '>= 8.0.0')
|
|
38
|
+
s.add_development_dependency('pry', '>= 0.10.0')
|
|
39
|
+
s.add_development_dependency('pry-byebug', '>= 3.0.0')
|
|
46
40
|
else
|
|
47
41
|
s.add_development_dependency('pry', '>= 0.10.0')
|
|
48
42
|
end
|
|
49
43
|
|
|
50
|
-
s.required_ruby_version = '>=
|
|
44
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
51
45
|
end
|
|
@@ -15,7 +15,7 @@ AppOpticsAPM::Config[:tracing_mode] = 'always'
|
|
|
15
15
|
# and doesn't have to be called manually
|
|
16
16
|
#
|
|
17
17
|
# Load library instrumentation to auto-capture stuff we know about...
|
|
18
|
-
# e.g. ActiveRecord, Cassandra, Dalli, Redis,
|
|
18
|
+
# e.g. ActiveRecord, Cassandra, Dalli, Redis, Memcache, Mongo
|
|
19
19
|
# AppOpticsAPM::Ruby.load
|
|
20
20
|
|
|
21
21
|
# Some KVs to report to the dashboard
|
data/ext/oboe_metal/extconf.rb
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
require 'mkmf'
|
|
5
5
|
require 'rbconfig'
|
|
6
6
|
require 'open-uri'
|
|
7
|
-
require '
|
|
8
|
-
|
|
9
|
-
# require 'digest'
|
|
7
|
+
require 'digest'
|
|
10
8
|
|
|
11
9
|
ext_dir = File.expand_path(File.dirname(__FILE__))
|
|
12
10
|
|
|
@@ -20,7 +18,7 @@ ao_include = File.join(ext_dir, 'src')
|
|
|
20
18
|
|
|
21
19
|
# Download the appropriate liboboe from S3(via rake for testing) or files.appoptics.com (production)
|
|
22
20
|
version = File.read(File.join(ao_include, 'VERSION')).chomp
|
|
23
|
-
if ENV['
|
|
21
|
+
if ENV['FROM_S3']
|
|
24
22
|
ao_path = File.join('https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/', version)
|
|
25
23
|
puts "Fetching c-lib from S3"
|
|
26
24
|
else
|
|
@@ -80,7 +78,6 @@ if success
|
|
|
80
78
|
|
|
81
79
|
dir_config('oboe', 'src', 'lib')
|
|
82
80
|
|
|
83
|
-
# create Makefile
|
|
84
81
|
if jruby || ENV.key?('APPOPTICS_URL')
|
|
85
82
|
# Build the noop extension under JRuby and Heroku.
|
|
86
83
|
# The oboe-heroku gem builds it's own c extension which links to
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.9
|
|
@@ -9,6 +9,7 @@ module AppOpticsAPM
|
|
|
9
9
|
module API
|
|
10
10
|
##
|
|
11
11
|
# Utility methods for the Memcache instrumentation
|
|
12
|
+
# currently used by dalli and memcached
|
|
12
13
|
module Memcache #:nodoc:
|
|
13
14
|
MEMCACHE_OPS = %w(add append cas decr decrement delete fetch get incr increment prepend replace set)
|
|
14
15
|
|
|
@@ -85,11 +85,7 @@ module AppOpticsAPM
|
|
|
85
85
|
# like we did something to nicely play the no-op part.
|
|
86
86
|
return true unless AppOpticsAPM.loaded
|
|
87
87
|
|
|
88
|
-
if
|
|
89
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/error] profile_method: Use the legacy method profiling for Ruby versions before 1.9.3'
|
|
90
|
-
return false
|
|
91
|
-
|
|
92
|
-
elsif !klass.is_a?(Module)
|
|
88
|
+
if !klass.is_a?(Module)
|
|
93
89
|
AppOpticsAPM.logger.warn "[appoptics_apm/error] profile_method: Not sure what to do with #{klass}. Send a class or module."
|
|
94
90
|
return false
|
|
95
91
|
|
data/lib/appoptics_apm/base.rb
CHANGED
|
@@ -193,25 +193,21 @@ module AppOpticsAPMBase
|
|
|
193
193
|
env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
|
|
194
194
|
return unless %w(development, test).include? env
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
require 'pry-byebug'
|
|
199
|
-
|
|
200
|
-
if defined?(PryByebug)
|
|
201
|
-
Pry.commands.alias_command 'c', 'continue'
|
|
202
|
-
Pry.commands.alias_command 's', 'step'
|
|
203
|
-
Pry.commands.alias_command 'n', 'next'
|
|
204
|
-
Pry.commands.alias_command 'f', 'finish'
|
|
205
|
-
|
|
206
|
-
Pry::Commands.command(/^$/, 'repeat last command') do
|
|
207
|
-
_pry_.run_command Pry.history.to_a.last
|
|
208
|
-
end
|
|
209
|
-
end
|
|
196
|
+
require 'pry'
|
|
197
|
+
require 'pry-byebug'
|
|
210
198
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
199
|
+
if defined?(PryByebug)
|
|
200
|
+
Pry.commands.alias_command 'c', 'continue'
|
|
201
|
+
Pry.commands.alias_command 's', 'step'
|
|
202
|
+
Pry.commands.alias_command 'n', 'next'
|
|
203
|
+
Pry.commands.alias_command 'f', 'finish'
|
|
204
|
+
|
|
205
|
+
Pry::Commands.command(/^$/, 'repeat last command') do
|
|
206
|
+
_pry_.run_command Pry.history.to_a.last
|
|
207
|
+
end
|
|
214
208
|
end
|
|
209
|
+
|
|
210
|
+
byebug
|
|
215
211
|
end
|
|
216
212
|
|
|
217
213
|
##
|
data/lib/appoptics_apm/config.rb
CHANGED
|
@@ -15,8 +15,7 @@ module AppOpticsAPM
|
|
|
15
15
|
:active_record, :bunnyclient, :bunnyconsumer, :cassandra, :curb,
|
|
16
16
|
:dalli, :delayed_jobclient, :delayed_jobworker,
|
|
17
17
|
:em_http_request, :excon, :faraday, :grape,
|
|
18
|
-
:httpclient, :nethttp, :memcached,
|
|
19
|
-
:memcache, :mongo, :moped, :rack, :redis,
|
|
18
|
+
:httpclient, :nethttp, :memcached, :mongo, :moped, :rack, :redis,
|
|
20
19
|
:resqueclient, :resqueworker, :rest_client,
|
|
21
20
|
:sequel, :sidekiqclient, :sidekiqworker, :typhoeus]
|
|
22
21
|
|
|
@@ -66,7 +65,6 @@ module AppOpticsAPM
|
|
|
66
65
|
AppOpticsAPM::Config[:faraday][:collect_backtraces] = false
|
|
67
66
|
AppOpticsAPM::Config[:grape][:collect_backtraces] = true
|
|
68
67
|
AppOpticsAPM::Config[:httpclient][:collect_backtraces] = true
|
|
69
|
-
AppOpticsAPM::Config[:memcache][:collect_backtraces] = false
|
|
70
68
|
AppOpticsAPM::Config[:memcached][:collect_backtraces] = false
|
|
71
69
|
AppOpticsAPM::Config[:mongo][:collect_backtraces] = true
|
|
72
70
|
AppOpticsAPM::Config[:moped][:collect_backtraces] = true
|
|
@@ -321,7 +321,7 @@ module AppOpticsAPM
|
|
|
321
321
|
end
|
|
322
322
|
end
|
|
323
323
|
|
|
324
|
-
if AppOpticsAPM::Config[:curb][:enabled] && defined?(::Curl)
|
|
324
|
+
if AppOpticsAPM::Config[:curb][:enabled] && defined?(::Curl)
|
|
325
325
|
::AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting curb' if AppOpticsAPM::Config[:verbose]
|
|
326
326
|
::AppOpticsAPM::Util.send_include(::Curl::Easy, ::AppOpticsAPM::Inst::CurlEasy)
|
|
327
327
|
::AppOpticsAPM::Util.send_extend(::Curl::Multi, ::AppOpticsAPM::Inst::CurlMultiCM)
|
|
@@ -12,7 +12,8 @@ module AppOpticsAPM
|
|
|
12
12
|
if ::Dalli::Client.private_method_defined? :perform
|
|
13
13
|
alias perform_without_appoptics perform
|
|
14
14
|
alias perform perform_with_appoptics
|
|
15
|
-
else
|
|
15
|
+
else
|
|
16
|
+
AppOpticsAPM.logger.warn '[appoptics_apm/loading] Couldn\'t properly instrument Memcache (Dalli). Partial traces may occur.'
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
if ::Dalli::Client.method_defined? :get_multi
|
|
@@ -76,30 +76,28 @@ module AppOpticsAPM
|
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
if
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/loading] Couldn\'t properly instrument em-http-request (:setup_request). Partial traces may occur.'
|
|
91
|
-
end
|
|
79
|
+
if defined?(::EventMachine::HttpConnection) && defined?(::EventMachine::HttpClient) && AppOpticsAPM::Config[:em_http_request][:enabled]
|
|
80
|
+
AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting em-http-request' if AppOpticsAPM::Config[:verbose]
|
|
81
|
+
|
|
82
|
+
class ::EventMachine::HttpConnection
|
|
83
|
+
include AppOpticsAPM::Inst::EventMachine::HttpConnection
|
|
84
|
+
|
|
85
|
+
if method_defined?(:setup_request)
|
|
86
|
+
class_eval 'alias :setup_request_without_appoptics :setup_request'
|
|
87
|
+
class_eval 'alias :setup_request :setup_request_with_appoptics'
|
|
88
|
+
else
|
|
89
|
+
AppOpticsAPM.logger.warn '[appoptics_apm/loading] Couldn\'t properly instrument em-http-request (:setup_request). Partial traces may occur.'
|
|
92
90
|
end
|
|
91
|
+
end
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
class ::EventMachine::HttpClient
|
|
94
|
+
include AppOpticsAPM::Inst::EventMachine::HttpClient
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
end
|
|
96
|
+
if method_defined?(:parse_response_header)
|
|
97
|
+
class_eval 'alias :parse_response_header_without_appoptics :parse_response_header'
|
|
98
|
+
class_eval 'alias :parse_response_header :parse_response_header_with_appoptics'
|
|
99
|
+
else
|
|
100
|
+
AppOpticsAPM.logger.warn '[appoptics_apm/loading] Couldn\'t properly instrument em-http-request (:parse_response_header). Partial traces may occur.'
|
|
103
101
|
end
|
|
104
102
|
end
|
|
105
103
|
end
|
|
@@ -20,15 +20,7 @@ module AppOpticsAPM
|
|
|
20
20
|
# Conditionally log query args
|
|
21
21
|
if AppOpticsAPM::Config[:excon][:log_args] && @data[:query]
|
|
22
22
|
if @data[:query].is_a?(Hash)
|
|
23
|
-
|
|
24
|
-
kvs[:ServiceArg] = "#{@data[:path]}?#{URI.encode_www_form(@data[:query])}"
|
|
25
|
-
else
|
|
26
|
-
# An imperfect solution for the lack of URI.encode_www_form for Ruby versions before
|
|
27
|
-
# 1.9.2. We manually create a query string for reporting purposes only.
|
|
28
|
-
query_arg = ""
|
|
29
|
-
@data[:query].each_pair { |k,v| query_arg += "#{k}=#{v}?"; }
|
|
30
|
-
kvs[:ServiceArg] = "#{@data[:path]}?#{query_arg.chop}"
|
|
31
|
-
end
|
|
23
|
+
kvs[:ServiceArg] = "#{@data[:path]}?#{URI.encode_www_form(@data[:query])}"
|
|
32
24
|
else
|
|
33
25
|
kvs[:ServiceArg] = "#{@data[:path]}?#{@data[:query]}"
|
|
34
26
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require 'json'
|
|
5
5
|
|
|
6
|
-
if
|
|
6
|
+
if AppOpticsAPM::Config[:mongo][:enabled]
|
|
7
7
|
if defined?(::Mongo) && (Gem.loaded_specs['mongo'].version.to_s >= '2.0.0')
|
|
8
8
|
::AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting mongo' if AppOpticsAPM::Config[:verbose]
|
|
9
9
|
|
|
@@ -138,7 +138,7 @@ module AppOpticsAPM
|
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
-
if defined?(::Resque)
|
|
141
|
+
if defined?(::Resque)
|
|
142
142
|
AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting resque' if AppOpticsAPM::Config[:verbose]
|
|
143
143
|
|
|
144
144
|
::AppOpticsAPM::Util.send_include(::Resque, ::AppOpticsAPM::Inst::ResqueClient) if AppOpticsAPM::Config[:resqueclient][:enabled]
|
|
@@ -43,7 +43,7 @@ module AppOpticsAPM
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
if defined?(::Sidekiq) &&
|
|
46
|
+
if defined?(::Sidekiq) && AppOpticsAPM::Config[:sidekiqclient][:enabled]
|
|
47
47
|
::Sidekiq.configure_client do |config|
|
|
48
48
|
config.client_middleware do |chain|
|
|
49
49
|
::AppOpticsAPM.logger.info '[appoptics_apm/loading] Adding Sidekiq client middleware' if AppOpticsAPM::Config[:verbose]
|
|
@@ -55,7 +55,7 @@ module AppOpticsAPM
|
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
if defined?(::Sidekiq) &&
|
|
58
|
+
if defined?(::Sidekiq) && AppOpticsAPM::Config[:sidekiqworker][:enabled]
|
|
59
59
|
::AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting sidekiq' if AppOpticsAPM::Config[:verbose]
|
|
60
60
|
|
|
61
61
|
::Sidekiq.configure_server do |config|
|
|
@@ -29,20 +29,13 @@ module AppOpticsAPMMethodProfiling
|
|
|
29
29
|
def profile_method_real(method_name, profile_name, store_args = false, store_return = false, *_)
|
|
30
30
|
begin
|
|
31
31
|
# this only gets file and line where profiling is turned on, presumably
|
|
32
|
-
# right after the function definition.
|
|
33
|
-
# but its appears no such luck for ruby 1.8
|
|
32
|
+
# right after the function definition.
|
|
34
33
|
file = ''
|
|
35
34
|
line = ''
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
line = info[1].to_s
|
|
41
|
-
end
|
|
42
|
-
else
|
|
43
|
-
info = Kernel.caller[0].split(':')
|
|
44
|
-
file = info.first.to_s
|
|
45
|
-
line = info.last.to_s
|
|
35
|
+
info = instance_method(method_name).source_location
|
|
36
|
+
unless info.nil?
|
|
37
|
+
file = info[0].to_s
|
|
38
|
+
line = info[1].to_s
|
|
46
39
|
end
|
|
47
40
|
|
|
48
41
|
# Safety: Make sure there are no quotes or double quotes to break the class_eval
|
data/lib/appoptics_apm/util.rb
CHANGED
|
@@ -105,9 +105,6 @@ module AppOpticsAPM
|
|
|
105
105
|
#
|
|
106
106
|
def static_asset?(path)
|
|
107
107
|
path =~ Regexp.new(AppOpticsAPM::Config[:dnt_regexp], AppOpticsAPM::Config[:dnt_opts])
|
|
108
|
-
rescue => e
|
|
109
|
-
AppOpticsAPM.logger.warn "[AppOpticsAPM/debug] Could not apply Regex.new to path. #{e.inspect}"
|
|
110
|
-
false
|
|
111
108
|
end
|
|
112
109
|
|
|
113
110
|
##
|
|
@@ -209,7 +206,7 @@ module AppOpticsAPM
|
|
|
209
206
|
platform_info['Ruby.Excon.Version'] = "Excon-#{::Excon::VERSION}" if defined?(::Excon::VERSION)
|
|
210
207
|
platform_info['Ruby.Faraday.Version'] = "Faraday-#{::Faraday::VERSION}" if defined?(::Faraday::VERSION)
|
|
211
208
|
platform_info['Ruby.HTTPClient.Version'] = "HTTPClient-#{::HTTPClient::VERSION}" if defined?(::HTTPClient::VERSION)
|
|
212
|
-
platform_info['Ruby.
|
|
209
|
+
platform_info['Ruby.Memcached.Version'] = "Memcached-#{::Memcached::VERSION}" if defined?(::Memcached::VERSION)
|
|
213
210
|
platform_info['Ruby.Moped.Version'] = "Moped-#{::Moped::VERSION}" if defined?(::Moped::VERSION)
|
|
214
211
|
platform_info['Ruby.Redis.Version'] = "Redis-#{::Redis::VERSION}" if defined?(::Redis::VERSION)
|
|
215
212
|
platform_info['Ruby.Resque.Version'] = "Resque-#{::Resque::VERSION}" if defined?(::Resque::VERSION)
|
|
@@ -165,7 +165,6 @@ if defined?(AppOpticsAPM::Config)
|
|
|
165
165
|
# AppOpticsAPM::Config[:faraday][:enabled] = true
|
|
166
166
|
# AppOpticsAPM::Config[:grape][:enabled] = true
|
|
167
167
|
# AppOpticsAPM::Config[:httpclient][:enabled] = true
|
|
168
|
-
# AppOpticsAPM::Config[:memcache][:enabled] = true
|
|
169
168
|
# AppOpticsAPM::Config[:memcached][:enabled] = true
|
|
170
169
|
# AppOpticsAPM::Config[:mongo][:enabled] = true
|
|
171
170
|
# AppOpticsAPM::Config[:moped][:enabled] = true
|
|
@@ -204,7 +203,6 @@ if defined?(AppOpticsAPM::Config)
|
|
|
204
203
|
# AppOpticsAPM::Config[:faraday][:collect_backtraces] = false
|
|
205
204
|
# AppOpticsAPM::Config[:grape][:collect_backtraces] = false
|
|
206
205
|
# AppOpticsAPM::Config[:httpclient][:collect_backtraces] = false
|
|
207
|
-
# AppOpticsAPM::Config[:memcache][:collect_backtraces] = false
|
|
208
206
|
# AppOpticsAPM::Config[:memcached][:collect_backtraces] = false
|
|
209
207
|
# AppOpticsAPM::Config[:mongo][:collect_backtraces] = true
|
|
210
208
|
# AppOpticsAPM::Config[:moped][:collect_backtraces] = true
|
data/run_tests_docker.rb
CHANGED
|
@@ -31,7 +31,6 @@ travis['matrix']['exclude'].each do |h|
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
matrix.each do |args|
|
|
34
|
-
args['rvm'] = '1.9.3-p551' if args['rvm'] =~ /1.9.3/
|
|
35
34
|
`docker-compose run --rm --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh #{args['rvm']} #{args['gemfile']} #{args['env']}`
|
|
36
35
|
puts "docker-compose run --rm --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh #{args['rvm']} #{args['gemfile']} #{args['env']}"
|
|
37
36
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appoptics_apm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maia Engeli
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2018-
|
|
13
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: json
|
|
@@ -26,26 +26,6 @@ dependencies:
|
|
|
26
26
|
- - ">="
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
28
|
version: '0'
|
|
29
|
-
- !ruby/object:Gem::Dependency
|
|
30
|
-
name: no_proxy_fix
|
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
|
32
|
-
requirements:
|
|
33
|
-
- - "~>"
|
|
34
|
-
- !ruby/object:Gem::Version
|
|
35
|
-
version: 0.1.2
|
|
36
|
-
- - ">="
|
|
37
|
-
- !ruby/object:Gem::Version
|
|
38
|
-
version: 0.1.2
|
|
39
|
-
type: :runtime
|
|
40
|
-
prerelease: false
|
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
-
requirements:
|
|
43
|
-
- - "~>"
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
version: 0.1.2
|
|
46
|
-
- - ">="
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: 0.1.2
|
|
49
29
|
- !ruby/object:Gem::Dependency
|
|
50
30
|
name: rake
|
|
51
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -192,7 +172,6 @@ files:
|
|
|
192
172
|
- lib/appoptics_apm/inst/faraday.rb
|
|
193
173
|
- lib/appoptics_apm/inst/http.rb
|
|
194
174
|
- lib/appoptics_apm/inst/httpclient.rb
|
|
195
|
-
- lib/appoptics_apm/inst/memcache.rb
|
|
196
175
|
- lib/appoptics_apm/inst/memcached.rb
|
|
197
176
|
- lib/appoptics_apm/inst/mongo.rb
|
|
198
177
|
- lib/appoptics_apm/inst/mongo2.rb
|
|
@@ -242,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
242
221
|
requirements:
|
|
243
222
|
- - ">="
|
|
244
223
|
- !ruby/object:Gem::Version
|
|
245
|
-
version:
|
|
224
|
+
version: 2.0.0
|
|
246
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
226
|
requirements:
|
|
248
227
|
- - ">="
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
|
2
|
-
# All rights reserved.
|
|
3
|
-
|
|
4
|
-
module AppOpticsAPM
|
|
5
|
-
module Inst
|
|
6
|
-
module MemCache
|
|
7
|
-
include AppOpticsAPM::API::Memcache
|
|
8
|
-
|
|
9
|
-
def self.included(cls)
|
|
10
|
-
AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting memcache' if AppOpticsAPM::Config[:verbose]
|
|
11
|
-
|
|
12
|
-
cls.class_eval do
|
|
13
|
-
MEMCACHE_OPS.reject { |m| !method_defined?(m) }.each do |m|
|
|
14
|
-
|
|
15
|
-
define_method("#{m}_with_appoptics") do |*args|
|
|
16
|
-
report_kvs = { :KVOp => m }
|
|
17
|
-
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
|
18
|
-
|
|
19
|
-
if AppOpticsAPM.tracing?
|
|
20
|
-
AppOpticsAPM::API.trace(:memcache, report_kvs) do
|
|
21
|
-
send("#{m}_without_appoptics", *args)
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
send("#{m}_without_appoptics", *args)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
class_eval "alias #{m}_without_appoptics #{m}"
|
|
29
|
-
class_eval "alias #{m} #{m}_with_appoptics"
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
[:request_setup, :cache_get, :get_multi].each do |m|
|
|
34
|
-
if ::MemCache.method_defined? :request_setup
|
|
35
|
-
cls.class_eval "alias #{m}_without_appoptics #{m}"
|
|
36
|
-
cls.class_eval "alias #{m} #{m}_with_appoptics"
|
|
37
|
-
elsif AppOpticsAPM::Config[:verbose]
|
|
38
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/loading] Couldn't properly instrument Memcache: #{m}"
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def get_multi_with_appoptics(*args)
|
|
44
|
-
return get_multi_without_appoptics(args) unless AppOpticsAPM.tracing?
|
|
45
|
-
|
|
46
|
-
info_kvs = {}
|
|
47
|
-
|
|
48
|
-
begin
|
|
49
|
-
info_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
|
50
|
-
|
|
51
|
-
if args.last.is_a?(Hash) || args.last.nil?
|
|
52
|
-
info_kvs[:KVKeyCount] = args.flatten.length - 1
|
|
53
|
-
else
|
|
54
|
-
info_kvs[:KVKeyCount] = args.flatten.length
|
|
55
|
-
end
|
|
56
|
-
rescue StandardError => e
|
|
57
|
-
AppOpticsAPM.logger.debug "[appoptics_apm/debug] Error collecting info keys: #{e.message}"
|
|
58
|
-
AppOpticsAPM.logger.debug e.backtrace
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
AppOpticsAPM::API.trace(:memcache, { :KVOp => :get_multi }, :get_multi) do
|
|
62
|
-
values = get_multi_without_appoptics(args)
|
|
63
|
-
|
|
64
|
-
info_kvs[:KVHitCount] = values.length
|
|
65
|
-
AppOpticsAPM::API.log(:memcache, :info, info_kvs)
|
|
66
|
-
|
|
67
|
-
values
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def request_setup_with_appoptics(*args)
|
|
72
|
-
if AppOpticsAPM.tracing? && !AppOpticsAPM.tracing_layer_op?(:get_multi)
|
|
73
|
-
server, cache_key = request_setup_without_appoptics(*args)
|
|
74
|
-
|
|
75
|
-
info_kvs = { :KVKey => cache_key, :RemoteHost => server.host }
|
|
76
|
-
info_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
|
77
|
-
AppOpticsAPM::API.log(:memcache, :info, info_kvs)
|
|
78
|
-
|
|
79
|
-
[server, cache_key]
|
|
80
|
-
else
|
|
81
|
-
request_setup_without_appoptics(*args)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def cache_get_with_appoptics(server, cache_key)
|
|
86
|
-
result = cache_get_without_appoptics(server, cache_key)
|
|
87
|
-
|
|
88
|
-
info_kvs = { :KVHit => memcache_hit?(result) }
|
|
89
|
-
info_kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:memcache][:collect_backtraces]
|
|
90
|
-
AppOpticsAPM::API.log(:memcache, :info, info_kvs)
|
|
91
|
-
|
|
92
|
-
result
|
|
93
|
-
end
|
|
94
|
-
end # module MemCache
|
|
95
|
-
end # module Inst
|
|
96
|
-
end # module AppOpticsAPM
|
|
97
|
-
|
|
98
|
-
if defined?(::MemCache) && AppOpticsAPM::Config[:memcache][:enabled]
|
|
99
|
-
::MemCache.class_eval do
|
|
100
|
-
include AppOpticsAPM::Inst::MemCache
|
|
101
|
-
end
|
|
102
|
-
end
|