ddtrace 0.43.0 → 0.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +148 -130
  3. data/.circleci/images/primary/Dockerfile-3.0.0 +73 -0
  4. data/.github/workflows/add-milestone-to-pull-requests.yml +1 -1
  5. data/.simplecov +4 -1
  6. data/Appraisals +215 -14
  7. data/CHANGELOG.md +1048 -377
  8. data/Gemfile +4 -2
  9. data/README.md +1 -0
  10. data/Rakefile +172 -6
  11. data/ddtrace.gemspec +6 -8
  12. data/docker-compose.yml +30 -0
  13. data/docs/GettingStarted.md +112 -14
  14. data/lib/ddtrace.rb +8 -0
  15. data/lib/ddtrace/auto_instrument.rb +3 -0
  16. data/lib/ddtrace/auto_instrument_base.rb +6 -0
  17. data/lib/ddtrace/contrib/action_cable/integration.rb +7 -0
  18. data/lib/ddtrace/contrib/action_pack/integration.rb +7 -0
  19. data/lib/ddtrace/contrib/action_view/event.rb +0 -4
  20. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +1 -0
  21. data/lib/ddtrace/contrib/action_view/events/render_template.rb +1 -0
  22. data/lib/ddtrace/contrib/action_view/integration.rb +7 -0
  23. data/lib/ddtrace/contrib/active_record/integration.rb +7 -0
  24. data/lib/ddtrace/contrib/active_record/utils.rb +67 -21
  25. data/lib/ddtrace/contrib/active_support/integration.rb +7 -1
  26. data/lib/ddtrace/contrib/auto_instrument.rb +48 -0
  27. data/lib/ddtrace/contrib/aws/services.rb +1 -0
  28. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +2 -0
  29. data/lib/ddtrace/contrib/cucumber/integration.rb +5 -0
  30. data/lib/ddtrace/contrib/ethon/easy_patch.rb +6 -5
  31. data/lib/ddtrace/contrib/ethon/ext.rb +1 -0
  32. data/lib/ddtrace/contrib/extensions.rb +27 -1
  33. data/lib/ddtrace/contrib/grape/endpoint.rb +29 -11
  34. data/lib/ddtrace/contrib/grape/ext.rb +1 -0
  35. data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +32 -0
  36. data/lib/ddtrace/contrib/httpclient/ext.rb +17 -0
  37. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +152 -0
  38. data/lib/ddtrace/contrib/httpclient/integration.rb +43 -0
  39. data/lib/ddtrace/contrib/httpclient/patcher.rb +35 -0
  40. data/lib/ddtrace/contrib/httprb/instrumentation.rb +1 -1
  41. data/lib/ddtrace/contrib/patchable.rb +18 -7
  42. data/lib/ddtrace/contrib/qless/configuration/settings.rb +35 -0
  43. data/lib/ddtrace/contrib/qless/ext.rb +20 -0
  44. data/lib/ddtrace/contrib/qless/integration.rb +38 -0
  45. data/lib/ddtrace/contrib/qless/patcher.rb +35 -0
  46. data/lib/ddtrace/contrib/qless/qless_job.rb +72 -0
  47. data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +32 -0
  48. data/lib/ddtrace/contrib/rack/integration.rb +7 -0
  49. data/lib/ddtrace/contrib/rack/middlewares.rb +1 -1
  50. data/lib/ddtrace/contrib/rack/request_queue.rb +6 -1
  51. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +10 -0
  52. data/lib/ddtrace/contrib/rails/utils.rb +4 -0
  53. data/lib/ddtrace/contrib/rake/integration.rb +1 -1
  54. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +3 -1
  55. data/lib/ddtrace/contrib/redis/configuration/settings.rb +5 -0
  56. data/lib/ddtrace/contrib/redis/ext.rb +1 -0
  57. data/lib/ddtrace/contrib/redis/patcher.rb +20 -3
  58. data/lib/ddtrace/contrib/redis/quantize.rb +27 -0
  59. data/lib/ddtrace/contrib/redis/tags.rb +5 -1
  60. data/lib/ddtrace/contrib/rspec/integration.rb +5 -0
  61. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +2 -2
  62. data/lib/ddtrace/ext/ci.rb +42 -10
  63. data/lib/ddtrace/ext/git.rb +0 -1
  64. data/lib/ddtrace/propagation/http_propagator.rb +17 -2
  65. data/lib/ddtrace/version.rb +1 -1
  66. data/lib/ddtrace/workers/runtime_metrics.rb +7 -3
  67. metadata +91 -20
