appoptics_apm 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -7
- data/Rakefile +15 -15
- data/appoptics_apm.gemspec +3 -7
- data/ext/oboe_metal/extconf.rb +88 -39
- data/lib/appoptics_apm/inst/excon.rb +1 -1
- data/lib/appoptics_apm/inst/faraday.rb +10 -3
- data/lib/appoptics_apm/inst/rest-client.rb +1 -1
- data/lib/appoptics_apm/version.rb +1 -1
- metadata +2 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff856df7c5459eb39bfa7b9d5a248c44f74a6d3e
|
4
|
+
data.tar.gz: e41c9199c097afcae143d271016566f2fb2077f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3d4658d0bb2f448561fa6aa46f38a506eeabb6eb07681c726b2de3b1b63c5976be1b72851c598c7dcf975a53a85bc9a600267cf569fb1a834ee7ffac0f401e
|
7
|
+
data.tar.gz: 374174feff92a2d0accbd4ce04548f580814d5d3246d390c67d694703474f91da860517cab0c1ba777c2ff4b499c00fcb9556fb0bbee4d2d02a7d50d32546ce6
|
data/.travis.yml
CHANGED
@@ -6,8 +6,9 @@ cache:
|
|
6
6
|
- vendor/bundle
|
7
7
|
|
8
8
|
rvm:
|
9
|
-
- 2.
|
10
|
-
- 2.3
|
9
|
+
- 2.5.0
|
10
|
+
- 2.4.3
|
11
|
+
- 2.3.6
|
11
12
|
- 1.9.3
|
12
13
|
# - jruby-9.0.5.0
|
13
14
|
|
@@ -15,6 +16,7 @@ gemfile:
|
|
15
16
|
- gemfiles/noop.gemfile
|
16
17
|
- gemfiles/libraries.gemfile
|
17
18
|
- gemfiles/instrumentation_mocked.gemfile
|
19
|
+
- gemfiles/instrumentation_mocked_oldgems.gemfile
|
18
20
|
- gemfiles/frameworks.gemfile
|
19
21
|
- gemfiles/rails32.gemfile
|
20
22
|
- gemfiles/rails42.gemfile
|
@@ -25,7 +27,9 @@ gemfile:
|
|
25
27
|
matrix:
|
26
28
|
exclude:
|
27
29
|
# Rails 3.2 is not compatible with Ruby >= '2.4'
|
28
|
-
- rvm: 2.
|
30
|
+
- rvm: 2.5.0
|
31
|
+
gemfile: gemfiles/rails32.gemfile
|
32
|
+
- rvm: 2.4.3
|
29
33
|
gemfile: gemfiles/rails32.gemfile
|
30
34
|
|
31
35
|
- rvm: 1.9.3
|
@@ -34,9 +38,11 @@ matrix:
|
|
34
38
|
- rvm: 1.9.3
|
35
39
|
gemfile: gemfiles/rails51.gemfile
|
36
40
|
|
37
|
-
|
41
|
+
# WebMock requires Ruby 2.0 or higher
|
38
42
|
- rvm: 1.9.3
|
39
43
|
gemfile: gemfiles/instrumentation_mocked.gemfile
|
44
|
+
- rvm: 1.9.3
|
45
|
+
gemfile: gemfiles/instrumentation_mocked_oldgems.gemfile
|
40
46
|
|
41
47
|
# - rvm: jruby-9.0.5.0
|
42
48
|
# gemfile: gemfiles/delayed_job.gemfile
|
@@ -45,12 +51,11 @@ matrix:
|
|
45
51
|
# - rvm: jruby-9.0.5.0
|
46
52
|
# gemfile: gemfiles/rails50.gemfile
|
47
53
|
|
54
|
+
# FIXME: Figure out if this is still an issue when reviewing cassandra test setup
|
48
55
|
# Attempt Travis/Cassandra fix re: https://github.com/travis-ci/travis-ci/issues/1484
|
49
56
|
# Updated Cassandra: https://github.com/travis-ci/travis-ci/issues/1650
|
57
|
+
|
50
58
|
before_install:
|
51
|
-
- gem update --system '2.6.1'
|
52
|
-
- gem update bundler
|
53
|
-
- gem --version
|
54
59
|
- sudo service cassandra stop
|
55
60
|
- sudo sh -c "echo 'JVM_OPTS=\"\${JVM_OPTS} -Djava.net.preferIPv4Stack=false\"' >> /etc/cassandra/cassandra-env.sh"
|
56
61
|
- echo "127.0.0.1 localhost" | sudo tee /etc/hosts
|
data/Rakefile
CHANGED
@@ -63,25 +63,25 @@ end
|
|
63
63
|
desc "Fetch extension dependency files"
|
64
64
|
task :fetch_ext_deps do
|
65
65
|
swig_version = %x{swig -version} rescue ''
|
66
|
-
|
67
|
-
|
66
|
+
swig_version = swig_version.scan(/swig version 3.0.\d*/i)
|
67
|
+
if swig_version.empty?
|
68
|
+
$stderr.puts '== ERROR ================================================================='
|
69
|
+
$stderr.puts "Could not find required swig version 3.0.*, found #{swig_version.inspect}"
|
70
|
+
$stderr.puts 'Please install swig "~ 3.0.8" and try again.'
|
71
|
+
$stderr.puts '=========================================================================='
|
72
|
+
raise
|
68
73
|
end
|
74
|
+
|
75
|
+
# The c-lib version is different from the gem version
|
69
76
|
oboe_version = ENV['OBOE_VERSION'] || 'latest'
|
70
|
-
oboe_arch = ENV['APPOPTICS_OS_ARCH'] || 'x86_64'
|
71
77
|
oboe_src_dir = "https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/#{oboe_version}"
|
72
|
-
ext_lib_dir = File.expand_path('ext/oboe_metal/lib')
|
73
78
|
ext_src_dir = File.expand_path('ext/oboe_metal/src')
|
74
79
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
local_file = File.join(ext_lib_dir, filename)
|
81
|
-
else
|
82
|
-
remote_file = File.join(oboe_src_dir, filename)
|
83
|
-
local_file = File.join(ext_src_dir, filename)
|
84
|
-
end
|
80
|
+
# VERSION is used by extconf.rb to download the correct liboboe when installing the gem
|
81
|
+
%w(oboe.i oboe.h oboe.hpp oboe_debug.h VERSION).each do |filename|
|
82
|
+
remote_file = File.join(oboe_src_dir, filename)
|
83
|
+
local_file = File.join(ext_src_dir, filename)
|
84
|
+
|
85
85
|
puts "fetching #{remote_file} to #{local_file}"
|
86
86
|
open(remote_file, 'rb') do |rf|
|
87
87
|
content = rf.read
|
@@ -90,7 +90,7 @@ task :fetch_ext_deps do
|
|
90
90
|
end
|
91
91
|
FileUtils.cd(ext_src_dir) do
|
92
92
|
system('swig -c++ -ruby -module oboe_metal oboe.i')
|
93
|
-
|
93
|
+
FileUtils.rm('oboe.i')
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
data/appoptics_apm.gemspec
CHANGED
@@ -16,16 +16,16 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.extra_rdoc_files = ["LICENSE"]
|
18
18
|
s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|gemfiles)/}) }
|
19
|
-
s.files += ['ext/oboe_metal/
|
20
|
-
'ext/oboe_metal/src/oboe.h',
|
19
|
+
s.files += ['ext/oboe_metal/src/oboe.h',
|
21
20
|
'ext/oboe_metal/src/oboe.hpp',
|
22
21
|
'ext/oboe_metal/src/oboe_debug.h',
|
23
22
|
'ext/oboe_metal/src/oboe_wrap.cxx',
|
24
23
|
'ext/oboe_metal/src/VERSION']
|
25
|
-
# s.test_files = Dir.glob("{test}/**/*.rb")
|
26
24
|
|
27
25
|
# TODO this is commented out util we can actually provide gems for different platforms
|
26
|
+
# it will create a gem that goes into noop on Darwin and other unsupported platforms
|
28
27
|
# s.platform = defined?(JRUBY_VERSION) ? 'java' : Gem::Platform::CURRENT
|
28
|
+
|
29
29
|
s.extensions = ['ext/oboe_metal/extconf.rb'] unless defined?(JRUBY_VERSION)
|
30
30
|
|
31
31
|
s.add_runtime_dependency('json', '>= 0')
|
@@ -47,9 +47,5 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_development_dependency('pry', '>= 0.10.0')
|
48
48
|
end
|
49
49
|
|
50
|
-
s.add_development_dependency('benchmark-ips')
|
51
|
-
s.add_development_dependency('benchmark-memory')
|
52
|
-
s.add_development_dependency('ruby-prof')
|
53
|
-
|
54
50
|
s.required_ruby_version = '>= 1.9.3'
|
55
51
|
end
|
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
require 'mkmf'
|
5
5
|
require 'rbconfig'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'digest'
|
6
8
|
|
7
9
|
ext_dir = File.expand_path(File.dirname(__FILE__))
|
8
10
|
|
@@ -11,48 +13,95 @@ jruby = defined?(JRUBY_VERSION) ? true : false
|
|
11
13
|
|
12
14
|
# Set the mkmf lib paths so we have no issues linking to
|
13
15
|
# the AppOpticsAPM libs.
|
14
|
-
|
16
|
+
ao_lib_dir = File.join(ext_dir, 'lib')
|
15
17
|
ao_include = File.join(ext_dir, 'src')
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
19
|
+
# Download the appropriate liboboe from files.appoptics.com
|
20
|
+
ao_path = File.join('https://files.appoptics.com/c-lib', File.read(File.join(ao_include, 'VERSION')).chomp)
|
21
|
+
ao_arch = `ldd --version 2>&1` =~ /musl/ ? 'alpine-x86_64' : 'x86_64'
|
22
|
+
ao_clib = "liboboe-1.0-#{ao_arch}.so.0.0.0"
|
23
|
+
ao_item = File.join(ao_path, ao_clib)
|
24
|
+
ao_checksum_item = "#{ao_item}.sha256"
|
25
|
+
target = File.join(ao_lib_dir, ao_clib)
|
26
|
+
|
27
|
+
retries = 3
|
28
|
+
while retries > 0
|
29
|
+
begin
|
30
|
+
# download
|
31
|
+
download = open(ao_item, 'rb')
|
32
|
+
IO.copy_stream(download, target)
|
33
|
+
|
34
|
+
checksum = open(ao_checksum_item, 'r').read.chomp
|
35
|
+
target_checksum = Digest::SHA256.file(target).hexdigest
|
36
|
+
|
37
|
+
# verify_checksum
|
38
|
+
if target_checksum != checksum
|
39
|
+
$stderr.puts '== ERROR ================================================================='
|
40
|
+
$stderr.puts 'Checksum Verification failed for the c-extension of the appoptics_apm gem.'
|
41
|
+
$stderr.puts 'appoptics_apm will not instrument the code. No tracing will occur.'
|
42
|
+
$stderr.puts 'Contact support@appoptics.com if the problem persists.'
|
43
|
+
$stderr.puts '=========================================================================='
|
44
|
+
create_makefile('oboe_noop', 'noop')
|
45
|
+
retries = 0
|
46
|
+
else
|
47
|
+
success = true
|
48
|
+
retries = 0
|
49
|
+
end
|
50
|
+
rescue => e
|
51
|
+
File.write(target, '')
|
52
|
+
retries -= 1
|
53
|
+
if retries == 0
|
54
|
+
$stderr.puts '== ERROR =========================================================='
|
55
|
+
$stderr.puts 'Download of the c-extension for the appoptics_apm gem failed.'
|
56
|
+
$stderr.puts 'appoptics_apm will not instrument the code. No tracing will occur.'
|
57
|
+
$stderr.puts 'Contact support@appoptics.com if the problem persists.'
|
58
|
+
$stderr.puts '==================================================================='
|
59
|
+
create_makefile('oboe_noop', 'noop')
|
60
|
+
end
|
61
|
+
sleep 0.5
|
48
62
|
end
|
49
|
-
|
63
|
+
end
|
50
64
|
|
51
|
-
|
52
|
-
|
53
|
-
|
65
|
+
if success
|
66
|
+
# Create symlinks for the AppOpticsAPM library
|
67
|
+
File.symlink(target, File.join(ao_lib_dir, 'liboboe.so'))
|
68
|
+
File.symlink(target, File.join(ao_lib_dir, 'liboboe-1.0.so.0'))
|
69
|
+
|
70
|
+
dir_config('oboe', ao_include, ao_lib_dir)
|
71
|
+
|
72
|
+
if jruby || ENV.key?('APPOPTICS_URL')
|
73
|
+
# Build the noop extension under JRuby and Heroku.
|
74
|
+
# The oboe-heroku gem builds it's own c extension which links to
|
75
|
+
# libs specific to a Heroku dyno
|
76
|
+
# FIXME: For JRuby we need to remove the c extension entirely
|
77
|
+
create_makefile('oboe_noop', 'noop')
|
78
|
+
|
79
|
+
elsif have_library('oboe', 'oboe_config_get_revision', 'oboe.h')
|
80
|
+
|
81
|
+
$libs = append_library($libs, 'oboe')
|
82
|
+
$libs = append_library($libs, 'stdc++')
|
83
|
+
|
84
|
+
$CFLAGS << " #{ENV['CFLAGS']}"
|
85
|
+
$CPPFLAGS << " #{ENV['CPPFLAGS']}"
|
86
|
+
$LIBS << " #{ENV['LIBS']}"
|
87
|
+
$LDFLAGS << " #{ENV['LDFLAGS']} -Wl,-rpath=#{ao_lib_dir}"
|
88
|
+
|
89
|
+
if RUBY_VERSION < '1.9'
|
90
|
+
cpp_command('g++')
|
91
|
+
$CPPFLAGS << '-I./src/'
|
92
|
+
end
|
93
|
+
create_makefile('oboe_metal', 'src')
|
94
|
+
|
95
|
+
else
|
96
|
+
$stderr.puts '== ERROR ========================================================='
|
97
|
+
if have_library('oboe')
|
98
|
+
$stderr.puts "The c-library either needs to be updated or doesn't match the OS."
|
99
|
+
$stderr.puts 'No tracing will occur.'
|
100
|
+
else
|
101
|
+
$stderr.puts 'Could not find a matching c-library. No tracing will occur.'
|
102
|
+
end
|
103
|
+
$stderr.puts 'Contact support@appoptics.com if the problem persists.'
|
104
|
+
$stderr.puts '=================================================================='
|
105
|
+
create_makefile('oboe_noop', 'noop')
|
54
106
|
end
|
55
|
-
|
56
|
-
$stderr.puts 'Error: Could not find the base liboboe libraries. No tracing will occur.'
|
57
|
-
create_makefile('oboe_noop', 'noop')
|
58
107
|
end
|
@@ -69,7 +69,7 @@ module AppOpticsAPM
|
|
69
69
|
|
70
70
|
def request_with_appoptics(params={}, &block)
|
71
71
|
# Avoid cross host tracing for blacklisted domains
|
72
|
-
blacklisted = AppOpticsAPM::API.blacklisted?(@data[:hostname])
|
72
|
+
blacklisted = AppOpticsAPM::API.blacklisted?(@data[:hostname] || @data[:host])
|
73
73
|
|
74
74
|
# If we're not tracing, just do a fast return.
|
75
75
|
# If making HTTP pipeline requests (ordered batched)
|
@@ -9,9 +9,10 @@ module AppOpticsAPM
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run_request_with_appoptics(method, url, body, headers, &block)
|
12
|
+
blacklisted = url_blacklisted?
|
12
13
|
unless AppOpticsAPM.tracing?
|
13
14
|
xtrace = AppOpticsAPM::Context.toString
|
14
|
-
@headers['X-Trace'] = xtrace if AppOpticsAPM::XTrace.valid?(xtrace) && !
|
15
|
+
@headers['X-Trace'] = xtrace if AppOpticsAPM::XTrace.valid?(xtrace) && !blacklisted
|
15
16
|
return run_request_without_appoptics(method, url, body, headers, &block)
|
16
17
|
end
|
17
18
|
|
@@ -19,7 +20,7 @@ module AppOpticsAPM
|
|
19
20
|
AppOpticsAPM::API.log_entry(:faraday)
|
20
21
|
|
21
22
|
xtrace = AppOpticsAPM::Context.toString
|
22
|
-
@headers['X-Trace'] = xtrace if AppOpticsAPM::XTrace.valid?(xtrace) && !
|
23
|
+
@headers['X-Trace'] = xtrace if AppOpticsAPM::XTrace.valid?(xtrace) && !blacklisted
|
23
24
|
result = run_request_without_appoptics(method, url, body, headers, &block)
|
24
25
|
|
25
26
|
kvs = {}
|
@@ -31,7 +32,6 @@ module AppOpticsAPM
|
|
31
32
|
handle_service = !@builder.handlers.include?(Faraday::Adapter::NetHttp) &&
|
32
33
|
!@builder.handlers.include?(Faraday::Adapter::Excon)
|
33
34
|
if handle_service
|
34
|
-
blacklisted = AppOpticsAPM::API.blacklisted?(@url_prefix.to_s)
|
35
35
|
context = AppOpticsAPM::Context.toString
|
36
36
|
task_id = AppOpticsAPM::XTrace.task_id(context)
|
37
37
|
|
@@ -65,6 +65,13 @@ module AppOpticsAPM
|
|
65
65
|
AppOpticsAPM::API.log_exit(:faraday)
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def url_blacklisted?
|
72
|
+
url = @url_prefix ? @url_prefix.to_s : @host
|
73
|
+
AppOpticsAPM::API.blacklisted?(url)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
70
77
|
end
|
@@ -14,7 +14,7 @@ module AppOpticsAPM
|
|
14
14
|
# The wrapper method for RestClient::Request.execute
|
15
15
|
#
|
16
16
|
def execute_with_appoptics(&block)
|
17
|
-
blacklisted = AppOpticsAPM::API.blacklisted?(
|
17
|
+
blacklisted = AppOpticsAPM::API.blacklisted?(url)
|
18
18
|
|
19
19
|
unless AppOpticsAPM.tracing?
|
20
20
|
xtrace = AppOpticsAPM::Context.toString
|
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.0.
|
4
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maia Engeli
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -82,48 +82,6 @@ dependencies:
|
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 3.0.0
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: benchmark-ips
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: benchmark-memory
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: ruby-prof
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - ">="
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0'
|
127
85
|
description: The AppOpticsAPM gem provides performance instrumentation for MRI Ruby
|
128
86
|
and related frameworks.
|
129
87
|
email: support@appoptics.com
|
@@ -160,7 +118,6 @@ files:
|
|
160
118
|
- examples/unicorn_on_heroku_config.rb
|
161
119
|
- ext/oboe_metal/extconf.rb
|
162
120
|
- ext/oboe_metal/lib/.keep
|
163
|
-
- ext/oboe_metal/lib/liboboe-1.0.so.0.0.0
|
164
121
|
- ext/oboe_metal/noop/noop.c
|
165
122
|
- ext/oboe_metal/src/VERSION
|
166
123
|
- ext/oboe_metal/src/bson/bson.h
|