appoptics_apm 4.2.3 → 4.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -0
  3. data/.travis.yml +15 -12
  4. data/Gemfile +0 -1
  5. data/README.md +7 -38
  6. data/Rakefile +17 -1
  7. data/appoptics_apm.gemspec +2 -0
  8. data/{build_gems.sh → build_gem.sh} +1 -1
  9. data/build_gem_upload_to_packagecloud.sh +15 -0
  10. data/examples/SDK/01_basic_tracing.rb +1 -1
  11. data/ext/oboe_metal/src/VERSION +1 -1
  12. data/ext/oboe_metal/src/bson/bson.h +1 -2
  13. data/ext/oboe_metal/src/bson/platform_hacks.h +4 -4
  14. data/lib/appoptics_apm.rb +28 -30
  15. data/lib/appoptics_apm/api/logging.rb +13 -27
  16. data/lib/appoptics_apm/api/metrics.rb +25 -11
  17. data/lib/appoptics_apm/api/profiling.rb +6 -11
  18. data/lib/appoptics_apm/api/tracing.rb +3 -24
  19. data/lib/appoptics_apm/base.rb +7 -32
  20. data/lib/appoptics_apm/config.rb +26 -4
  21. data/lib/appoptics_apm/frameworks/grape.rb +10 -8
  22. data/lib/appoptics_apm/frameworks/padrino.rb +3 -0
  23. data/lib/appoptics_apm/frameworks/rails.rb +20 -42
  24. data/lib/appoptics_apm/frameworks/rails/inst/action_controller.rb +4 -6
  25. data/lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb +1 -1
  26. data/lib/appoptics_apm/frameworks/rails/inst/action_controller5.rb +1 -1
  27. data/lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb +1 -1
  28. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils.rb +1 -9
  29. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +1 -1
  30. data/lib/appoptics_apm/frameworks/sinatra.rb +4 -1
  31. data/lib/appoptics_apm/inst/bunny-client.rb +16 -18
  32. data/lib/appoptics_apm/inst/memcached.rb +6 -10
  33. data/lib/appoptics_apm/inst/moped.rb +1 -1
  34. data/lib/appoptics_apm/inst/rack.rb +13 -15
  35. data/lib/appoptics_apm/inst/sidekiq-worker.rb +1 -1
  36. data/lib/appoptics_apm/inst/typhoeus.rb +4 -2
  37. data/lib/appoptics_apm/loading.rb +1 -1
  38. data/lib/appoptics_apm/sdk.rb +48 -50
  39. data/lib/appoptics_apm/version.rb +1 -1
  40. data/lib/appoptics_apm/xtrace.rb +1 -1
  41. data/lib/oboe_metal.rb +13 -11
  42. data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +45 -7
  43. metadata +5 -16
  44. data/.codeclimate.yml +0 -43
  45. data/Dockerfile +0 -41
  46. data/Dockerfile_alpine +0 -66
  47. data/Dockerfile_test +0 -73
  48. data/config/initializers/.keep +0 -0
  49. data/docker-compose.yml +0 -95
  50. data/ext/oboe_metal/tests/test.rb +0 -11
  51. data/lib/appoptics_apm/frameworks/rails/inst/action_controller2.rb +0 -61
  52. data/lib/appoptics_apm/frameworks/rails/inst/action_view_2x.rb +0 -56
  53. data/ruby_setup.sh +0 -49
  54. data/run_docker_build_gem_upload_to_packagecloud.sh +0 -20
  55. data/run_tests_docker.rb +0 -38
