appoptics_apm 4.11.2 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d253a9e5a6be4b11234dc7c761fe700c4ee8ca0d9e254a492de1dd978f80e05
4
- data.tar.gz: 45fee16fc9023d5c1e626778cbfd067608b74e0cd70db43376196c6db0d75418
3
+ metadata.gz: 7a652aaa478b98230f9f924d9b8aaf98c36d532dd078e66fe2f123c53d0b871e
4
+ data.tar.gz: dff2fd57dfab08035c3a3f0af29b9cf41ebf0df486fe5e2ce93db5fa9ecef306
5
5
  SHA512:
6
- metadata.gz: 2d28d01c42520a2245013ac8441880251e5037cf4fbd7523caeba159eee241acd36b32c1a709d95334c98cb44d885f30c3e39c0f3e020ef6b16581aabe461d5d
7
- data.tar.gz: 1cc6d1af93479adcb85535e86a791bd7c8eb4806517718612b0c42cf860654a2b07f8d69cc6ac3cc91747ee698dfa85f089d2065f1da7bc5b3cdeb3b68fbbdeb
6
+ metadata.gz: 187b9e776b1a976e12aa704cb8c1d894a8cd428b8e7702ed2871efd451d5d8127a7d02a1dd6461d87d3077c9348ec1334baaff5adc28e871ee67ae97d130632b
7
+ data.tar.gz: f7b555c14f9456c7a7a565003c48092104eed3c8f54d5c705e0abde35e33fc2e56748ddb7b6452729da5fa04dbad36c408f8fe9b2c58866261d3cecc9f532163
@@ -75,27 +75,26 @@ matrix:
75
75
  # - sudo service cassandra start
76
76
 
77
77
  install:
78
- # - curl -LO http://kent.dl.sourceforge.net/project/swig/swig/swig-3.0.12/swig-3.0.12.tar.gz
79
- # - curl -LO http://kent.dl.sourceforge.net/project/swig/swig/swig-4.0.1/swig-4.0.1.tar.gz
80
- # - tar xzf swig-4.0.1.tar.gz
81
- # - pushd swig-4.0.1
82
- # - ./configure && make && sudo make install
83
- # - popd
84
-
85
- # use swig from git, it is the only one that works with Ruby 2.7 for now
86
- - git clone https://github.com/swig/swig.git
87
- - pushd swig
88
- - ./autogen.sh
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
89
81
  - ./configure && make && sudo make install
90
82
  - popd
91
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
+
92
91
  before_script:
93
92
  - export APPOPTICS_GEM_TEST=true
94
93
  - export APPOPTICS_REPORTER=file
95
94
  - export APPOPTICS_COLLECTOR=/tmp/appoptics_traces.bson
96
95
  - export APPOPTICS_REPORTER_FILE_SINGLE=false
97
- - export APPOPTICS_TOKEN_BUCKET_CAPACITY=1000
98
- - export APPOPTICS_TOKEN_BUCKET_RATE=1000
96
+ # - export APPOPTICS_TOKEN_BUCKET_CAPACITY=1000
97
+ # - export APPOPTICS_TOKEN_BUCKET_RATE=1000
99
98
  - export APPOPTICS_FROM_S3=true
100
99
 
101
100
  # - bundle update --jobs=3 --retry=3
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'rake', '>= 0.9.0'
8
8
  group :development, :test do
9
9
  # gem 'benchmark-ips', '>= 2.7.2'
10
10
  # gem 'bson'
11
- # gem 'byebug', '>= 8.0.0'
11
+ gem 'byebug', '>= 8.0.0'
12
12
  # gem 'debugger', :platform => :mri_19
13
13
  # gem 'get_process_mem'
14
14
  gem 'irb', '>= 1.0.0' # if RUBY_VERSION >= '2.6.0'
