appoptics_apm 4.12.2 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build_and_release_gem.yml +103 -0
  3. data/.github/workflows/build_for_packagecloud.yml +70 -0
  4. data/.github/workflows/docker-images.yml +47 -0
  5. data/.github/workflows/run_cpluplus_tests.yml +73 -0
  6. data/.github/workflows/run_tests.yml +168 -0
  7. data/.github/workflows/scripts/test_install.rb +23 -0
  8. data/.github/workflows/swig/swig-v4.0.2.tar.gz +0 -0
  9. data/.github/workflows/test_on_4_linux.yml +159 -0
  10. data/.gitignore +17 -25
  11. data/.travis.yml +17 -14
  12. data/Gemfile +1 -25
  13. data/README.md +4 -6
  14. data/appoptics_apm.gemspec +11 -5
  15. data/examples/prepend.rb +13 -0
  16. data/examples/sdk_examples.rb +16 -0
  17. data/ext/oboe_metal/extconf.rb +25 -31
  18. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -0
  19. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -0
  20. data/ext/oboe_metal/src/README.md +6 -0
  21. data/ext/oboe_metal/src/VERSION +2 -1
  22. data/ext/oboe_metal/src/frames.cc +246 -0
  23. data/ext/oboe_metal/src/frames.h +40 -0
  24. data/ext/oboe_metal/src/init_appoptics_apm.cc +5 -4
  25. data/ext/oboe_metal/src/logging.cc +95 -0
  26. data/ext/oboe_metal/src/logging.h +35 -0
  27. data/ext/oboe_metal/src/oboe.h +8 -5
  28. data/ext/oboe_metal/src/oboe_api.cpp +40 -14
  29. data/ext/oboe_metal/src/oboe_api.hpp +29 -8
  30. data/ext/oboe_metal/src/oboe_debug.h +1 -0
  31. data/ext/oboe_metal/src/oboe_swig_wrap.cc +85 -21
  32. data/ext/oboe_metal/src/profiling.cc +435 -0
  33. data/ext/oboe_metal/src/profiling.h +78 -0
  34. data/ext/oboe_metal/test/CMakeLists.txt +53 -0
  35. data/ext/oboe_metal/test/FindGMock.cmake +43 -0
  36. data/ext/oboe_metal/test/README.md +56 -0
  37. data/ext/oboe_metal/test/frames_test.cc +164 -0
  38. data/ext/oboe_metal/test/profiling_test.cc +93 -0
  39. data/ext/oboe_metal/test/ruby_inc_dir.rb +8 -0
  40. data/ext/oboe_metal/test/ruby_prefix.rb +8 -0
  41. data/ext/oboe_metal/test/ruby_test_helper.rb +67 -0
  42. data/ext/oboe_metal/test/test.h +11 -0
  43. data/ext/oboe_metal/test/test_main.cc +32 -0
  44. data/lib/appoptics_apm/api/metrics.rb +3 -0
  45. data/lib/appoptics_apm/base.rb +1 -1
  46. data/lib/appoptics_apm/config.rb +11 -2
  47. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +7 -1
  48. data/lib/appoptics_apm/inst/rack.rb +13 -6
  49. data/lib/appoptics_apm/inst/redis.rb +1 -2
  50. data/lib/appoptics_apm/noop/context.rb +3 -0
  51. data/lib/appoptics_apm/noop/metadata.rb +4 -1
  52. data/lib/appoptics_apm/noop/profiling.rb +21 -0
  53. data/lib/appoptics_apm/oboe_init_options.rb +26 -22
  54. data/lib/appoptics_apm/support/profiling.rb +18 -0
  55. data/lib/appoptics_apm/support/transaction_metrics.rb +1 -1
  56. data/lib/appoptics_apm/support/transaction_settings.rb +2 -2
  57. data/lib/appoptics_apm/support/x_trace_options.rb +2 -2
  58. data/lib/appoptics_apm/support_report.rb +2 -2
  59. data/lib/appoptics_apm/test.rb +4 -3
  60. data/lib/appoptics_apm/util.rb +1 -1
  61. data/lib/appoptics_apm/version.rb +3 -3
  62. data/lib/appoptics_apm/xtrace.rb +1 -1
  63. data/lib/appoptics_apm.rb +3 -1
  64. data/lib/oboe_metal.rb +2 -2
  65. data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +24 -0
  66. data/log/.keep +0 -0
  67. metadata +46 -16
  68. data/.travis/bundle.sh +0 -9
