appoptics_apm 4.10.1 → 4.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e70295e3dc49a39e001776c90ae399d1c1ee522
4
- data.tar.gz: bc03b3d467a18370ce889b6c66228172a41efd5c
2
+ SHA256:
3
+ metadata.gz: 6407eda7d31bb8fe541c0dc6295a82229c72a4fdcca5208f10cc30eae7c22d2c
4
+ data.tar.gz: 8dcfafc3e7bb8caf5c93afc6a54e5682cc9eea0dc790ec5a6334458b1b98107e
5
5
  SHA512:
6
- metadata.gz: f9d957a9d608fd1c3e3499125c96784b9767485934666986c8ecc1ca6befe89d870eb67b087887d5e6caf274452522e52c70dd773bf624a3144c225334688fe8
7
- data.tar.gz: 01e0625d7242ea1717d5264e65ab3b53df8f4e534e08ba7c67e6959a1e0478d81cdc2dcb6c08d7361008bdf78dbfd962879a59e0fd2ce3302d5c4e9e38e57d1a
6
+ metadata.gz: e4f04e064600294fa39899f61fb153816c90bb5969fa1a9173ed65925e9f4e2f36e61670098fe5ecb7e18ddcf0995b9aac4150d1048510ae3127fe950e7bf52b
7
+ data.tar.gz: b33f037425f2b7d1d19cbd069456f75c28b97de0906b2a9950a2b1fa408771c083f8b5dc811480a0f9b60f21437ddd6e50ea37fd22fff3c36cb51bbb9782f057
data/.gitignore CHANGED
@@ -1,34 +1,38 @@
1
- oboe*.gem
1
+ *.code-workspace
2
+ *.gem
2
3
  *.lock
3
- gemfiles/*.lock
4
- .ruby-version
5
- *~
6
4
  *.swp
5
+ *.vscode
6
+ *~
7
+ .*byebug*
8
+ .bundle
7
9
  .env
8
- lib/oboe_metal.so
10
+ .github
11
+ .irb_history
12
+ .irbrc
13
+ .ruby-version
14
+ .travis
15
+ .vagrant
16
+ .yardoc
17
+ builds
18
+ coverage
19
+ config
20
+ doc
21
+ ext/oboe_metal/*.o
9
22
  ext/oboe_metal/Makefile
23
+ ext/oboe_metal/lib/liboboe*so*
10
24
  ext/oboe_metal/mkmf.log
11
25
  ext/oboe_metal/oboe_metal.so
12
26
  ext/oboe_metal/oboe_noop.so
13
- ext/oboe_metal/*.o
14
- ext/oboe_metal/lib/liboboe*so*
27
+ ext/oboe_metal/src/bson/*
15
28
  ext/oboe_metal/src/oboe.h
16
29
  ext/oboe_metal/src/oboe.hpp
17
30
  ext/oboe_metal/src/oboe_debug.h
18
31
  ext/oboe_metal/src/oboe_wrap.cxx
19
- ext/oboe_metal/src/bson/*
20
- log/
21
- .vagrant
22
- gemfiles/.bundle
23
- swig*
24
- *.gem
25
- .yardoc
26
- coverage
27
- doc
28
- .*byebug*
29
32
  gemfiles/vendor*
33
+ lib/rb_appoptics_apm.so
34
+ lib/oboe_metal.so
35
+ log
36
+ oboe*.gem
30
37
  scrap*
31
- .irbrc
32
- *.code-workspace
33
- .irb_history
34
- .bundle/
38
+ swig*
@@ -1,8 +1,29 @@
1
- Metrics/LineLength:
2
- Max: 120
1
+ Style/StringLiterals:
2
+ Description: 'Checks if uses of quotes match the configured preference.'
3
+ StyleGuide: '#consistent-string-literals'
4
+ Enabled: false
3
5
 
4
- Style/HashSyntax:
5
- EnforcedStyle: hash_rockets
6
+ Layout/LineLength:
7
+ Description: 'Limit lines to 80 characters.'
8
+ Enabled: false
6
9
 
7
- Layout/TrailingWhitespace:
8
- Enabled: false
10
+ Naming/VariableNumber:
11
+ Description: 'Use the configured style when numbering variables.'
12
+ Enabled: false
13
+
14
+ Style/FrozenStringLiteralComment:
15
+ Description: >-
16
+ Add the frozen_string_literal comment to the top of files
17
+ to help transition to frozen string literals by default.
18
+ Enabled: false
19
+
20
+ Style/Documentation:
21
+ Description: 'Document classes and non-namespace modules.'
22
+ Enabled: false
23
+
24
+ Style/WordArray:
25
+ EnforcedStyle: brackets
26
+
27
+ Metrics/BlockLength:
28
+ Exclude:
29
+ - test/*/*_test.rb
@@ -8,14 +8,13 @@ cache:
8
8
  env:
9
9
  - DBTYPE=postgresql
10
10
  - DBTYPE=mysql2
11
- - DBTYPE=mysql
12
11
 
13
12
  rvm:
13
+ - 2.7.0
14
14
  - 2.6.4
15
15
  - 2.5.5
16
16
  - 2.4.5
17
- - 2.7.0-preview2
18
- # - ruby-head
17
+ - ruby-head
19
18
  # - jruby-9.0.5.0
20
19
 
21
20
  gemfile:
@@ -34,42 +33,14 @@ matrix:
34
33
  exclude:
35
34
  - rvm: ruby-head
36
35
  gemfile: gemfiles/rails42.gemfile
37
- - rvm: 2.7.0-preview2
36
+ - rvm: 2.7.0
38
37
  gemfile: gemfiles/rails42.gemfile
39
38
  - rvm: 2.6.4
40
39
  gemfile: gemfiles/rails42.gemfile
41
40
  - rvm: 2.4.5
42
41
  gemfile: gemfiles/rails60.gemfile
43
-
44
- - rvm: ruby-head
45
- env: DBTYPE=mysql
46
- - rvm: 2.7.0-preview2
47
- env: DBTYPE=mysql
48
- - rvm: 2.6.4
49
- env: DBTYPE=mysql
50
- - rvm: 2.5.5
51
- env: DBTYPE=mysql
52
- - rvm: 2.4.5
53
- env: DBTYPE=mysql
54
-
55
- - gemfile: gemfiles/unit.gemfile
56
- env: DBTYPE=mysql
57
- - gemfile: gemfiles/noop.gemfile
58
- env: DBTYPE=mysql
59
- - gemfile: gemfiles/libraries.gemfile
60
- env: DBTYPE=mysql
61
- - gemfile: gemfiles/instrumentation_mocked.gemfile
62
- env: DBTYPE=mysql
63
- - gemfile: gemfiles/instrumentation_mocked_oldgems.gemfile
64
- env: DBTYPE=mysql
65
- - gemfile: gemfiles/frameworks.gemfile
66
- env: DBTYPE=mysql
67
- - gemfile: gemfiles/rails52.gemfile
68
- env: DBTYPE=mysql
69
- - gemfile: gemfiles/rails60.gemfile
70
- env: DBTYPE=mysql
71
- - gemfile: gemfiles/delayed_job.gemfile
72
- env: DBTYPE=mysql
42
+ - rvm: 2.4.5 # excluding because of new sprockets version (4.0.0)
43
+ gemfile: gemfiles/rails52.gemfile
73
44
 
74
45
  - gemfile: gemfiles/unit.gemfile
75
46
  env: DBTYPE=mysql2
@@ -87,9 +58,9 @@ matrix:
87
58
  env: DBTYPE=mysql2
88
59
  allow_failures:
89
60
  - rvm: ruby-head
90
- - rvm: 2.7.0-preview2
91
61
 
92
- # FIXME: Figure out if this is still an issue when reviewing cassandra test setup
62
+ # FIXME: No cassandra tests for now
63
+ # ____ Figure out if this is still an issue when reviving cassandra
93
64
  # Attempt Travis/Cassandra fix re: https://github.com/travis-ci/travis-ci/issues/1484
94
65
  # Updated Cassandra: https://github.com/travis-ci/travis-ci/issues/1650
95
66
 