@@ -0,0 +1 @@
1
+ {}
@@ -42,7 +42,7 @@ 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', '~> 2.3')
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
@@ -0,0 +1,20 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "(lldb) Launch",
9
+ "type": "cppdbg",
10
+ "request": "launch",
11
+ "program": "enter program name, for example ${workspaceFolder}/a.out",
12
+ "args": [],
13
+ "stopAtEntry": false,
14
+ "cwd": "${workspaceFolder}",
15
+ "environment": [],
16
+ "externalConsole": false,
17
+ "MIMode": "lldb"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,160 @@
1
+ // function_profiler C++11 per-thread function profling
2
+ // https://git.the-pluc.net/function_profiler.git/
3
+ // Version 0.3
4
+ //
5
+ // Copyright (C) 2015, 2016 Pierre-Luc Perrier <pluc@the-pluc.net>
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+
19
+ #ifndef function_profiler_h
20
+ #define function_profiler_h
21
+
22
+ #ifdef FP_ENABLE
23
+
24
+ #include <boost/chrono.hpp>
25
+
26
+ #include <cstdio> // std::printf
27
+ #include <ios> // std::hex
28
+ #include <string> // std::string
29
+ #include <thread> // std::this_thread::get_id
30
+ #include <iostream>
31
+ #include <iomanip>
32
+
33
+ namespace fp {
34
+
35
+ // Main structure used to collect data
36
+ struct collector {
37
+ // Clocks
38
+ using thread_clock = boost::chrono::thread_clock;
39
+ using thread_time_point = thread_clock::time_point;
40
+ using thread_accumulator = boost::chrono::duration<uint_least64_t, thread_clock::period>;
41
+
42
+ using steady_clock = boost::chrono::steady_clock;
43
+ using steady_time_point = steady_clock::time_point;
44
+ using steady_accumulator = boost::chrono::duration<uint_least64_t, steady_clock::period>;
45
+
46
+ // The duration we use for the report
47
+ using report_duration = boost::chrono::duration<double, boost::milli>;
48
+
49
+ collector() = delete;
50
+ collector(const std::string &name)
51
+ : m_thread_last{thread_clock::now()},
52
+ m_steady_last{steady_clock::now()},
53
+ m_count{0},
54
+ m_thread_accumulator{0},
55
+ m_steady_accumulator{0},
56
+ m_last_report{steady_clock::now()}
57
+ {
58
+ std::ostringstream os;
59
+ // os << "[FP] " << std::hex << std::this_thread::get_id() << " " << name << " #%-7lu %8.5F %8.5F %11.4F %11.4F\n";
60
+ os << std::setfill (' ') << std::setw(22) << name << " " << std::hex << std::this_thread::get_id() << "\t#%-7lu\t%4.5F\t%4.5F\t%6.4F\t%6.4F\n";
61
+ m_fmt = os.str();
62
+ }
63
+
64
+ // We also report upon destruction. Note: this is probably a bad
65
+ // idea.
66
+ ~collector() noexcept
67
+ {
68
+ report();
69
+ }
70
+
71
+ inline void start() noexcept
72
+ {
73
+ m_thread_last = thread_clock::now();
74
+ m_steady_last = steady_clock::now();
75
+ }
76
+
77
+ inline void stop()
78
+ {
79
+ ++m_count;
80
+
81
+ {
82
+ const auto now = thread_clock::now();
83
+ m_thread_accumulator += now - m_thread_last;
84
+ m_thread_last = std::move(now);
85
+ }
86
+ {
87
+ const auto now = steady_clock::now();
88
+ m_steady_accumulator += now - m_steady_last;
89
+ m_steady_last = std::move(now);
90
+ }
91
+
92
+ // Check if we need to report current stats
93
+ if (m_steady_last - m_last_report > report_interval) {
94
+ m_last_report = m_steady_last;
95
+ report();
96
+ }
97
+ }
98
+
99
+ private:
100
+ inline void report() const
101
+ {
102
+ if (m_count == 0) return;
103
+ const auto thread_ms = report_duration{m_thread_accumulator}.count();
104
+ const auto steady_ms = report_duration{m_steady_accumulator}.count();
105
+ std::printf(m_fmt.c_str(), m_count, steady_ms / m_count, thread_ms / m_count, steady_ms, thread_ms);
106
+ }
107
+
108
+ private:
109
+ static constexpr auto report_interval = boost::chrono::seconds{1};
110
+
111
+ thread_time_point m_thread_last; // Last thread clock time point
112
+ steady_time_point m_steady_last; // Last steady clock time point
113
+ uint_least64_t m_count; // Number of samples
114
+ thread_accumulator m_thread_accumulator; // Total thread clock duration
115
+ steady_accumulator m_steady_accumulator; // Total steady clock duration
116
+ steady_time_point m_last_report; // Last report
117
+ std::string m_fmt; // Format used for reporting
118
+ };
119
+
120
+ // RAII structure responsible to update a collector
121
+ struct scoped_profiler {
122
+ public:
123
+ scoped_profiler(collector &collector_) : m_collector{collector_}
124
+ {
125
+ m_collector.start();
126
+ }
127
+
128
+ ~scoped_profiler()
129
+ {
130
+ m_collector.stop();
131
+ }
132
+
133
+ scoped_profiler() = delete;
134
+ scoped_profiler(const scoped_profiler &) = delete;
135
+ scoped_profiler(scoped_profiler &&) = delete;
136
+
137
+ scoped_profiler &operator=(const scoped_profiler &) = delete;
138
+ scoped_profiler &operator=(scoped_profiler &&) = delete;
139
+
140
+ private:
141
+ collector &m_collector;
142
+ };
143
+
144
+ // constexpr boost::chrono::seconds collector::report_interval;
145
+
146
+ } // namespace fp
147
+
148
+ // Note: __func__ is not a preprocessor macro, it's a 'function-local
149
+ // predefined variable' (char *), hence we don't expand it.
150
+ #define PROFILE_FUNCTION() \
151
+ thread_local fp::collector fp_info_fp{__func__}; \
152
+ fp::scoped_profiler fp_scoped_profiler_fp{fp_info_fp};
153
+
154
+ #else // !FB_ENABLE
155
+
156
+ #define PROFILE_FUNCTION() static_cast<void>(0);
157
+
158
+ #endif // FB_ENABLE
159
+
160
+ #endif // function_profiler_h
@@ -65,15 +65,16 @@ module AppOpticsAPM
65
65
  config_file = File.join(Dir.pwd, 'appoptics_apm_config.rb')
