appoptics_apm 4.5.2 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -4
- data/Gemfile +3 -3
- data/README.md +3 -3
- data/Rakefile +9 -11
- data/appoptics_apm.gemspec +2 -4
- data/build_gem_upload_to_packagecloud.sh +2 -1
- data/examples/SDK/01_basic_tracing.rb +2 -1
- data/ext/oboe_metal/src/VERSION +1 -1
- data/lib/appoptics_apm.rb +2 -1
- data/lib/appoptics_apm/api/layerinit.rb +1 -1
- data/lib/appoptics_apm/api/logging.rb +75 -73
- data/lib/appoptics_apm/base.rb +13 -9
- data/lib/appoptics_apm/config.rb +33 -6
- data/lib/appoptics_apm/inst/curb.rb +2 -0
- data/lib/appoptics_apm/inst/rack.rb +68 -92
- data/lib/appoptics_apm/logger.rb +29 -27
- data/lib/appoptics_apm/sdk/tracing.rb +1 -0
- data/lib/appoptics_apm/support/transaction_metrics.rb +66 -0
- data/lib/appoptics_apm/support/transaction_settings.rb +186 -0
- data/lib/appoptics_apm/{support.rb → support_report.rb} +0 -0
- data/lib/appoptics_apm/test.rb +2 -2
- data/lib/appoptics_apm/util.rb +21 -15
- data/lib/appoptics_apm/version.rb +2 -2
- data/lib/appoptics_apm/xtrace.rb +2 -3
- data/lib/joboe_metal.rb +2 -2
- data/lib/oboe_metal.rb +5 -5
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +64 -25
- metadata +12 -24
File without changes
|
data/lib/appoptics_apm/test.rb
CHANGED
@@ -69,7 +69,7 @@ module AppOpticsAPM
|
|
69
69
|
if ENV.key?('TRAVIS_MYSQL_PASS')
|
70
70
|
ENV['DATABASE_URL'] = "mysql://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test"
|
71
71
|
elsif ENV.key?('DOCKER_MYSQL_PASS')
|
72
|
-
ENV['DATABASE_URL'] = "mysql://root:#{ENV['DOCKER_MYSQL_PASS']}
|
72
|
+
ENV['DATABASE_URL'] = "mysql://root:#{ENV['DOCKER_MYSQL_PASS']}@#{ENV['MYSQL_HOST']}:3306/travis_ci_test"
|
73
73
|
else
|
74
74
|
ENV['DATABASE_URL'] = 'mysql://root@127.0.0.1:3306/travis_ci_test'
|
75
75
|
end
|
@@ -84,7 +84,7 @@ module AppOpticsAPM
|
|
84
84
|
if ENV.key?('TRAVIS_MYSQL_PASS')
|
85
85
|
ENV['DATABASE_URL'] = "mysql2://root:#{ENV['TRAVIS_MYSQL_PASS']}@127.0.0.1:3306/travis_ci_test"
|
86
86
|
elsif ENV.key?('DOCKER_MYSQL_PASS')
|
87
|
-
ENV['DATABASE_URL'] = "mysql2://root:#{ENV['DOCKER_MYSQL_PASS']}
|
87
|
+
ENV['DATABASE_URL'] = "mysql2://root:#{ENV['DOCKER_MYSQL_PASS']}@#{ENV['MYSQL_HOST']}:3306/travis_ci_test"
|
88
88
|
else
|
89
89
|
ENV['DATABASE_URL'] = 'mysql2://root@127.0.0.1:3306/travis_ci_test'
|
90
90
|
end
|
data/lib/appoptics_apm/util.rb
CHANGED
@@ -97,19 +97,6 @@ module AppOpticsAPM
|
|
97
97
|
target_cls.send(:include, cls) if defined?(target_cls)
|
98
98
|
end
|
99
99
|
|
100
|
-
##
|
101
|
-
# static_asset?
|
102
|
-
#
|
103
|
-
# Given a path, this method determines whether it is a static asset or not (based
|
104
|
-
# solely on filename)
|
105
|
-
#
|
106
|
-
def static_asset?(path)
|
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
|
-
end
|
112
|
-
|
113
100
|
##
|
114
101
|
# prettify
|
115
102
|
#
|
@@ -173,6 +160,25 @@ module AppOpticsAPM
|
|
173
160
|
sql.gsub(/\\\'/,'').gsub(regexp, '?')
|
174
161
|
end
|
175
162
|
|
163
|
+
##
|
164
|
+
# deep_dup
|
165
|
+
#
|
166
|
+
# deep duplicate of array or hash
|
167
|
+
#
|
168
|
+
def deep_dup(obj)
|
169
|
+
if obj.is_a? Array
|
170
|
+
new_obj = []
|
171
|
+
obj.each do |v|
|
172
|
+
new_obj << deep_dup(v)
|
173
|
+
end
|
174
|
+
elsif obj.is_a? Hash
|
175
|
+
new_obj = {}
|
176
|
+
obj.each_pair do |key, value|
|
177
|
+
new_obj[key] = deep_dup(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
176
182
|
##
|
177
183
|
# legacy_build_init_report
|
178
184
|
#
|
@@ -186,7 +192,7 @@ module AppOpticsAPM
|
|
186
192
|
#
|
187
193
|
# @deprecated Please use {#build_init_report} instead
|
188
194
|
def legacy_build_init_report
|
189
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/
|
195
|
+
AppOpticsAPM.logger.warn '[appoptics_apm/deprecated] Oboe::API will be deprecated in a future version.'
|
190
196
|
platform_info = {}
|
191
197
|
|
192
198
|
begin
|
@@ -243,7 +249,7 @@ module AppOpticsAPM
|
|
243
249
|
|
244
250
|
platform_info['Error'] = "Error in legacy_build_init_report: #{e.message}"
|
245
251
|
|
246
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/
|
252
|
+
AppOpticsAPM.logger.warn "[appoptics_apm/legacy] Error in legacy_build_init_report: #{e.message}"
|
247
253
|
AppOpticsAPM.logger.debug e.backtrace
|
248
254
|
end
|
249
255
|
platform_info
|
data/lib/appoptics_apm/xtrace.rb
CHANGED
@@ -81,9 +81,8 @@ module AppOpticsAPM
|
|
81
81
|
# Remote requests can return a X-Trace header in which case we want
|
82
82
|
# to pickup on and continue the context in most cases.
|
83
83
|
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
# @finish is the context returned to us (as an HTTP response header
|
84
|
+
# +start+ is the context just before the outgoing request
|
85
|
+
# +finish+ is the context returned to us (as an HTTP response header
|
87
86
|
# if that be the case)
|
88
87
|
#
|
89
88
|
def continue_service_context(start, finish)
|
data/lib/joboe_metal.rb
CHANGED
@@ -66,9 +66,9 @@ module Oboe_metal
|
|
66
66
|
cfg = LayerUtil.getLocalSampleRate(nil, nil)
|
67
67
|
|
68
68
|
if cfg.hasSampleStartFlag
|
69
|
-
AppOpticsAPM::Config.tracing_mode = :
|
69
|
+
AppOpticsAPM::Config.tracing_mode = :enabled
|
70
70
|
else
|
71
|
-
AppOpticsAPM::Config.tracing_mode = :
|
71
|
+
AppOpticsAPM::Config.tracing_mode = :disabled
|
72
72
|
end
|
73
73
|
|
74
74
|
AppOpticsAPM.sample_rate = cfg.getSampleRate
|
data/lib/oboe_metal.rb
CHANGED
@@ -172,15 +172,15 @@ module AppOpticsAPM
|
|
172
172
|
value = mode.to_sym
|
173
173
|
|
174
174
|
case value
|
175
|
-
when :never
|
176
|
-
AppOpticsAPM::Context.setTracingMode(
|
175
|
+
when :disabled, :never
|
176
|
+
AppOpticsAPM::Context.setTracingMode(APPOPTICS_TRACE_DISABLED)
|
177
177
|
|
178
|
-
when :always
|
179
|
-
AppOpticsAPM::Context.setTracingMode(
|
178
|
+
when :enabled, :always
|
179
|
+
AppOpticsAPM::Context.setTracingMode(APPOPTICS_TRACE_ENABLED)
|
180
180
|
|
181
181
|
else
|
182
182
|
AppOpticsAPM.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
|
183
|
-
AppOpticsAPM::Context.setTracingMode(
|
183
|
+
AppOpticsAPM::Context.setTracingMode(APPOPTICS_TRACE_DISABLED)
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
@@ -11,7 +11,7 @@ if defined?(AppOpticsAPM::Config)
|
|
11
11
|
# :service_key, :hostname_alias, and :debug_level are startup settings and can't be changed afterwards.
|
12
12
|
#
|
13
13
|
# Set APPOPTICS_SERVICE_KEY
|
14
|
-
# This
|
14
|
+
# This setting will be overridden if APPOPTICS_SERVICE_KEY is set as an environment variable.
|
15
15
|
# This is a required setting. If the service key is not set here it needs to be set as environment variable.
|
16
16
|
#
|
17
17
|
# The service key is a combination of the API token plus a service name.
|
@@ -21,7 +21,7 @@ if defined?(AppOpticsAPM::Config)
|
|
21
21
|
|
22
22
|
#
|
23
23
|
# Set APPOPTICS_HOSTNAME_ALIAS
|
24
|
-
# This
|
24
|
+
# This setting will be overridden if APPOPTICS_HOSTNAME_ALIAS is set as an environment variable
|
25
25
|
#
|
26
26
|
# AppOpticsAPM::Config[:hostname_alias] = 'alias_name'
|
27
27
|
|
@@ -42,7 +42,7 @@ if defined?(AppOpticsAPM::Config)
|
|
42
42
|
|
43
43
|
#
|
44
44
|
# Set APPOPTICS_GEM_VERBOSE
|
45
|
-
# This
|
45
|
+
# This setting will be overridden if APPOPTICS_GEM_VERBOSE is set as an environment variable
|
46
46
|
#
|
47
47
|
# On startup the components that are being instrumented will be reported if this is set to true.
|
48
48
|
# If true and the log level is 4 or higher this may create extra debug log messages
|
@@ -52,11 +52,13 @@ if defined?(AppOpticsAPM::Config)
|
|
52
52
|
#
|
53
53
|
# Turn tracing on or off
|
54
54
|
#
|
55
|
-
# By default tracing is set to
|
56
|
-
#
|
57
|
-
# sampling rate.
|
55
|
+
# By default tracing is set to :enabled, the other option is :disabled.
|
56
|
+
# :enabled means that sampling will be done according to the current
|
57
|
+
# sampling rate. :disabled means that there is no sampling.
|
58
58
|
#
|
59
|
-
|
59
|
+
# The values :always and :never are deprecated
|
60
|
+
#
|
61
|
+
AppOpticsAPM::Config[:tracing_mode] = :enabled
|
60
62
|
|
61
63
|
#
|
62
64
|
# Prepend domain to transaction name
|
@@ -80,33 +82,70 @@ if defined?(AppOpticsAPM::Config)
|
|
80
82
|
|
81
83
|
#
|
82
84
|
# Do Not Trace - DNT
|
83
|
-
# 'dnt_regexp' and 'dnt_opts' allow you to configure specific URL patterns
|
84
|
-
# to never be traced. By default, this is set to common static file
|
85
|
-
# extensions but you may want to customize this list for your needs.
|
86
|
-
# Examples of such files may be images, javascript, pdfs, and text files.
|
87
85
|
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
# the
|
86
|
+
# DEPRECATED
|
87
|
+
# Please comment out if no filtering is desired, e.g. your static
|
88
|
+
# assets are served by the web server and not the application
|
89
|
+
#
|
90
|
+
# This configuration allows creating a regexp for paths for which no metrics or
|
91
|
+
# traces should get recorded. These requests should not include transactions
|
92
|
+
# with outbound calls, for which metrics and traces aren't desired either.
|
93
|
+
#
|
94
|
+
# For example:
|
95
|
+
# - static assets that aren't served by the web server, or
|
96
|
+
# - healthcheck endpoints that respond to a heart beat.
|
97
|
+
#
|
98
|
+
# :dnt_regexp is the regular expression that is applied to the incoming path
|
99
|
+
# to determine whether the request should be measured and traced or not.
|
91
100
|
#
|
92
|
-
#
|
93
|
-
# as follows:
|
101
|
+
# :dnt_opts can be commented out, nil, or Regexp::IGNORECASE
|
94
102
|
#
|
103
|
+
# The matching happens before routes are applied.
|
104
|
+
# The path originates from the rack layer and is retrieved as follows:
|
95
105
|
# req = ::Rack::Request.new(env)
|
96
106
|
# path = URI.unescape(req.path)
|
97
107
|
#
|
98
|
-
|
99
|
-
|
100
|
-
# AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
108
|
+
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}$'
|
109
|
+
AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
101
110
|
#
|
102
|
-
|
103
|
-
# regardless of case
|
111
|
+
|
104
112
|
#
|
105
|
-
#
|
106
|
-
#
|
113
|
+
# Transaction Settings
|
114
|
+
#
|
115
|
+
# Use this configuration to add exceptions to the global tracing mode and
|
116
|
+
# disable/enable metrics and traces for certain transactions.
|
117
|
+
#
|
118
|
+
# Currently allowed hash keys:
|
119
|
+
# :url to apply listed filters to urls.
|
120
|
+
# The matching of settings to urls happens before routes are applied.
|
121
|
+
# The url is extracted from the env argument passed to rack: `env['PATH_INFO']`
|
122
|
+
#
|
123
|
+
# :extensions takes an array of strings for filtering (not regular expressions!)
|
124
|
+
# :regexp is a regular expression that is applied to the incoming path
|
125
|
+
# :opts (optional) nil(default) or Regexp::IGNORECASE (options for regexp)
|
126
|
+
# :tracing defaults to :disabled, can be set to :enabled to override
|
127
|
+
# the global :disabled setting
|
128
|
+
#
|
129
|
+
# Be careful not to add too many :regexp configurations as they will slow
|
130
|
+
# down execution.
|
131
|
+
#
|
132
|
+
AppOpticsAPM::Config[:transaction_settings] = {
|
133
|
+
url: [
|
134
|
+
# {
|
135
|
+
# extensions: %w['long_job'],
|
136
|
+
# tracing: :disabled
|
137
|
+
# },
|
138
|
+
# {
|
139
|
+
# regexp: '^.*\/long_job\/.*$',
|
140
|
+
# opts: Regexp::IGNORECASE,
|
141
|
+
# tracing: :disabled
|
142
|
+
# },
|
143
|
+
# {
|
144
|
+
# regexp: /batch/,
|
145
|
+
# }
|
146
|
+
]
|
147
|
+
}
|
107
148
|
#
|
108
|
-
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}$'
|
109
|
-
AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
|
110
149
|
|
111
150
|
#
|
112
151
|
# Blacklist urls
|
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.
|
4
|
+
version: 4.6.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: 2019-
|
13
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -75,47 +75,33 @@ dependencies:
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 8.0.0
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
79
|
-
requirement: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 0.10.0
|
84
|
-
type: :development
|
85
|
-
prerelease: false
|
86
|
-
version_requirements: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 0.10.0
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: pry-byebug
|
78
|
+
name: minitest-hooks
|
93
79
|
requirement: !ruby/object:Gem::Requirement
|
94
80
|
requirements:
|
95
81
|
- - ">="
|
96
82
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
83
|
+
version: 1.5.0
|
98
84
|
type: :development
|
99
85
|
prerelease: false
|
100
86
|
version_requirements: !ruby/object:Gem::Requirement
|
101
87
|
requirements:
|
102
88
|
- - ">="
|
103
89
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
90
|
+
version: 1.5.0
|
105
91
|
- !ruby/object:Gem::Dependency
|
106
|
-
name:
|
92
|
+
name: benchmark-ips
|
107
93
|
requirement: !ruby/object:Gem::Requirement
|
108
94
|
requirements:
|
109
95
|
- - ">="
|
110
96
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
97
|
+
version: 2.7.2
|
112
98
|
type: :development
|
113
99
|
prerelease: false
|
114
100
|
version_requirements: !ruby/object:Gem::Requirement
|
115
101
|
requirements:
|
116
102
|
- - ">="
|
117
103
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
104
|
+
version: 2.7.2
|
119
105
|
description: 'Automatic tracing and metrics for Ruby applications. Get started at
|
120
106
|
appoptics.com. @AppOptics
|
121
107
|
|
@@ -221,7 +207,9 @@ files:
|
|
221
207
|
- lib/appoptics_apm/ruby.rb
|
222
208
|
- lib/appoptics_apm/sdk/custom_metrics.rb
|
223
209
|
- lib/appoptics_apm/sdk/tracing.rb
|
224
|
-
- lib/appoptics_apm/support.rb
|
210
|
+
- lib/appoptics_apm/support/transaction_metrics.rb
|
211
|
+
- lib/appoptics_apm/support/transaction_settings.rb
|
212
|
+
- lib/appoptics_apm/support_report.rb
|
225
213
|
- lib/appoptics_apm/test.rb
|
226
214
|
- lib/appoptics_apm/thread_local.rb
|
227
215
|
- lib/appoptics_apm/util.rb
|
@@ -260,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
248
|
version: '0'
|
261
249
|
requirements: []
|
262
250
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.6.11
|
264
252
|
signing_key:
|
265
253
|
specification_version: 4
|
266
254
|
summary: AppOptics APM performance instrumentation gem for Ruby
|