appoptics_apm 4.8.2 → 4.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +6 -1
- data/.travis.yml +50 -28
- data/CONFIG.md +1 -1
- data/Gemfile +6 -7
- data/README.md +1 -1
- data/appoptics_apm.gemspec +4 -1
- data/examples/SDK/01_basic_tracing.rb +0 -2
- data/ext/oboe_metal/README.md +69 -0
- data/ext/oboe_metal/noop/noop.c +2 -1
- data/ext/oboe_metal/src/VERSION +1 -1
- data/ext/oboe_metal/src/bson/bson.h +105 -105
- data/ext/oboe_metal/src/bson/platform_hacks.h +10 -10
- data/ext/oboe_metal/src/oboe.h +104 -73
- data/ext/oboe_metal/src/oboe.hpp +103 -61
- data/ext/oboe_metal/src/oboe_wrap.cxx +1470 -314
- data/lib/appoptics_apm.rb +1 -3
- data/lib/appoptics_apm/api.rb +0 -1
- data/lib/appoptics_apm/api/tracing.rb +4 -0
- data/lib/appoptics_apm/config.rb +16 -5
- data/lib/appoptics_apm/frameworks/padrino.rb +6 -36
- data/lib/appoptics_apm/frameworks/rails.rb +0 -1
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller.rb +5 -5
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller6.rb +50 -0
- data/lib/appoptics_apm/frameworks/rails/inst/action_view.rb +11 -24
- data/lib/appoptics_apm/frameworks/rails/inst/active_record.rb +3 -3
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils.rb +1 -1
- data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +1 -1
- data/lib/appoptics_apm/frameworks/sinatra.rb +3 -32
- data/lib/appoptics_apm/inst/curb.rb +6 -6
- data/lib/appoptics_apm/inst/faraday.rb +16 -4
- data/lib/appoptics_apm/inst/rack.rb +11 -11
- data/lib/appoptics_apm/oboe_init_options.rb +17 -4
- data/lib/appoptics_apm/sdk/custom_metrics.rb +2 -0
- data/lib/appoptics_apm/sdk/tracing.rb +118 -0
- data/lib/appoptics_apm/support/transaction_metrics.rb +1 -0
- data/lib/appoptics_apm/support/transaction_settings.rb +40 -15
- data/lib/appoptics_apm/support/x_trace_options.rb +110 -0
- data/lib/appoptics_apm/version.rb +2 -2
- data/lib/appoptics_apm/xtrace.rb +7 -7
- data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +37 -12
- metadata +7 -15
- data/Rakefile +0 -229
- data/build_gem.sh +0 -15
- data/build_gem_upload_to_packagecloud.sh +0 -20
- data/lib/appoptics_apm/api/profiling.rb +0 -203
- data/lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb +0 -55
- data/lib/appoptics_apm/frameworks/rails/inst/action_view_30.rb +0 -50
- data/lib/appoptics_apm/legacy_method_profiling.rb +0 -90
- data/lib/appoptics_apm/method_profiling.rb +0 -33
- data/lib/oboe/README +0 -2
- data/lib/oboe/backward_compatibility.rb +0 -80
- data/lib/oboe/inst/rack.rb +0 -11
@@ -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
|
-
PATCH =
|
10
|
+
MINOR = 10 # feature,
|
11
|
+
PATCH = 1 # fix => BFF
|
12
12
|
|
13
13
|
STRING = [MAJOR, MINOR, PATCH].compact.join('.')
|
14
14
|
end
|
data/lib/appoptics_apm/xtrace.rb
CHANGED
@@ -97,16 +97,16 @@ module AppOpticsAPM
|
|
97
97
|
# +finish+ is the context returned to us (as an HTTP response header
|
98
98
|
# if that be the case)
|
99
99
|
#
|
100
|
-
def continue_service_context(
|
101
|
-
if AppOpticsAPM::XTrace.valid?(
|
100
|
+
def continue_service_context(start_xtrace, end_xtrace)
|
101
|
+
if AppOpticsAPM::XTrace.valid?(end_xtrace) && AppOpticsAPM.tracing?
|
102
102
|
|
103
|
-
#
|
103
|
+
# Make sure that we received back a valid X-Trace with the same task_id
|
104
104
|
# and the sampling bit is set, otherwise it is a response from a non-sampling service
|
105
|
-
if AppOpticsAPM::XTrace.task_id(
|
106
|
-
AppOpticsAPM::XTrace.sampled?(
|
107
|
-
AppOpticsAPM::Context.fromString(
|
105
|
+
if AppOpticsAPM::XTrace.task_id(start_xtrace) == AppOpticsAPM::XTrace.task_id(end_xtrace) &&
|
106
|
+
AppOpticsAPM::XTrace.sampled?(end_xtrace)
|
107
|
+
AppOpticsAPM::Context.fromString(end_xtrace)
|
108
108
|
else
|
109
|
-
AppOpticsAPM.logger.debug "[XTrace] Sampling flag unset or mismatched start and finish ids:\n#{
|
109
|
+
AppOpticsAPM.logger.debug "[XTrace] Sampling flag unset or mismatched start and finish ids:\n#{start_xtrace}\n#{end_xtrace}"
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -50,7 +50,7 @@ if defined?(AppOpticsAPM::Config)
|
|
50
50
|
AppOpticsAPM::Config[:verbose] = false
|
51
51
|
|
52
52
|
#
|
53
|
-
# Turn
|
53
|
+
# Turn Tracing on or off
|
54
54
|
#
|
55
55
|
# By default tracing is set to :enabled, the other option is :disabled.
|
56
56
|
# :enabled means that sampling will be done according to the current
|
@@ -61,31 +61,41 @@ if defined?(AppOpticsAPM::Config)
|
|
61
61
|
#
|
62
62
|
AppOpticsAPM::Config[:tracing_mode] = :enabled
|
63
63
|
|
64
|
+
#
|
65
|
+
# Turn Trigger Tracing on or off
|
66
|
+
#
|
67
|
+
# By default trigger tracing is :enabled, the other option is :disabled.
|
68
|
+
# It allows to use the X-Trace-Options header to force a request to be
|
69
|
+
# traced (within rate limits set for trigger tracing)
|
70
|
+
#
|
71
|
+
AppOpticsAPM::Config[:trigger_tracing_mode] = :enabled
|
72
|
+
|
64
73
|
#
|
65
74
|
# Trace Context in Logs
|
66
75
|
#
|
67
|
-
# Configure if and when the
|
76
|
+
# Configure if and when the Trace ID should be included in application logs.
|
68
77
|
# Common Ruby and Rails loggers are auto-instrumented, so that they can include
|
69
|
-
# the current
|
78
|
+
# the current Trace ID in log messages.
|
70
79
|
#
|
71
80
|
# The added string will look like: "ao.traceId=7435A9FE510AE4533414D425DADF4E180D2B4E36-0"
|
72
81
|
# It ends in '-1' if the request is sampled and in '-0' otherwise.
|
73
82
|
#
|
74
83
|
# The following options are available:
|
75
84
|
# :never (default)
|
76
|
-
# :sampled only include the
|
77
|
-
# :traced include the
|
78
|
-
# :always always add a
|
85
|
+
# :sampled only include the Trace ID of sampled requests
|
86
|
+
# :traced include the Trace ID for all traced requests
|
87
|
+
# :always always add a Trace ID, it will be '0000000000000000000000000000000000000000-0'
|
79
88
|
# when there is no tracing context.
|
80
89
|
#
|
81
90
|
AppOpticsAPM::Config[:log_traceId] = :never
|
82
91
|
|
83
92
|
#
|
84
|
-
# Prepend
|
93
|
+
# Prepend Domain to Transaction Name
|
85
94
|
#
|
86
|
-
# If this is set to `true` transaction names will be composed as
|
87
|
-
# `controller.action
|
88
|
-
#
|
95
|
+
# If this is set to `true` transaction names will be composed as
|
96
|
+
# `my.host.com/controller.action` instead of `controller.action`.
|
97
|
+
# This configuration applies to all transaction names, whether deduced by the
|
98
|
+
# instrumentation or implicitly set.
|
89
99
|
#
|
90
100
|
AppOpticsAPM::Config[:transaction_name][:prepend_domain] = false
|
91
101
|
|
@@ -195,6 +205,21 @@ if defined?(AppOpticsAPM::Config)
|
|
195
205
|
AppOpticsAPM::Config[:report_rescued_errors] = false
|
196
206
|
#
|
197
207
|
|
208
|
+
#
|
209
|
+
# EC2 Metadata Fetching Timeout
|
210
|
+
#
|
211
|
+
# The timeout can be in the range 0 - 3000 (milliseconds)
|
212
|
+
# Setting to 0 milliseconds effectively disables fetching from
|
213
|
+
# the metadata URL (not waiting), and should only be used if
|
214
|
+
# not running on EC2 / Openstack to minimize agent start up time.
|
215
|
+
#
|
216
|
+
AppOpticsAPM::Config[:ec2_metadata_timeout] = 1000
|
217
|
+
|
218
|
+
|
219
|
+
#############################################
|
220
|
+
## SETTINGS FOR INDIVIDUAL GEMS/FRAMEWORKS ##
|
221
|
+
#############################################
|
222
|
+
|
198
223
|
#
|
199
224
|
# Bunny Controller and Action
|
200
225
|
#
|
@@ -235,7 +260,7 @@ if defined?(AppOpticsAPM::Config)
|
|
235
260
|
AppOpticsAPM::Config[:dalli][:enabled] = true
|
236
261
|
AppOpticsAPM::Config[:delayed_jobclient][:enabled] = true
|
237
262
|
AppOpticsAPM::Config[:delayed_jobworker][:enabled] = true
|
238
|
-
AppOpticsAPM::Config[:em_http_request][:enabled] = false
|
263
|
+
# AppOpticsAPM::Config[:em_http_request][:enabled] = false # not supported anymore
|
239
264
|
AppOpticsAPM::Config[:excon][:enabled] = true
|
240
265
|
AppOpticsAPM::Config[:faraday][:enabled] = true
|
241
266
|
AppOpticsAPM::Config[:grpc_client][:enabled] = true
|
@@ -301,7 +326,7 @@ if defined?(AppOpticsAPM::Config)
|
|
301
326
|
AppOpticsAPM::Config[:dalli][:collect_backtraces] = false
|
302
327
|
AppOpticsAPM::Config[:delayed_jobclient][:collect_backtraces] = false
|
303
328
|
AppOpticsAPM::Config[:delayed_jobworker][:collect_backtraces] = false
|
304
|
-
AppOpticsAPM::Config[:em_http_request][:collect_backtraces] = true
|
329
|
+
# AppOpticsAPM::Config[:em_http_request][:collect_backtraces] = true # not supported anymore
|
305
330
|
AppOpticsAPM::Config[:excon][:collect_backtraces] = true
|
306
331
|
AppOpticsAPM::Config[:faraday][:collect_backtraces] = false
|
307
332
|
AppOpticsAPM::Config[:grape][:collect_backtraces] = true
|
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.
|
4
|
+
version: 4.10.1
|
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: 2019-
|
13
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -125,13 +125,11 @@ files:
|
|
125
125
|
- Gemfile
|
126
126
|
- LICENSE
|
127
127
|
- README.md
|
128
|
-
- Rakefile
|
129
128
|
- appoptics_apm.gemspec
|
130
129
|
- bin/appoptics_apm_config
|
131
|
-
- build_gem.sh
|
132
|
-
- build_gem_upload_to_packagecloud.sh
|
133
130
|
- examples/SDK/01_basic_tracing.rb
|
134
131
|
- examples/carrying_context.rb
|
132
|
+
- ext/oboe_metal/README.md
|
135
133
|
- ext/oboe_metal/extconf.rb
|
136
134
|
- ext/oboe_metal/lib/.keep
|
137
135
|
- ext/oboe_metal/noop/noop.c
|
@@ -149,7 +147,6 @@ files:
|
|
149
147
|
- lib/appoptics_apm/api/logging.rb
|
150
148
|
- lib/appoptics_apm/api/memcache.rb
|
151
149
|
- lib/appoptics_apm/api/metrics.rb
|
152
|
-
- lib/appoptics_apm/api/profiling.rb
|
153
150
|
- lib/appoptics_apm/api/tracing.rb
|
154
151
|
- lib/appoptics_apm/api/util.rb
|
155
152
|
- lib/appoptics_apm/base.rb
|
@@ -158,12 +155,11 @@ files:
|
|
158
155
|
- lib/appoptics_apm/frameworks/padrino.rb
|
159
156
|
- lib/appoptics_apm/frameworks/rails.rb
|
160
157
|
- lib/appoptics_apm/frameworks/rails/inst/action_controller.rb
|
161
|
-
- lib/appoptics_apm/frameworks/rails/inst/action_controller3.rb
|
162
158
|
- lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb
|
163
159
|
- lib/appoptics_apm/frameworks/rails/inst/action_controller5.rb
|
160
|
+
- lib/appoptics_apm/frameworks/rails/inst/action_controller6.rb
|
164
161
|
- lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb
|
165
162
|
- lib/appoptics_apm/frameworks/rails/inst/action_view.rb
|
166
|
-
- lib/appoptics_apm/frameworks/rails/inst/action_view_30.rb
|
167
163
|
- lib/appoptics_apm/frameworks/rails/inst/active_record.rb
|
168
164
|
- lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql.rb
|
169
165
|
- lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb
|
@@ -201,10 +197,8 @@ files:
|
|
201
197
|
- lib/appoptics_apm/inst/twitter-cassandra.rb
|
202
198
|
- lib/appoptics_apm/inst/typhoeus.rb
|
203
199
|
- lib/appoptics_apm/instrumentation.rb
|
204
|
-
- lib/appoptics_apm/legacy_method_profiling.rb
|
205
200
|
- lib/appoptics_apm/loading.rb
|
206
201
|
- lib/appoptics_apm/logger.rb
|
207
|
-
- lib/appoptics_apm/method_profiling.rb
|
208
202
|
- lib/appoptics_apm/noop/README.md
|
209
203
|
- lib/appoptics_apm/noop/context.rb
|
210
204
|
- lib/appoptics_apm/noop/metadata.rb
|
@@ -216,6 +210,7 @@ files:
|
|
216
210
|
- lib/appoptics_apm/sdk/tracing.rb
|
217
211
|
- lib/appoptics_apm/support/transaction_metrics.rb
|
218
212
|
- lib/appoptics_apm/support/transaction_settings.rb
|
213
|
+
- lib/appoptics_apm/support/x_trace_options.rb
|
219
214
|
- lib/appoptics_apm/support_report.rb
|
220
215
|
- lib/appoptics_apm/test.rb
|
221
216
|
- lib/appoptics_apm/thread_local.rb
|
@@ -224,9 +219,6 @@ files:
|
|
224
219
|
- lib/appoptics_apm/xtrace.rb
|
225
220
|
- lib/joboe_metal.rb
|
226
221
|
- lib/oboe.rb
|
227
|
-
- lib/oboe/README
|
228
|
-
- lib/oboe/backward_compatibility.rb
|
229
|
-
- lib/oboe/inst/rack.rb
|
230
222
|
- lib/oboe_metal.rb
|
231
223
|
- lib/rails/generators/appoptics_apm/install_generator.rb
|
232
224
|
- lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb
|
@@ -247,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
239
|
requirements:
|
248
240
|
- - ">="
|
249
241
|
- !ruby/object:Gem::Version
|
250
|
-
version: 2.
|
242
|
+
version: 2.4.0
|
251
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
244
|
requirements:
|
253
245
|
- - ">="
|
@@ -255,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
247
|
version: '0'
|
256
248
|
requirements: []
|
257
249
|
rubyforge_project:
|
258
|
-
rubygems_version: 2.
|
250
|
+
rubygems_version: 2.6.11
|
259
251
|
signing_key:
|
260
252
|
specification_version: 4
|
261
253
|
summary: AppOptics APM performance instrumentation gem for Ruby
|
data/Rakefile
DELETED
@@ -1,229 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'open-uri'
|
6
|
-
require 'bundler/setup'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'appoptics_apm/test'
|
9
|
-
|
10
|
-
Rake::TestTask.new do |t|
|
11
|
-
t.verbose = false
|
12
|
-
t.warning = false
|
13
|
-
t.ruby_opts = []
|
14
|
-
t.libs << 'test'
|
15
|
-
|
16
|
-
# Since we support so many libraries and frameworks, tests
|
17
|
-
# runs are segmented into gemfiles that have different
|
18
|
-
# sets and versions of gems (libraries and frameworks).
|
19
|
-
#
|
20
|
-
# Here we detect the Gemfile the tests are being run against
|
21
|
-
# and load the appropriate tests.
|
22
|
-
#
|
23
|
-
case AppOpticsAPM::Test.gemfile
|
24
|
-
when /delayed_job/
|
25
|
-
require 'delayed/tasks'
|
26
|
-
t.test_files = FileList['test/queues/delayed_job*_test.rb']
|
27
|
-
when /rails/
|
28
|
-
# Pre-load rails to get the major version number
|
29
|
-
require 'rails'
|
30
|
-
|
31
|
-
if Rails::VERSION::MAJOR == 5
|
32
|
-
t.test_files = FileList["test/frameworks/rails#{Rails::VERSION::MAJOR}x_test.rb"] +
|
33
|
-
FileList["test/frameworks/rails#{Rails::VERSION::MAJOR}x_api_test.rb"]
|
34
|
-
else
|
35
|
-
t.test_files = FileList["test/frameworks/rails#{Rails::VERSION::MAJOR}x_test.rb"]
|
36
|
-
end
|
37
|
-
|
38
|
-
when /frameworks/
|
39
|
-
t.test_files = FileList['test/frameworks/sinatra*_test.rb'] +
|
40
|
-
FileList['test/frameworks/padrino*_test.rb'] +
|
41
|
-
FileList['test/frameworks/grape*_test.rb']
|
42
|
-
when /libraries/
|
43
|
-
t.test_files = FileList['test/support/*_test.rb'] +
|
44
|
-
FileList['test/reporter/*_test.rb'] +
|
45
|
-
FileList['test/instrumentation/*_test.rb'] +
|
46
|
-
FileList['test/profiling/*_test.rb'] -
|
47
|
-
['test/instrumentation/twitter-cassandra_test.rb']
|
48
|
-
when /instrumentation_mocked/
|
49
|
-
# WebMock is interfering with other tests, so these have to run separately
|
50
|
-
t.test_files = FileList['test/mocked/*_test.rb']
|
51
|
-
when /noop/
|
52
|
-
t.test_files = FileList['test/noop/*_test.rb']
|
53
|
-
when /unit/
|
54
|
-
t.test_files = FileList['test/unit/*_test.rb'] +
|
55
|
-
FileList['test/unit/*/*_test.rb']
|
56
|
-
end
|
57
|
-
|
58
|
-
if defined?(JRUBY_VERSION)
|
59
|
-
t.ruby_opts << ['-J-javaagent:/usr/local/tracelytics/tracelyticsagent.jar']
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Run all test suites defined by travis"
|
64
|
-
task "docker_tests" do
|
65
|
-
Dir.chdir('test/run_tests')
|
66
|
-
exec('docker-compose run ruby_appoptics /code/ruby-appoptics/test/run_tests/ruby_setup.sh test --remove-orphans')
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "Start docker container for testing and debugging"
|
70
|
-
task "docker" do
|
71
|
-
Dir.chdir('test/run_tests')
|
72
|
-
exec('docker-compose run ruby_appoptics /code/ruby-appoptics/test/run_tests/ruby_setup.sh bash --remove-orphans')
|
73
|
-
end
|
74
|
-
|
75
|
-
desc "Stop all containers that were started for testing and debugging"
|
76
|
-
task "docker_down" do
|
77
|
-
Dir.chdir('test/run_tests')
|
78
|
-
exec('docker-compose down')
|
79
|
-
end
|
80
|
-
|
81
|
-
desc "Fetch extension dependency files"
|
82
|
-
task :fetch_ext_deps do
|
83
|
-
swig_version = %x{swig -version} rescue ''
|
84
|
-
swig_version = swig_version.scan(/swig version 3.0.\d*/i)
|
85
|
-
if swig_version.empty?
|
86
|
-
$stderr.puts '== ERROR ================================================================='
|
87
|
-
$stderr.puts "Could not find required swig version 3.0.*, found #{swig_version.inspect}"
|
88
|
-
$stderr.puts 'Please install swig "~ 3.0.8" and try again.'
|
89
|
-
$stderr.puts '=========================================================================='
|
90
|
-
raise
|
91
|
-
end
|
92
|
-
|
93
|
-
# The c-lib version is different from the gem version
|
94
|
-
oboe_version = ENV['OBOE_VERSION'] || 'latest'
|
95
|
-
oboe_s3_dir = "https://s3-us-west-2.amazonaws.com/rc-files-t2/c-lib/#{oboe_version}"
|
96
|
-
ext_src_dir = File.expand_path('ext/oboe_metal/src')
|
97
|
-
|
98
|
-
# VERSION is used by extconf.rb to download the correct liboboe when installing the gem
|
99
|
-
remote_file = File.join(oboe_s3_dir, 'VERSION')
|
100
|
-
local_file = File.join(ext_src_dir, 'VERSION')
|
101
|
-
puts "fetching #{remote_file} to #{local_file}"
|
102
|
-
open(remote_file, 'rb') do |rf|
|
103
|
-
content = rf.read
|
104
|
-
File.open(local_file, 'wb') { |f| f.puts content }
|
105
|
-
puts "!!!!!!! C-Lib VERSION: #{content.strip} !!!!!!!!"
|
106
|
-
end
|
107
|
-
|
108
|
-
# oboe and bson header files
|
109
|
-
FileUtils.mkdir_p(File.join(ext_src_dir, 'bson'))
|
110
|
-
%w(oboe.h oboe.hpp oboe_debug.h oboe.i bson/bson.h bson/platform_hacks.h).each do |filename|
|
111
|
-
# %w(oboe.h oboe_debug.h bson/bson.h bson/platform_hacks.h).each do |filename|
|
112
|
-
remote_file = File.join(oboe_s3_dir, 'include', filename)
|
113
|
-
local_file = File.join(ext_src_dir, filename)
|
114
|
-
|
115
|
-
puts "fetching #{remote_file} to #{local_file}"
|
116
|
-
open(remote_file, 'rb') do |rf|
|
117
|
-
content = rf.read
|
118
|
-
File.open(local_file, 'wb') { |f| f.puts content }
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
FileUtils.cd(ext_src_dir) do
|
123
|
-
system('swig -c++ -ruby -module oboe_metal oboe.i')
|
124
|
-
# FileUtils.rm('oboe.i')
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
desc "Build the gem's c extension"
|
129
|
-
task :compile do
|
130
|
-
if !defined?(JRUBY_VERSION)
|
131
|
-
puts "== Building the c extension against Ruby #{RUBY_VERSION}"
|
132
|
-
|
133
|
-
pwd = Dir.pwd
|
134
|
-
ext_dir = File.expand_path('ext/oboe_metal')
|
135
|
-
final_so = File.expand_path('lib/oboe_metal.so')
|
136
|
-
so_file = File.expand_path('ext/oboe_metal/oboe_metal.so')
|
137
|
-
|
138
|
-
Dir.chdir ext_dir
|
139
|
-
ENV['APPOPTICS_FROM_S3'] = 'true'
|
140
|
-
cmd = [Gem.ruby, 'extconf.rb']
|
141
|
-
sh cmd.join(' ')
|
142
|
-
sh '/usr/bin/env make'
|
143
|
-
|
144
|
-
File.delete(final_so) if File.exist?(final_so)
|
145
|
-
|
146
|
-
if File.exist?(so_file)
|
147
|
-
FileUtils.mv(so_file, final_so)
|
148
|
-
Dir.chdir(pwd)
|
149
|
-
puts "== Extension built and moved to #{final_so}"
|
150
|
-
else
|
151
|
-
Dir.chdir(pwd)
|
152
|
-
puts '!! Extension failed to build (see above). Have the required binary and header files been fetched?'
|
153
|
-
puts '!! Try the tasks in this order: clean > fetch_ext_deps > compile.'
|
154
|
-
end
|
155
|
-
else
|
156
|
-
puts '== Nothing to do under JRuby.'
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
desc 'Clean up extension build files'
|
161
|
-
task :clean do
|
162
|
-
if !defined?(JRUBY_VERSION)
|
163
|
-
pwd = Dir.pwd
|
164
|
-
ext_dir = File.expand_path('ext/oboe_metal')
|
165
|
-
symlinks = [
|
166
|
-
File.expand_path('lib/oboe_metal.so'),
|
167
|
-
File.expand_path('ext/oboe_metal/lib/liboboe.so'),
|
168
|
-
File.expand_path('ext/oboe_metal/lib/liboboe-1.0.so.0')
|
169
|
-
]
|
170
|
-
|
171
|
-
symlinks.each do |symlink|
|
172
|
-
FileUtils.rm_f symlink
|
173
|
-
end
|
174
|
-
Dir.chdir ext_dir
|
175
|
-
sh '/usr/bin/env make clean' if File.exist? 'Makefile'
|
176
|
-
|
177
|
-
Dir.chdir pwd
|
178
|
-
else
|
179
|
-
puts '== Nothing to do under JRuby.'
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
desc 'Remove all built files and extensions'
|
184
|
-
task :distclean do
|
185
|
-
if !defined?(JRUBY_VERSION)
|
186
|
-
pwd = Dir.pwd
|
187
|
-
ext_dir = File.expand_path('ext/oboe_metal')
|
188
|
-
mkmf_log = File.expand_path('ext/oboe_metal/mkmf.log')
|
189
|
-
symlinks = [
|
190
|
-
File.expand_path('lib/oboe_metal.so'),
|
191
|
-
File.expand_path('ext/oboe_metal/lib/liboboe.so'),
|
192
|
-
File.expand_path('ext/oboe_metal/lib/liboboe-1.0.so.0')
|
193
|
-
]
|
194
|
-
|
195
|
-
if File.exist? mkmf_log
|
196
|
-
symlinks.each do |symlink|
|
197
|
-
FileUtils.rm_f symlink
|
198
|
-
end
|
199
|
-
Dir.chdir ext_dir
|
200
|
-
sh '/usr/bin/env make distclean' if File.exist? 'Makefile'
|
201
|
-
|
202
|
-
Dir.chdir pwd
|
203
|
-
else
|
204
|
-
puts 'Nothing to distclean. (nothing built yet?)'
|
205
|
-
end
|
206
|
-
else
|
207
|
-
puts '== Nothing to do under JRuby.'
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
desc "Rebuild the gem's c extension"
|
212
|
-
task :recompile => [:distclean, :compile]
|
213
|
-
|
214
|
-
task :environment do
|
215
|
-
ENV['APPOPTICS_GEM_VERBOSE'] = 'true'
|
216
|
-
|
217
|
-
Bundler.require(:default, :development)
|
218
|
-
AppOpticsAPM::Config[:tracing_mode] = :enabled
|
219
|
-
AppOpticsAPM::Test.load_extras
|
220
|
-
|
221
|
-
if AppOpticsAPM::Test.gemfile?(:delayed_job)
|
222
|
-
require 'delayed/tasks'
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
# Used when testing Resque locally
|
227
|
-
task 'resque:setup' => :environment do
|
228
|
-
require 'resque/tasks'
|
229
|
-
end
|