@@ -104,23 +75,32 @@ matrix:
104
75
  # - sudo service cassandra start
105
76
 
106
77
  install:
107
- - curl -LO http://kent.dl.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz
108
- - tar xzf swig-3.0.12.tar.gz
109
- - pushd swig-3.0.12
78
+ - curl -LO http://kent.dl.sourceforge.net/project/swig/swig/swig-4.0.2/swig-4.0.2.tar.gz
79
+ - tar xzf swig-4.0.2.tar.gz
80
+ - pushd swig-4.0.2
110
81
  - ./configure && make && sudo make install
111
82
  - popd
112
83
 
84
+ # use swig from git in case fixes haven't been released
85
+ # - git clone https://github.com/swig/swig.git
86
+ # - pushd swig
87
+ # - ./autogen.sh
88
+ # - ./configure && make && sudo make install
89
+ # - popd
90
+
113
91
  before_script:
114
92
  - export APPOPTICS_GEM_TEST=true
115
93
  - export APPOPTICS_REPORTER=file
116
94
  - export APPOPTICS_COLLECTOR=/tmp/appoptics_traces.bson
117
95
  - export APPOPTICS_REPORTER_FILE_SINGLE=false
118
- - export APPOPTICS_TOKEN_BUCKET_CAPACITY=1000
119
- - export APPOPTICS_TOKEN_BUCKET_RATE=1000
96
+ # - export APPOPTICS_TOKEN_BUCKET_CAPACITY=1000
97
+ # - export APPOPTICS_TOKEN_BUCKET_RATE=1000
120
98
  - export APPOPTICS_FROM_S3=true
99
+ - export OBOE_VERSION=10.0.0
121
100
 
122
- - bundle update --jobs=3 --retry=3
123
- - bundle exec rake clean fetch compile
101
+ # - bundle update --jobs=3 --retry=3
102
+ - ./.travis/bundle.sh
103
+ - bundle exec rake distclean fetch compile
124
104
  - psql -c 'create database travis_ci_test;' -U postgres
125
105
  - mysql -e 'create database travis_ci_test;'
126
106
  - redis-server --requirepass secret_pass &
data/Gemfile CHANGED
@@ -1,29 +1,38 @@
1
1
  source 'https://rubygems.org'
2
- gem 'rake'
2
+
3
+ # this Gemfile is very minimal
4
+ # use rake commands or gemfiles in the gemfiles directory for testing
5
+
6
+ gem 'rake', '>= 0.9.0'
3
7
 
4
8
  group :development, :test do
5
- gem 'minitest'
6
- gem 'minitest-reporters', '< 1.0.18'
7
- gem 'minitest-debugger', :require => false
8
- gem 'rack-test'
9
- gem 'puma'
10
- gem 'bson'
11
- gem 'webmock' if RUBY_VERSION >= '2.0.0'
12
- gem 'mocha'
13
- gem 'rubocop', require: false
14
- gem 'ruby-prof'
15
- gem 'benchmark-ips'
16
- gem 'ruby-debug', :platforms => :jruby
17
- gem 'debugger', :platform => :mri_19
18
- gem 'byebug'
19
- gem 'get_process_mem'
20
- gem 'memory_profiler'
9
+ # gem 'benchmark-ips', '>= 2.7.2'
10
+ # gem 'bson'
11
+ gem 'byebug', '>= 8.0.0'
12
+ # gem 'debugger', :platform => :mri_19
13
+ # gem 'get_process_mem'
14
+ 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'
21
30
 
22
- if defined?(JRUBY_VERSION)
23
- gem 'sinatra', :require => false
24
- else
25
- gem 'sinatra'
26
- end
31
+ # if defined?(JRUBY_VERSION)
32
+ # gem 'sinatra', :require => false
33
+ # else
34
+ # gem 'sinatra'
35
+ # end
27
36
  end
28
37
 
29
38
  gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.version = AppOpticsAPM::Version::STRING
7
7
  s.date = Time.now.strftime('%Y-%m-%d')
8
8
 
9
- s.license = "Librato Open License, Version 1.0"
9
+ s.license = "Librato Open License, Version 1.0, https://bit.ly/2Kmm0mN"
10
10
 
