appoptics_apm 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile_alpine +4 -5
- data/Rakefile +3 -3
- data/appoptics_apm.gemspec +2 -0
- data/bin/appoptics_apm_config +15 -0
- data/config/initializers/.keep +0 -0
- data/docker-compose.yml +22 -22
- data/ext/oboe_metal/extconf.rb +3 -2
- data/ext/oboe_metal/src/VERSION +1 -1
- data/lib/appoptics_apm.rb +3 -1
- data/lib/appoptics_apm/config.rb +82 -142
- data/lib/appoptics_apm/support.rb +1 -1
- data/lib/appoptics_apm/util.rb +3 -0
- data/lib/appoptics_apm/version.rb +1 -1
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +91 -104
- data/run_docker_build_gem_upload_to_packagecloud.sh +1 -1
- metadata +26 -4
- data/get_version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bec85d45871f627c9a17c7d4ee6e592d33b1df21
|
4
|
+
data.tar.gz: c3bfd02109828928249837b492672ec0f7f5a0e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 847a79988f646a46381ee1ca6d581e500a8aa5e156569143aee9e846ef63b2dd0ec7a9686d8dce16e6f843185d758e1a87f88fe07d003546be2147a90f6d6bab
|
7
|
+
data.tar.gz: 5969da7af7a351e23d569ca2e02338164029227a97d73885ab0e0d042ae3f029c8b18d2f5d4c20c4089fe7881c2092756f08069272237eed6be54acb6443a5f1
|
data/Dockerfile_alpine
CHANGED
@@ -32,11 +32,10 @@ RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
|
|
32
32
|
&& echo 'bundler' > ~/.rbenv/default-gems
|
33
33
|
|
34
34
|
# install rubies to build our gem against
|
35
|
-
RUN source ~/.profile
|
36
|
-
&& rbenv install 1.9.3-p551 \
|
35
|
+
RUN source ~/.profile \
|
37
36
|
&& rbenv install 2.3.1 \
|
38
|
-
&& rbenv install 2.4.1
|
39
|
-
&& rbenv install jruby-9.0.5.0
|
37
|
+
&& rbenv install 2.4.1 \
|
38
|
+
# && rbenv install jruby-9.0.5.0
|
40
39
|
|
41
40
|
# install swig 3.0.8
|
42
41
|
RUN curl -SL http://kent.dl.sourceforge.net/project/swig/swig/swig-3.0.8/swig-3.0.8.tar.gz \
|
@@ -50,7 +49,7 @@ RUN apk add --upgrade \
|
|
50
49
|
redis \
|
51
50
|
memcached \
|
52
51
|
postgresql \
|
53
|
-
openrc
|
52
|
+
openrc \
|
54
53
|
&& rc-service postgresql start \
|
55
54
|
&& echo "psql --command \"CREATE USER docker WITH SUPERUSER PASSWORD 'docker';\"" >> /tmp/config \
|
56
55
|
&& echo "createdb -O docker travis_ci_test" >> /tmp/config \
|
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'] || 'latest'
|
76
|
+
oboe_version = ENV['OBOE_VERSION'] || '2.0.10' # '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
|
|
@@ -85,7 +85,7 @@ task :fetch_ext_deps do
|
|
85
85
|
puts "fetching #{remote_file} to #{local_file}"
|
86
86
|
open(remote_file, 'rb') do |rf|
|
87
87
|
content = rf.read
|
88
|
-
File.open(local_file, 'wb') {|f| f.puts content}
|
88
|
+
File.open(local_file, 'wb') { |f| f.puts content }
|
89
89
|
end
|
90
90
|
end
|
91
91
|
FileUtils.cd(ext_src_dir) do
|
@@ -105,7 +105,7 @@ task :compile do
|
|
105
105
|
so_file = File.expand_path('ext/oboe_metal/oboe_metal.so')
|
106
106
|
|
107
107
|
Dir.chdir ext_dir
|
108
|
-
ENV['
|
108
|
+
ENV['APPOPTICS_FROM_S3'] = 'true'
|
109
109
|
cmd = [Gem.ruby, 'extconf.rb']
|
110
110
|
sh cmd.join(' ')
|
111
111
|
sh '/usr/bin/env make'
|
data/appoptics_apm.gemspec
CHANGED
@@ -29,6 +29,7 @@ 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')
|
32
33
|
|
33
34
|
# Development dependencies used in gem development & testing
|
34
35
|
s.add_development_dependency('rake', '>= 0.9.0')
|
@@ -42,4 +43,5 @@ Gem::Specification.new do |s|
|
|
42
43
|
end
|
43
44
|
|
44
45
|
s.required_ruby_version = '>= 2.0.0'
|
46
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
45
47
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
##
|
4
|
+
# execute this with `bundle exec appoptics_apm_config`
|
5
|
+
# copies the configuration template file into the current directory
|
6
|
+
#
|
7
|
+
|
8
|
+
puts "Copying the configuration template file to appoptics_apm_config_tmp.rb"
|
9
|
+
puts "Edit and save as appoptics_apm_config.rb"
|
10
|
+
|
11
|
+
target_file = File.join(Dir.pwd, 'appoptics_apm_config_tmp.rb')
|
12
|
+
temp_orig = File.join(File.dirname(File.dirname(__FILE__)),
|
13
|
+
'lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb')
|
14
|
+
|
15
|
+
FileUtils.copy(temp_orig, target_file)
|
File without changes
|
data/docker-compose.yml
CHANGED
@@ -7,7 +7,7 @@ version: "2"
|
|
7
7
|
# ('ruby_appoptics' and 'wait' will exit)
|
8
8
|
#
|
9
9
|
# to run some ruby tests:
|
10
|
-
# > docker-compose run --service-ports
|
10
|
+
# > docker-compose run --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh 2.3.6 gemfiles/rails42.gemfile
|
11
11
|
#
|
12
12
|
########################################################################################################
|
13
13
|
|
@@ -34,27 +34,27 @@ services:
|
|
34
34
|
- MYSQL_HOST=mysql
|
35
35
|
- APPOPTICS_MONGO_SERVER=mongo
|
36
36
|
|
37
|
-
ruby_appoptics_apm_alpine:
|
38
|
-
container_name: ruby_appoptics_apm_alpine
|
39
|
-
image: ruby_alpine
|
40
|
-
build:
|
41
|
-
context: .
|
42
|
-
dockerfile: ./Dockerfile_alpine
|
43
|
-
cpu_quota: 100000 # 1 cpu, assumes cpu_period of 1 second
|
44
|
-
mem_limit: 1G
|
45
|
-
volumes:
|
46
|
-
- .:/code/ruby-appoptics_apm
|
47
|
-
depends_on:
|
48
|
-
- wait
|
49
|
-
links:
|
50
|
-
- wait
|
51
|
-
environment:
|
52
|
-
- APPOPTICS_RABBITMQ_SERVER=rabbitmq
|
53
|
-
- DOCKER_MYSQL_PASS=admin
|
54
|
-
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
55
|
-
- MYSQL_ROOT_PASSWORD=admin
|
56
|
-
- MYSQL_HOST=mysql
|
57
|
-
- APPOPTICS_MONGO_SERVER=mongo
|
37
|
+
# ruby_appoptics_apm_alpine:
|
38
|
+
# container_name: ruby_appoptics_apm_alpine
|
39
|
+
# image: ruby_alpine
|
40
|
+
# build:
|
41
|
+
# context: .
|
42
|
+
# dockerfile: ./Dockerfile_alpine
|
43
|
+
# cpu_quota: 100000 # 1 cpu, assumes cpu_period of 1 second
|
44
|
+
# mem_limit: 1G
|
45
|
+
# volumes:
|
46
|
+
# - .:/code/ruby-appoptics_apm
|
47
|
+
# depends_on:
|
48
|
+
# - wait
|
49
|
+
# links:
|
50
|
+
# - wait
|
51
|
+
# environment:
|
52
|
+
# - APPOPTICS_RABBITMQ_SERVER=rabbitmq
|
53
|
+
# - DOCKER_MYSQL_PASS=admin
|
54
|
+
# - MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
55
|
+
# - MYSQL_ROOT_PASSWORD=admin
|
56
|
+
# - MYSQL_HOST=mysql
|
57
|
+
# - APPOPTICS_MONGO_SERVER=mongo
|
58
58
|
|
59
59
|
rabbitmq:
|
60
60
|
container_name: rabbitmq
|
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'mkmf'
|
5
5
|
require 'rbconfig'
|
6
6
|
require 'open-uri'
|
7
|
-
require '
|
7
|
+
require 'no_proxy_fix'
|
8
8
|
|
9
9
|
ext_dir = File.expand_path(File.dirname(__FILE__))
|
10
10
|
|
@@ -18,7 +18,7 @@ ao_include = File.join(ext_dir, 'src')
|
|
18
18
|
|
19
19
|
# Download the appropriate liboboe from S3(via rake for testing) or files.appoptics.com (production)
|
20
20
|
version = File.read(File.join(ao_include, 'VERSION')).chomp
|
21
|
-
if ENV['
|
21
|
+
if ENV['APPOPTICS_FROM_S3'].to_s.downcase == 'true'
|
22
22
|
ao_path = File.join('https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/', version)
|
23
23
|
puts "Fetching c-lib from S3"
|
24
24
|
else
|
@@ -78,6 +78,7 @@ if success
|
|
78
78
|
|
79
79
|
dir_config('oboe', 'src', 'lib')
|
80
80
|
|
81
|
+
# create Makefile
|
81
82
|
if jruby || ENV.key?('APPOPTICS_URL')
|
82
83
|
# Build the noop extension under JRuby and Heroku.
|
83
84
|
# The oboe-heroku gem builds it's own c extension which links to
|
data/ext/oboe_metal/src/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.10
|
data/lib/appoptics_apm.rb
CHANGED
@@ -46,6 +46,8 @@ begin
|
|
46
46
|
end
|
47
47
|
|
48
48
|
require 'appoptics_apm/config'
|
49
|
+
AppOpticsAPM::Config.load_config_file
|
50
|
+
|
49
51
|
require 'appoptics_apm/loading'
|
50
52
|
require 'appoptics_apm/legacy_method_profiling'
|
51
53
|
require 'appoptics_apm/method_profiling'
|
@@ -69,4 +71,4 @@ begin
|
|
69
71
|
rescue => e
|
70
72
|
$stderr.puts "[appoptics_apm/error] Problem loading: #{e.inspect}"
|
71
73
|
$stderr.puts e.backtrace
|
72
|
-
end
|
74
|
+
end
|
data/lib/appoptics_apm/config.rb
CHANGED
@@ -23,156 +23,97 @@ module AppOpticsAPM
|
|
23
23
|
@@http_clients = [:curb, :excon, :em_http_request, :faraday, :httpclient, :nethttp, :rest_client, :typhoeus]
|
24
24
|
|
25
25
|
##
|
26
|
-
#
|
26
|
+
# load_config_file
|
27
27
|
#
|
28
|
-
|
29
|
-
|
28
|
+
# There are 3 possible locations for the config file:
|
29
|
+
# Rails default, ENV['APPOPTICS_APM_CONFIG_RUBY'], or the gem's default
|
30
|
+
#
|
31
|
+
# Hierarchie:
|
32
|
+
# 1 - Rails default: config/initializers/appoptics_apm.rb
|
33
|
+
# (also loaded by Rails, but we can't reliably determine if Rails is running)
|
34
|
+
# 2 - ENV['APPOPTICS_APM_CONFIG_RUBY']
|
35
|
+
# 3 - Gem default: <startup_dir>/appoptics_apm_config.rb
|
36
|
+
#
|
37
|
+
def self.load_config_file
|
38
|
+
config_files = []
|
39
|
+
|
40
|
+
# Check for the rails config file
|
41
|
+
config_file = File.join(Dir.pwd, 'config/initializers/appoptics_apm.rb')
|
42
|
+
config_files << config_file if File.exist?(config_file)
|
43
|
+
|
44
|
+
# Check for file set by env variable
|
45
|
+
if ENV.key?('APPOPTICS_APM_CONFIG_RUBY')
|
46
|
+
if File.exist?(ENV['APPOPTICS_APM_CONFIG_RUBY']) && !File.directory?(ENV['APPOPTICS_APM_CONFIG_RUBY'])
|
47
|
+
config_files << ENV['APPOPTICS_APM_CONFIG_RUBY']
|
48
|
+
elsif File.exist?(File.join(ENV['APPOPTICS_APM_CONFIG_RUBY'], 'appoptics_apm_config.rb'))
|
49
|
+
config_files << File.join(ENV['APPOPTICS_APM_CONFIG_RUBY'], 'appoptics_apm_config.rb')
|
50
|
+
else
|
51
|
+
$stderr.puts 'Could not find the configuration file set by the APPOPTICS_APM_CONFIG_RUBY environment variable:'
|
52
|
+
$stderr.puts "#{ENV['APPOPTICS_APM_CONFIG_RUBY']}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check for default config file
|
57
|
+
config_file = File.join(Dir.pwd, 'appoptics_apm_config.rb')
|
58
|
+
config_files << config_file if File.exist?(config_file)
|
59
|
+
|
60
|
+
return if config_files.empty?
|
61
|
+
|
62
|
+
if config_files.size > 1
|
63
|
+
$stderr.puts 'Found multiple configuration files, using the first one listed:'
|
64
|
+
config_files.each { |path| $stderr.puts " #{path}" }
|
65
|
+
end
|
66
|
+
load(config_files[0])
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# print_config
|
71
|
+
#
|
72
|
+
# print configurations one per line
|
73
|
+
# to create an output similar to the content of the config file
|
74
|
+
#
|
75
|
+
def self.print_config
|
76
|
+
puts "# General configurations"
|
77
|
+
non_instrumentation = @@config.keys - @@instrumentation
|
78
|
+
non_instrumentation.each do |config|
|
79
|
+
puts "AppOpticsAPM::Config[:#{config}] = #{@@config[config]}"
|
80
|
+
end
|
81
|
+
|
82
|
+
puts "\n# Instrumentation specific configurations"
|
83
|
+
puts "# Enabled/Disabled Instrumentation"
|
84
|
+
@@instrumentation.each do |config|
|
85
|
+
puts "AppOpticsAPM::Config[:#{config}][:enabled] = #{@@config[config][:enabled]}"
|
86
|
+
end
|
87
|
+
|
88
|
+
puts "\n# Enabled/Disabled Backtrace Collection"
|
89
|
+
@@instrumentation.each do |config|
|
90
|
+
puts "AppOpticsAPM::Config[:#{config}][:collect_backtraces] = #{@@config[config][:collect_backtraces]}"
|
91
|
+
end
|
92
|
+
|
93
|
+
puts "\n# Logging of outgoing HTTP query args"
|
94
|
+
@@instrumentation.each do |config|
|
95
|
+
puts "AppOpticsAPM::Config[:#{config}][:log_args] = #{@@config[config][:log_args]}"
|
96
|
+
end
|
97
|
+
|
98
|
+
puts "\n# Bunny Controller and Action"
|
99
|
+
puts "AppOpticsAPM::Config[:bunnyconsumer][:controller] = #{@@config[:bunnyconsumer][:controller].inspect}"
|
100
|
+
puts "AppOpticsAPM::Config[:bunnyconsumer][:action] = #{@@config[:bunnyconsumer][:action].inspect}"
|
101
|
+
nil
|
30
102
|
end
|
31
103
|
|
32
104
|
##
|
33
105
|
# initialize
|
34
106
|
#
|
35
|
-
# Initializer method to set everything up with a
|
36
|
-
#
|
107
|
+
# Initializer method to set everything up with a default configuration.
|
108
|
+
# The defaults are read from the template configuration file.
|
37
109
|
#
|
38
110
|
# rubocop:disable Metrics/AbcSize
|
39
111
|
def self.initialize(_data = {})
|
40
|
-
# Setup default instrumentation values
|
41
112
|
@@instrumentation.each do |k|
|
42
113
|
@@config[k] = {}
|
43
|
-
@@config[k][:enabled] = true
|
44
|
-
@@config[k][:collect_backtraces] = false
|
45
|
-
@@config[k][:log_args] = true
|
46
114
|
end
|
47
|
-
|
48
|
-
|
49
|
-
AppOpticsAPM::Config[:em_http_request][:enabled] = false
|
50
|
-
|
51
|
-
# Set collect_backtraces defaults
|
52
|
-
AppOpticsAPM::Config[:action_controller][:collect_backtraces] = false
|
53
|
-
AppOpticsAPM::Config[:action_controller_api][:collect_backtraces] = false
|
54
|
-
AppOpticsAPM::Config[:active_record][:collect_backtraces] = true
|
55
|
-
AppOpticsAPM::Config[:bunnyclient][:collect_backtraces] = false
|
56
|
-
AppOpticsAPM::Config[:bunnyconsumer][:collect_backtraces] = false
|
57
|
-
AppOpticsAPM::Config[:action_view][:collect_backtraces] = true
|
58
|
-
AppOpticsAPM::Config[:cassandra][:collect_backtraces] = true
|
59
|
-
AppOpticsAPM::Config[:curb][:collect_backtraces] = true
|
60
|
-
AppOpticsAPM::Config[:dalli][:collect_backtraces] = false
|
61
|
-
AppOpticsAPM::Config[:delayed_jobclient][:collect_backtraces] = false
|
62
|
-
AppOpticsAPM::Config[:delayed_jobworker][:collect_backtraces] = false
|
63
|
-
AppOpticsAPM::Config[:em_http_request][:collect_backtraces] = false
|
64
|
-
AppOpticsAPM::Config[:excon][:collect_backtraces] = true
|
65
|
-
AppOpticsAPM::Config[:faraday][:collect_backtraces] = false
|
66
|
-
AppOpticsAPM::Config[:grape][:collect_backtraces] = true
|
67
|
-
AppOpticsAPM::Config[:httpclient][:collect_backtraces] = true
|
68
|
-
AppOpticsAPM::Config[:memcached][:collect_backtraces] = false
|
69
|
-
AppOpticsAPM::Config[:mongo][:collect_backtraces] = true
|
70
|
-
AppOpticsAPM::Config[:moped][:collect_backtraces] = true
|
71
|
-
AppOpticsAPM::Config[:nethttp][:collect_backtraces] = true
|
72
|
-
AppOpticsAPM::Config[:rack][:collect_backtraces] = false
|
73
|
-
AppOpticsAPM::Config[:redis][:collect_backtraces] = false
|
74
|
-
AppOpticsAPM::Config[:resqueclient][:collect_backtraces] = true
|
75
|
-
AppOpticsAPM::Config[:resqueworker][:collect_backtraces] = false
|
76
|
-
AppOpticsAPM::Config[:rest_client][:collect_backtraces] = false
|
77
|
-
AppOpticsAPM::Config[:sequel][:collect_backtraces] = true
|
78
|
-
AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces] = false
|
79
|
-
AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces] = false
|
80
|
-
AppOpticsAPM::Config[:typhoeus][:collect_backtraces] = false
|
81
|
-
|
82
|
-
# Legacy Resque config support. To be removed in a future version
|
83
|
-
@@config[:resque] = {}
|
84
|
-
|
85
|
-
# Setup an empty host blacklist (see: AppOpticsAPM::API::Util.blacklisted?)
|
86
|
-
@@config[:blacklist] = []
|
87
|
-
|
88
|
-
# Logging of outgoing HTTP query args
|
89
|
-
#
|
90
|
-
# This optionally disables the logging of query args of outgoing
|
91
|
-
# HTTP clients such as Net::HTTP, excon, typhoeus and others.
|
92
|
-
#
|
93
|
-
# This flag is global to all HTTP client instrumentation.
|
94
|
-
#
|
95
|
-
# To configure this on a per instrumentation basis, set this
|
96
|
-
# option to true and instead disable the instrumenstation specific
|
97
|
-
# option <tt>log_args</tt>:
|
98
|
-
#
|
99
|
-
# AppOpticsAPM::Config[:nethttp][:log_args] = false
|
100
|
-
# AppOpticsAPM::Config[:excon][:log_args] = false
|
101
|
-
# AppOpticsAPM::Config[:typhoeus][:log_args] = true
|
102
|
-
#
|
103
|
-
@@config[:include_url_query_params] = true
|
104
|
-
|
105
|
-
# Logging of incoming HTTP query args
|
106
|
-
#
|
107
|
-
# This optionally disables the logging of incoming URL request
|
108
|
-
# query args.
|
109
|
-
#
|
110
|
-
# This flag is global and currently only affects the Rack
|
111
|
-
# instrumentation which reports incoming request URLs and
|
112
|
-
# query args by default.
|
113
|
-
@@config[:include_remote_url_params] = true
|
114
|
-
|
115
|
-
# The AppOpticsAPM Ruby gem has the ability to sanitize query literals
|
116
|
-
# from SQL statements. By default this is enabled to
|
117
|
-
# avoid collecting and reporting query literals to AppOpticsAPM.
|
118
|
-
@@config[:sanitize_sql] = true
|
119
|
-
|
120
|
-
# The regular expression used to sanitize SQL.
|
121
|
-
@@config[:sanitize_sql_regexp] = '(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)'
|
122
|
-
@@config[:sanitize_sql_opts] = Regexp::IGNORECASE
|
123
|
-
|
124
|
-
# Do Not Trace
|
125
|
-
# These two values allow you to configure specific URL patterns to
|
126
|
-
# never be traced. By default, this is set to common static file
|
127
|
-
# extensions but you may want to customize this list for your needs.
|
128
|
-
#
|
129
|
-
# dnt_regexp and dnt_opts is passed to Regexp.new to create
|
130
|
-
# a regular expression object. That is then used to match against
|
131
|
-
# the incoming request path.
|
132
|
-
#
|
133
|
-
# The path string originates from the rack layer and is retrieved
|
134
|
-
# as follows:
|
135
|
-
#
|
136
|
-
# req = ::Rack::Request.new(env)
|
137
|
-
# path = URI.unescape(req.path)
|
138
|
-
#
|
139
|
-
# Usage:
|
140
|
-
# AppOpticsAPM::Config[:dnt_regexp] = "lobster$"
|
141
|
-
# AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
142
|
-
#
|
143
|
-
# This will ignore all requests that end with the string lobster
|
144
|
-
# regardless of case
|
145
|
-
#
|
146
|
-
# Requests with positive matches (non nil) will not be traced.
|
147
|
-
# See lib/appoptics_apm/util.rb: AppOpticsAPM::Util.static_asset?
|
148
|
-
#
|
149
|
-
@@config[:dnt_regexp] = '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|otf|eot|ttf|woff|woff2|svg|less)(\?.+){0,1}$'
|
150
|
-
@@config[:dnt_opts] = Regexp::IGNORECASE
|
151
|
-
|
152
|
-
# In Rails, raised exceptions with rescue handlers via
|
153
|
-
# <tt>rescue_from</tt> are not reported to the AppOptics
|
154
|
-
# dashboard by default. Setting this value to true will
|
155
|
-
# report all raised exception regardless.
|
156
|
-
#
|
157
|
-
@@config[:report_rescued_errors] = false
|
158
|
-
|
159
|
-
# The bunny (Rabbitmq) instrumentation can optionally report
|
160
|
-
# Controller and Action values to allow filtering of bunny
|
161
|
-
# message handling in # the UI. Use of Controller and Action
|
162
|
-
# for filters is temporary until the UI is updated with
|
163
|
-
# additional filters.
|
164
|
-
#
|
165
|
-
# These values identify which properties of
|
166
|
-
# Bunny::MessageProperties to report as Controller
|
167
|
-
# and Action. The defaults are to report :app_id (as
|
168
|
-
# Controller) and :type (as Action). If these values
|
169
|
-
# are not specified in the publish, then nothing
|
170
|
-
# will be reported here.
|
171
|
-
#
|
172
|
-
@@config[:bunnyconsumer][:controller] = :app_id
|
173
|
-
@@config[:bunnyconsumer][:action] = :type
|
174
|
-
|
175
|
-
@@config[:verbose] = ENV.key?('APPOPTICS_GEM_VERBOSE') && ENV['APPOPTICS_GEM_VERBOSE'] == 'true' ? true : false
|
115
|
+
load(File.join(File.dirname(File.dirname(__FILE__)),
|
116
|
+
'rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb'))
|
176
117
|
end
|
177
118
|
# rubocop:enable Metrics/AbcSize
|
178
119
|
|
@@ -235,21 +176,20 @@ module AppOpticsAPM
|
|
235
176
|
AppOpticsAPM.logger.warn "[appoptics_apm/config] :resque config is deprecated. It is now split into :resqueclient and :resqueworker."
|
236
177
|
AppOpticsAPM.logger.warn "[appoptics_apm/config] Called from #{Kernel.caller[0]}"
|
237
178
|
|
238
|
-
elsif key == :include_url_query_params
|
179
|
+
elsif key == :include_url_query_params # DEPRECATED
|
239
180
|
# Obey the global flag and update all of the per instrumentation
|
240
181
|
# <tt>:log_args</tt> values.
|
241
182
|
@@config[:rack][:log_args] = value
|
242
183
|
|
243
|
-
elsif key == :include_remote_url_params
|
184
|
+
elsif key == :include_remote_url_params # DEPRECATED
|
244
185
|
# Obey the global flag and update all of the per instrumentation
|
245
186
|
# <tt>:log_args</tt> values.
|
246
187
|
@@http_clients.each do |i|
|
247
188
|
@@config[i][:log_args] = value
|
248
189
|
end
|
249
|
-
end
|
250
190
|
|
251
191
|
# Update liboboe if updating :tracing_mode
|
252
|
-
|
192
|
+
elsif key == :tracing_mode
|
253
193
|
AppOpticsAPM.set_tracing_mode(value.to_sym) if AppOpticsAPM.loaded
|
254
194
|
|
255
195
|
# Make sure that the mode is stored as a symbol
|
@@ -100,7 +100,7 @@ module AppOpticsAPM
|
|
100
100
|
AppOpticsAPM.logger.warn '********************************************************'
|
101
101
|
AppOpticsAPM.logger.warn '* AppOpticsAPM::Config Values'
|
102
102
|
AppOpticsAPM.logger.warn '********************************************************'
|
103
|
-
AppOpticsAPM::Config.
|
103
|
+
AppOpticsAPM::Config.config.each { |k,v|
|
104
104
|
AppOpticsAPM.logger.warn "#{k}: #{v}"
|
105
105
|
}
|
106
106
|
|
data/lib/appoptics_apm/util.rb
CHANGED
@@ -105,6 +105,9 @@ 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
|
108
111
|
end
|
109
112
|
|
110
113
|
##
|
@@ -3,6 +3,8 @@
|
|
3
3
|
#
|
4
4
|
# More information on instrumenting Ruby applications can be found here:
|
5
5
|
# https://docs.appoptics.com/kb/apm_tracing/ruby/
|
6
|
+
#
|
7
|
+
# The settings in this template file represent the defaults
|
6
8
|
|
7
9
|
if defined?(AppOpticsAPM::Config)
|
8
10
|
|
@@ -18,37 +20,8 @@ if defined?(AppOpticsAPM::Config)
|
|
18
20
|
#
|
19
21
|
# Verbose output of instrumentation initialization
|
20
22
|
#
|
21
|
-
|
22
|
-
#
|
23
|
-
|
24
|
-
#
|
25
|
-
# Logging of incoming HTTP query args
|
26
|
-
#
|
27
|
-
# This optionally disables the logging of incoming URL request
|
28
|
-
# query args.
|
29
|
-
#
|
30
|
-
# This flag is global and currently only affects the Rack
|
31
|
-
# instrumentation which reports incoming request URLs and
|
32
|
-
# query args by default.
|
33
|
-
AppOpticsAPM::Config[:include_remote_url_params] = true
|
34
|
-
|
35
|
-
#
|
36
|
-
# Logging of outgoing HTTP query args
|
37
|
-
#
|
38
|
-
# This optionally disables the logging of query args of outgoing
|
39
|
-
# HTTP clients such as Net::HTTP, excon, typhoeus and others.
|
40
|
-
#
|
41
|
-
# This flag is global to all HTTP client instrumentation.
|
42
|
-
#
|
43
|
-
# To configure this on a per instrumentation basis, set this
|
44
|
-
# option to true and instead disable the instrumentation specific
|
45
|
-
# option <tt>log_args</tt>:
|
46
|
-
#
|
47
|
-
# AppOpticsAPM::Config[:nethttp][:log_args] = false
|
48
|
-
# AppOpticsAPM::Config[:excon][:log_args] = false
|
49
|
-
# AppOpticsAPM::Config[:typhoeus][:log_args] = true
|
23
|
+
AppOpticsAPM::Config[:verbose] = ENV.key?('APPOPTICS_GEM_VERBOSE') && ENV['APPOPTICS_GEM_VERBOSE'] == 'true' ? true : false
|
50
24
|
#
|
51
|
-
AppOpticsAPM::Config[:include_url_query_params] = true
|
52
25
|
|
53
26
|
#
|
54
27
|
# Sanitize SQL Statements
|
@@ -57,9 +30,11 @@ if defined?(AppOpticsAPM::Config)
|
|
57
30
|
# from SQL statements. By default this is enabled. Disable to
|
58
31
|
# collect and report query literals to AppOpticsAPM.
|
59
32
|
#
|
60
|
-
|
61
|
-
|
33
|
+
AppOpticsAPM::Config[:sanitize_sql] = true
|
34
|
+
AppOpticsAPM::Config[:sanitize_sql_regexp] = '(\'[\s\S][^\']*\'|\d*\.\d+|\d+|NULL)'
|
35
|
+
AppOpticsAPM::Config[:sanitize_sql_opts] = Regexp::IGNORECASE
|
62
36
|
|
37
|
+
#
|
63
38
|
# Do Not Trace
|
64
39
|
# These two values allow you to configure specific URL patterns to
|
65
40
|
# never be traced. By default, this is set to common static file
|
@@ -85,8 +60,8 @@ if defined?(AppOpticsAPM::Config)
|
|
85
60
|
# Requests with positive matches (non nil) will not be traced.
|
86
61
|
# See lib/appoptics_apm/util.rb: AppOpticsAPM::Util.static_asset?
|
87
62
|
#
|
88
|
-
|
89
|
-
|
63
|
+
AppOpticsAPM::Config[:dnt_regexp] = '\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|otf|eot|ttf|woff|woff2|svg|less)(\?.+){0,1}$'
|
64
|
+
AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
90
65
|
|
91
66
|
#
|
92
67
|
# Blacklist urls
|
@@ -99,7 +74,7 @@ if defined?(AppOpticsAPM::Config)
|
|
99
74
|
#
|
100
75
|
# Example: AppOpticsAPM::Config[:blacklist] = ['google.com']
|
101
76
|
#
|
102
|
-
|
77
|
+
AppOpticsAPM::Config[:blacklist] = []
|
103
78
|
#
|
104
79
|
|
105
80
|
#
|
@@ -110,7 +85,7 @@ if defined?(AppOpticsAPM::Config)
|
|
110
85
|
# dashboard by default. Setting this value to true will
|
111
86
|
# report all raised exception regardless.
|
112
87
|
#
|
113
|
-
|
88
|
+
AppOpticsAPM::Config[:report_rescued_errors] = false
|
114
89
|
#
|
115
90
|
|
116
91
|
#
|
@@ -129,54 +104,66 @@ if defined?(AppOpticsAPM::Config)
|
|
129
104
|
# are not specified in the publish, then nothing
|
130
105
|
# will be reported here.
|
131
106
|
#
|
132
|
-
|
133
|
-
|
107
|
+
AppOpticsAPM::Config[:bunnyconsumer][:controller] = :app_id
|
108
|
+
AppOpticsAPM::Config[:bunnyconsumer][:action] = :type
|
134
109
|
#
|
135
110
|
|
136
111
|
#
|
137
|
-
#
|
112
|
+
# Enabling/Disabling Instrumentation
|
138
113
|
#
|
139
|
-
#
|
114
|
+
# If you're having trouble with one of the instrumentation libraries, they
|
115
|
+
# can be individually disabled here by setting the :enabled
|
116
|
+
# value to false:
|
140
117
|
#
|
141
|
-
|
142
|
-
|
118
|
+
AppOpticsAPM::Config[:action_controller][:enabled] = true
|
119
|
+
AppOpticsAPM::Config[:action_controller_api][:enabled] = true
|
120
|
+
AppOpticsAPM::Config[:action_view][:enabled] = true
|
121
|
+
AppOpticsAPM::Config[:active_record][:enabled] = true
|
122
|
+
AppOpticsAPM::Config[:bunnyclient][:enabled] = true
|
123
|
+
AppOpticsAPM::Config[:bunnyconsumer][:enabled] = true
|
124
|
+
AppOpticsAPM::Config[:cassandra][:enabled] = true
|
125
|
+
AppOpticsAPM::Config[:curb][:enabled] = true
|
126
|
+
AppOpticsAPM::Config[:dalli][:enabled] = true
|
127
|
+
AppOpticsAPM::Config[:delayed_jobclient][:enabled] = true
|
128
|
+
AppOpticsAPM::Config[:delayed_jobworker][:enabled] = true
|
129
|
+
AppOpticsAPM::Config[:em_http_request][:enabled] = false
|
130
|
+
AppOpticsAPM::Config[:excon][:enabled] = true
|
131
|
+
AppOpticsAPM::Config[:faraday][:enabled] = true
|
132
|
+
AppOpticsAPM::Config[:grape][:enabled] = true
|
133
|
+
AppOpticsAPM::Config[:httpclient][:enabled] = true
|
134
|
+
AppOpticsAPM::Config[:memcached][:enabled] = true
|
135
|
+
AppOpticsAPM::Config[:mongo][:enabled] = true
|
136
|
+
AppOpticsAPM::Config[:moped][:enabled] = true
|
137
|
+
AppOpticsAPM::Config[:nethttp][:enabled] = true
|
138
|
+
AppOpticsAPM::Config[:rack][:enabled] = true
|
139
|
+
AppOpticsAPM::Config[:redis][:enabled] = true
|
140
|
+
AppOpticsAPM::Config[:resqueclient][:enabled] = true
|
141
|
+
AppOpticsAPM::Config[:resqueworker][:enabled] = true
|
142
|
+
AppOpticsAPM::Config[:rest_client][:enabled] = true
|
143
|
+
AppOpticsAPM::Config[:sequel][:enabled] = true
|
144
|
+
AppOpticsAPM::Config[:sidekiqclient][:enabled] = true
|
145
|
+
AppOpticsAPM::Config[:sidekiqworker][:enabled] = true
|
146
|
+
AppOpticsAPM::Config[:typhoeus][:enabled] = true
|
143
147
|
#
|
144
148
|
|
145
149
|
#
|
146
|
-
#
|
150
|
+
# Argument logging
|
147
151
|
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
# value to false:
|
152
|
+
# for http requests
|
153
|
+
# Set to true to enable argument logging
|
151
154
|
#
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
# AppOpticsAPM::Config[:excon][:enabled] = true
|
165
|
-
# AppOpticsAPM::Config[:faraday][:enabled] = true
|
166
|
-
# AppOpticsAPM::Config[:grape][:enabled] = true
|
167
|
-
# AppOpticsAPM::Config[:httpclient][:enabled] = true
|
168
|
-
# AppOpticsAPM::Config[:memcached][:enabled] = true
|
169
|
-
# AppOpticsAPM::Config[:mongo][:enabled] = true
|
170
|
-
# AppOpticsAPM::Config[:moped][:enabled] = true
|
171
|
-
# AppOpticsAPM::Config[:nethttp][:enabled] = true
|
172
|
-
# AppOpticsAPM::Config[:redis][:enabled] = true
|
173
|
-
# AppOpticsAPM::Config[:resqueclient][:enabled] = true
|
174
|
-
# AppOpticsAPM::Config[:resqueworker][:enabled] = true
|
175
|
-
# AppOpticsAPM::Config[:rest_client][:enabled] = true
|
176
|
-
# AppOpticsAPM::Config[:sequel][:enabled] = true
|
177
|
-
# AppOpticsAPM::Config[:sidekiqclient][:enabled] = true
|
178
|
-
# AppOpticsAPM::Config[:sidekiqworker][:enabled] = true
|
179
|
-
# AppOpticsAPM::Config[:typhoeus][:enabled] = true
|
155
|
+
AppOpticsAPM::Config[:bunnyconsumer][:log_args] = true
|
156
|
+
AppOpticsAPM::Config[:curb][:log_args] = true
|
157
|
+
AppOpticsAPM::Config[:excon][:log_args] = true
|
158
|
+
AppOpticsAPM::Config[:httpclient][:log_args] = true
|
159
|
+
AppOpticsAPM::Config[:mongo][:log_args] = true
|
160
|
+
AppOpticsAPM::Config[:nethttp][:log_args] = true
|
161
|
+
AppOpticsAPM::Config[:rack][:log_args] = true
|
162
|
+
AppOpticsAPM::Config[:resqueclient][:log_args] = true
|
163
|
+
AppOpticsAPM::Config[:resqueworker][:log_args] = true
|
164
|
+
AppOpticsAPM::Config[:sidekiqclient][:log_args] = true
|
165
|
+
AppOpticsAPM::Config[:sidekiqworker][:log_args] = true
|
166
|
+
AppOpticsAPM::Config[:typhoeus][:log_args] = true
|
180
167
|
#
|
181
168
|
|
182
169
|
#
|
@@ -187,34 +174,34 @@ if defined?(AppOpticsAPM::Config)
|
|
187
174
|
# performance but can be useful when trying to locate the source of
|
188
175
|
# a certain call or operation.
|
189
176
|
#
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
177
|
+
AppOpticsAPM::Config[:action_controller][:collect_backtraces] = true
|
178
|
+
AppOpticsAPM::Config[:action_controller_api][:collect_backtraces] = true
|
179
|
+
AppOpticsAPM::Config[:action_view][:collect_backtraces] = true
|
180
|
+
AppOpticsAPM::Config[:active_record][:collect_backtraces] = true
|
181
|
+
AppOpticsAPM::Config[:bunnyclient][:collect_backtraces] = false
|
182
|
+
AppOpticsAPM::Config[:bunnyconsumer][:collect_backtraces] = false
|
183
|
+
AppOpticsAPM::Config[:cassandra][:collect_backtraces] = true
|
184
|
+
AppOpticsAPM::Config[:curb][:collect_backtraces] = true
|
185
|
+
AppOpticsAPM::Config[:dalli][:collect_backtraces] = false
|
186
|
+
AppOpticsAPM::Config[:delayed_jobclient][:collect_backtraces] = false
|
187
|
+
AppOpticsAPM::Config[:delayed_jobworker][:collect_backtraces] = false
|
188
|
+
AppOpticsAPM::Config[:em_http_request][:collect_backtraces] = true
|
189
|
+
AppOpticsAPM::Config[:excon][:collect_backtraces] = true
|
190
|
+
AppOpticsAPM::Config[:faraday][:collect_backtraces] = false
|
191
|
+
AppOpticsAPM::Config[:grape][:collect_backtraces] = true
|
192
|
+
AppOpticsAPM::Config[:httpclient][:collect_backtraces] = true
|
193
|
+
AppOpticsAPM::Config[:memcached][:collect_backtraces] = false
|
194
|
+
AppOpticsAPM::Config[:mongo][:collect_backtraces] = true
|
195
|
+
AppOpticsAPM::Config[:moped][:collect_backtraces] = true
|
196
|
+
AppOpticsAPM::Config[:nethttp][:collect_backtraces] = true
|
197
|
+
AppOpticsAPM::Config[:rack][:collect_backtraces] = true
|
198
|
+
AppOpticsAPM::Config[:redis][:collect_backtraces] = false
|
199
|
+
AppOpticsAPM::Config[:resqueclient][:collect_backtraces] = true
|
200
|
+
AppOpticsAPM::Config[:resqueworker][:collect_backtraces] = true
|
201
|
+
AppOpticsAPM::Config[:rest_client][:collect_backtraces] = true
|
202
|
+
AppOpticsAPM::Config[:sequel][:collect_backtraces] = true
|
203
|
+
AppOpticsAPM::Config[:sidekiqclient][:collect_backtraces] = false
|
204
|
+
AppOpticsAPM::Config[:sidekiqworker][:collect_backtraces] = false
|
205
|
+
AppOpticsAPM::Config[:typhoeus][:collect_backtraces] = false
|
206
|
+
|
220
207
|
end
|
@@ -6,7 +6,7 @@ docker build -f Dockerfile -t buildgem .
|
|
6
6
|
# build the gems in the image
|
7
7
|
docker run --rm -v `pwd`:/code/ruby-appoptics_apm buildgem bash -l -c 'cd /code/ruby-appoptics_apm && ./build_gems.sh'
|
8
8
|
|
9
|
-
# save current rbenv setting and switch to 2.4.
|
9
|
+
# save current rbenv setting and switch to 2.4.3 for the package_cloud commands
|
10
10
|
current_ruby=`rbenv local`
|
11
11
|
rbenv local 2.4.1
|
12
12
|
|
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.1.
|
4
|
+
version: 4.1.1
|
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-05-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -26,6 +26,26 @@ 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
|
29
49
|
- !ruby/object:Gem::Dependency
|
30
50
|
name: rake
|
31
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +105,8 @@ dependencies:
|
|
85
105
|
description: The AppOpticsAPM gem provides performance instrumentation for MRI Ruby
|
86
106
|
and related frameworks.
|
87
107
|
email: support@appoptics.com
|
88
|
-
executables:
|
108
|
+
executables:
|
109
|
+
- appoptics_apm_config
|
89
110
|
extensions:
|
90
111
|
- ext/oboe_metal/extconf.rb
|
91
112
|
extra_rdoc_files:
|
@@ -108,7 +129,9 @@ files:
|
|
108
129
|
- Rakefile
|
109
130
|
- Vagrantfile
|
110
131
|
- appoptics_apm.gemspec
|
132
|
+
- bin/appoptics_apm_config
|
111
133
|
- build_gems.sh
|
134
|
+
- config/initializers/.keep
|
112
135
|
- docker-compose.yml
|
113
136
|
- examples/DNT.md
|
114
137
|
- examples/carrying_context.rb
|
@@ -129,7 +152,6 @@ files:
|
|
129
152
|
- ext/oboe_metal/src/oboe_debug.h
|
130
153
|
- ext/oboe_metal/src/oboe_wrap.cxx
|
131
154
|
- ext/oboe_metal/tests/test.rb
|
132
|
-
- get_version.rb
|
133
155
|
- init.rb
|
134
156
|
- lib/appoptics_apm.rb
|
135
157
|
- lib/appoptics_apm/api.rb
|