66
66
  config_files << config_file if File.exist?(config_file)
67
67
 
68
- return if config_files.empty? # we use the defaults from the template in this case
69
-
70
- if config_files.size > 1
71
- AppOpticsAPM.logger.warn [
72
- '[appoptics_apm/config] Multiple configuration files configured, using the first one listed: ',
73
- config_files.join(', ')
74
- ].join(' ')
68
+ unless config_files.empty? # we use the defaults from the template if there are no config files
69
+ if config_files.size > 1
70
+ AppOpticsAPM.logger.warn [
71
+ '[appoptics_apm/config] Multiple configuration files configured, using the first one listed: ',
72
+ config_files.join(', ')
73
+ ].join(' ')
74
+ end
75
+ load(config_files[0])
75
76
  end
76
- load(config_files[0])
77
+
77
78
  # sets AppOpticsAPM::Config[:debug_level], AppOpticsAPM.logger.level
78
79
  set_log_level
79
80
 
@@ -1,6 +1,8 @@
1
1
  # Copyright (c) 2016 SolarWinds, LLC.
2
2
  # All rights reserved.
3
3
 
4
+ require_relative '../../../lib/appoptics_apm/inst/logger_formatter'
5
+
4
6
  module AppOpticsAPM
5
7
  module Rails
6
8
  module Helpers
@@ -75,6 +77,10 @@ if defined?(::Rails)
75
77
  AppOpticsAPM::Rails.include_helpers
76
78
  end
77
79
 
80
+ initializer 'appoptics_apm.controller', before: 'wicked_pdf.register' do
81
+ AppOpticsAPM::Rails.load_instrumentation
82
+ end
83
+
78
84
  initializer 'appoptics_apm.rack' do |app|
79
85
  AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting rack' if AppOpticsAPM::Config[:verbose]
80
86
  app.config.middleware.insert 0, AppOpticsAPM::Rack
@@ -84,7 +90,7 @@ if defined?(::Rails)
84
90
  AppOpticsAPM.logger = ::Rails.logger if ::Rails.logger && !ENV.key?('APPOPTICS_GEM_TEST')