11
11
  s.authors = ["Maia Engeli", "Peter Giacomo Lombardo", "Spiros Eliopoulos"]
12
12
  s.email = %q{support@appoptics.com}
@@ -42,20 +42,21 @@ Automatic tracing and metrics for Ruby applications. Get started at appoptics.co
42
42
 
43
43
  s.extensions = ['ext/oboe_metal/extconf.rb'] unless defined?(JRUBY_VERSION)
44
44
 
45
- s.add_runtime_dependency('json', '>= 0')
45
+ s.add_runtime_dependency('json')
46
46
  s.add_runtime_dependency('no_proxy_fix', '~> 0.1.2', '>= 0.1.2')
47
47
 
48
48
  # Development dependencies used in gem development & testing
49
- s.add_development_dependency('rake', '>= 0.9.0')
50
- s.add_development_dependency('simplecov', '>= 0.16.0') if ENV["SIMPLECOV_COVERAGE"]
51
- s.add_development_dependency('simplecov-console', '>= 0.4.0') if ENV["SIMPLECOV_COVERAGE"]
52
- s.add_development_dependency('irb', '>= 1.0.0') if RUBY_VERSION >= '2.6.0'
53
-
54
- unless defined?(JRUBY_VERSION)
55
- s.add_development_dependency('byebug', '>= 8.0.0')
56
- s.add_development_dependency('minitest-hooks', '>= 1.5.0')
57
- s.add_development_dependency('benchmark-ips', '>= 2.7.2')
58
- end
49
+ # s.add_development_dependency('rake', '>= 0.9.0')
50
+ # s.add_development_dependency('simplecov', '>= 0.16.0') if ENV["SIMPLECOV_COVERAGE"]
51
+ # s.add_development_dependency('simplecov-console', '>= 0.4.0') if ENV["SIMPLECOV_COVERAGE"]
52
+ # s.add_development_dependency('irb', '>= 1.0.0') if RUBY_VERSION >= '2.6.0'
53
+ #
54
+ # unless defined?(JRUBY_VERSION)
55
+ # s.add_development_dependency('byebug', '>= 8.0.0')
56
+ # s.add_development_dependency('minitest-hooks', '>= 1.5.0')
57
+ # s.add_development_dependency('minitest-focus', '>=1.1.2')
58
+ # s.add_development_dependency('benchmark-ips', '>= 2.7.2')
59
+ # end
59
60
 
60
61
  s.required_ruby_version = '>= 2.4.0'