@@ -0,0 +1,23 @@
1
+ # Copyright (c) 2021 SolarWinds, LLC.
2
+ # All rights reserved.
3
+
4
+ # Test script used to check if a newly created gem installs and connects to
5
+ # the collector
6
+ # requires env vars:
7
+ # - APPOPTICS_SERVICE_KEY
8
+ # - APPOPTICS_COLLECTOR (optional if the key is for production)
9
+
10
+ require 'appoptics_apm'
11
+ AppOpticsAPM.support_report
12
+ exit 1 unless AppOpticsAPM.reporter
13
+
14
+ AppOpticsAPM::Config[:profiling] = :enabled
15
+
16
+ AppOpticsAPM::SDK.start_trace("install_test_profiling") do
17
+ AppOpticsAPM::Profiling.run do
18
+ 10.times do
19
+ [9, 6, 12, 2, 7, 1, 9, 3, 4, 14, 5, 8].sort
20
+ sleep 0.2
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,159 @@
1
+ # Copyright (c) 2021 SolarWinds, LLC.
2
+ # All rights reserved.
3
+
4
+ name: Run Ruby Tests on 4 Linux
5
+
6
+ on:
7
+ push:
8
+ paths-ignore:
9
+ - 'test/run_tests/Dockerfile_*'
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ env:
14
+ GHRC: ghcr.io/appoptics/appoptics-apm-ruby/apm_ruby
15
+ DOCKERFILE: test/run_tests/Dockerfile
16
+
17
+ jobs:
18
+
19
+ #-------------------------------------------------------------------------------
20
+ # TODO: figure out how to build images first if necessary
21
+ #
22
+ # ********* this is not working because we don't have a *************
23
+ # ********* reference to the commit of the previous GH run *************
24
+ #
25
+ # build_images:
26
+ # name: Build docker images if necessary
27
+ # runs-on: ubuntu-latest
28
+ #
29
+ # strategy:
30
+ # fail-fast: true
31
+ # matrix:
32
+ # os: [ ubuntu, debian, centos, alpine ]
33
+ #
34
+ # steps:
35
+ # - name: Checkout
36
+ # uses: actions/checkout@v2
37
+ #
38
+ #
39
+ # ## comment out to get a debug session
40
+ # ## only works with ubuntu and debian, because it uses apt:
41
+ ## - name: tmate debugging session
42
+ ## uses: mxschmitt/action-tmate@v3
43
+ ## with:
44
+ ## sudo: false
45
+ #
46
+ # - name: check modified files
47
+ # id: check_files
48
+ # run: |
49
+ # git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep Dockerfile_
50
+ # echo ::set-output name=check_dockerfiles::$?
51
+ ## git diff --name-only HEAD^ HEAD | grep [D]ockerfile_
52
+ ## echo ::set-output name=check_dockerfiles::$?
53
+ #
54
+ # - name: ghcr.io login ... build and publish images if needed
55
+ # uses: docker/login-action@v1
56
+ # if: ${{ steps.check_files.outputs.check_dockerfiles == 0}}
57
+ # with:
58
+ # registry: ghcr.io
59
+ # username: ${{ github.actor }}
60
+ # password: ${{ secrets.GITHUB_TOKEN }}
61
+ #
62
+ # - name: Build and publish new Docker image
63
+ # if: ${{ steps.check_files.outputs.check_dockerfiles == 0 }}
64
+ # run: |
65
+ # docker build -f ${{ env.DOCKERFILE }}_${{ matrix.os }} -t ${{ env.GHRC }}_${{ matrix.os }} .
66
+ # docker push ${{ env.GHRC }}_${{ matrix.os }}
67
+
68
+ #-------------------------------------------------------------------------------
69
+ all_linux_test:
70
+ name: ${{ matrix.os }} - ruby ${{ matrix.ruby }}
71
+ runs-on: ubuntu-latest
72
+ # needs: build_images
73
+
74
+ strategy:
75
+ fail-fast: false
76
+ matrix:
77
+ os: [ubuntu, debian, centos, alpine]
78
+ ruby: ['3.0', '2.7', '2.6', '2.5', '2.4']
79
+
80
+ container:
81
+ # maybe github.repository works
82
+ image: ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }}
83
+
84
+ env:
85
+ APPOPTICS_GEM_TEST: true
86
+ APPOPTICS_REPORTER: file
87
+ APPOPTICS_COLLECTOR: /tmp/appoptics_traces.bson
88
+ APPOPTICS_MONGO_SERVER: "mongo"
89
+ APPOPTICS_RABBITMQ_SERVER: "rabbitmq"
90
+ APPOPTICS_MEMCACHED_SERVER: "memcached"
91
+ APPOPTICS_REPORTER_FILE_SINGLE: false
92
+ APPOPTICS_FROM_S3: true
93
+ MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
94
+ MYSQL_ROOT_PASSWORD: "admin"
95
+ MYSQL_HOST: "mysql"
96
+ MYSQL_DATABASE: "travis_ci_test"
97
+ POSTGRES_DB: "travis_ci_test"
98
+ DOCKER_MYSQL_PASS: "admin"
99
+ DOCKER_PSQL_PASS: "postgres"
100
+ POSTGRES_USER: "postgres"
101
+ POSTGRES_PASSWORD: "postgres"
102
+ POSTGRES_HOST: "postgres"
103
+ REDIS_PASSWORD: "redis_pass"
104
+ TEST_RUNS_TO_FILE: "true"
105
+
106
+ services:
107
+ memcached:
108
+ image: memcached:latest
109
+ ports:
110
+ - 11211:11211
111
+ options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5
112
+ rabbitmq:
113
+ image: rabbitmq:latest
114
+ ports:
115
+ - 5672:5672
116
+ options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
117
+ mongo:
118
+ image: mongo:latest
119
+ ports:
120
+ - 27017:27017
121
+ options: "--health-cmd \"mongo --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'\" --health-interval 10s --health-timeout 5s --health-retries 5"
122
+ postgres:
123
+ image: postgres:10.8
124
+ env:
125
+ POSTGRES_DB: travis_ci_test
126
+ ports:
127
+ - 5432:5432
128
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
129
+ mysql:
130
+ image: mariadb:latest
131
+ env:
132
+ MYSQL_USER: user
133
+ MYSQL_PASSWORD: password
134
+ MYSQL_DATABASE: travis_ci_test
135
+ MYSQL_ROOT_PASSWORD: admin
136
+ ports:
137
+ - 3306:3306
138
+ options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
139
+
140
+ steps:
141
+ - name: Checkout ${{ github.ref }}
142
+ uses: actions/checkout@v2
143
+
144
+ - name: print some info
145
+ run: |
146
+ user=`whoami`
147
+ pwd=`pwd`
148
+ echo "User: $user"
149
+ echo "Current dir: $pwd"
150
+ echo "Home dir: $HOME"
151
+ echo "Branch: ${GITHUB_REF#refs/*/}"
152
+
153
+ - name: ruby tests
154
+ run: |
155
+ export HOME=/root
156
+ test/run_tests/ruby_setup.sh
157
+ version=`rbenv versions --bare | grep ${{ matrix.ruby }}`
158
+ echo "testing with ruby version: $version"
159
+ test/run_tests/run_tests.sh -r $version
data/.gitignore CHANGED
@@ -1,44 +1,36 @@
1
- *.code-workspace
1
+ !.keep
2
2
  *.gem