85
91
 
86
92
  AppOpticsAPM::Inst.load_instrumentation
87
- AppOpticsAPM::Rails.load_instrumentation
93
+ # AppOpticsAPM::Rails.load_instrumentation
88
94
 
89
95
  # Report __Init after fork when in Heroku
90
96
  AppOpticsAPM::API.report_init unless AppOpticsAPM.heroku?
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2020 SolarWinds, LLC.
2
+ # All rights reserved.
3
+
4
+ module AppOpticsAPM
5
+ module RackCacheContext
6
+
7
+ ###
8
+ # This adds a controller.action like transaction name for
9
+ # requests directly served from the cache without involving a controller.
10
+ # The resulting transaction name is `rack-cache.<cache-store>`,
11
+ # e.g. `rack-cache.memcached`
12
+ #
13
+ # It is not a full instrumentation, no span is added.
14
+ #
15
+ def call!(env)
16
+ metastore_type = begin
17
+ if options['rack-cache.metastore']
18
+ options['rack-cache.metastore'].match(/^([^\:]*)\:/)[1]
19
+ end || 'unknown_store'
20
+ rescue
21
+ 'unknown_store'
22
+ end
23
+
24
+ env['appoptics_apm.action'] = metastore_type
25
+ env['appoptics_apm.controller'] = 'rack-cache'
26
+
27
+ super
28
+ end
29
+ end
30
+ end
31
+
32
+ if AppOpticsAPM::Config[:rack_cache][:transaction_name] && defined?(Rack::Cache::Context)
33
+ AppOpticsAPM.logger.info '[appoptics_apm/loading] Instrumenting rack_cache' if AppOpticsAPM::Config[:verbose]
34
+ Rack::Cache::Context.send(:prepend, ::AppOpticsAPM::RackCacheContext)
35
+ end
@@ -55,6 +55,7 @@ module AppOpticsAPM
55
55
  ENV['DATABASE_URL'] = "postgresql://postgres:#{ENV['TRAVIS_PSQL_PASS']}@127.0.0.1:5432/travis_ci_test"
56
56
  elsif ENV.key?('DOCKER_PSQL_PASS')
57
57
  ENV['DATABASE_URL'] = "postgresql://docker:#{ENV['DOCKER_PSQL_PASS']}@#{ENV['PSQL_HOST']}:5432/travis_ci_test"
58
+ # ENV['DATABASE_URL'] = "postgresql://postgres@#{ENV['PSQL_HOST']}:5432/travis_ci_test"
58
59
  else
59
60
  ENV['DATABASE_URL'] = 'postgresql://postgres@127.0.0.1:5432/travis_ci_test'
60
61
  end
@@ -7,8 +7,8 @@ module AppOpticsAPM
7
7
  # appoptics_apm.gemspec during gem build process
8
8
  module Version
9
9
  MAJOR = 4 # breaking,
10
- MINOR = 11 # feature,
11
- PATCH = 2 # fix => BFF
10
+ MINOR = 12 # feature,
11
+ PATCH = 0 # fix => BFF
12
12
 
13
13
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
14
14
  end
@@ -112,25 +112,6 @@ if defined?(AppOpticsAPM::Config)
112
112
  AppOpticsAPM::Config[:sanitize_sql_regexp] = '(\'[^\']*\'|\d*\.\d+|\d+|NULL)'
113
113
  AppOpticsAPM::Config[:sanitize_sql_opts] = Regexp::IGNORECASE
114
114
 
115
- #
116
- # GraphQL
117
- #
118
- # Enable tracing for GraphQL.
119
- # (true | false, default: true)
120
- AppOpticsAPM::Config[:graphql][:enabled] = true
121
- # Replace query arguments with a '?' when sent with a trace.
122
- # (true | false, default: true)
123
- AppOpticsAPM::Config[:graphql][:sanitize] = true
124
- # Remove comments from queries when sent with a trace.
125
- # (true | false, default: true)
126
- AppOpticsAPM::Config[:graphql][:remove_comments] = true
127
- # Create a transaction name by combining
128
- # "query" or "mutation" with the first word of the query.
129
- # This overwrites the default transaction name, which is a combination of
130
- # controller + action and would be the same for all graphql queries.
131
- # (true | false, default: true)
132
- AppOpticsAPM::Config[:graphql][:transaction_name] = true
133
-
134
115
  #
