ddtrace 0.3.1
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 +7 -0
- data/.env +11 -0
- data/.gitignore +56 -0
- data/.rubocop.yml +43 -0
- data/Appraisals +65 -0
- data/Gemfile +3 -0
- data/LICENSE +24 -0
- data/README.md +119 -0
- data/Rakefile +103 -0
- data/circle.yml +68 -0
- data/ddtrace.gemspec +41 -0
- data/docker-compose.yml +33 -0
- data/docs/GettingStarted +352 -0
- data/gemfiles/contrib.gemfile +9 -0
- data/gemfiles/rails3_mysql2.gemfile +11 -0
- data/gemfiles/rails3_postgres.gemfile +10 -0
- data/gemfiles/rails3_postgres_redis.gemfile +11 -0
- data/gemfiles/rails4_mysql2.gemfile +9 -0
- data/gemfiles/rails4_postgres.gemfile +9 -0
- data/gemfiles/rails4_postgres_redis.gemfile +10 -0
- data/gemfiles/rails5_mysql2.gemfile +8 -0
- data/gemfiles/rails5_postgres.gemfile +8 -0
- data/gemfiles/rails5_postgres_redis.gemfile +9 -0
- data/lib/ddtrace.rb +63 -0
- data/lib/ddtrace/buffer.rb +77 -0
- data/lib/ddtrace/contrib/elasticsearch/core.rb +56 -0
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +35 -0
- data/lib/ddtrace/contrib/elasticsearch/quantize.rb +22 -0
- data/lib/ddtrace/contrib/rails/action_controller.rb +75 -0
- data/lib/ddtrace/contrib/rails/action_view.rb +121 -0
- data/lib/ddtrace/contrib/rails/active_record.rb +44 -0
- data/lib/ddtrace/contrib/rails/active_support.rb +115 -0
- data/lib/ddtrace/contrib/rails/core_extensions.rb +89 -0
- data/lib/ddtrace/contrib/rails/framework.rb +107 -0
- data/lib/ddtrace/contrib/rails/utils.rb +42 -0
- data/lib/ddtrace/contrib/redis/core.rb +72 -0
- data/lib/ddtrace/contrib/redis/patcher.rb +36 -0
- data/lib/ddtrace/contrib/redis/quantize.rb +30 -0
- data/lib/ddtrace/contrib/redis/tags.rb +19 -0
- data/lib/ddtrace/encoding.rb +65 -0
- data/lib/ddtrace/ext/app_types.rb +9 -0
- data/lib/ddtrace/ext/cache.rb +7 -0
- data/lib/ddtrace/ext/errors.rb +9 -0
- data/lib/ddtrace/ext/http.rb +11 -0
- data/lib/ddtrace/ext/net.rb +8 -0
- data/lib/ddtrace/ext/redis.rb +16 -0
- data/lib/ddtrace/ext/sql.rb +8 -0
- data/lib/ddtrace/monkey.rb +60 -0
- data/lib/ddtrace/pin.rb +62 -0
- data/lib/ddtrace/span.rb +163 -0
- data/lib/ddtrace/tracer.rb +180 -0
- data/lib/ddtrace/transport.rb +149 -0
- data/lib/ddtrace/utils.rb +9 -0
- data/lib/ddtrace/version.rb +9 -0
- data/lib/ddtrace/workers.rb +109 -0
- data/lib/ddtrace/writer.rb +119 -0
- metadata +187 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2a9186d275327ce22e549c851bfa05a3d35f2331
|
4
|
+
data.tar.gz: 80ddf28da3679f110f6c2b570ca2d7356ada9ce2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e754f087c383bb50d2c4738fceee184b8766d5c880a2980005b0fee2ae36f301c843a0b88d873bc5e571f951e14c49a9de9b3598f708467b34b99e923b023202
|
7
|
+
data.tar.gz: 679c519b49988a592bb4c9ac434384fc2bea7d5ba7dc710596e097fa814a1064d6de1565748c966f7d715f3f3d319070ba0c5b330510555c6111a70024df5e86
|
data/.env
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
TEST_POSTGRES_PORT=55432
|
2
|
+
TEST_POSTGRES_USER=postgres
|
3
|
+
TEST_POSTGRES_PASSWORD=postgres
|
4
|
+
TEST_POSTGRES_DB=postgres
|
5
|
+
TEST_MYSQL_PORT=53306
|
6
|
+
TEST_MYSQL_ROOT_PASSWORD=root
|
7
|
+
TEST_MYSQL_PASSWORD=mysql
|
8
|
+
TEST_MYSQL_USER=mysql
|
9
|
+
TEST_ELASTICSEARCH_REST_PORT=49200
|
10
|
+
TEST_ELASTICSEARCH_NATIVE_PORT=49300
|
11
|
+
TEST_REDIS_PORT=46379
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
/log/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
/html/
|
39
|
+
|
40
|
+
## Environment normalization:
|
41
|
+
/.bundle/
|
42
|
+
/vendor/bundle
|
43
|
+
/lib/bundler/man/
|
44
|
+
|
45
|
+
# for a library or gem, you might want to ignore these files since the code is
|
46
|
+
# intended to run in multiple environments; otherwise, check them in:
|
47
|
+
# Gemfile.lock
|
48
|
+
# .ruby-version
|
49
|
+
# .ruby-gemset
|
50
|
+
|
51
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
52
|
+
.rvmrc
|
53
|
+
|
54
|
+
# lock files
|
55
|
+
Gemfile.lock
|
56
|
+
gemfiles/*.lock
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.1
|
3
|
+
|
4
|
+
# 80 characters is a nice goal, but not worth currently changing in existing
|
5
|
+
# code for the sake of changing it to conform to a length set in 1928 (IBM).
|
6
|
+
Metrics/LineLength:
|
7
|
+
Max: 124
|
8
|
+
|
9
|
+
# These exceptions are good goals to attain, and probably will over time,
|
10
|
+
# so periodic disabling and re-running to inspect values is suggested.
|
11
|
+
|
12
|
+
Metrics/AbcSize:
|
13
|
+
Max: 50
|
14
|
+
|
15
|
+
# TODO: As refactors continue, this should drop. However, the goal of
|
16
|
+
# 10 lines in a method may be a little lofty.
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Max: 36
|
19
|
+
|
20
|
+
# TODO: this is not compliant with the Ruby community style guide. We
|
21
|
+
# should enable again this rule but it will change the public API because
|
22
|
+
# we're using set_ methods. We should work on that because also Rails
|
23
|
+
# honors this rule.
|
24
|
+
Style/AccessorMethodName:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/MethodCallWithoutArgsParentheses:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/RescueModifier:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/NumericLiterals:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/ClassLength:
|
37
|
+
Max: 120
|
38
|
+
|
39
|
+
Metrics/BlockLength:
|
40
|
+
Max: 42
|
41
|
+
|
42
|
+
Metrics/ParameterLists:
|
43
|
+
Enabled: false
|
data/Appraisals
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
appraise "rails3-postgres" do
|
2
|
+
gem "test-unit"
|
3
|
+
gem "rails", "3.2.22.5"
|
4
|
+
gem "pg", platform: :ruby
|
5
|
+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
|
6
|
+
end
|
7
|
+
|
8
|
+
appraise "rails4-postgres" do
|
9
|
+
gem "rails", "4.2.7.1"
|
10
|
+
gem "pg", platform: :ruby
|
11
|
+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
|
12
|
+
end
|
13
|
+
|
14
|
+
appraise "rails3-mysql2" do
|
15
|
+
gem "test-unit"
|
16
|
+
gem "rails", "3.2.22.5"
|
17
|
+
gem "mysql2", "0.3.21", platform: :ruby
|
18
|
+
gem "activerecord-mysql-adapter", platform: :ruby
|
19
|
+
gem 'activerecord-jdbcmysql-adapter', platform: :jruby
|
20
|
+
end
|
21
|
+
|
22
|
+
appraise "rails4-mysql2" do
|
23
|
+
gem "rails", "4.2.7.1"
|
24
|
+
gem "mysql2", platform: :ruby
|
25
|
+
gem 'activerecord-jdbcmysql-adapter', platform: :jruby
|
26
|
+
end
|
27
|
+
|
28
|
+
appraise "rails3-postgres-redis" do
|
29
|
+
gem "test-unit"
|
30
|
+
gem "rails", "3.2.22.5"
|
31
|
+
gem "pg", platform: :ruby
|
32
|
+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
|
33
|
+
gem "redis-rails"
|
34
|
+
end
|
35
|
+
|
36
|
+
appraise "rails4-postgres-redis" do
|
37
|
+
gem "rails", "4.2.7.1"
|
38
|
+
gem "pg", platform: :ruby
|
39
|
+
gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
|
40
|
+
gem "redis-rails"
|
41
|
+
end
|
42
|
+
|
43
|
+
if RUBY_VERSION >= "2.2.2" && RUBY_PLATFORM != "java"
|
44
|
+
appraise "rails5-postgres" do
|
45
|
+
gem "rails", "5.0.0.1"
|
46
|
+
gem "pg", platform: :ruby
|
47
|
+
end
|
48
|
+
|
49
|
+
appraise "rails5-mysql2" do
|
50
|
+
gem "rails", "5.0.0.1"
|
51
|
+
gem "mysql2", platform: :ruby
|
52
|
+
end
|
53
|
+
|
54
|
+
appraise "rails5-postgres-redis" do
|
55
|
+
gem "rails", "5.0.0.1"
|
56
|
+
gem "pg", platform: :ruby
|
57
|
+
gem "redis-rails"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
appraise "contrib" do
|
62
|
+
gem "elasticsearch-transport"
|
63
|
+
gem "redis"
|
64
|
+
gem "hiredis"
|
65
|
+
end
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2016, Datadog <info@datadoghq.com>
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of Datadog nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# dd-trace-rb
|
2
|
+
|
3
|
+
[](https://circleci.com/gh/DataDog/dd-trace-rb/tree/master)
|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
You can find the latest documentation in the Datadog's [private repository][docs]
|
8
|
+
|
9
|
+
[docs]: http://gems.datadoghq.com/trace/docs/
|
10
|
+
|
11
|
+
## Getting started
|
12
|
+
|
13
|
+
### Install
|
14
|
+
|
15
|
+
If you're using ``Bundler``, just update your ``Gemfile`` as follows:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
source 'https://rubygems.org'
|
19
|
+
|
20
|
+
# tracing gem
|
21
|
+
gem 'ddtrace', :source => 'http://gems.datadoghq.com/trace/'
|
22
|
+
```
|
23
|
+
|
24
|
+
### Quickstart (manual instrumentation)
|
25
|
+
|
26
|
+
If you aren't using a supported framework instrumentation, you may want to to manually instrument your code.
|
27
|
+
Adding tracing to your code is very simple. As an example, let’s imagine we have a web server and we want
|
28
|
+
to trace requests to the home page:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'ddtrace'
|
32
|
+
require 'sinatra'
|
33
|
+
require 'activerecord'
|
34
|
+
|
35
|
+
# a generic tracer that you can use across your application
|
36
|
+
tracer = Datadog.tracer
|
37
|
+
|
38
|
+
get '/' do
|
39
|
+
tracer.trace('web.request') do |span|
|
40
|
+
# set some span metadata
|
41
|
+
span.service = 'my-web-site'
|
42
|
+
span.resource = '/'
|
43
|
+
span.set_tag('http.method', request.request_method)
|
44
|
+
|
45
|
+
# trace the activerecord call
|
46
|
+
tracer.trace('posts.fetch') do
|
47
|
+
@posts = Posts.order(created_at: :desc).limit(10)
|
48
|
+
end
|
49
|
+
|
50
|
+
# trace the template rendering
|
51
|
+
tracer.trace('template.render') do
|
52
|
+
erb :index
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
### Monkey patching
|
59
|
+
|
60
|
+
By default, our monkey-patching is not active, you need to
|
61
|
+
explicitly activate it by calling `Datadog::Monkey.patch_all`
|
62
|
+
or `Datadog::Monkey.patch_module`
|
63
|
+
|
64
|
+
This ultimately allows you to enable or disable tracing on a per-library basis.
|
65
|
+
|
66
|
+
The example below shows the Redis case, but any other non-rails library
|
67
|
+
should work the same way:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
|
71
|
+
require 'redis'
|
72
|
+
require 'ddtrace'
|
73
|
+
|
74
|
+
Datadog::Monkey.patch_all # you need to explicitly patch it
|
75
|
+
|
76
|
+
# now do your Redis stuff, eg:
|
77
|
+
redis = Redis.new
|
78
|
+
redis.set 'foo', 'bar' # traced!
|
79
|
+
```
|
80
|
+
|
81
|
+
## Development
|
82
|
+
|
83
|
+
### Testing
|
84
|
+
|
85
|
+
Configure your environment through:
|
86
|
+
|
87
|
+
$ bundle install
|
88
|
+
$ appraisal install
|
89
|
+
|
90
|
+
You can launch all tests using the following rake command:
|
91
|
+
|
92
|
+
$ rake test # tracer tests
|
93
|
+
$ appraisal rails<version>-<database>rake rails # tests Rails matrix
|
94
|
+
$ appraisal contrib rake contrib # tests other contrib libraries (Redis, ...)
|
95
|
+
$ appraisal contrib rake monkey # tests monkey patching
|
96
|
+
|
97
|
+
Available appraisals are:
|
98
|
+
|
99
|
+
* ``rails{3,4,5}-postgres``: Rails with PostgreSQL
|
100
|
+
* ``rails{3,4,5}-mysql2``: Rails with MySQL
|
101
|
+
* ``contrib``: Other contrib libraries (Redis, ...)
|
102
|
+
|
103
|
+
jRuby includes only Rails 3.x and 4.x because the current implementation of jdbc drivers, don't support
|
104
|
+
ActiveRecord 5.x.
|
105
|
+
|
106
|
+
The test suite requires many backing services (PostgreSQL, MySQL, Redis, ...) and we're using
|
107
|
+
``docker`` and ``docker-compose`` to start these services in the CI.
|
108
|
+
To launch properly the test matrix, please [install docker][2] and [docker-compose][3] using
|
109
|
+
the instructions provided by your platform. Then launch them through:
|
110
|
+
|
111
|
+
$ docker-compose up -d
|
112
|
+
|
113
|
+
We also enforce the Ruby [community-driven style guide][1] through Rubocop. Simply launch:
|
114
|
+
|
115
|
+
$ rake rubocop
|
116
|
+
|
117
|
+
[1]: https://github.com/bbatsov/ruby-style-guide
|
118
|
+
[2]: https://www.docker.com/products/docker
|
119
|
+
[3]: https://www.docker.com/products/docker-compose
|
data/Rakefile
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'appraisal'
|
6
|
+
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << %w(test lib)
|
9
|
+
t.test_files = FileList['test/**/*_test.rb'].reject do |path|
|
10
|
+
path.include?('contrib') ||
|
11
|
+
path.include?('benchmark') ||
|
12
|
+
path.include?('redis') ||
|
13
|
+
path.include?('monkey_test.rb')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Rake::TestTask.new(:rails) do |t|
|
18
|
+
t.libs << %w(test lib)
|
19
|
+
t.test_files = FileList['test/contrib/rails/**/*_test.rb'].reject do |path|
|
20
|
+
path.include?('redis')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::TestTask.new(:railsredis) do |t|
|
25
|
+
t.libs << %w(test lib)
|
26
|
+
t.test_files = FileList['test/contrib/rails/**/*redis*_test.rb']
|
27
|
+
end
|
28
|
+
|
29
|
+
Rake::TestTask.new(:contrib) do |t|
|
30
|
+
t.libs << %w(test lib)
|
31
|
+
t.test_files = FileList['test/contrib/**/*_test.rb'].reject do |path|
|
32
|
+
path.include?('rails') ||
|
33
|
+
path.include?('monkey_test.rb')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::TestTask.new(:monkey) do |t|
|
38
|
+
t.libs << %w(test lib)
|
39
|
+
t.test_files = FileList['test/monkey_test.rb']
|
40
|
+
end
|
41
|
+
|
42
|
+
Rake::TestTask.new(:benchmark) do |t|
|
43
|
+
t.libs << %w(test lib)
|
44
|
+
t.test_files = FileList['test/benchmark_test.rb']
|
45
|
+
end
|
46
|
+
|
47
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
48
|
+
t.patterns = ['lib/**/*.rb', 'test/**/*.rb', 'Gemfile', 'Rakefile']
|
49
|
+
end
|
50
|
+
|
51
|
+
RDoc::Task.new(:rdoc) do |doc|
|
52
|
+
doc.main = 'docs/GettingStarted'
|
53
|
+
doc.title = 'Datadog Ruby Tracer'
|
54
|
+
# TODO[manu]: include all lib/ folder, but only when all classes' docs are ready
|
55
|
+
doc.rdoc_files = FileList.new(%w(lib/ddtrace/tracer.rb lib/ddtrace/span.rb docs/**/*))
|
56
|
+
doc.rdoc_dir = 'html'
|
57
|
+
end
|
58
|
+
|
59
|
+
# Deploy tasks
|
60
|
+
S3_BUCKET = 'gems.datadoghq.com'.freeze
|
61
|
+
S3_DIR = ENV['S3_DIR']
|
62
|
+
|
63
|
+
desc 'create a new indexed repository'
|
64
|
+
task :'release:gem' do
|
65
|
+
raise 'Missing environment variable S3_DIR' if !S3_DIR || S3_DIR.empty?
|
66
|
+
# load existing deployed gems
|
67
|
+
sh "aws s3 cp --exclude 'docs/*' --recursive s3://#{S3_BUCKET}/#{S3_DIR}/ ./rubygems/"
|
68
|
+
|
69
|
+
# create folders
|
70
|
+
sh 'mkdir -p ./gems'
|
71
|
+
sh 'mkdir -p ./rubygems/gems/'
|
72
|
+
sh 'mkdir -p ./rubygems/quick/'
|
73
|
+
|
74
|
+
# copy previous builds
|
75
|
+
sh 'cp ./rubygems/gems/* ./gems/'
|
76
|
+
|
77
|
+
# build the gem
|
78
|
+
Rake::Task['build'].execute
|
79
|
+
|
80
|
+
# copy the output in the indexed folder
|
81
|
+
sh 'cp pkg/*.gem ./gems/'
|
82
|
+
|
83
|
+
# generate the gems index
|
84
|
+
sh 'gem generate_index'
|
85
|
+
|
86
|
+
# namespace everything under ./rubygems/
|
87
|
+
sh 'cp -r ./gems/* ./rubygems/gems/'
|
88
|
+
sh 'cp -r specs.* ./rubygems/'
|
89
|
+
sh 'cp -r latest_specs.* ./rubygems/'
|
90
|
+
sh 'cp -r prerelease_specs.* ./rubygems/'
|
91
|
+
sh 'cp -r ./quick/* ./rubygems/quick/'
|
92
|
+
|
93
|
+
# deploy a static gem registry
|
94
|
+
sh "aws s3 cp --recursive ./rubygems/ s3://#{S3_BUCKET}/#{S3_DIR}/"
|
95
|
+
end
|
96
|
+
|
97
|
+
desc 'release the docs website'
|
98
|
+
task :'release:docs' => :rdoc do
|
99
|
+
raise 'Missing environment variable S3_DIR' if !S3_DIR || S3_DIR.empty?
|
100
|
+
sh "aws s3 cp --recursive html/ s3://#{S3_BUCKET}/#{S3_DIR}/docs/"
|
101
|
+
end
|
102
|
+
|
103
|
+
task default: :test
|
data/circle.yml
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
machine:
|
2
|
+
services:
|
3
|
+
- docker
|
4
|
+
environment:
|
5
|
+
MRI_VERSIONS: 2.3.1,2.2.5,2.1.10
|
6
|
+
RAILS5_VERSIONS: 2.3.1,2.2.5
|
7
|
+
JRUBY_VERSIONS: jruby-9.1.5.0
|
8
|
+
JRUBY_OPTS: --dev
|
9
|
+
AGENT_BUILD_PATH: "/home/ubuntu/agent"
|
10
|
+
TEST_DATADOG_INTEGRATION: 1
|
11
|
+
|
12
|
+
dependencies:
|
13
|
+
cache_directories:
|
14
|
+
# Cache Ruby binaries and gems
|
15
|
+
- "/opt/circleci/.rvm/"
|
16
|
+
pre:
|
17
|
+
# we should use an old docker-compose because CircleCI supports
|
18
|
+
# only docker-engine==1.9
|
19
|
+
- pip install docker-compose==1.7.1
|
20
|
+
- docker-compose up -d | cat
|
21
|
+
# configure Ruby interpreters
|
22
|
+
- gem install builder
|
23
|
+
- bundle install
|
24
|
+
- rvm get head
|
25
|
+
- rvm install $MRI_VERSIONS
|
26
|
+
- rvm install $JRUBY_VERSIONS
|
27
|
+
# prepare and run the trace agent
|
28
|
+
# TODO[manu]: remove this part when everything will be open source
|
29
|
+
- git clone git@github.com:DataDog/datadog-trace-agent.git $AGENT_BUILD_PATH
|
30
|
+
- cd $AGENT_BUILD_PATH && docker build -t datadog/trace-agent .
|
31
|
+
- docker run -d -e DD_API_KEY=invalid_key_but_this_is_fine -e DD_BIND_HOST=0.0.0.0 -p 127.0.0.1:7777:7777 datadog/trace-agent
|
32
|
+
override:
|
33
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do gem install bundler
|
34
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do bundle install
|
35
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal install
|
36
|
+
|
37
|
+
test:
|
38
|
+
override:
|
39
|
+
- rvm 2.1.10 --verbose do rake rubocop
|
40
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do rake test
|
41
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails3-postgres rake rails
|
42
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails3-mysql2 rake rails
|
43
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails4-postgres rake rails
|
44
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails4-mysql2 rake rails
|
45
|
+
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres rake rails
|
46
|
+
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-mysql2 rake rails
|
47
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails3-postgres-redis rake railsredis
|
48
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal rails4-postgres-redis rake railsredis
|
49
|
+
- rvm $RAILS5_VERSIONS --verbose do appraisal rails5-postgres-redis rake railsredis
|
50
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal contrib rake contrib
|
51
|
+
- rvm $MRI_VERSIONS,$JRUBY_VERSIONS --verbose do appraisal contrib rake monkey
|
52
|
+
- rvm 2.3.1 --verbose do rake benchmark
|
53
|
+
- rvm jruby-9.1.5.0 --verbose do rake benchmark
|
54
|
+
|
55
|
+
deployment:
|
56
|
+
develop:
|
57
|
+
branch: /(master)|(develop)/
|
58
|
+
# CircleCI is configured to provide VERSION_SUFFIX=$CIRCLE_BUILD_NUM
|
59
|
+
commands:
|
60
|
+
- S3_DIR=trace-dev rake release:docs
|
61
|
+
- S3_DIR=trace-dev rake release:gem
|
62
|
+
- cp -r ./rubygems/* $CIRCLE_ARTIFACTS
|
63
|
+
public:
|
64
|
+
tag: /v[0-9]+(\.[0-9]+)*/
|
65
|
+
commands:
|
66
|
+
- S3_DIR=trace rake release:docs
|
67
|
+
- S3_DIR=trace VERSION_SUFFIX= rake release:gem
|
68
|
+
- cp -r ./rubygems/* $CIRCLE_ARTIFACTS
|