data/ddtrace.gemspec CHANGED
@@ -50,16 +50,13 @@ Gem::Specification.new do |spec|
50
50
  spec.add_development_dependency 'minitest', '= 5.10.1'
51
51
  spec.add_development_dependency 'minitest-around', '0.5.0'
52
52
  spec.add_development_dependency 'minitest-stub_any_instance', '1.0.2'
53
+ spec.add_development_dependency 'pimpmychangelog', '>= 0.1.2'
53
54
  spec.add_development_dependency 'appraisal', '~> 2.2'
54
55
  spec.add_development_dependency 'yard', '~> 0.9'
55
- spec.add_development_dependency 'webmock', '~> 2.0'
56
+ spec.add_development_dependency 'webmock', '>= 3.10.0'
56
57
  spec.add_development_dependency 'builder'
57
- if RUBY_PLATFORM != 'java'
58
- spec.add_development_dependency 'sqlite3', '~> 1.3.6'
59
- else
60
- spec.add_development_dependency 'jdbc-sqlite3', '~> 3'
61
- end
62
58
  spec.add_development_dependency 'climate_control', '~> 0.2.0'
59
+ spec.add_development_dependency 'rspec_junit_formatter', '>= 0.4.1'
63
60
 
64
61
  # locking transitive dependency of webmock
65
62
  spec.add_development_dependency 'addressable', '~> 2.4.0'
@@ -67,8 +64,9 @@ Gem::Specification.new do |spec|
67
64
  spec.add_development_dependency 'benchmark-memory', '~> 0.1'
68
65
  spec.add_development_dependency 'memory_profiler', '~> 0.9'
69
66
  spec.add_development_dependency 'redcarpet', '~> 3.4' if RUBY_PLATFORM != 'java'
70
- spec.add_development_dependency 'pry', '~> 0.10.4'
71
- spec.add_development_dependency 'pry-stack_explorer', '~> 0.4.9.2'
67
+ spec.add_development_dependency 'pry', '~> 0.12.2'
68
+ spec.add_development_dependency 'pry-nav', '~> 0.3.0'
69
+ spec.add_development_dependency 'pry-stack_explorer', '~> 0.4.9' if RUBY_PLATFORM != 'java'
72
70
  spec.add_development_dependency 'simplecov', '~> 0.17'
73
71
  spec.add_development_dependency 'warning', '~> 1' if RUBY_VERSION >= '2.5.0'
74
72
  end
data/docker-compose.yml CHANGED
@@ -248,6 +248,34 @@ services:
248
248
  - .:/app
249
249
  - bundle-2.7:/usr/local/bundle
250
250
  - gemfiles-2.7:/app/gemfiles
251
+ tracer-3.0:
252
+ image: marcotc/docker-library:ddtrace_rb_3.0.0
253
+ command: /bin/bash
254
+ depends_on:
255
+ - ddagent
256
+ - elasticsearch
257
+ - memcached
258
+ - mongodb
259
+ - mysql
260
+ - postgres
261
+ - redis
262
+ env_file: ./.env
263
+ environment:
264
+ - BUNDLE_GEMFILE=/app/Gemfile
265
+ - DD_AGENT_HOST=ddagent
266
+ - TEST_DATADOG_INTEGRATION=1
267
+ - TEST_ELASTICSEARCH_HOST=elasticsearch
268
+ - TEST_MEMCACHED_HOST=memcached
269
+ - TEST_MONGODB_HOST=mongodb
270
+ - TEST_MYSQL_HOST=mysql
271
+ - TEST_POSTGRES_HOST=postgres
272
+ - TEST_REDIS_HOST=redis
273
+ stdin_open: true
274
+ tty: true
275
+ volumes:
276
+ - .:/app
277
+ - bundle-3.0:/usr/local/bundle
278
+ - gemfiles-3.0:/app/gemfiles
251
279
  # JRuby
