appoptics_apm 4.8.4 → 4.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +7 -1
- data/.rubocop.yml +27 -6
- data/.travis.yml +24 -37
- data/.travis/bundle.sh +9 -0
- data/CONFIG.md +1 -1
- data/Gemfile +6 -6
- data/appoptics_apm.gemspec +6 -2
- data/examples/SDK/01_basic_tracing.rb +1 -1
- data/ext/oboe_metal/extconf.rb +6 -2
- data/ext/oboe_metal/noop/noop.c +2 -1
- data/ext/oboe_metal/src/VERSION +1 -1
- data/lib/appoptics_apm.rb +1 -3
- data/lib/appoptics_apm/api.rb +0 -1
- data/lib/appoptics_apm/api/logging.rb +6 -2
- data/lib/appoptics_apm/api/tracing.rb +4 -0
- data/lib/appoptics_apm/api/util.rb +5 -7
- data/lib/appoptics_apm/config.rb +16 -5
- data/lib/appoptics_apm/frameworks/grape.rb +3 -2
- data/lib/appoptics_apm/frameworks/padrino.rb +7 -37
- data/lib/appoptics_apm/frameworks/rails.rb +0 -1
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller.rb +1 -1
- data/lib/appoptics_apm/frameworks/rails/inst/action_view.rb +12 -25
- data/lib/appoptics_apm/frameworks/rails/inst/active_record.rb +1 -1
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils.rb +1 -1
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +1 -1
- data/lib/appoptics_apm/frameworks/sinatra.rb +4 -33
- data/lib/appoptics_apm/inst/curb.rb +6 -6
- data/lib/appoptics_apm/inst/faraday.rb +16 -4
- data/lib/appoptics_apm/inst/graphql.rb +240 -0
- data/lib/appoptics_apm/inst/grpc_client.rb +1 -1
- data/lib/appoptics_apm/inst/rack.rb +11 -11
- data/lib/appoptics_apm/oboe_init_options.rb +13 -3
- data/lib/appoptics_apm/sdk/custom_metrics.rb +2 -0
- data/lib/appoptics_apm/sdk/logging.rb +1 -1
- data/lib/appoptics_apm/sdk/tracing.rb +120 -2
- data/lib/appoptics_apm/support/transaction_metrics.rb +2 -1
- data/lib/appoptics_apm/support/transaction_settings.rb +40 -15
- data/lib/appoptics_apm/support/x_trace_options.rb +110 -0
- data/lib/appoptics_apm/version.rb +2 -2
- data/lib/appoptics_apm/xtrace.rb +7 -7
- data/lib/oboe_metal.rb +1 -1
- data/lib/rails/generators/appoptics_apm/install_generator.rb +23 -21
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +68 -30
- metadata +40 -21
- data/Rakefile +0 -234
- data/build_gem.sh +0 -15
- data/build_gem_upload_to_packagecloud.sh +0 -15
- data/lib/appoptics_apm/api/profiling.rb +0 -203
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb +0 -55
- data/lib/appoptics_apm/frameworks/rails/inst/action_view_30.rb +0 -50
- data/lib/appoptics_apm/legacy_method_profiling.rb +0 -90
- data/lib/appoptics_apm/method_profiling.rb +0 -33
- data/lib/oboe/README +0 -2
- data/lib/oboe/backward_compatibility.rb +0 -80
- data/lib/oboe/inst/rack.rb +0 -11
@@ -1,55 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
module AppOpticsAPM
|
5
|
-
module Inst
|
6
|
-
#
|
7
|
-
# ActionController
|
8
|
-
#
|
9
|
-
# This modules contains the instrumentation code specific
|
10
|
-
# to Rails v3
|
11
|
-
#
|
12
|
-
module ActionController
|
13
|
-
include AppOpticsAPM::Inst::RailsBase
|
14
|
-
|
15
|
-
def self.included(base)
|
16
|
-
base.class_eval do
|
17
|
-
alias_method_chain :process, :appoptics
|
18
|
-
alias_method_chain :process_action, :appoptics
|
19
|
-
alias_method_chain :render, :appoptics
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def process_with_appoptics(*args)
|
24
|
-
request.env['appoptics_apm.controller'] = self.class.name
|
25
|
-
request.env['appoptics_apm.action'] = self.action_name
|
26
|
-
|
27
|
-
trace('rails') do
|
28
|
-
process_without_appoptics(*args)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def process_action_with_appoptics(*args)
|
33
|
-
kvs = {
|
34
|
-
:Controller => self.class.name,
|
35
|
-
:Action => action_name,
|
36
|
-
}
|
37
|
-
request.env['appoptics_apm.controller'] = kvs[:Controller]
|
38
|
-
request.env['appoptics_apm.action'] = kvs[:Action]
|
39
|
-
|
40
|
-
return process_action_without_appoptics(*args) unless AppOpticsAPM.tracing?
|
41
|
-
begin
|
42
|
-
kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:action_controller][:collect_backtraces]
|
43
|
-
AppOpticsAPM::API.log(nil, 'info', kvs)
|
44
|
-
|
45
|
-
process_action_without_appoptics(*args)
|
46
|
-
rescue Exception
|
47
|
-
kvs[:Status] = 500
|
48
|
-
kvs.delete(:Backtrace)
|
49
|
-
AppOpticsAPM::API.log(nil, 'info', kvs)
|
50
|
-
raise
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
if defined?(ActionView::Base) && AppOpticsAPM::Config[:action_view][:enabled]
|
5
|
-
|
6
|
-
if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 0
|
7
|
-
|
8
|
-
ActionView::Partials::PartialRenderer.class_eval do
|
9
|
-
alias :render_partial_without_appoptics :render_partial
|
10
|
-
def render_partial(object = @object)
|
11
|
-
entry_kvs = {}
|
12
|
-
begin
|
13
|
-
name = AppOpticsAPM::Util.prettify(@options[:partial]) if @options.is_a?(Hash)
|
14
|
-
entry_kvs[:FunctionName] = :render_partial
|
15
|
-
entry_kvs[:Class] = :PartialRenderer
|
16
|
-
entry_kvs[:Module] = 'ActionView::Partials'
|
17
|
-
entry_kvs[:File] = __FILE__
|
18
|
-
entry_kvs[:LineNumber] = __LINE__
|
19
|
-
rescue => e
|
20
|
-
AppOpticsAPM.logger.debug "[appoptics_apm/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if AppOpticsAPM::Config[:verbose]
|
21
|
-
end
|
22
|
-
|
23
|
-
AppOpticsAPM::API.profile(name, entry_kvs, AppOpticsAPM::Config[:action_view][:collect_backtraces]) do
|
24
|
-
render_partial_without_appoptics(object)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
alias :render_collection_without_appoptics :render_collection
|
29
|
-
def render_collection
|
30
|
-
entry_kvs = {}
|
31
|
-
begin
|
32
|
-
name = AppOpticsAPM::Util.prettify(@path)
|
33
|
-
entry_kvs[:FunctionName] = :render_collection
|
34
|
-
entry_kvs[:Class] = :PartialRenderer
|
35
|
-
entry_kvs[:Module] = 'ActionView::Partials'
|
36
|
-
entry_kvs[:File] = __FILE__
|
37
|
-
entry_kvs[:LineNumber] = __LINE__
|
38
|
-
rescue => e
|
39
|
-
AppOpticsAPM.logger.debug "[appoptics_apm/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if AppOpticsAPM::Config[:verbose]
|
40
|
-
end
|
41
|
-
|
42
|
-
AppOpticsAPM::API.profile(name, entry_kvs, AppOpticsAPM::Config[:action_view][:collect_backtraces]) do
|
43
|
-
render_collection_without_appoptics
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# vim:set expandtab:tabstop=2
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# Copyright (c) 2016 SolarWinds, LLC.
|
2
|
-
# All rights reserved.
|
3
|
-
|
4
|
-
##
|
5
|
-
# Provides the methods necessary for method profiling. Profiling
|
6
|
-
# results are sent to the AppOptics dashboard.
|
7
|
-
#
|
8
|
-
# Example usage:
|
9
|
-
# class MyApp
|
10
|
-
# include AppOpticsAPMMethodProfiling
|
11
|
-
#
|
12
|
-
# def process_request()
|
13
|
-
# # The hard work
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# # call syntax: profile_method <method>, <profile_name>
|
17
|
-
# profile_method :process_request, 'request_processor'
|
18
|
-
# end
|
19
|
-
module AppOpticsAPMMethodProfiling
|
20
|
-
def self.included(klass)
|
21
|
-
klass.extend ClassMethods
|
22
|
-
end
|
23
|
-
|
24
|
-
module ClassMethods
|
25
|
-
def profile_method_noop(*args)
|
26
|
-
nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def profile_method_real(method_name, profile_name, store_args = false, store_return = false, *_)
|
30
|
-
begin
|
31
|
-
# this only gets file and line where profiling is turned on, presumably
|
32
|
-
# right after the function definition.
|
33
|
-
file = ''
|
34
|
-
line = ''
|
35
|
-
info = instance_method(method_name).source_location
|
36
|
-
unless info.nil?
|
37
|
-
file = info[0].to_s
|
38
|
-
line = info[1].to_s
|
39
|
-
end
|
40
|
-
|
41
|
-
# Safety: Make sure there are no quotes or double quotes to break the class_eval
|
42
|
-
file = file.gsub(/[\'\"]/, '')
|
43
|
-
line = line.gsub(/[\'\"]/, '')
|
44
|
-
|
45
|
-
# profiling via ruby-prof, is it possible to get return value of profiled code?
|
46
|
-
code = "def _appoptics_profiled_#{method_name}(*args, &block)
|
47
|
-
entry_kvs = {}
|
48
|
-
entry_kvs['Language'] = 'ruby'
|
49
|
-
entry_kvs['ProfileName'] = '#{AppOpticsAPM::Util.prettify(profile_name)}'
|
50
|
-
entry_kvs['FunctionName'] = '#{AppOpticsAPM::Util.prettify(method_name)}'
|
51
|
-
entry_kvs['File'] = '#{file}'
|
52
|
-
entry_kvs['LineNumber'] = '#{line}'
|
53
|
-
entry_kvs['Args'] = AppOpticsAPM::API.pps(*args) if #{store_args}
|
54
|
-
entry_kvs.merge!(AppOpticsAPM::API.get_class_name(self))
|
55
|
-
|
56
|
-
AppOpticsAPM::API.log(nil, 'profile_entry', entry_kvs)
|
57
|
-
|
58
|
-
ret = _appoptics_orig_#{method_name}(*args, &block)
|
59
|
-
|
60
|
-
exit_kvs = {}
|
61
|
-
exit_kvs['Language'] = 'ruby'
|
62
|
-
exit_kvs['ProfileName'] = '#{AppOpticsAPM::Util.prettify(profile_name)}'
|
63
|
-
exit_kvs['ReturnValue'] = AppOpticsAPM::API.pps(ret) if #{store_return}
|
64
|
-
|
65
|
-
AppOpticsAPM::API.log(nil, 'profile_exit', exit_kvs)
|
66
|
-
ret
|
67
|
-
end"
|
68
|
-
rescue => e
|
69
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] profile_method: #{e.inspect}"
|
70
|
-
end
|
71
|
-
|
72
|
-
begin
|
73
|
-
class_eval code, __FILE__, __LINE__
|
74
|
-
alias_method "_appoptics_orig_#{method_name}", method_name
|
75
|
-
alias_method method_name, "_appoptics_profiled_#{method_name}"
|
76
|
-
rescue => e
|
77
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Fatal error profiling method (#{method_name}): #{e.inspect}" if AppOpticsAPM::Config[:verbose]
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# This allows this module to be included and called even if the gem is in
|
82
|
-
# no-op mode (no base libraries).
|
83
|
-
if AppOpticsAPM.loaded
|
84
|
-
alias :profile_method :profile_method_real
|
85
|
-
else
|
86
|
-
alias :profile_method :profile_method_noop
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
module AppOpticsAPM
|
3
|
-
module MethodProfiling
|
4
|
-
def profile_wrapper(method, report_kvs, opts, *args, &block)
|
5
|
-
report_kvs[:Backtrace] = AppOpticsAPM::API.backtrace(2) if opts[:backtrace]
|
6
|
-
report_kvs[:Arguments] = args if opts[:arguments]
|
7
|
-
|
8
|
-
# if this is a rails controller we want to set the transaction for the outbound metrics
|
9
|
-
if defined?(request) && defined?(request.env)
|
10
|
-
report_kvs['Controller'] = self.class.name
|
11
|
-
report_kvs['Action'] = self.action_name
|
12
|
-
request.env['appoptics_apm.controller'] = report_kvs['Controller']
|
13
|
-
request.env['appoptics_apm.action'] = report_kvs['Action']
|
14
|
-
end
|
15
|
-
|
16
|
-
AppOpticsAPM::API.log(nil, :profile_entry, report_kvs)
|
17
|
-
|
18
|
-
begin
|
19
|
-
rv = self.send(method, *args, &block)
|
20
|
-
report_kvs[:ReturnValue] = rv if opts[:result]
|
21
|
-
rv
|
22
|
-
rescue => e
|
23
|
-
AppOpticsAPM::API.log_exception(nil, e)
|
24
|
-
raise
|
25
|
-
ensure
|
26
|
-
report_kvs.delete(:Backtrace)
|
27
|
-
report_kvs.delete(:Controller)
|
28
|
-
report_kvs.delete(:Action)
|
29
|
-
AppOpticsAPM::API.log(nil, :profile_exit, report_kvs)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/lib/oboe/README
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'appoptics_apm/thread_local'
|
2
|
-
|
3
|
-
module Oboe
|
4
|
-
extend AppOpticsAPMBase
|
5
|
-
if AppOpticsAPM.loaded
|
6
|
-
include Oboe_metal
|
7
|
-
end
|
8
|
-
|
9
|
-
#
|
10
|
-
# Support for Oboe::API calls
|
11
|
-
#
|
12
|
-
module API
|
13
|
-
include AppOpticsAPM::API
|
14
|
-
extend AppOpticsAPM::ThreadLocal
|
15
|
-
thread_local :deprecation_notified
|
16
|
-
|
17
|
-
def self.method_missing(sym, *args, &blk)
|
18
|
-
# Notify of deprecation only once
|
19
|
-
unless @deprecated_notified
|
20
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Note that Oboe::API has been renamed to AppOpticsAPM::API. (#{sym}:#{args})"
|
21
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/warn] Oboe::API will be deprecated in a future version.'
|
22
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Caller: #{Kernel.caller[0]}"
|
23
|
-
@deprecated_notified = true
|
24
|
-
end
|
25
|
-
AppOpticsAPM::API.send(sym, *args, &blk)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
#
|
31
|
-
# Support for Oboe::Config calls
|
32
|
-
#
|
33
|
-
module Config
|
34
|
-
extend AppOpticsAPM::ThreadLocal
|
35
|
-
thread_local :deprecation_notified
|
36
|
-
|
37
|
-
def self.method_missing(sym, *args)
|
38
|
-
# Notify of deprecation only once
|
39
|
-
unless @deprecated_notified
|
40
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Note that Oboe::Config has been renamed to AppOpticsAPM::Config. (#{sym}:#{args})"
|
41
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/warn] Oboe::Config will be deprecated in a future version.'
|
42
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Caller: #{Kernel.caller[0]}"
|
43
|
-
@deprecated_notified = true
|
44
|
-
end
|
45
|
-
AppOpticsAPM::Config.send(sym, *args)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
#
|
50
|
-
# Support for legacy Oboe::Ruby.load calls
|
51
|
-
#
|
52
|
-
module Ruby
|
53
|
-
extend AppOpticsAPM::ThreadLocal
|
54
|
-
thread_local :deprecation_notified
|
55
|
-
|
56
|
-
def self.method_missing(sym, *args)
|
57
|
-
# Notify of deprecation only once
|
58
|
-
unless @deprecated_notified
|
59
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Note that Oboe::Ruby has been renamed to AppOpticsAPM::Ruby. (#{sym}:#{args})"
|
60
|
-
AppOpticsAPM.logger.warn '[appoptics_apm/warn] Oboe::Ruby will be deprecated in a future version.'
|
61
|
-
AppOpticsAPM.logger.warn "[appoptics_apm/warn] Caller: #{Kernel.caller[0]}"
|
62
|
-
@deprecated_notified = true
|
63
|
-
end
|
64
|
-
AppOpticsAPM::Ruby.send(sym, *args)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
#
|
70
|
-
# Support for OboeMethodProfiling
|
71
|
-
#
|
72
|
-
module OboeMethodProfiling
|
73
|
-
def self.included(klass)
|
74
|
-
klass.extend ClassMethods
|
75
|
-
end
|
76
|
-
|
77
|
-
module ClassMethods
|
78
|
-
include AppOpticsAPMMethodProfiling::ClassMethods
|
79
|
-
end
|
80
|
-
end
|
data/lib/oboe/inst/rack.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'appoptics_apm/inst/rack'
|
2
|
-
|
3
|
-
module Oboe
|
4
|
-
class Rack < AppOpticsAPM::Rack
|
5
|
-
# This simply makes Oboe::Rack available (and a clone of AppOpticsAPM::Rack) for
|
6
|
-
# backward compatibility
|
7
|
-
#
|
8
|
-
# Provided for pre-existing apps (sinatra, padrino, grape etc..) that may still
|
9
|
-
# call `use Oboe::Rack`
|
10
|
-
end
|
11
|
-
end
|