61
62
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -0,0 +1,142 @@
1
+ # Copyright (c) 2020 SolarWinds, LLC.
2
+ # All rights reserved.
3
+
4
+ ###############################################################
5
+ # SDK EXAMPLES
6
+ ###############################################################
7
+ # The uses cases of the SDK include:
8
+ # - tracing a piece of your own code
9
+ # - tracing a method call of a gem that is not auto-instrumented
10
+ # by appoptics_apm
11
+ #
12
+ # SDK documentation:
13
+ # https://rubydoc.info/gems/appoptics_apm/AppOpticsAPM/SDK
14
+
15
+ ###############################################################
16
+ # Prerequisits
17
+ # export APPOPTICS_SERVICE_KEY=<API token>:<service_name>
18
+ # `bundle exec ruby sdk_examples.rb`
19
+ # 5 traced requests will show up at https://my.appoptics.com/
20
+ ###############################################################
21
+
22
+ require 'appoptics_apm'
23
+
24
+ unless AppOpticsAPM::SDK.appoptics_ready?(10_000)
25
+ puts "aborting!!! Agent not ready after 10 seconds"
26
+ exit false
27
+ end
28
+
29
+ ###############################################################
30
+ ### ADD A SPAN
31
+ ###############################################################
32
+ #
33
+ # AppOpticsAPM::SDK.trace()
34
+ # This method adds a span to a trace that has been started either
35
+ # by the auto-instrumentation of the gem handling incoming requests
36
+ # or the SDK method `start_trace`.
37
+ # If this method is called outside of the context of a started
38
+ # trace no spans will be created.
39
+ #
40
+ # The argument is the name for the span
41
+
42
+ AppOpticsAPM::SDK.trace('span_name') do
43
+ [9, 6, 12, 2, 7, 1, 9, 3, 4, 14, 5, 8].sort
44
+ end
45
+
46
+ ###############################################################
47
+ # START A TRACE, ADD A SPAN, AND LOG AN INFO EVENT
48
+ ###############################################################
49
+ #
50
+ # AppOpticsAPM::SDK.start_trace()
51
+ # This method starts a trace. It is handy for background jobs,
52
+ # workers, or scripts, that are not part of a rack application
53
+
54
+ AppOpticsAPM::SDK.start_trace('outer_span') do
55
+ AppOpticsAPM::SDK.trace('first_child_span') do
56
+ [9, 6, 12, 2, 7, 1, 9, 3, 4, 14, 5, 8].sort
57
+ AppOpticsAPM::SDK.log_info({ some: :fancy, hash: :to, send: 1 })
58
+ end
59
+ end
60
+
61
+ ###############################################################
62
+ # LOG AN ERROR EVENT
63
+ ###############################################################
64
+ #
65
+ # AppOpticsAPM::SDK.log_exception()
66
+ # This method adds an error event to the trace, which will be
67
+ # displayed and counted as exception on the appoptics dashboard.
68
+
69
+ def do_raise
70
+ raise StandardError.new("oops")
71
+ end
72
+
73
+ AppOpticsAPM::SDK.start_trace('with_error') do
74
+ begin
75
+ do_raise
76
+ rescue => e
77
+ AppOpticsAPM::SDK.log_exception(e)
78
+ end
79
+ end
80
+
81
+ ###############################################################
82
+ # TRACE A METHOD
83
+ ###############################################################
84
+ #
85
+ # AppOpticsAPM::SDK.trace_method()
86
+ # This creates a span every time the defined method is run.
87
+ # The method can be of any (accessible) type (instance,
88
+ # singleton, private, protected etc.).
89
+
90
+ module ExampleModule
91
+ def self.do_sum(a, b)
92
+ a + b
93
+ end
94
+ end
95
+
96
+ AppOpticsAPM::SDK.trace_method(ExampleModule,
97
+ :do_sum,
98
+ { name: 'computation', backtrace: true },
99
+ { CustomKey: "some_info"})
100
+
101
+ AppOpticsAPM::SDK.start_trace('trace_a_method') do
102
+ ExampleModule.do_sum(1, 2)
103
+ ExampleModule.do_sum(3, 4)
104
+ end
105
+
106
+ ###############################################################
107
+ # SET A CUSTOM TRANSACTION NAME
108
+ ###############################################################
109
+ #
110
+ # AppOpticsAPM::SDK.set_transaction_name()
111
+ #
112
+ # this method can be called anytime after a trace has been started to add a
113
+ # custom name for the whole transaction.
114
+ # In case of a controller the trace is usually started in rack.
115
+
116
+ class FakeController
117
+ def create(params)
118
+ # @fake = fake.new(params.permit(:type, :title))
119
+ # @fake.save
120
+ AppOpticsAPM::SDK.set_transaction_name("fake.#{params[:type]}")
121
+ # redirect_to @fake
122
+ end
123
+ end
124
+
125
+ AppOpticsAPM::SDK.start_trace('set_transaction_name') do
126
+ FakeController.new.create(type: 'news')
127
+ end
128
+
129
+ ###############################################################
130
+ # LOG INJECTION OF TRACE_ID
131
+ ###############################################################
132
+ #
133
+ # AppOpticsAPM::SDK.current_trace
134
+ # This method creates an object with the current trace ID and
135
+ # helper methods to add the ID to logs for cross-referencing.
136
+
137
+ AppOpticsAPM::Config[:log_traceId] = :always
138
+
139
+ AppOpticsAPM::SDK.start_trace('log_trace_id') do
140
+ trace = AppOpticsAPM::SDK.current_trace
141
+ AppOpticsAPM.logger.warn "Some log message #{trace.for_log}"
142
+ end