@@ -1,11 +0,0 @@
1
- # Copyright (c) 2016 SolarWinds, LLC.
2
- # All rights reserved.
3
-
4
- require 'oboe'
5
-
6
- r = Oboe::UdpReporter.new('127.0.0.1')
7
- Oboe::Context.init()
8
- e = Oboe::Context.createEvent()
9
- e.addInfo("TestKey", "TestValue")
10
- r.sendReport(e)
11
-
@@ -1,61 +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 v2
11
- #
12
- module ActionController
13
- include ::AppOpticsAPM::Inst::RailsBase
14
-
15
- def self.included(klass)
16
- ::AppOpticsAPM::Util.method_alias(klass, :perform_action)
17
- ::AppOpticsAPM::Util.method_alias(klass, :rescue_action)
18
- ::AppOpticsAPM::Util.method_alias(klass, :process)
19
- ::AppOpticsAPM::Util.method_alias(klass, :render)
20
- end
21
-
22
- def process_with_appoptics(*args)
23
- AppOpticsAPM::API.log_entry('rails')
24
- process_without_appoptics(*args)
25
-
26
- rescue Exception => e
27
- AppOpticsAPM::API.log_exception(nil, e) if log_rails_error?(e)
28
- raise
29
- ensure
30
- AppOpticsAPM::API.log_exit('rails')
31
- end
32
-
33
- def perform_action_with_appoptics(*arguments)
34
- kvs = {
35
- :Controller => @_request.path_parameters['controller'],
36
- :Action => @_request.path_parameters['action']
37
- }
38
- kvs[:Backtrace] = AppOpticsAPM::API.backtrace if AppOpticsAPM::Config[:action_controller][:collect_backtraces]
39
-
40
- AppOpticsAPM::API.log(nil, 'info', kvs)
41
- perform_action_without_appoptics(*arguments)
42
- end
43
-
44
- def rescue_action_with_appoptics(exn)
45
- AppOpticsAPM::API.log_exception(nil, exn) if log_rails_error?(exn)
46
- rescue_action_without_appoptics(exn)
47
- end
48
-
49
- def render_with_appoptics(options = nil, extra_options = {}, &block)
50
- AppOpticsAPM::API.log_entry('actionview')
51
- render_without_appoptics(options, extra_options, &block)
52
-
53
- rescue Exception => e
54
- AppOpticsAPM::API.log_exception(nil, e) if log_rails_error?(e)
55
- raise
56
- ensure
57
- AppOpticsAPM::API.log_exit('actionview')
58
- end
59
- end
60
- end
61
- end
@@ -1,56 +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 == 2
7
-
8
- AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting actionview' if AppOpticsAPM::Config[:verbose]
9
-
10
- ActionView::Partials.module_eval do
11
- alias :render_partial_without_appoptics :render_partial
12
- def render_partial(options = {})
13
- if options.key?(:partial) && options[:partial].is_a?(String)
14
- entry_kvs = {}
15
- begin
16
- name = AppOpticsAPM::Util.prettify(options[:partial]) if options.is_a?(Hash)
17
- entry_kvs[:FunctionName] = :render_partial
18
- entry_kvs[:Class] = :Partials
19
- entry_kvs[:Module] = :ActionView
20
- entry_kvs[:File] = __FILE__
21
- entry_kvs[:LineNumber] = __LINE__
22
- rescue => e
23
- AppOpticsAPM.logger.debug "[appoptics_apm/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if AppOpticsAPM::Config[:verbose]
24
- end
25
-
26
- AppOpticsAPM::API.profile(name, entry_kvs, AppOpticsAPM::Config[:action_view][:collect_backtraces]) do
27
- render_partial_without_appoptics(options)
28
- end
29
- else
30
- render_partial_without_appoptics(options)
31
- end
32
- end
33
-
34
- alias :render_partial_collection_without_appoptics :render_partial_collection
35
- def render_partial_collection(options = {})
36
- entry_kvs = {}
37
- begin
38
- name = 'partial_collection'
39
- entry_kvs[:FunctionName] = :render_partial_collection
40
- entry_kvs[:Class] = :Partials
41
- entry_kvs[:Module] = :ActionView
42
- entry_kvs[:File] = __FILE__
43
- entry_kvs[:LineNumber] = __LINE__
44
- rescue => e
45
- AppOpticsAPM.logger.debug "[appoptics_apm/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if AppOpticsAPM::Config[:verbose]
46
- end
47
-
48
- AppOpticsAPM::API.profile(name, entry_kvs, AppOpticsAPM::Config[:action_view][:collect_backtraces]) do
49
- render_partial_collection_without_appoptics(options)
50
- end
51
- end
52
- end
53
- end
54
- end
55
-
56
- # vim:set expandtab:tabstop=2
@@ -1,49 +0,0 @@
1
- #!/bin/bash
2
-
3
- # used by run_tests_docker.sh
4
- # call with:
5
- # docker-compose run --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh <ruby-version> <gemfile> <DBNAME=mysql2> <true|false>
6
- # docker-compose run --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh 2.4.3 gemfiles/libraries.gemfile
7
-
8
- cd /code/ruby-appoptics_apm/
9
-
10
- rbenv global $1
11
-
12
- rm gemfiles/*.lock
13
-
14
- export RVM_TEST=$1
15
- export BUNDLE_GEMFILE=$2
16
- bundle install
17
-
18
- bundle update
19
- bundle exec rake fetch_ext_deps
20
- bundle exec rake clean
21
- bundle exec rake compile
22
-
23
- # start postgres
24
- service postgresql start
25
-
26
- # start redis with password
27
- redis-server --requirepass secret_pass &
28
-
29
- # start memcached
30
- service memcached start
31
-
32
- # mysql add table for tests
33
- mysql -e 'create database travis_ci_test;' -h$MYSQL_HOST -p$MYSQL_ROOT_PASSWORD
34
-
35
- # replicate stdout of tests to file in local log directory
36
- export TEST_RUNS_TO_FILE=true
37
- export $3
38
-
39
- if [ "$4" == "true" ]; then
40
- /bin/bash
41
- # now run tests either with:
42
- # bundle exec rake test TEST=test/instrumentation/curb_test.rb
43
- # or
44
- # bundle exec ruby -I test test/instrumentation/curb_test.rb -n test_obey_collect_backtraces_when_false
45
- else
46
- bundle exec rake test
47
- fi
48
-
49
- mysql -e 'drop database travis_ci_test;' -h$MYSQL_HOST -p$MYSQL_ROOT_PASSWORD
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
-
3
- # to build the image:
4
- docker build -f Dockerfile -t buildgem .
5
-
6
- # build the gems in the image
7
- docker run --rm -v `pwd`:/code/ruby-appoptics_apm buildgem bash -l -c 'cd /code/ruby-appoptics_apm && ./build_gems.sh'
8
-
9
- # save current rbenv setting and switch to 2.4.3 for the package_cloud commands
10
- current_ruby=`rbenv local`
11
- rbenv local 2.4.1
12
-
13
- # prerequisite: package_cloud tocken needs to be in ~/.packagecloud
14
-
15
- gem=`ls -dt1 appoptics_apm-[^pre]*.gem | head -1`
16
-
17
- package_cloud push AppOptics/apm-instrumentation $gem
18
-
19
- # restore ruby version
20
- rbenv local $current_ruby
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # this runs all the tests on the current code base
4
- # any edits take effect immediately
5
- # test output is logged to log/test_runs.log
6
- # make sure log/ and log/test_runs.log is writeable by docker
7
-
8
- # `docker build -f Dockerfile_test -t ruby_appoptics_apm .`
9
- # (docker-compose will build it too if missing)
10
-
11
-
12
- # remove rbenv .ruby_version file that may be stuck on a different ruby version
13
- # because we mounted this directory in a docker container
14
- require 'fileutils'
15
- FileUtils.rm_f('.ruby_version')
16
-
17
- require 'yaml'
18
- travis = YAML.load_file('.travis.yml')
19
-
20
- matrix = []
21
- travis['rvm'].each do |rvm|
22
- travis['gemfile'].each do |gemfile|
23
- travis['env'].each do |env|
24
- matrix << { "rvm" => rvm, "gemfile" => gemfile, 'env' => env}
25
- end
26
- end
27
- end
28
-
29
- travis['matrix']['exclude'].each do |h|
30
- matrix.delete_if do |m|
31
- m == m.merge(h)
32
- end
33
- end
34
-
35
- matrix.each do |args|
36
- puts "docker-compose run --rm --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh #{args['rvm']} #{args['gemfile']} #{args['env']}"
37
- `docker-compose run --rm --service-ports ruby_appoptics_apm /code/ruby-appoptics_apm/ruby_setup.sh #{args['rvm']} #{args['gemfile']} #{args['env']}`
38
- end