ddtrace 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +3 -3
- data/CHANGELOG.md +24 -2
- data/Rakefile +14 -28
- data/docker-compose.yml +1 -0
- data/docs/GettingStarted.md +302 -263
- data/lib/ddtrace.rb +22 -21
- data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +23 -0
- data/lib/ddtrace/contrib/active_model_serializers/event.rb +4 -2
- data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +2 -2
- data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +2 -2
- data/lib/ddtrace/contrib/active_model_serializers/ext.rb +17 -0
- data/lib/ddtrace/contrib/active_model_serializers/integration.rb +39 -0
- data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +24 -43
- data/lib/ddtrace/contrib/active_record/configuration/settings.rb +3 -2
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +6 -7
- data/lib/ddtrace/contrib/active_record/events/sql.rb +10 -8
- data/lib/ddtrace/contrib/active_record/ext.rb +22 -0
- data/lib/ddtrace/contrib/aws/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/aws/ext.rb +21 -0
- data/lib/ddtrace/contrib/aws/instrumentation.rb +11 -9
- data/lib/ddtrace/contrib/aws/integration.rb +32 -0
- data/lib/ddtrace/contrib/aws/patcher.rb +42 -41
- data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +3 -1
- data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +11 -0
- data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +7 -3
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +1 -0
- data/lib/ddtrace/contrib/dalli/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/dalli/ext.rb +15 -0
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +3 -3
- data/lib/ddtrace/contrib/dalli/integration.rb +36 -0
- data/lib/ddtrace/contrib/dalli/patcher.rb +31 -38
- data/lib/ddtrace/contrib/dalli/quantize.rb +3 -3
- data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/delayed_job/ext.rb +18 -0
- data/lib/ddtrace/contrib/delayed_job/integration.rb +32 -0
- data/lib/ddtrace/contrib/delayed_job/patcher.rb +20 -27
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +7 -6
- data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +16 -0
- data/lib/ddtrace/contrib/elasticsearch/ext.rb +18 -0
- data/lib/ddtrace/contrib/elasticsearch/integration.rb +37 -0
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +30 -39
- data/lib/ddtrace/contrib/excon/configuration/settings.rb +18 -0
- data/lib/ddtrace/contrib/excon/ext.rb +13 -0
- data/lib/ddtrace/contrib/excon/integration.rb +32 -0
- data/lib/ddtrace/contrib/excon/middleware.rb +10 -10
- data/lib/ddtrace/contrib/excon/patcher.rb +14 -30
- data/lib/ddtrace/contrib/faraday/configuration/settings.rb +23 -0
- data/lib/ddtrace/contrib/faraday/ext.rb +13 -0
- data/lib/ddtrace/contrib/faraday/integration.rb +36 -0
- data/lib/ddtrace/contrib/faraday/middleware.rb +10 -9
- data/lib/ddtrace/contrib/faraday/patcher.rb +39 -54
- data/lib/ddtrace/contrib/grape/configuration/settings.rb +16 -0
- data/lib/ddtrace/contrib/grape/endpoint.rb +10 -13
- data/lib/ddtrace/contrib/grape/ext.rb +19 -0
- data/lib/ddtrace/contrib/grape/integration.rb +36 -0
- data/lib/ddtrace/contrib/grape/patcher.rb +24 -24
- data/lib/ddtrace/contrib/graphql/configuration/settings.rb +20 -0
- data/lib/ddtrace/contrib/graphql/ext.rb +11 -0
- data/lib/ddtrace/contrib/graphql/integration.rb +38 -0
- data/lib/ddtrace/contrib/graphql/patcher.rb +33 -41
- data/lib/ddtrace/contrib/grpc/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +5 -2
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +5 -2
- data/lib/ddtrace/contrib/grpc/ext.rb +14 -0
- data/lib/ddtrace/contrib/grpc/integration.rb +38 -0
- data/lib/ddtrace/contrib/grpc/patcher.rb +25 -35
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +39 -0
- data/lib/ddtrace/contrib/http/configuration/settings.rb +16 -0
- data/lib/ddtrace/contrib/http/ext.rb +13 -0
- data/lib/ddtrace/contrib/http/integration.rb +32 -0
- data/lib/ddtrace/contrib/http/patcher.rb +10 -58
- data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +18 -0
- data/lib/ddtrace/contrib/mongodb/ext.rb +20 -0
- data/lib/ddtrace/contrib/mongodb/integration.rb +36 -0
- data/lib/ddtrace/contrib/mongodb/patcher.rb +17 -27
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +12 -11
- data/lib/ddtrace/contrib/mysql2/client.rb +8 -6
- data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/mysql2/ext.rb +15 -0
- data/lib/ddtrace/contrib/mysql2/integration.rb +32 -0
- data/lib/ddtrace/contrib/mysql2/patcher.rb +12 -22
- data/lib/ddtrace/contrib/racecar/configuration/settings.rb +23 -0
- data/lib/ddtrace/contrib/racecar/event.rb +7 -6
- data/lib/ddtrace/contrib/racecar/events/batch.rb +2 -2
- data/lib/ddtrace/contrib/racecar/events/message.rb +2 -2
- data/lib/ddtrace/contrib/racecar/ext.rb +21 -0
- data/lib/ddtrace/contrib/racecar/integration.rb +36 -0
- data/lib/ddtrace/contrib/racecar/patcher.rb +24 -41
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +39 -0
- data/lib/ddtrace/contrib/rack/ext.rb +18 -0
- data/lib/ddtrace/contrib/rack/integration.rb +32 -0
- data/lib/ddtrace/contrib/rack/middlewares.rb +5 -2
- data/lib/ddtrace/contrib/rack/patcher.rb +22 -40
- data/lib/ddtrace/contrib/rails/action_controller.rb +10 -7
- data/lib/ddtrace/contrib/rails/action_controller_patch.rb +1 -0
- data/lib/ddtrace/contrib/rails/active_support.rb +9 -9
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +26 -0
- data/lib/ddtrace/contrib/rails/core_extensions.rb +12 -15
- data/lib/ddtrace/contrib/rails/ext.rb +30 -0
- data/lib/ddtrace/contrib/rails/framework.rb +3 -2
- data/lib/ddtrace/contrib/rails/integration.rb +37 -0
- data/lib/ddtrace/contrib/rails/patcher.rb +56 -63
- data/lib/ddtrace/contrib/rails/railtie.rb +3 -10
- data/lib/ddtrace/contrib/rake/configuration/settings.rb +17 -0
- data/lib/ddtrace/contrib/rake/ext.rb +18 -0
- data/lib/ddtrace/contrib/rake/instrumentation.rb +7 -8
- data/lib/ddtrace/contrib/rake/integration.rb +36 -0
- data/lib/ddtrace/contrib/rake/patcher.rb +23 -33
- data/lib/ddtrace/contrib/redis/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/redis/ext.rb +19 -0
- data/lib/ddtrace/contrib/redis/integration.rb +36 -0
- data/lib/ddtrace/contrib/redis/patcher.rb +21 -29
- data/lib/ddtrace/contrib/redis/tags.rb +3 -3
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +16 -0
- data/lib/ddtrace/contrib/resque/ext.rb +13 -0
- data/lib/ddtrace/contrib/resque/integration.rb +37 -0
- data/lib/ddtrace/contrib/resque/patcher.rb +30 -36
- data/lib/ddtrace/contrib/resque/resque_job.rb +2 -1
- data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +5 -8
- data/lib/ddtrace/contrib/rest_client/ext.rb +13 -0
- data/lib/ddtrace/contrib/rest_client/integration.rb +9 -1
- data/lib/ddtrace/contrib/rest_client/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +9 -10
- data/lib/ddtrace/contrib/sequel/configuration/settings.rb +2 -0
- data/lib/ddtrace/contrib/sequel/database.rb +4 -3
- data/lib/ddtrace/contrib/sequel/dataset.rb +3 -2
- data/lib/ddtrace/contrib/sequel/ext.rb +15 -0
- data/lib/ddtrace/contrib/sequel/integration.rb +1 -3
- data/lib/ddtrace/contrib/sequel/patcher.rb +0 -1
- data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/sidekiq/ext.rb +19 -0
- data/lib/ddtrace/contrib/sidekiq/integration.rb +36 -0
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +18 -18
- data/lib/ddtrace/contrib/sidekiq/tracer.rb +10 -10
- data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +27 -0
- data/lib/ddtrace/contrib/sinatra/env.rb +3 -4
- data/lib/ddtrace/contrib/sinatra/ext.rb +19 -0
- data/lib/ddtrace/contrib/sinatra/integration.rb +36 -0
- data/lib/ddtrace/contrib/sinatra/patcher.rb +33 -0
- data/lib/ddtrace/contrib/sinatra/tracer.rb +4 -34
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +2 -3
- data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +15 -0
- data/lib/ddtrace/contrib/sucker_punch/ext.rb +18 -0
- data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +6 -5
- data/lib/ddtrace/contrib/sucker_punch/integration.rb +36 -0
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +29 -35
- data/lib/ddtrace/encoding.rb +21 -16
- data/lib/ddtrace/span.rb +29 -0
- data/lib/ddtrace/transport.rb +2 -2
- data/lib/ddtrace/version.rb +2 -2
- metadata +74 -6
- data/lib/ddtrace/ext/cache.rb +0 -8
- data/lib/ddtrace/ext/grpc.rb +0 -7
- data/lib/ddtrace/ext/mongo.rb +0 -12
- data/lib/ddtrace/ext/redis.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6e5b9ed9670e7fae8c7713c4262912573d1d85d
|
4
|
+
data.tar.gz: 2299e40d5eda07a3a16247ead6ab701e8e40f244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6373e9ac4dc7c3dbe3dc58119a3c88043cdb5d440787eddce6fc1c967e16226513b6d89fc7920215baf23f8ef241afe3b431b24c5869dfcfb1fba08f58857f99
|
7
|
+
data.tar.gz: d325aae3c7c5b550caf3a2eae70ca67d80d7555fe2295ee2c0e30e78d63d7633f34629c802941730971b5eb001523b08cf8d48c944fb7554b74141ac5e326da7
|
data/Appraisals
CHANGED
@@ -84,7 +84,7 @@ elsif Gem::Version.new('1.9.3') <= Gem::Version.new(RUBY_VERSION) \
|
|
84
84
|
gem 'rest-client', '< 2.0'
|
85
85
|
gem 'resque', '< 2.0'
|
86
86
|
gem 'sequel', '~> 4.0', '< 4.37'
|
87
|
-
gem 'sidekiq', '
|
87
|
+
gem 'sidekiq', '~> 3.5.4'
|
88
88
|
gem 'sinatra', '1.4.5'
|
89
89
|
gem 'sqlite3'
|
90
90
|
gem 'sucker_punch'
|
@@ -168,7 +168,7 @@ elsif Gem::Version.new('2.0.0') <= Gem::Version.new(RUBY_VERSION) \
|
|
168
168
|
gem 'rest-client'
|
169
169
|
gem 'resque', '< 2.0'
|
170
170
|
gem 'sequel', '~> 4.0', '< 4.37'
|
171
|
-
gem 'sidekiq', '
|
171
|
+
gem 'sidekiq', '~> 3.5.4'
|
172
172
|
gem 'sinatra', '1.4.5'
|
173
173
|
gem 'sqlite3'
|
174
174
|
gem 'sucker_punch'
|
@@ -272,7 +272,7 @@ elsif Gem::Version.new('2.1.0') <= Gem::Version.new(RUBY_VERSION) \
|
|
272
272
|
gem 'rest-client'
|
273
273
|
gem 'resque', '< 2.0'
|
274
274
|
gem 'sequel', '~> 4.0', '< 4.37'
|
275
|
-
gem 'sidekiq', '
|
275
|
+
gem 'sidekiq', '~> 3.5.4'
|
276
276
|
gem 'sinatra', '1.4.5'
|
277
277
|
gem 'sqlite3'
|
278
278
|
gem 'sucker_punch'
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,27 @@
|
|
4
4
|
|
5
5
|
## [Unreleased (beta)]
|
6
6
|
|
7
|
+
## [0.17.0] - 2018-10-30
|
8
|
+
|
9
|
+
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.17.0
|
10
|
+
|
11
|
+
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.16.1...v0.17.0
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- [BETA] Span memory `allocations` attribute (#597) (@dasch)
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Use Rack Env to update resource in Rails (#580) (@dasch)
|
20
|
+
- Expand support for Sidekiq to 3.5.4+ (#593)
|
21
|
+
- Expand support for mysql2 to 0.3.21+ (#578)
|
22
|
+
|
23
|
+
### Refactored
|
24
|
+
|
25
|
+
- Upgraded integrations to new API (#544)
|
26
|
+
- Encoding classes into modules (#598)
|
27
|
+
|
7
28
|
## [0.16.1] - 2018-10-17
|
8
29
|
|
9
30
|
Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.16.1
|
@@ -522,8 +543,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
522
543
|
|
523
544
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
524
545
|
|
525
|
-
[Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.
|
526
|
-
[Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.
|
546
|
+
[Unreleased (stable)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.0...master
|
547
|
+
[Unreleased (beta)]: https://github.com/DataDog/dd-trace-rb/compare/v0.17.0...0.18-dev
|
548
|
+
[0.17.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.16.1...v0.17.0
|
527
549
|
[0.16.1]: https://github.com/DataDog/dd-trace-rb/compare/v0.16.0...v0.16.1
|
528
550
|
[0.16.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.15.0...v0.16.0
|
529
551
|
[0.15.0]: https://github.com/DataDog/dd-trace-rb/compare/v0.14.2...v0.15.0
|
data/Rakefile
CHANGED
@@ -86,7 +86,7 @@ end
|
|
86
86
|
namespace :test do
|
87
87
|
task all: [:main,
|
88
88
|
:rails, :railsredis, :railssidekiq, :railsactivejob,
|
89
|
-
:
|
89
|
+
:sidekiq, :sinatra, :monkey]
|
90
90
|
|
91
91
|
Rake::TestTask.new(:main) do |t|
|
92
92
|
t.libs << %w[test lib]
|
@@ -130,9 +130,7 @@ namespace :test do
|
|
130
130
|
|
131
131
|
[
|
132
132
|
:aws,
|
133
|
-
:elasticsearch,
|
134
133
|
:grape,
|
135
|
-
:http,
|
136
134
|
:rack,
|
137
135
|
:sidekiq,
|
138
136
|
:sinatra,
|
@@ -192,8 +190,6 @@ task :ci do
|
|
192
190
|
if RUBY_PLATFORM != 'java'
|
193
191
|
# Contrib minitests
|
194
192
|
sh 'bundle exec appraisal contrib-old rake test:aws'
|
195
|
-
sh 'bundle exec appraisal contrib-old rake test:elasticsearch'
|
196
|
-
sh 'bundle exec appraisal contrib-old rake test:http'
|
197
193
|
sh 'bundle exec appraisal contrib-old rake test:monkey'
|
198
194
|
sh 'bundle exec appraisal contrib-old rake test:rack'
|
199
195
|
sh 'bundle exec appraisal contrib-old rake test:sinatra'
|
@@ -201,10 +197,10 @@ task :ci do
|
|
201
197
|
# Contrib specs
|
202
198
|
sh 'bundle exec appraisal contrib-old rake spec:active_model_serializers'
|
203
199
|
sh 'bundle exec appraisal contrib-old rake spec:active_record'
|
204
|
-
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
205
200
|
sh 'bundle exec appraisal contrib-old rake spec:active_support'
|
206
201
|
sh 'bundle exec appraisal contrib-old rake spec:concurrent_ruby'
|
207
202
|
sh 'bundle exec appraisal contrib-old rake spec:dalli'
|
203
|
+
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
208
204
|
sh 'bundle exec appraisal contrib-old rake spec:elasticsearch'
|
209
205
|
sh 'bundle exec appraisal contrib-old rake spec:excon'
|
210
206
|
sh 'bundle exec appraisal contrib-old rake spec:faraday'
|
@@ -214,8 +210,8 @@ task :ci do
|
|
214
210
|
sh 'bundle exec appraisal contrib-old rake spec:rake'
|
215
211
|
sh 'bundle exec appraisal contrib-old rake spec:redis'
|
216
212
|
sh 'bundle exec appraisal contrib-old rake spec:resque'
|
217
|
-
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
218
213
|
sh 'bundle exec appraisal contrib-old rake spec:rest_client'
|
214
|
+
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
219
215
|
# Rails minitests
|
220
216
|
sh 'bundle exec appraisal rails30-postgres rake test:rails'
|
221
217
|
sh 'bundle exec appraisal rails30-postgres rake test:railsdisableenv'
|
@@ -238,8 +234,6 @@ task :ci do
|
|
238
234
|
if RUBY_PLATFORM != 'java'
|
239
235
|
# Contrib minitests
|
240
236
|
sh 'bundle exec appraisal contrib-old rake test:aws'
|
241
|
-
sh 'bundle exec appraisal contrib-old rake test:elasticsearch'
|
242
|
-
sh 'bundle exec appraisal contrib-old rake test:http'
|
243
237
|
sh 'bundle exec appraisal contrib-old rake test:monkey'
|
244
238
|
sh 'bundle exec appraisal contrib-old rake test:rack'
|
245
239
|
sh 'bundle exec appraisal contrib-old rake test:sinatra'
|
@@ -247,10 +241,10 @@ task :ci do
|
|
247
241
|
# Contrib specs
|
248
242
|
sh 'bundle exec appraisal contrib-old rake spec:active_model_serializers'
|
249
243
|
sh 'bundle exec appraisal contrib-old rake spec:active_record'
|
250
|
-
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
251
244
|
sh 'bundle exec appraisal contrib-old rake spec:active_support'
|
252
245
|
sh 'bundle exec appraisal contrib-old rake spec:concurrent_ruby'
|
253
246
|
sh 'bundle exec appraisal contrib-old rake spec:dalli'
|
247
|
+
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
254
248
|
sh 'bundle exec appraisal contrib-old rake spec:elasticsearch'
|
255
249
|
sh 'bundle exec appraisal contrib-old rake spec:excon'
|
256
250
|
sh 'bundle exec appraisal contrib-old rake spec:faraday'
|
@@ -260,8 +254,8 @@ task :ci do
|
|
260
254
|
sh 'bundle exec appraisal contrib-old rake spec:rake'
|
261
255
|
sh 'bundle exec appraisal contrib-old rake spec:redis'
|
262
256
|
sh 'bundle exec appraisal contrib-old rake spec:resque'
|
263
|
-
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
264
257
|
sh 'bundle exec appraisal contrib-old rake spec:rest_client'
|
258
|
+
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
265
259
|
# Rails minitests
|
266
260
|
sh 'bundle exec appraisal contrib-old rake test:sidekiq'
|
267
261
|
sh 'bundle exec appraisal rails30-postgres rake test:rails'
|
@@ -288,8 +282,6 @@ task :ci do
|
|
288
282
|
if RUBY_PLATFORM != 'java'
|
289
283
|
# Contrib minitests
|
290
284
|
sh 'bundle exec appraisal contrib-old rake test:aws'
|
291
|
-
sh 'bundle exec appraisal contrib-old rake test:elasticsearch'
|
292
|
-
sh 'bundle exec appraisal contrib-old rake test:http'
|
293
285
|
sh 'bundle exec appraisal contrib-old rake test:monkey'
|
294
286
|
sh 'bundle exec appraisal contrib-old rake test:rack'
|
295
287
|
sh 'bundle exec appraisal contrib-old rake test:sinatra'
|
@@ -297,10 +289,10 @@ task :ci do
|
|
297
289
|
# Contrib specs
|
298
290
|
sh 'bundle exec appraisal contrib-old rake spec:active_model_serializers'
|
299
291
|
sh 'bundle exec appraisal contrib-old rake spec:active_record'
|
300
|
-
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
301
292
|
sh 'bundle exec appraisal contrib-old rake spec:active_support'
|
302
293
|
sh 'bundle exec appraisal contrib-old rake spec:concurrent_ruby'
|
303
294
|
sh 'bundle exec appraisal contrib-old rake spec:dalli'
|
295
|
+
sh 'bundle exec appraisal contrib-old rake spec:delayed_job'
|
304
296
|
sh 'bundle exec appraisal contrib-old rake spec:elasticsearch'
|
305
297
|
sh 'bundle exec appraisal contrib-old rake spec:excon'
|
306
298
|
sh 'bundle exec appraisal contrib-old rake spec:faraday'
|
@@ -310,8 +302,8 @@ task :ci do
|
|
310
302
|
sh 'bundle exec appraisal contrib-old rake spec:rake'
|
311
303
|
sh 'bundle exec appraisal contrib-old rake spec:redis'
|
312
304
|
sh 'bundle exec appraisal contrib-old rake spec:resque'
|
313
|
-
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
314
305
|
sh 'bundle exec appraisal contrib-old rake spec:rest_client'
|
306
|
+
sh 'bundle exec appraisal contrib-old rake spec:sequel'
|
315
307
|
# Rails minitests
|
316
308
|
sh 'bundle exec appraisal contrib-old rake test:sidekiq'
|
317
309
|
sh 'bundle exec appraisal rails30-postgres rake test:rails'
|
@@ -344,19 +336,17 @@ task :ci do
|
|
344
336
|
if RUBY_PLATFORM != 'java'
|
345
337
|
# Contrib minitests
|
346
338
|
sh 'bundle exec appraisal contrib rake test:aws'
|
347
|
-
sh 'bundle exec appraisal contrib rake test:elasticsearch'
|
348
339
|
sh 'bundle exec appraisal contrib rake test:grape'
|
349
|
-
sh 'bundle exec appraisal contrib rake test:http'
|
350
340
|
sh 'bundle exec appraisal contrib rake test:rack'
|
351
341
|
sh 'bundle exec appraisal contrib rake test:sinatra'
|
352
342
|
sh 'bundle exec appraisal contrib rake test:sucker_punch'
|
353
343
|
# Contrib specs
|
354
344
|
sh 'bundle exec appraisal contrib rake spec:active_model_serializers'
|
355
345
|
sh 'bundle exec appraisal contrib rake spec:active_record'
|
356
|
-
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
357
346
|
sh 'bundle exec appraisal contrib rake spec:active_support'
|
358
347
|
sh 'bundle exec appraisal contrib rake spec:concurrent_ruby'
|
359
348
|
sh 'bundle exec appraisal contrib rake spec:dalli'
|
349
|
+
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
360
350
|
sh 'bundle exec appraisal contrib rake spec:elasticsearch'
|
361
351
|
sh 'bundle exec appraisal contrib rake spec:excon'
|
362
352
|
sh 'bundle exec appraisal contrib rake spec:faraday'
|
@@ -369,8 +359,8 @@ task :ci do
|
|
369
359
|
sh 'bundle exec appraisal contrib rake spec:rake'
|
370
360
|
sh 'bundle exec appraisal contrib rake spec:redis'
|
371
361
|
sh 'bundle exec appraisal contrib rake spec:resque'
|
372
|
-
sh 'bundle exec appraisal contrib rake spec:sequel'
|
373
362
|
sh 'bundle exec appraisal contrib rake spec:rest_client'
|
363
|
+
sh 'bundle exec appraisal contrib rake spec:sequel'
|
374
364
|
# Rails minitests
|
375
365
|
sh 'bundle exec appraisal contrib rake test:sidekiq'
|
376
366
|
sh 'bundle exec appraisal rails30-postgres rake test:rails'
|
@@ -411,21 +401,19 @@ task :ci do
|
|
411
401
|
if RUBY_PLATFORM != 'java'
|
412
402
|
# Contrib minitests
|
413
403
|
sh 'bundle exec appraisal contrib rake test:aws'
|
414
|
-
sh 'bundle exec appraisal contrib rake test:elasticsearch'
|
415
404
|
sh 'bundle exec appraisal contrib rake test:grape'
|
416
|
-
sh 'bundle exec appraisal contrib rake test:http'
|
417
405
|
sh 'bundle exec appraisal contrib rake test:rack'
|
418
406
|
sh 'bundle exec appraisal contrib rake test:sinatra'
|
419
407
|
sh 'bundle exec appraisal contrib rake test:sucker_punch'
|
420
408
|
# Contrib specs
|
421
409
|
sh 'bundle exec appraisal contrib rake spec:active_model_serializers'
|
422
410
|
sh 'bundle exec appraisal contrib rake spec:active_record'
|
423
|
-
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
424
411
|
sh 'bundle exec appraisal contrib rake spec:active_support'
|
425
412
|
sh 'bundle exec appraisal contrib rake spec:concurrent_ruby'
|
426
413
|
sh 'bundle exec appraisal contrib rake spec:dalli'
|
427
|
-
sh 'bundle exec appraisal contrib rake spec:
|
414
|
+
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
428
415
|
sh 'bundle exec appraisal contrib rake spec:elasticsearch'
|
416
|
+
sh 'bundle exec appraisal contrib rake spec:excon'
|
429
417
|
sh 'bundle exec appraisal contrib rake spec:faraday'
|
430
418
|
sh 'bundle exec appraisal contrib rake spec:graphql'
|
431
419
|
sh 'bundle exec appraisal contrib rake spec:grpc'
|
@@ -436,8 +424,8 @@ task :ci do
|
|
436
424
|
sh 'bundle exec appraisal contrib rake spec:rake'
|
437
425
|
sh 'bundle exec appraisal contrib rake spec:redis'
|
438
426
|
sh 'bundle exec appraisal contrib rake spec:resque'
|
439
|
-
sh 'bundle exec appraisal contrib rake spec:sequel'
|
440
427
|
sh 'bundle exec appraisal contrib rake spec:rest_client'
|
428
|
+
sh 'bundle exec appraisal contrib rake spec:sequel'
|
441
429
|
# Rails minitests
|
442
430
|
sh 'bundle exec appraisal contrib rake test:sidekiq'
|
443
431
|
sh 'bundle exec appraisal rails30-postgres rake test:rails'
|
@@ -477,19 +465,17 @@ task :ci do
|
|
477
465
|
if RUBY_PLATFORM != 'java'
|
478
466
|
# Contrib minitests
|
479
467
|
sh 'bundle exec appraisal contrib rake test:aws'
|
480
|
-
sh 'bundle exec appraisal contrib rake test:elasticsearch'
|
481
468
|
sh 'bundle exec appraisal contrib rake test:grape'
|
482
|
-
sh 'bundle exec appraisal contrib rake test:http'
|
483
469
|
sh 'bundle exec appraisal contrib rake test:rack'
|
484
470
|
sh 'bundle exec appraisal contrib rake test:sinatra'
|
485
471
|
sh 'bundle exec appraisal contrib rake test:sucker_punch'
|
486
472
|
# Contrib specs
|
487
473
|
sh 'bundle exec appraisal contrib rake spec:active_model_serializers'
|
488
474
|
sh 'bundle exec appraisal contrib rake spec:active_record'
|
489
|
-
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
490
475
|
sh 'bundle exec appraisal contrib rake spec:active_support'
|
491
476
|
sh 'bundle exec appraisal contrib rake spec:concurrent_ruby'
|
492
477
|
sh 'bundle exec appraisal contrib rake spec:dalli'
|
478
|
+
sh 'bundle exec appraisal contrib rake spec:delayed_job'
|
493
479
|
sh 'bundle exec appraisal contrib rake spec:elasticsearch'
|
494
480
|
sh 'bundle exec appraisal contrib rake spec:excon'
|
495
481
|
sh 'bundle exec appraisal contrib rake spec:faraday'
|
@@ -502,8 +488,8 @@ task :ci do
|
|
502
488
|
sh 'bundle exec appraisal contrib rake spec:rake'
|
503
489
|
sh 'bundle exec appraisal contrib rake spec:redis'
|
504
490
|
sh 'bundle exec appraisal contrib rake spec:resque'
|
505
|
-
sh 'bundle exec appraisal contrib rake spec:sequel'
|
506
491
|
sh 'bundle exec appraisal contrib rake spec:rest_client'
|
492
|
+
sh 'bundle exec appraisal contrib rake spec:sequel'
|
507
493
|
# Rails minitests
|
508
494
|
sh 'bundle exec appraisal contrib rake test:sidekiq'
|
509
495
|
sh 'bundle exec rake benchmark'
|
data/docker-compose.yml
CHANGED
data/docs/GettingStarted.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Datadog Trace Client
|
2
2
|
|
3
|
-
|
3
|
+
`ddtrace` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
|
4
4
|
databases and microservices so that developers have great visiblity into bottlenecks and troublesome requests.
|
5
5
|
|
6
6
|
## Getting started
|
@@ -24,6 +24,7 @@ For descriptions of terminology used in APM, take a look at the [official docume
|
|
24
24
|
- [Quickstart for OpenTracing](#quickstart-for-opentracing)
|
25
25
|
- [Manual instrumentation](#manual-instrumentation)
|
26
26
|
- [Integration instrumentation](#integration-instrumentation)
|
27
|
+
- [Active Model Serializers](#active-model-serializers)
|
27
28
|
- [Active Record](#active-record)
|
28
29
|
- [AWS](#aws)
|
29
30
|
- [Concurrent Ruby](#concurrent-ruby)
|
@@ -32,9 +33,9 @@ For descriptions of terminology used in APM, take a look at the [official docume
|
|
32
33
|
- [Elastic Search](#elastic-search)
|
33
34
|
- [Excon](#excon)
|
34
35
|
- [Faraday](#faraday)
|
35
|
-
- [gRPC](#grpc)
|
36
36
|
- [Grape](#grape)
|
37
37
|
- [GraphQL](#graphql)
|
38
|
+
- [gRPC](#grpc)
|
38
39
|
- [MongoDB](#mongodb)
|
39
40
|
- [MySQL2](#mysql2)
|
40
41
|
- [Net/HTTP](#nethttp)
|
@@ -43,7 +44,7 @@ For descriptions of terminology used in APM, take a look at the [official docume
|
|
43
44
|
- [Rails](#rails)
|
44
45
|
- [Rake](#rake)
|
45
46
|
- [Redis](#redis)
|
46
|
-
- [Rest Client](#
|
47
|
+
- [Rest Client](#rest-client)
|
47
48
|
- [Resque](#resque)
|
48
49
|
- [Sequel](#sequel)
|
49
50
|
- [Sidekiq](#sidekiq)
|
@@ -198,13 +199,13 @@ And `options` is an optional `Hash` that accepts the following parameters:
|
|
198
199
|
|
199
200
|
| Key | Type | Description | Default |
|
200
201
|
| --- | --- | --- | --- |
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
202
|
+
| `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
|
203
|
+
| `resource` | `String` | Name of the resource or action being operated on. Traces with the same resource value will be grouped together for the purpose of metrics (but still independently viewable.) Usually domain specific, such as a URL, query, request, etc. (e.g. `'Article#submit'`, `http://example.com/articles/list`.) | `name` of Span. |
|
204
|
+
| `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
|
205
|
+
| `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
|
206
|
+
| `start_time` | `Integer` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now.utc` |
|
207
|
+
| `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
|
208
|
+
| `on_error` | `Proc` | Handler invoked when a block is provided to trace, and it raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
208
209
|
|
209
210
|
It's highly recommended you set both `service` and `resource` at a minimum. Spans without a `service` or `resource` as `nil` will be discarded by the Datadog agent.
|
210
211
|
|
@@ -304,33 +305,55 @@ end
|
|
304
305
|
|
305
306
|
For a list of available integrations, and their configuration options, please refer to the following:
|
306
307
|
|
307
|
-
| Name
|
308
|
-
|
|
309
|
-
| Active
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
| Grape
|
319
|
-
| GraphQL
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
| Resque
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
308
|
+
| Name | Key | Versions Supported | How to configure | Gem source |
|
309
|
+
| ------------------------ | -------------------------- | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------ |
|
310
|
+
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
311
|
+
| Active Record | `active_record` | `>= 3.2, < 6.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
312
|
+
| AWS | `aws` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
313
|
+
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
314
|
+
| Dalli | `dalli` | `>= 2.7` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
315
|
+
| DelayedJob | `delayed_job` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
316
|
+
| Elastic Search | `elasticsearch` | `>= 6.0` | *[Link](#elastic-search)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
317
|
+
| Excon | `excon` | `>= 0.62` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
|
318
|
+
| Faraday | `faraday` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
|
319
|
+
| Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
320
|
+
| GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
321
|
+
| gRPC | `grpc` | `>= 1.10` | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
322
|
+
| MongoDB | `mongo` | `>= 2.0, < 2.5` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
323
|
+
| MySQL2 | `mysql2` | `>= 0.3.21` | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
324
|
+
| Net/HTTP | `http` | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
|
325
|
+
| Racecar | `racecar` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
|
326
|
+
| Rack | `rack` | `>= 1.4.7` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
|
327
|
+
| Rails | `rails` | `>= 3.2, <= 6.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
|
328
|
+
| Rake | `rake` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
|
329
|
+
| Redis | `redis` | `>= 3.2, < 4.0` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
|
330
|
+
| Resque | `resque` | `>= 1.0, < 2.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
|
331
|
+
| Rest Client | `rest-client` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
|
332
|
+
| Sequel | `sequel` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
|
333
|
+
| Sidekiq | `sidekiq` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
|
334
|
+
| Sinatra | `sinatra` | `>= 1.4.5` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
|
335
|
+
| Sucker Punch | `sucker_punch` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
|
336
|
+
|
337
|
+
### Active Model Serializers
|
338
|
+
|
339
|
+
The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
|
340
|
+
|
341
|
+
```ruby
|
342
|
+
require 'active_model_serializers'
|
343
|
+
require 'ddtrace'
|
344
|
+
|
345
|
+
Datadog.configure do |c|
|
346
|
+
c.use :active_model_serializers, options
|
347
|
+
end
|
348
|
+
|
349
|
+
my_object = MyModel.new(name: 'my object')
|
350
|
+
ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
351
|
+
```
|
352
|
+
|
353
|
+
| Key | Description | Default |
|
354
|
+
| --- | ----------- | ------- |
|
355
|
+
| `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
|
356
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
334
357
|
|
335
358
|
### Active Record
|
336
359
|
|
@@ -356,13 +379,14 @@ end
|
|
356
379
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
357
380
|
|
358
381
|
| Key | Description | Default |
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
382
|
+
| ---| --- | --- |
|
383
|
+
| `orm_service_name` | Service name used for the Ruby ORM portion of `active_record` instrumentation. Overrides service name for ORM spans if explicitly set, which otherwise inherit their service from their parent. | `'active_record'` |
|
384
|
+
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
385
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
362
386
|
|
363
387
|
**Configuring trace settings per database**
|
364
388
|
|
365
|
-
You can
|
389
|
+
You can configure trace settings per database connection by using the `describes` option:
|
366
390
|
|
367
391
|
```ruby
|
368
392
|
# Provide a `:describes` option with a connection key.
|
@@ -396,7 +420,7 @@ Datadog.configure do |c|
|
|
396
420
|
end
|
397
421
|
```
|
398
422
|
|
399
|
-
If ActiveRecord traces an event that uses a connection
|
423
|
+
If ActiveRecord traces an event that uses a connection that matches a key defined by `describes`, it will use the trace settings assigned to that connection. If the connection does not match any of the described connections, it will use default settings defined by `c.use :active_record` instead.
|
400
424
|
|
401
425
|
### AWS
|
402
426
|
|
@@ -410,26 +434,29 @@ Datadog.configure do |c|
|
|
410
434
|
c.use :aws, options
|
411
435
|
end
|
412
436
|
|
413
|
-
|
437
|
+
# Perform traced call
|
438
|
+
Aws::S3::Client.new.list_buckets
|
414
439
|
```
|
415
440
|
|
416
441
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
417
442
|
|
418
443
|
| Key | Description | Default |
|
419
|
-
| --- |
|
420
|
-
|
|
444
|
+
| --- | ----------- | ------- |
|
445
|
+
| `service_name` | Service name used for `aws` instrumentation | `'aws'` |
|
446
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
421
447
|
|
422
448
|
### Concurrent Ruby
|
423
449
|
|
424
450
|
The Concurrent Ruby integration adds support for context propagation when using `::Concurrent::Future`.
|
425
451
|
Making sure that code traced within the `Future#execute` will have correct parent set.
|
426
452
|
|
427
|
-
To activate your integration, use the
|
453
|
+
To activate your integration, use the `Datadog.configure` method:
|
428
454
|
|
429
455
|
```ruby
|
430
456
|
# Inside Rails initializer or equivalent
|
431
457
|
Datadog.configure do |c|
|
432
|
-
|
458
|
+
# Patches ::Concurrent::Future to use ExecutorService that propagates context
|
459
|
+
c.use :concurrent_ruby, options
|
433
460
|
end
|
434
461
|
|
435
462
|
# Pass context into code executed within Concurrent::Future
|
@@ -438,25 +465,27 @@ Datadog.tracer.trace('outer') do
|
|
438
465
|
end
|
439
466
|
```
|
440
467
|
|
441
|
-
|
468
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
442
469
|
|
443
470
|
| Key | Description | Default |
|
444
|
-
| --- |
|
445
|
-
|
|
446
|
-
|
471
|
+
| --- | ----------- | ------- |
|
472
|
+
| `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
|
473
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
447
474
|
|
448
475
|
### Dalli
|
449
476
|
|
450
|
-
Dalli integration will trace all calls to your
|
477
|
+
Dalli integration will trace all calls to your `memcached` server:
|
451
478
|
|
452
479
|
```ruby
|
453
480
|
require 'dalli'
|
454
481
|
require 'ddtrace'
|
455
482
|
|
483
|
+
# Configure default Dalli tracing behavior
|
456
484
|
Datadog.configure do |c|
|
457
|
-
c.use :dalli,
|
485
|
+
c.use :dalli, options
|
458
486
|
end
|
459
487
|
|
488
|
+
# Configure Dalli tracing behavior for single client
|
460
489
|
client = Dalli::Client.new('localhost:11211', options)
|
461
490
|
client.set('abc', 123)
|
462
491
|
```
|
@@ -464,12 +493,34 @@ client.set('abc', 123)
|
|
464
493
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
465
494
|
|
466
495
|
| Key | Description | Default |
|
467
|
-
| --- |
|
468
|
-
|
|
496
|
+
| --- | ----------- | ------- |
|
497
|
+
| `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
|
498
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
499
|
+
|
500
|
+
### DelayedJob
|
501
|
+
|
502
|
+
The DelayedJob integration uses lifecycle hooks to trace the job executions.
|
503
|
+
|
504
|
+
You can enable it through `Datadog.configure`:
|
505
|
+
|
506
|
+
```ruby
|
507
|
+
require 'ddtrace'
|
508
|
+
|
509
|
+
Datadog.configure do |c|
|
510
|
+
c.use :delayed_job, options
|
511
|
+
end
|
512
|
+
```
|
513
|
+
|
514
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
515
|
+
|
516
|
+
| Key | Description | Default |
|
517
|
+
| --- | ----------- | ------- |
|
518
|
+
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
519
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
469
520
|
|
470
521
|
### Elastic Search
|
471
522
|
|
472
|
-
The Elasticsearch integration will trace any call to
|
523
|
+
The Elasticsearch integration will trace any call to `perform_request` in the `Client` object:
|
473
524
|
|
474
525
|
```ruby
|
475
526
|
require 'elasticsearch/transport'
|
@@ -479,7 +530,7 @@ Datadog.configure do |c|
|
|
479
530
|
c.use :elasticsearch, options
|
480
531
|
end
|
481
532
|
|
482
|
-
#
|
533
|
+
# Perform a query to ElasticSearch
|
483
534
|
client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
|
484
535
|
response = client.perform_request 'GET', '_cluster/health'
|
485
536
|
```
|
@@ -487,9 +538,10 @@ response = client.perform_request 'GET', '_cluster/health'
|
|
487
538
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
488
539
|
|
489
540
|
| Key | Description | Default |
|
490
|
-
| --- |
|
491
|
-
|
|
492
|
-
|
|
541
|
+
| --- | ----------- | ------- |
|
542
|
+
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` |
|
543
|
+
| `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
|
544
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
493
545
|
|
494
546
|
### Excon
|
495
547
|
|
@@ -501,7 +553,7 @@ require 'ddtrace'
|
|
501
553
|
|
502
554
|
# Configure default Excon tracing behavior
|
503
555
|
Datadog.configure do |c|
|
504
|
-
c.use :excon,
|
556
|
+
c.use :excon, options
|
505
557
|
end
|
506
558
|
|
507
559
|
connection = Excon.new('https://example.com')
|
@@ -511,12 +563,12 @@ connection.get
|
|
511
563
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
512
564
|
|
513
565
|
| Key | Description | Default |
|
514
|
-
| --- |
|
515
|
-
| `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
|
516
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
566
|
+
| --- | ----------- | ------- |
|
517
567
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `false` |
|
518
568
|
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
519
|
-
| `
|
569
|
+
| `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
|
570
|
+
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
571
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
520
572
|
|
521
573
|
**Configuring connections to use different settings**
|
522
574
|
|
@@ -551,10 +603,12 @@ The `faraday` integration is available through the `ddtrace` middleware:
|
|
551
603
|
require 'faraday'
|
552
604
|
require 'ddtrace'
|
553
605
|
|
606
|
+
# Configure default Faraday tracing behavior
|
554
607
|
Datadog.configure do |c|
|
555
|
-
c.use :faraday,
|
608
|
+
c.use :faraday, options
|
556
609
|
end
|
557
610
|
|
611
|
+
# Configure Faraday tracing behavior for single connection
|
558
612
|
connection = Faraday.new('https://example.com') do |builder|
|
559
613
|
builder.use(:ddtrace, options)
|
560
614
|
builder.adapter Faraday.default_adapter
|
@@ -566,68 +620,18 @@ connection.get('/foo')
|
|
566
620
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
567
621
|
|
568
622
|
| Key | Description | Default |
|
569
|
-
| --- |
|
623
|
+
| --- | ----------- | ------- |
|
624
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `false` |
|
625
|
+
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
570
626
|
| `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
|
571
627
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
572
|
-
| `
|
573
|
-
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | ``5xx`` evaluated as errors |
|
574
|
-
| `tracer` | A `Datadog::Tracer` instance used to instrument the application. Usually you don't need to set that. | `Datadog.tracer` |
|
575
|
-
|
576
|
-
### gRPC
|
577
|
-
|
578
|
-
The `grpc` integration adds both client and server interceptors, which run as middleware prior to executing the service's remote procedure call. As gRPC applications are often distributed, the integration shares trace information between client and server.
|
579
|
-
|
580
|
-
To setup your integration, use the ``Datadog.configure`` method like so:
|
581
|
-
|
582
|
-
```ruby
|
583
|
-
require 'grpc'
|
584
|
-
require 'ddtrace'
|
585
|
-
|
586
|
-
Datadog.configure do |c|
|
587
|
-
c.use :grpc, options
|
588
|
-
end
|
589
|
-
|
590
|
-
# run your application normally
|
591
|
-
|
592
|
-
# server side
|
593
|
-
server = GRPC::RpcServer.new
|
594
|
-
server.add_http2_port('localhost:50051', :this_port_is_insecure)
|
595
|
-
server.handle(Demo)
|
596
|
-
server.run_till_terminated
|
597
|
-
|
598
|
-
# client side
|
599
|
-
client = Demo.rpc_stub_class.new('localhost:50051', :this_channel_is_insecure)
|
600
|
-
client.my_endpoint(DemoMessage.new(contents: 'hello!'))
|
601
|
-
```
|
602
|
-
|
603
|
-
In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
|
604
|
-
|
605
|
-
```ruby
|
606
|
-
configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
|
607
|
-
c.service_name = "Alternate"
|
608
|
-
end
|
609
|
-
|
610
|
-
alternate_client = Demo::Echo::Service.rpc_stub_class.new(
|
611
|
-
'localhost:50052',
|
612
|
-
:this_channel_is_insecure,
|
613
|
-
:interceptors => [configured_interceptor]
|
614
|
-
)
|
615
|
-
```
|
616
|
-
|
617
|
-
The integration will ensure that the ``configured_interceptor`` establishes a unique tracing setup for that client instance.
|
618
|
-
|
619
|
-
The following configuration options are supported:
|
620
|
-
|
621
|
-
| Key | Description | Default |
|
622
|
-
| --- | --- | --- |
|
623
|
-
| ``service_name`` | Service name used for `grpc` instrumentation | grpc |
|
624
|
-
| ``tracer`` | Datadog tracer used for `grpc` instrumentation | Datadog.tracer |
|
628
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
625
629
|
|
626
630
|
### Grape
|
627
631
|
|
628
632
|
The Grape integration adds the instrumentation to Grape endpoints and filters. This integration can work side by side with other integrations like Rack and Rails.
|
629
633
|
|
630
|
-
To activate your integration, use the
|
634
|
+
To activate your integration, use the `Datadog.configure` method before defining your Grape application:
|
631
635
|
|
632
636
|
```ruby
|
633
637
|
# api.rb
|
@@ -638,7 +642,7 @@ Datadog.configure do |c|
|
|
638
642
|
c.use :grape, options
|
639
643
|
end
|
640
644
|
|
641
|
-
#
|
645
|
+
# Then define your application
|
642
646
|
class RackTestingAPI < Grape::API
|
643
647
|
desc 'main endpoint'
|
644
648
|
get :success do
|
@@ -650,34 +654,33 @@ end
|
|
650
654
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
651
655
|
|
652
656
|
| Key | Description | Default |
|
653
|
-
| --- |
|
654
|
-
|
|
657
|
+
| --- | ----------- | ------- |
|
658
|
+
| `service_name` | Service name used for `grape` instrumentation | `'grape'` |
|
659
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
655
660
|
|
656
661
|
### GraphQL
|
657
662
|
|
658
663
|
The GraphQL integration activates instrumentation for GraphQL queries.
|
659
664
|
|
660
|
-
To activate your integration, use the
|
665
|
+
To activate your integration, use the `Datadog.configure` method:
|
661
666
|
|
662
667
|
```ruby
|
663
668
|
# Inside Rails initializer or equivalent
|
664
669
|
Datadog.configure do |c|
|
665
|
-
c.use :graphql,
|
666
|
-
service_name: 'graphql',
|
667
|
-
schemas: [YourSchema]
|
670
|
+
c.use :graphql, schemas: [YourSchema], options
|
668
671
|
end
|
669
672
|
|
670
673
|
# Then run a GraphQL query
|
671
674
|
YourSchema.execute(query, variables: {}, context: {}, operation_name: nil)
|
672
675
|
```
|
673
676
|
|
674
|
-
The `use :graphql` method accepts the following parameters
|
677
|
+
The `use :graphql` method accepts the following parameters. Additional options can be substituted in for `options`:
|
675
678
|
|
676
679
|
| Key | Description | Default |
|
677
|
-
| --- |
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
680
|
+
| --- | ----------- | ------- |
|
681
|
+
| `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
|
682
|
+
| `schemas` | Required. Array of `GraphQL::Schema` objects which to trace. Tracing will be added to all the schemas listed, using the options provided to this configuration. If you do not provide any, then tracing will not be activated. | `[]` |
|
683
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
681
684
|
|
682
685
|
**Manually configuring GraphQL schemas**
|
683
686
|
|
@@ -703,7 +706,57 @@ YourSchema.define do
|
|
703
706
|
end
|
704
707
|
```
|
705
708
|
|
706
|
-
Do *
|
709
|
+
Do *NOT* `use :graphql` in `Datadog.configure` if you choose to configure manually, as to avoid double tracing. These two means of configuring GraphQL tracing are considered mutually exclusive.
|
710
|
+
|
711
|
+
### gRPC
|
712
|
+
|
713
|
+
The `grpc` integration adds both client and server interceptors, which run as middleware prior to executing the service's remote procedure call. As gRPC applications are often distributed, the integration shares trace information between client and server.
|
714
|
+
|
715
|
+
To setup your integration, use the `Datadog.configure` method like so:
|
716
|
+
|
717
|
+
```ruby
|
718
|
+
require 'grpc'
|
719
|
+
require 'ddtrace'
|
720
|
+
|
721
|
+
Datadog.configure do |c|
|
722
|
+
c.use :grpc, options
|
723
|
+
end
|
724
|
+
|
725
|
+
# Server side
|
726
|
+
server = GRPC::RpcServer.new
|
727
|
+
server.add_http2_port('localhost:50051', :this_port_is_insecure)
|
728
|
+
server.handle(Demo)
|
729
|
+
server.run_till_terminated
|
730
|
+
|
731
|
+
# Client side
|
732
|
+
client = Demo.rpc_stub_class.new('localhost:50051', :this_channel_is_insecure)
|
733
|
+
client.my_endpoint(DemoMessage.new(contents: 'hello!'))
|
734
|
+
```
|
735
|
+
|
736
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
737
|
+
|
738
|
+
| Key | Description | Default |
|
739
|
+
| --- | ----------- | ------- |
|
740
|
+
| `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
|
741
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
742
|
+
|
743
|
+
**Configuring clients to use different settings**
|
744
|
+
|
745
|
+
In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
|
746
|
+
|
747
|
+
```ruby
|
748
|
+
configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
|
749
|
+
c.service_name = "Alternate"
|
750
|
+
end
|
751
|
+
|
752
|
+
alternate_client = Demo::Echo::Service.rpc_stub_class.new(
|
753
|
+
'localhost:50052',
|
754
|
+
:this_channel_is_insecure,
|
755
|
+
:interceptors => [configured_interceptor]
|
756
|
+
)
|
757
|
+
```
|
758
|
+
|
759
|
+
The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
|
707
760
|
|
708
761
|
### MongoDB
|
709
762
|
|
@@ -717,21 +770,22 @@ Datadog.configure do |c|
|
|
717
770
|
c.use :mongo, options
|
718
771
|
end
|
719
772
|
|
720
|
-
#
|
773
|
+
# Create a MongoDB client and use it as usual
|
721
774
|
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
|
722
775
|
collection = client[:people]
|
723
776
|
collection.insert_one({ name: 'Steve' })
|
724
777
|
|
725
778
|
# In case you want to override the global configuration for a certain client instance
|
726
|
-
Datadog.configure(client,
|
779
|
+
Datadog.configure(client, options)
|
727
780
|
```
|
728
781
|
|
729
782
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
730
783
|
|
731
784
|
| Key | Description | Default |
|
732
|
-
| --- |
|
733
|
-
|
|
734
|
-
|
|
785
|
+
| --- | ----------- | ------- |
|
786
|
+
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{ show: [:collection, :database, :operation] }` |
|
787
|
+
| `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
|
788
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
735
789
|
|
736
790
|
### MySQL2
|
737
791
|
|
@@ -752,9 +806,9 @@ client.query("SELECT * FROM users WHERE group='x'")
|
|
752
806
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
753
807
|
|
754
808
|
| Key | Description | Default |
|
755
|
-
| --- |
|
756
|
-
|
|
757
|
-
|
|
809
|
+
| --- | ----------- | ------- |
|
810
|
+
| `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
|
811
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
758
812
|
|
759
813
|
### Net/HTTP
|
760
814
|
|
@@ -770,7 +824,7 @@ end
|
|
770
824
|
|
771
825
|
Net::HTTP.start('127.0.0.1', 8080) do |http|
|
772
826
|
request = Net::HTTP::Get.new '/index'
|
773
|
-
response = http.request
|
827
|
+
response = http.request(request)
|
774
828
|
end
|
775
829
|
|
776
830
|
content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
|
@@ -779,12 +833,12 @@ content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
|
|
779
833
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
780
834
|
|
781
835
|
| Key | Description | Default |
|
782
|
-
| --- |
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
836
|
+
| --- | ----------- | ------- |
|
837
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `false` |
|
838
|
+
| `service_name` | Service name used for `http` instrumentation | `'net/http'` |
|
839
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
786
840
|
|
787
|
-
If you wish to configure each connection object individually, you may use the
|
841
|
+
If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
|
788
842
|
|
789
843
|
```ruby
|
790
844
|
client = Net::HTTP.new(host, port)
|
@@ -808,15 +862,15 @@ end
|
|
808
862
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
809
863
|
|
810
864
|
| Key | Description | Default |
|
811
|
-
| --- |
|
812
|
-
|
|
813
|
-
|
|
865
|
+
| --- | ----------- | ------- |
|
866
|
+
| `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
|
867
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
814
868
|
|
815
869
|
### Rack
|
816
870
|
|
817
871
|
The Rack integration provides a middleware that traces all requests before they reach the underlying framework or application. It responds to the Rack minimal interface, providing reasonable values that can be retrieved at the Rack level.
|
818
872
|
|
819
|
-
This integration is automatically activated with web frameworks like Rails. If you're using a plain Rack application, just enable the integration it to your
|
873
|
+
This integration is automatically activated with web frameworks like Rails. If you're using a plain Rack application, just enable the integration it to your `config.ru`:
|
820
874
|
|
821
875
|
```ruby
|
822
876
|
# config.ru example
|
@@ -838,20 +892,21 @@ run app
|
|
838
892
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
839
893
|
|
840
894
|
| Key | Description | Default |
|
841
|
-
| --- |
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
895
|
+
| --- | ----------- | ------- |
|
896
|
+
| `application` | Your Rack application. Required for `middleware_names`. | `nil` |
|
897
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `false` |
|
898
|
+
| `headers` | Hash of HTTP request or response headers to add as tags to the `rack.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
899
|
+
| `middleware_names` | Enable this if you want to use the middleware classes as the resource names for `rack` spans. Requires `application` option to use. | `false` |
|
900
|
+
| `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
|
901
|
+
| `quantize.query` | Hash containing options for query portion of URL quantization. May include `:show` or `:exclude`. See options below. Option must be nested inside the `quantize` option. | `{}` |
|
902
|
+
| `quantize.query.show` | Defines which values should always be shown. Shows no values by default. May be an Array of strings, or `:all` to show all values. Option must be nested inside the `query` option. | `nil` |
|
903
|
+
| `quantize.query.exclude` | Defines which values should be removed entirely. Excludes nothing by default. May be an Array of strings, or `:all` to remove the query string entirely. Option must be nested inside the `query` option. | `nil` |
|
904
|
+
| `quantize.fragment` | Defines behavior for URL fragments. Removes fragments by default. May be `:show` to show URL fragments. Option must be nested inside the `quantize` option. | `nil` |
|
905
|
+
| `request_queuing` | Track HTTP request time spent in the queue of the frontend server. See [HTTP request queuing](#http-request-queuing) for setup details. Set to `true` to enable. | `false` |
|
906
|
+
| `service_name` | Service name used for `rack` instrumentation | `'rack'` |
|
907
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
908
|
+
| `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
|
909
|
+
|
855
910
|
|
856
911
|
**Configuring URL quantization behavior**
|
857
912
|
|
@@ -887,10 +942,11 @@ end
|
|
887
942
|
|
888
943
|
The Rails integration will trace requests, database calls, templates rendering and cache read/write/delete operations. The integration makes use of the Active Support Instrumentation, listening to the Notification API so that any operation instrumented by the API is traced.
|
889
944
|
|
890
|
-
To enable the Rails
|
945
|
+
To enable the Rails instrumentation, create an initializer file in your `config/initializers` folder:
|
891
946
|
|
892
947
|
```ruby
|
893
|
-
# config/initializers/datadog
|
948
|
+
# config/initializers/datadog.rb
|
949
|
+
require 'ddtrace'
|
894
950
|
|
895
951
|
Datadog.configure do |c|
|
896
952
|
c.use :rails, options
|
@@ -900,18 +956,17 @@ end
|
|
900
956
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
901
957
|
|
902
958
|
| Key | Description | Default |
|
903
|
-
| --- |
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
| ``databases`` | Hash of tracer settings to use for each database connection. See [ActiveRecord](#activerecord) for more details. | ``{}`` |
|
959
|
+
| --- | ----------- | ------- |
|
960
|
+
| `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
|
961
|
+
| `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
|
962
|
+
| `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
|
963
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `false` |
|
964
|
+
| `exception_controller` | Class or Module which identifies a custom exception controller class. Tracer provides improved error behavior when it can identify custom exception controllers. By default, without this option, it 'guesses' what a custom exception controller looks like. Providing this option aids this identification. | `nil` |
|
965
|
+
| `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
|
966
|
+
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as resource for the trace. | `false` |
|
967
|
+
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
968
|
+
| `template_base_path` | Used when the template name is parsed. If you don't store your templates in the `views/` folder, you may need to change this value | `'views/'` |
|
969
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
915
970
|
|
916
971
|
**Supported versions**
|
917
972
|
|
@@ -947,11 +1002,11 @@ Rake::Task['my_task'].invoke
|
|
947
1002
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
948
1003
|
|
949
1004
|
| Key | Description | Default |
|
950
|
-
| --- |
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1005
|
+
| --- | ----------- | ------- |
|
1006
|
+
| `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1007
|
+
| `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
|
1008
|
+
| `service_name` | Service name used for `rake` instrumentation | `'rake'` |
|
1009
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
955
1010
|
|
956
1011
|
**Configuring task quantization behavior**
|
957
1012
|
|
@@ -996,19 +1051,20 @@ require 'redis'
|
|
996
1051
|
require 'ddtrace'
|
997
1052
|
|
998
1053
|
Datadog.configure do |c|
|
999
|
-
c.use :redis,
|
1054
|
+
c.use :redis, options
|
1000
1055
|
end
|
1001
1056
|
|
1002
|
-
#
|
1057
|
+
# Perform Redis commands
|
1003
1058
|
redis = Redis.new
|
1004
|
-
redis.set 'foo', 'bar'
|
1059
|
+
redis.set 'foo', 'bar'
|
1005
1060
|
```
|
1006
1061
|
|
1007
1062
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1008
1063
|
|
1009
1064
|
| Key | Description | Default |
|
1010
|
-
| --- |
|
1011
|
-
|
|
1065
|
+
| --- | ----------- | ------- |
|
1066
|
+
| `service_name` | Service name used for `redis` instrumentation | `'redis'` |
|
1067
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1012
1068
|
|
1013
1069
|
You can also set *per-instance* configuration as it follows:
|
1014
1070
|
|
@@ -1017,58 +1073,62 @@ customer_cache = Redis.new
|
|
1017
1073
|
invoice_cache = Redis.new
|
1018
1074
|
|
1019
1075
|
Datadog.configure(customer_cache, service_name: 'customer-cache')
|
1020
|
-
Datadog.configure(invoice_cache, service_name: invoice-cache')
|
1076
|
+
Datadog.configure(invoice_cache, service_name: 'invoice-cache')
|
1021
1077
|
|
1022
|
-
|
1023
|
-
|
1078
|
+
# Traced call will belong to `customer-cache` service
|
1079
|
+
customer_cache.get(...)
|
1080
|
+
# Traced call will belong to `invoice-cache` service
|
1081
|
+
invoice_cache.get(...)
|
1024
1082
|
```
|
1025
1083
|
|
1026
|
-
###
|
1084
|
+
### Resque
|
1027
1085
|
|
1028
|
-
The
|
1086
|
+
The Resque integration uses Resque hooks that wraps the `perform` method.
|
1087
|
+
|
1088
|
+
To add tracing to a Resque job, simply do as follows:
|
1029
1089
|
|
1030
1090
|
```ruby
|
1031
|
-
require 'rest_client'
|
1032
1091
|
require 'ddtrace'
|
1033
1092
|
|
1093
|
+
class MyJob
|
1094
|
+
def self.perform(*args)
|
1095
|
+
# do_something
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
|
1034
1099
|
Datadog.configure do |c|
|
1035
|
-
c.use :
|
1100
|
+
c.use :resque, options
|
1036
1101
|
end
|
1037
1102
|
```
|
1038
1103
|
|
1039
1104
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1040
1105
|
|
1041
1106
|
| Key | Description | Default |
|
1042
|
-
| --- |
|
1043
|
-
| `service_name` | Service name for
|
1044
|
-
| `
|
1045
|
-
| `
|
1107
|
+
| --- | ----------- | ------- |
|
1108
|
+
| `service_name` | Service name used for `resque` instrumentation | `'resque'` |
|
1109
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1110
|
+
| `workers` | An array including all worker classes you want to trace (eg `[MyJob]`) | `[]` |
|
1046
1111
|
|
1047
|
-
###
|
1112
|
+
### Rest Client
|
1048
1113
|
|
1049
|
-
The
|
1050
|
-
To add tracing to a Resque job, simply do as follows:
|
1114
|
+
The `rest-client` integration is available through the `ddtrace` middleware:
|
1051
1115
|
|
1052
1116
|
```ruby
|
1117
|
+
require 'rest_client'
|
1053
1118
|
require 'ddtrace'
|
1054
1119
|
|
1055
|
-
class MyJob
|
1056
|
-
def self.perform(*args)
|
1057
|
-
# do_something
|
1058
|
-
end
|
1059
|
-
end
|
1060
|
-
|
1061
1120
|
Datadog.configure do |c|
|
1062
|
-
c.use :
|
1121
|
+
c.use :rest_client, options
|
1063
1122
|
end
|
1064
1123
|
```
|
1065
1124
|
|
1066
1125
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1067
1126
|
|
1068
1127
|
| Key | Description | Default |
|
1069
|
-
| --- |
|
1070
|
-
|
|
1071
|
-
|
|
1128
|
+
| --- | ----------- | ------- |
|
1129
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `false` |
|
1130
|
+
| `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
|
1131
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1072
1132
|
|
1073
1133
|
### Sequel
|
1074
1134
|
|
@@ -1099,9 +1159,9 @@ articles.all
|
|
1099
1159
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1100
1160
|
|
1101
1161
|
| Key | Description | Default |
|
1102
|
-
| --- |
|
1103
|
-
|
|
1104
|
-
|
|
1162
|
+
| --- | ----------- | ------- |
|
1163
|
+
| `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
|
1164
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1105
1165
|
|
1106
1166
|
Only Ruby 2.0+ is supported.
|
1107
1167
|
|
@@ -1135,41 +1195,19 @@ end
|
|
1135
1195
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1136
1196
|
|
1137
1197
|
| Key | Description | Default |
|
1138
|
-
| --- |
|
1139
|
-
|
|
1140
|
-
|
1141
|
-
### DelayedJob
|
1142
|
-
|
1143
|
-
The DelayedJob integration uses lifecycle hooks to trace the job executions.
|
1144
|
-
|
1145
|
-
You can enable it through `Datadog.configure`:
|
1146
|
-
|
1147
|
-
```ruby
|
1148
|
-
require 'ddtrace'
|
1149
|
-
|
1150
|
-
Datadog.configure do |c|
|
1151
|
-
c.use :delayed_job, options
|
1152
|
-
end
|
1153
|
-
```
|
1154
|
-
|
1155
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1156
|
-
|
1157
|
-
| Key | Description | Default |
|
1158
|
-
| --- | --- | --- |
|
1159
|
-
| ``service_name`` | Service name used for `DelayedJob` instrumentation | delayed_job |
|
1160
|
-
| ``tracer`` | A ``Datadog::Tracer`` instance used to instrument the application. Usually you don't need to set that. | ``Datadog.tracer`` |
|
1198
|
+
| --- | ----------- | ------- |
|
1199
|
+
| `service_name` | Service name used for `sidekiq` instrumentation | `'sidekiq'` |
|
1200
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1161
1201
|
|
1162
1202
|
### Sinatra
|
1163
1203
|
|
1164
1204
|
The Sinatra integration traces requests and template rendering.
|
1165
1205
|
|
1166
|
-
To start using the tracing client, make sure you import
|
1167
|
-
either ``sinatra`` or ``sinatra/base``:
|
1206
|
+
To start using the tracing client, make sure you import `ddtrace` and `use :sinatra` after either `sinatra` or `sinatra/base`, and before you define your application/routes:
|
1168
1207
|
|
1169
1208
|
```ruby
|
1170
1209
|
require 'sinatra'
|
1171
1210
|
require 'ddtrace'
|
1172
|
-
require 'ddtrace/contrib/sinatra/tracer'
|
1173
1211
|
|
1174
1212
|
Datadog.configure do |c|
|
1175
1213
|
c.use :sinatra, options
|
@@ -1183,12 +1221,12 @@ end
|
|
1183
1221
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1184
1222
|
|
1185
1223
|
| Key | Description | Default |
|
1186
|
-
| --- |
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1224
|
+
| --- | ----------- | ------- |
|
1225
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `false` |
|
1226
|
+
| `headers` | Hash of HTTP request or response headers to add as tags to the `sinatra.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
1227
|
+
| `resource_script_names` | Prepend resource names with script name | `false` |
|
1228
|
+
| `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
|
1229
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1192
1230
|
|
1193
1231
|
### Sucker Punch
|
1194
1232
|
|
@@ -1201,15 +1239,16 @@ Datadog.configure do |c|
|
|
1201
1239
|
c.use :sucker_punch, options
|
1202
1240
|
end
|
1203
1241
|
|
1204
|
-
#
|
1242
|
+
# Execution of this job is traced
|
1205
1243
|
LogJob.perform_async('login')
|
1206
1244
|
```
|
1207
1245
|
|
1208
1246
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
1209
1247
|
|
1210
1248
|
| Key | Description | Default |
|
1211
|
-
| --- |
|
1212
|
-
|
|
1249
|
+
| --- | ----------- | ------- |
|
1250
|
+
| `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
|
1251
|
+
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1213
1252
|
|
1214
1253
|
## Advanced configuration
|
1215
1254
|
|
@@ -1227,23 +1266,23 @@ end
|
|
1227
1266
|
|
1228
1267
|
Available options are:
|
1229
1268
|
|
1230
|
-
-
|
1269
|
+
- `enabled`: defines if the `tracer` is enabled or not. If set to `false` the code could be still instrumented
|
1231
1270
|
because of other settings, but no spans are sent to the local trace agent.
|
1232
|
-
-
|
1233
|
-
-
|
1234
|
-
-
|
1235
|
-
-
|
1236
|
-
-
|
1237
|
-
-
|
1238
|
-
-
|
1271
|
+
- `debug`: set to true to enable debug logging.
|
1272
|
+
- `hostname`: set the hostname of the trace agent.
|
1273
|
+
- `port`: set the port the trace agent is listening on.
|
1274
|
+
- `env`: set the environment. Rails users may set it to `Rails.env` to use their application settings.
|
1275
|
+
- `tags`: set global tags that should be applied to all spans. Defaults to an empty hash
|
1276
|
+
- `log`: defines a custom logger.
|
1277
|
+
- `partial_flush`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
1239
1278
|
|
1240
1279
|
#### Custom logging
|
1241
1280
|
|
1242
1281
|
By default, all logs are processed by the default Ruby logger. When using Rails, you should see the messages in your application log file.
|
1243
1282
|
|
1244
|
-
Datadog client log messages are marked with
|
1283
|
+
Datadog client log messages are marked with `[ddtrace]` so you should be able to isolate them from other messages.
|
1245
1284
|
|
1246
|
-
Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the
|
1285
|
+
Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the `log` attribute of the tracer.
|
1247
1286
|
|
1248
1287
|
```ruby
|
1249
1288
|
f = File.new("my-custom.log", "w+") # Log messages should go there
|
@@ -1469,7 +1508,7 @@ Traces that originate from HTTP requests can be configured to include the time s
|
|
1469
1508
|
|
1470
1509
|
This functionality is **experimental** and deactivated by default.
|
1471
1510
|
|
1472
|
-
To activate this feature, you must add a
|
1511
|
+
To activate this feature, you must add a `X-Request-Start` or `X-Queue-Start` header from your web server (i.e. Nginx). The following is an Nginx configuration example:
|
1473
1512
|
|
1474
1513
|
```
|
1475
1514
|
# /etc/nginx/conf.d/ruby_service.conf
|