252
280
  tracer-jruby-9.2:
253
281
  image: marcotc/docker-library:ddtrace_rb_jruby_9_2
@@ -358,6 +386,7 @@ volumes:
358
386
  bundle-2.5:
359
387
  bundle-2.6:
360
388
  bundle-2.7:
389
+ bundle-3.0:
361
390
  bundle-jruby-9.2:
362
391
  gemfiles-2.0:
363
392
  gemfiles-2.1:
@@ -367,4 +396,5 @@ volumes:
367
396
  gemfiles-2.5:
368
397
  gemfiles-2.6:
369
398
  gemfiles-2.7:
399
+ gemfiles-3.0:
370
400
  gemfiles-jruby-9.2:
@@ -45,10 +45,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
45
45
  - [GraphQL](#graphql)
46
46
  - [gRPC](#grpc)
47
47
  - [http.rb](#http-rb)
48
+ - [httpclient](#httpclient)
48
49
  - [MongoDB](#mongodb)
49
50
  - [MySQL2](#mysql2)
50
51
  - [Net/HTTP](#net-http)
51
52
  - [Presto](#presto)
53
+ - [Qless](#qless)
52
54
  - [Que](#que)
53
55
  - [Racecar](#racecar)
54
56
  - [Rack](#rack)
@@ -57,6 +59,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
57
59
  - [Redis](#redis)
58
60
  - [Rest Client](#rest-client)
59
61
  - [Resque](#resque)
62
+ - [RSpec](#rspec)
60
63
  - [Shoryuken](#shoryuken)
61
64
  - [Sequel](#sequel)
62
65
  - [Sidekiq](#sidekiq)
@@ -86,7 +89,8 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
86
89
 
87
90
  | Type | Documentation | Version | Support type | Gem version support |
88
91
  | ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
89
- | MRI | https://www.ruby-lang.org/ | 2.7 | Full | Latest |
92
+ | MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
93
+ | | | 2.7 | Full | Latest |
90
94
  | | | 2.6 | Full | Latest |
91
95
  | | | 2.5 | Full | Latest |
92
96
  | | | 2.4 | Full | Latest |
@@ -124,14 +128,38 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
124
128
 
125
129
  The following steps will help you quickly start tracing your Ruby application.
126
130
 
127
- ### Setup the Datadog Agent
131
+ ### Configure the Datadog Agent for APM
128
132
 
129
133
  Before downloading tracing on your application, install the Datadog Agent. The Ruby APM tracer sends trace data through the Datadog Agent.
130
134
 
131
- [Install and configure the Datadog Agent](https://docs.datadoghq.com/tracing/setup), see additional documentation for [tracing Docker applications](https://docs.datadoghq.com/tracing/setup/docker/).
135
+ Install and configure the Datadog Agent to receive traces from your now instrumented application. By default the Datadog Agent is enabled in your `datadog.yaml` file under `apm_enabled: true` and listens for trace traffic at `localhost:8126`. For containerized environments, follow the steps below to enable trace collection within the Datadog Agent.
136
+
137
+ #### Containers
138
+
139
+ 1. Set `apm_non_local_traffic: true` in your main [`datadog.yaml` configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-main-configuration-file).
140
+
141
+ 2. See the specific setup instructions for [Docker](https://docs.datadoghq.com/agent/docker/apm/?tab=ruby), [Kubernetes](https://docs.datadoghq.com/agent/kubernetes/apm/?tab=helm), [Amazon ECS](https://docs.datadoghq.com/agent/amazon_ecs/apm/?tab=ruby) or [Fargate](https://docs.datadoghq.com/integrations/ecs_fargate/#trace-collection) to ensure that the Agent is configured to receive traces in a containerized environment:
142
+
143
+ 3. After having instrumented your application, the tracing client sends traces to `localhost:8126` by default. If this is not the correct host and port change it by setting the env variables `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`.
144
+
132
145
 
133
146
  ### Quickstart for Rails applications
134
147
 
148
+ #### Rails Auto Instrument all Integrations
149
+
150
+ 1. Add the `ddtrace` gem to your Gemfile:
151
+
152
+ ```ruby
153
+ source 'https://rubygems.org'
154
+ gem 'ddtrace', require: 'ddtrace/auto_instrument'
155
+ ```
156
+
157
+ 2. Install the gem with `bundle install`
158
+
159
+ 3. You can configure, override, or disable any specific integration settings by also adding a [Rails Manual Configuration](#rails-manual-configuration) file.
160
+
161
+ #### Rails Manual Configuration
162
+
135
163
  1. Add the `ddtrace` gem to your Gemfile:
136
164
 
137
165
  ```ruby
@@ -153,6 +181,25 @@ Before downloading tracing on your application, install the Datadog Agent. The R
153
181
 
154
182
  ### Quickstart for Ruby applications
155
183
 
184
+ #### Ruby Auto Instrument all Integrations
185
+
186
+ 1. Install the gem with `gem install ddtrace`
187
+ 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
188
+ 3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
189
+
190
+ ```ruby
191
+ # Example frameworks and libraries
192
+ require 'sinatra'
193
+ require 'faraday'
194
+ require 'redis'
195
+
196
+ require 'ddtrace/auto_instrument'
197
+ ```
198
+
199
+ You can configure, override, or disable any specific integration settings by also adding a [Ruby Manual Configuration Block](#ruby-manual-configuration).
200
+
201
+ #### Ruby Manual Configuration
202
+
156
203
  1. Install the gem with `gem install ddtrace`
157
204
  2. Add a configuration block to your Ruby application:
158
205
 
@@ -227,7 +274,7 @@ And `options` is an optional `Hash` that accepts the following parameters:
227
274
  | `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. |
228
275
  | `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
229
276
  | `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
230
- | `start_time` | `Integer` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now.utc` |
277
+ | `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
231
278
  | `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
232
279
  | `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? }` |
233
280
 
@@ -350,11 +397,13 @@ For a list of available integrations, and their configuration options, please re
350
397
  | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
351
398
  | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
352
399
  | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
400
+ | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
353
401
  | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
354
402
  | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
355
403
  | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
356
404
  | Net/HTTP | `http` | *(Any supported Ruby)* | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
357
405
  | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
406
+ | Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
358
407
  | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
359
408
  | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
360
409
  | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
@@ -363,6 +412,7 @@ For a list of available integrations, and their configuration options, please re
363
412
  | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
364
413
  | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
365
414
  | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
415
+ | RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
366
416
  | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
367
417
  | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
368
418
  | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
@@ -1003,6 +1053,32 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1003
1053
  | `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
1004
1054
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1005
1055
 
1056
+ ### httpclient
1057
+
1058
+ The httpclient integration will trace any HTTP call using the httpclient gem.
1059
+
1060
+ ```ruby
1061
+ require 'http'
1062
+ require 'ddtrace'
1063
+ Datadog.configure do |c|
1064
+ c.use :httpclient, options
1065
+ # optionally, specify a different service name for hostnames matching a regex
1066
+ c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
1067
+ httpclient.service_name = 'user.example.com'
1068
+ httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
1069
+ end
1070
+ end
1071
+ ```
1072
+
1073
+ Where `options` is an optional `Hash` that accepts the following parameters:
1074
+
1075
+ | Key | Description | Default |
1076
+ | --- | ----------- | ------- |
1077
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1078
+ | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1079
+ | `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
1080
+ | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1081
+
1006
1082
  ### Kafka
1007
1083
 
1008
1084
  The Kafka integration provides tracing of the `ruby-kafka` gem:
@@ -1153,6 +1229,29 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1153
1229
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1154
1230
  | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1155
1231
 
1232
+ ### Qless
1233
+
1234
+ The Qless integration uses lifecycle hooks to trace job executions.
1235
+
1236
+ To add tracing to a Qless job:
1237
+
1238
+ ```ruby
1239
+ require 'ddtrace'
1240
+
1241
+ Datadog.configure do |c|
1242
+ c.use :qless, options
1243
+ end
1244
+ ```
1245
+
1246
+ Where `options` is an optional `Hash` that accepts the following parameters:
1247
+
1248
+ | Key | Description | Default |
1249
+ | --- | ----------- | ------- |
1250
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1251
+ | `service_name` | Service name used for `qless` instrumentation | `'qless'` |
1252
+ | `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
1253
+ | `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
1254
+
1156
1255
  ### Que
1157
1256
 
1158
1257
  The Que integration is a middleware which will trace job executions.
@@ -1230,7 +1329,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1230
1329
  | `application` | Your Rack application. Required for `middleware_names`. | `nil` |
1231
1330
  | `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 | `true` |
1232
1331
  | `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'] }` |
1233
- | `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` |
1332
+ | `middleware_names` | Enable this if you want to use the last executed middleware class as the resource name for the `rack` span. If enabled alongside the `rails` instrumention, `rails` takes precedence by setting the `rack` resource name to the active `rails` controller when applicable. Requires `application` option to use. | `false` |
1234
1333
  | `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
1235
1334
  | `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. | `{}` |
1236
1335
  | `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` |
@@ -1309,8 +1408,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1309
1408
  | 2.1 | | 3.0 - 4.2 |
1310
1409
  | 2.2 - 2.3 | | 3.0 - 5.2 |
1311
1410
  | 2.4 | | 4.2.8 - 5.2 |
1312
- | 2.5 | | 4.2.8 - 6.0 |
1313
- | 2.6 - 2.7 | 9.2 | 5.0 - 6.0 |
1411
+ | 2.5 | | 4.2.8 - 6.1 |
1412
+ | 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
1413
+ | 3.0 | | 6.1 |
1314
1414
 
1315
1415
  ### Rake
1316
1416
 
@@ -1400,6 +1500,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1400
1500
  | --- | ----------- | ------- |
1401
1501
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1402
1502
  | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1503
+ | `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
1403
1504
 
1404
1505
  You can also set *per-instance* configuration as it follows:
1405
1506
 
@@ -1500,7 +1601,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1500
1601
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1501
1602
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1502
1603
 
1503
- ## RSpec
1604
+ ### RSpec
1504
1605
 
1505
1606
  RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
1506
1607
 
@@ -1986,6 +2087,7 @@ For more details on how to activate distributed tracing for integrations, see th
1986
2087
  - [Rails](#rails)
1987
2088
  - [Sinatra](#sinatra)
1988
2089
  - [http.rb](#http-rb)
2090
+ - [httpclient](#httpclient)
1989
2091
 
1990
2092
  **Using the HTTP propagator**
1991
2093
 
@@ -2014,9 +2116,7 @@ end
2014
2116
 
2015
2117
  Traces that originate from HTTP requests can be configured to include the time spent in a frontend web server or load balancer queue before the request reaches the Ruby application.
2016
2118
 
2017
- This functionality is **experimental** and deactivated by default.
2018
-
2019
- To activate this feature, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
2119
+ This feature is disabled by default. To activate it, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
2020
2120
 
2021
2121
  ```
2022
2122
  # /etc/nginx/conf.d/ruby_service.conf
@@ -2030,9 +2130,7 @@ server {
2030
2130
  }
2031
2131
  ```
2032
2132
 
2033
- Then you must enable the request queuing feature in the integration handling the request.
2034
-
2035
- For Rack-based applications, see the [documentation](#rack) for details for enabling this feature.
2133
+ Then you must enable the request queuing feature, by setting `request_queuing: true`, in the integration handling the request. For Rack-based applications, see the [documentation](#rack) for details.
2036
2134
 
2037
2135
  ### Processing Pipeline
2038
2136
 
data/lib/ddtrace.rb CHANGED
@@ -17,11 +17,13 @@ require 'ddtrace/configuration'
17
17
  require 'ddtrace/patcher'
18
18
  require 'ddtrace/augmentation'
19
19
  require 'ddtrace/metrics'
20
+ require 'ddtrace/auto_instrument_base'
20
21
 
21
22
  # \Datadog global namespace that includes all tracing functionality for Tracer and Span classes.
22
23
  module Datadog
23
24
  extend Augmentation
24
25
  extend Configuration
26
+ extend AutoInstrumentBase
25
27
 
26
28
  # Load and extend Contrib by default
27
29
  require 'ddtrace/contrib/extensions'
@@ -31,6 +33,10 @@ module Datadog
31
33
  require 'ddtrace/opentelemetry/extensions'
32
34
  extend OpenTelemetry::Extensions
33
35
 
36
+ # Load and extend AutoInstrument
37
+ require 'ddtrace/contrib/auto_instrument'
38
+ extend Contrib::AutoInstrument
39
+
34
40
  # Add shutdown hook:
35
41
  # Ensures the tracer has an opportunity to flush traces
36
42
  # and cleanup before terminating the process.
@@ -56,6 +62,7 @@ require 'ddtrace/contrib/grape/integration'
56
62
  require 'ddtrace/contrib/graphql/integration'
57
63
  require 'ddtrace/contrib/grpc/integration'
58
64
  require 'ddtrace/contrib/http/integration'
65
+ require 'ddtrace/contrib/httpclient/integration'
59
66
  require 'ddtrace/contrib/httprb/integration'
60
67
  require 'ddtrace/contrib/integration'
61
68
  require 'ddtrace/contrib/kafka/integration'
@@ -63,6 +70,7 @@ require 'ddtrace/contrib/presto/integration'
63
70
  require 'ddtrace/contrib/que/integration'
64
71
  require 'ddtrace/contrib/mysql2/integration'
65
72
  require 'ddtrace/contrib/mongodb/integration'
73
+ require 'ddtrace/contrib/qless/integration'
66
74
  require 'ddtrace/contrib/racecar/integration'
67
75
  require 'ddtrace/contrib/rack/integration'
68
76
  require 'ddtrace/contrib/rails/integration'
@@ -0,0 +1,3 @@
1
+ require 'ddtrace'
2
+
3
+ Datadog.add_auto_instrument
@@ -0,0 +1,6 @@
1
+ module Datadog
2
+ # base methods stubbed for adding auto instrument extensions
3
+ module AutoInstrumentBase
4
+ def add_auto_instrument; end
5
+ end
6
+ end
@@ -1,6 +1,7 @@
1
1
  require 'ddtrace/contrib/integration'
2
2
  require 'ddtrace/contrib/action_cable/configuration/settings'
3
3
  require 'ddtrace/contrib/action_cable/patcher'
4
+ require 'ddtrace/contrib/rails/utils'
4
5
 
5
6
  module Datadog
6
7
  module Contrib
@@ -25,6 +26,12 @@ module Datadog
25
26
  super && version >= MINIMUM_VERSION
26
27
  end
27
28
 
29
+ # enabled by rails integration so should only auto instrument
30
+ # if detected that it is being used without rails
31
+ def auto_instrument?
32
+ !Datadog::Contrib::Rails::Utils.railtie_supported?
33
+ end
34
+
28
35
  def default_configuration
29
36
  Configuration::Settings.new
30
37
  end
@@ -1,6 +1,7 @@
1
1
  require 'ddtrace/contrib/integration'
2
2
  require 'ddtrace/contrib/action_pack/configuration/settings'
3
3
  require 'ddtrace/contrib/action_pack/patcher'
4
+ require 'ddtrace/contrib/rails/utils'
4
5
 
5
6
  module Datadog
6
7
  module Contrib
@@ -25,6 +26,12 @@ module Datadog
25
26
  super && version >= MINIMUM_VERSION
26
27
  end
27
28
 
29
+ # enabled by rails integration so should only auto instrument
30
+ # if detected that it is being used without rails
31
+ def auto_instrument?
32
+ !Datadog::Contrib::Rails::Utils.railtie_supported?
33
+ end
34
+
28
35
  def default_configuration
29
36
  Configuration::Settings.new
30
37
  end
@@ -12,10 +12,6 @@ module Datadog
12
12
 
13
13
  # Class methods for ActionView events.
14
14
  module ClassMethods
15
- def span_options
16
- { service: configuration[:service_name] }
17
- end
18
-
19
15
  def tracer
20
16
  -> { configuration[:tracer] }
21
17
  end
@@ -24,6 +24,7 @@ module Datadog
24
24
  end
25
25
 
26
26
  def process(span, _event, _id, payload)
27
+ span.service = configuration[:service_name]
27
28
  span.span_type = Datadog::Ext::HTTP::TEMPLATE
28
29
 
29
30
  if (template_name = Utils.normalize_template_name(payload[:identifier]))