3
3
  *.lock
4
- *.o
5
- *.so
4
+ *.log
6
5
  *.swp
7
- *.vscode
8
6
  *~
9
7
  .*byebug*
10
- .bundle
8
+ .bundle/
11
9
  .env
12
10
  .irb_history
13
11
  .irbrc
14
12
  .ruby-version
15
- .travis/*
16
- .vagrant
17
- .yardoc
18
- builds
19
- coverage
20
- config
21
- doc
13
+ .yardoc/
14
+ app/
15
+ builds/
16
+ coverage/
17
+ doc/
18
+ ext/oboe_metal/*.o
22
19
  ext/oboe_metal/Makefile
23
20
  ext/oboe_metal/lib/liboboe*so*
24
21
  ext/oboe_metal/mkmf.log
25
22
  ext/oboe_metal/oboe_metal.so
26
23
  ext/oboe_metal/oboe_noop.so
27
- ext/oboe_metal/src/bson/*
28
- ext/oboe_metal/src/oboe.h
29
- ext/oboe_metal/src/oboe.hpp
24
+ ext/oboe_metal/src/bson/
30
25
  ext/oboe_metal/src/oboe_api.cpp
26
+ ext/oboe_metal/src/oboe.h
31
27
  ext/oboe_metal/src/oboe_api.hpp
32
28
  ext/oboe_metal/src/oboe_debug.h
33
- ext/oboe_metal/src/oboe_wrap.cxx
34
29
  ext/oboe_metal/src/oboe_swig_wrap.cc
35
- ext/oboe_metal/test
30
+ ext/oboe_metal/test/build/
31
+ ext/oboe_metal/test/MakeFile
32
+ gemfiles/*.lock
33
+ gemfiles/.bundle/
36
34
  gemfiles/vendor*
37
- log
38
- oboe*.gem
39
- scrap*
40
- swig*
41
- vendor
42
- ext/oboe_metal/experiments/
43
- ext/oboe_metal/test/
44
- test/run_tests/grpc_matrix/
35
+ lib/libappoptics_apm.so
36
+ vendor/
data/.travis.yml CHANGED
@@ -10,11 +10,11 @@ env:
10
10
  - DBTYPE=mysql2
11
11
 
12
12
  rvm:
13
- - 3.0.0 # appoptics_apm instrumentation not ready yet, probably ok, let's see
14
- - 2.7.0
15
- - 2.6.5
16
- - 2.5.5
17
- - 2.4.5
13
+ - 3.0.2
14
+ - 2.7.4
15
+ - 2.6.8
16
+ - 2.5.8
17
+ - 2.4.10
18
18
  # - ruby-head
19
19
  # - jruby-9.0.5.0
20
20
 
@@ -24,26 +24,26 @@ gemfile:
24
24
  - gemfiles/instrumentation_mocked.gemfile
25
25
  - gemfiles/instrumentation_mocked_oldgems.gemfile
26
26
  - gemfiles/frameworks.gemfile
27
- - gemfiles/rails61.gemfile
28
27
  - gemfiles/rails60.gemfile
29
28
  - gemfiles/rails52.gemfile
30
29
  - gemfiles/rails42.gemfile
30
+ - gemfiles/profiling.gemfile
31
31
  - gemfiles/delayed_job.gemfile
32
32
  - gemfiles/noop.gemfile
33
33
 
34
34
  matrix:
35
35
  exclude:
36
- - rvm: ruby-head
36
+ - rvm: 3.0.2
37
37
  gemfile: gemfiles/rails42.gemfile
38
- - rvm: 2.7.0
38
+ - rvm: 3.0.2
39
+ gemfile: gemfiles/rails52.gemfile
40
+ - rvm: 2.7.4
39
41
  gemfile: gemfiles/rails42.gemfile
40
- - rvm: 2.6.5
42
+ - rvm: 2.6.8
41
43
  gemfile: gemfiles/rails42.gemfile
42
- - rvm: 2.4.5
43
- gemfile: gemfiles/rails61.gemfile
44
- - rvm: 2.4.5
44
+ - rvm: 2.4.10
45
45
  gemfile: gemfiles/rails60.gemfile
46
- - rvm: 2.4.5 # excluding because of new sprockets version (4.0.0)
46
+ - rvm: 2.4.10 # excluding because of new sprockets version (4.0.0)
47
47
  gemfile: gemfiles/rails52.gemfile
48
48
 
49
49
  - gemfile: gemfiles/unit.gemfile
@@ -58,6 +58,8 @@ matrix:
58
58
  env: DBTYPE=mysql2
59
59
  - gemfile: gemfiles/frameworks.gemfile
60
60
  env: DBTYPE=mysql2
61
+ - gemfile: gemfiles/profiling.gemfile
62
+ env: DBTYPE=mysql2
61
63
  - gemfile: gemfiles/delayed_job.gemfile
62
64
  env: DBTYPE=mysql2
63
65
  allow_failures:
@@ -100,7 +102,8 @@ before_script:
100
102
  # - export APPOPTICS_TOKEN_BUCKET_CAPACITY=1000
101
103
  # - export APPOPTICS_TOKEN_BUCKET_RATE=1000
102
104
  - export APPOPTICS_FROM_S3=true
103
- - export OBOE_VERSION=10.0.0
105
+ # - export OBOE_WIP=true
106
+ # - export OBOE_VERSION=10.0.1
104
107
 
105
108
  # - bundle update --jobs=3 --retry=3
106
109
  - ./.travis/bundle.sh
data/Gemfile CHANGED
@@ -6,33 +6,9 @@ source 'https://rubygems.org'
6
6
  gem 'rake', '>= 0.9.0'
7
7
 
8
8
  group :development, :test do
9
- # gem 'benchmark-ips', '>= 2.7.2'
10
- # gem 'bson'
11
9
  gem 'byebug', '>= 8.0.0'
12
- # gem 'debugger', :platform => :mri_19
13
- # gem 'get_process_mem'
14
10
  gem 'irb', '>= 1.0.0' # if RUBY_VERSION >= '2.6.0'
15
- # gem 'memory_profiler'
16
- # gem 'minitest'
17
- # gem 'minitest-debugger', :require => false
18
- # gem 'minitest-focus', '>=1.1.2'
19
- # gem 'minitest-hooks', '>= 1.5.0'
20
- # gem 'minitest-reporters', '< 1.0.18'
21
- # gem 'mocha'
22
- # gem 'puma'
23
- # gem 'rack-test'
24
- # gem 'rubocop', require: false
25
- # gem 'ruby-debug', :platforms => :jruby
26
- # gem 'ruby-prof'
27
- # gem 'simplecov', '>= 0.16.0'
28
- # gem 'simplecov-console'
29
- # gem 'webmock' if RUBY_VERSION >= '2.0.0'
30
-
31
- # if defined?(JRUBY_VERSION)
32
- # gem 'sinatra', :require => false
33
- # else
34
- # gem 'sinatra'
35
- # end
11
+ gem 'memory_profiler'
36
12
  end
37
13
 
38
14
  gemspec
data/README.md CHANGED
@@ -13,13 +13,11 @@ It requires an [AppOptics](https://www.appoptics.com/) account to view metrics.
13
13
 
14
14
  [![Gem Version](https://badge.fury.io/rb/appoptics_apm.svg)](https://badge.fury.io/rb/appoptics_apm)
15
15
 
16
- [comment]: <> ([![Build Status]&#40;https://travis-ci.org/appoptics/appoptics-apm-ruby.png?branch=master&#41;]&#40;https://travis-ci.org/appoptics/appoptics-apm-ruby&#41;)
16
+ [![Run all Tests](https://github.com/appoptics/appoptics-apm-ruby/actions/workflows/run_tests.yml/badge.svg)](https://github.com/appoptics/appoptics-apm-ruby/actions/workflows/run_tests.yml)
17
+ [![C++ Tests](https://github.com/appoptics/appoptics-apm-ruby/actions/workflows/run_cpluplus_tests.yml/badge.svg)](https://github.com/appoptics/appoptics-apm-ruby/actions/workflows/run_cpluplus_tests.yml)
17
18
 
18
19
  [comment]: <> ([![Maintainability]&#40;https://api.codeclimate.com/v1/badges/ac7f36241a23a3a82fc5/maintainability&#41;]&#40;https://codeclimate.com/github/appoptics/appoptics-apm-ruby/maintainability&#41;)
19
20
 
20
- _Note: The repository is now at https://github.com/appoptics/appoptics-apm-ruby Please update your github remotes with
21
- `git remote set-url origin git@github.com:appoptics/appoptics-apm-ruby.git`._
22
-
23
21
  # Documentation
24
22
 
25
23
  * [AppOptics Knowledge Base](https://docs.appoptics.com/kb/apm_tracing/ruby)
@@ -236,7 +234,7 @@ Find more details in the [RubyDoc page](https://www.rubydoc.info/gems/appoptics_
236
234
  # Support
237
235
 
238
236
  If you run into a problem, find a bug, or would like to request an enhancement, feel free to contact our tech support
239
- [support@appoptics.com](support@appoptics.com).
237
+ [technicalsupport@solarwinds.com](technicalsupport@solarwinds.com).
240
238
 
241
239
  # Contributing
242
240
 
@@ -392,4 +390,4 @@ See the README in the test directory.
392
390
 
393
391
  Copyright (c) 2018 SolarWinds, LLC
394
392
 
395
- Released under the [Librato Open License](https://docs.appoptics.com/kb/apm_tracing/librato-open-license/)
393
+ Released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.license = "Apache-2.0"
10
10
 
11
11
  s.authors = ["Maia Engeli", "Peter Giacomo Lombardo", "Spiros Eliopoulos"]
12
- s.email = %q{support@appoptics.com}
12
+ s.email = %q{technicalsupport@solarwinds.com}
13
13
  s.homepage = %q{https://www.appoptics.com/}
14
14
  s.summary = %q{AppOptics APM performance instrumentation gem for Ruby}
15
15
  s.description = <<-EOF
@@ -32,7 +32,10 @@ Automatic tracing and metrics for Ruby applications. Get started at appoptics.co
32
32
  'ext/oboe_metal/src/oboe_swig_wrap.cc',
33
33
  'ext/oboe_metal/src/bson/bson.h',
34
34
  'ext/oboe_metal/src/bson/platform_hacks.h',
35
- 'ext/oboe_metal/src/VERSION']
35
+ 'ext/oboe_metal/src/VERSION',
36
+ 'ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256',
37
+ 'ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256'
38
+ ]
36
39
  s.files -= ['build_gem.sh',
37
40
  'build_gem_upload_to_packagecloud.sh',
38
41
  'Rakefile']
@@ -43,17 +46,20 @@ Automatic tracing and metrics for Ruby applications. Get started at appoptics.co
43
46
 
44
47
  s.extensions = ['ext/oboe_metal/extconf.rb'] unless defined?(JRUBY_VERSION)
45
48
 
46
- s.add_runtime_dependency('json')
49
+ # this still gives a warning, would have to be pinned to a minor version
50
+ # but that is not necessary and may restrict other gems
51
+ s.add_runtime_dependency('json', '~> 2.0')
47
52
  s.add_runtime_dependency('no_proxy_fix', '~> 0.1.2', '>= 0.1.2')
48
53
 
49
54
  # Development dependencies used in gem development & testing
50
55
  # s.add_development_dependency('rake', '>= 0.9.0')
51
56
  # s.add_development_dependency('simplecov', '>= 0.16.0') if ENV["SIMPLECOV_COVERAGE"]
52
57
  # s.add_development_dependency('simplecov-console', '>= 0.4.0') if ENV["SIMPLECOV_COVERAGE"]
53
- # s.add_development_dependency('irb', '>= 1.0.0') if RUBY_VERSION >= '2.6.0'
58
+ # s.add_development_dependency('irb', '>= 1.0.0', '< 1.2.2') if RUBY_VERSION >= '2.6.0'
54
59
  #
55
60
  # unless defined?(JRUBY_VERSION)
56
- # s.add_development_dependency('byebug', '>= 8.0.0')
61
+ # s.add_development_dependency('byebug', '>= 11.0.0')
62
+ # s.add_development_dependency('minitest')
57
63
  # s.add_development_dependency('minitest-hooks', '>= 1.5.0')
58
64
  # s.add_development_dependency('minitest-focus', '>=1.1.2')
59
65
  # s.add_development_dependency('benchmark-ips', '>= 2.7.2')
@@ -0,0 +1,13 @@
1
+ require 'appoptics_apm'
2
+
3
+ module Measurements
4
+ def request(*args, &block)
5
+ req = args.first
6
+ AppOpticsAPM::SDK.summary_metric("request_size", req.to_hash.to_s.size)
7
+ resp = super
8
+ AppOpticsAPM::SDK.summary_metric("response_size", resp.to_hash.to_s.size)
9
+ return resp
10
+ end
11
+ end
12
+
13
+ Net::HTTP.send(:prepend, :Measurements)
@@ -140,3 +140,19 @@ AppOpticsAPM::SDK.start_trace('log_trace_id') do
140
140
  trace = AppOpticsAPM::SDK.current_trace
141
141
  AppOpticsAPM.logger.warn "Some log message #{trace.for_log}"
142
142
  end
143
+
144
+ ###############################################################
145
+ # START A TRACE AND PROFILE
146
+ ###############################################################
147
+ #
148
+ # AppOpticsAPM::Profiling.run
149
+ # This method adds profiling for the code executed in the block
150
+
151
+ AppOpticsAPM::SDK.start_trace("#{name}_profiling") do
152
+ AppOpticsAPM::Profiling.run do
153
+ 10.times do
154
+ [9, 6, 12, 2, 7, 1, 9, 3, 4, 14, 5, 8].sort
155
+ sleep 0.2
156
+ end
157
+ end
158
+ end