135
116
  # Do Not Trace - DNT
136
117
  #
@@ -158,6 +139,36 @@ if defined?(AppOpticsAPM::Config)
158
139
  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}$'
159
140
  AppOpticsAPM::Config[:dnt_opts] = Regexp::IGNORECASE
160
141
 
142
+ #
143
+ # GraphQL
144
+ #
145
+ # Enable tracing for GraphQL.
146
+ # (true | false, default: true)
147
+ AppOpticsAPM::Config[:graphql][:enabled] = true
148
+ # Replace query arguments with a '?' when sent with a trace.
149
+ # (true | false, default: true)
150
+ AppOpticsAPM::Config[:graphql][:sanitize] = true
151
+ # Remove comments from queries when sent with a trace.
152
+ # (true | false, default: true)
153
+ AppOpticsAPM::Config[:graphql][:remove_comments] = true
154
+ # Create a transaction name by combining
155
+ # "query" or "mutation" with the first word of the query.
156
+ # This overwrites the default transaction name, which is a combination of
157
+ # controller + action and would be the same for all graphql queries.
158
+ # (true | false, default: true)
159
+ AppOpticsAPM::Config[:graphql][:transaction_name] = true
160
+
161
+ #
162
+ # Rack::Cache
163
+ #
164
+ # Create a transaction name like `rack-cache.<cache-store>`,
165
+ # e.g. `rack-cache.memcached`
166
+ # This can reduce the number of transaction names, when many requests are
167
+ # served directly from the cache without hitting a controller action.
168
+ # When set to `false` the path will be used for the transaction name.
169
+ #
170
+ AppOpticsAPM::Config[:rack_cache] = { transaction_name: true }
171
+
161
172
  #
162
173
  # Transaction Settings
163
174
  #
Binary file
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.11.2
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maia Engeli
@@ -10,22 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-05-21 00:00:00.000000000 Z
13
+ date: 2020-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '2.3'
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '2.3'
28
+ version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: no_proxy_fix
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -70,9 +70,11 @@ files:
70
70
  - Gemfile
71
71
  - LICENSE
72
72
  - README.md
73
+ - app/assets/config/manifest.js
73
74
  - appoptics_apm.gemspec
74
75
  - bin/appoptics_apm_config
75
76
  - examples/sdk_examples.rb
77
+ - ext/.vscode/launch.json
76
78
  - ext/oboe_metal/README.md
77
79
  - ext/oboe_metal/extconf.rb
78
80
  - ext/oboe_metal/lib/.keep
@@ -80,6 +82,7 @@ files:
80
82
  - ext/oboe_metal/src/VERSION
81
83
  - ext/oboe_metal/src/bson/bson.h
82
84
  - ext/oboe_metal/src/bson/platform_hacks.h
85
+ - ext/oboe_metal/src/function_profiler.hpp
83
86
  - ext/oboe_metal/src/oboe.h
84
87
  - ext/oboe_metal/src/oboe.hpp
85
88
  - ext/oboe_metal/src/oboe_debug.h
@@ -133,6 +136,7 @@ files:
133
136
  - lib/appoptics_apm/inst/mongo2.rb
134
137
  - lib/appoptics_apm/inst/moped.rb
135
138
  - lib/appoptics_apm/inst/rack.rb
139
+ - lib/appoptics_apm/inst/rack_cache.rb
136
140
  - lib/appoptics_apm/inst/redis.rb
137
141
  - lib/appoptics_apm/inst/resque.rb
138
142
  - lib/appoptics_apm/inst/rest-client.rb
@@ -167,6 +171,7 @@ files:
167
171
  - lib/oboe_metal.rb
168
172
  - lib/rails/generators/appoptics_apm/install_generator.rb
169
173
  - lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb
174
+ - lib/rb_appoptics_apm.so
170
175
  - yardoc_frontpage.md
171
176
  homepage: https://www.appoptics.com/
172
177
  licenses: