ddtrace 0.36.0 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +59 -1
  3. data/.gitignore +2 -0
  4. data/.gitlab-ci.yml +27 -0
  5. data/.simplecov +38 -0
  6. data/Appraisals +131 -6
  7. data/CHANGELOG.md +198 -1
  8. data/Rakefile +504 -467
  9. data/ddtrace.gemspec +7 -0
  10. data/docker-compose.yml +2 -2
  11. data/docs/DevelopmentGuide.md +16 -0
  12. data/docs/GettingStarted.md +192 -111
  13. data/lib/ddtrace.rb +4 -0
  14. data/lib/ddtrace/buffer.rb +154 -43
  15. data/lib/ddtrace/configuration.rb +39 -5
  16. data/lib/ddtrace/configuration/components.rb +4 -7
  17. data/lib/ddtrace/configuration/options.rb +3 -1
  18. data/lib/ddtrace/configuration/pin_setup.rb +3 -2
  19. data/lib/ddtrace/configuration/settings.rb +32 -4
  20. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +7 -2
  21. data/lib/ddtrace/contrib/action_cable/ext.rb +5 -2
  22. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +7 -2
  23. data/lib/ddtrace/contrib/action_pack/ext.rb +5 -2
  24. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +7 -2
  25. data/lib/ddtrace/contrib/action_view/ext.rb +5 -2
  26. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +7 -2
  27. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +5 -2
  28. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +7 -2
  29. data/lib/ddtrace/contrib/active_record/events/sql.rb +4 -0
  30. data/lib/ddtrace/contrib/active_record/ext.rb +5 -2
  31. data/lib/ddtrace/contrib/active_support/cache/redis.rb +1 -1
  32. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +7 -2
  33. data/lib/ddtrace/contrib/active_support/ext.rb +5 -2
  34. data/lib/ddtrace/contrib/active_support/notifications/event.rb +3 -1
  35. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +3 -3
  36. data/lib/ddtrace/contrib/aws/configuration/settings.rb +7 -2
  37. data/lib/ddtrace/contrib/aws/ext.rb +5 -2
  38. data/lib/ddtrace/contrib/aws/instrumentation.rb +4 -0
  39. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +5 -0
  40. data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +9 -3
  41. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
  42. data/lib/ddtrace/contrib/configuration/settings.rb +19 -0
  43. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +7 -2
  44. data/lib/ddtrace/contrib/dalli/ext.rb +5 -2
  45. data/lib/ddtrace/contrib/dalli/instrumentation.rb +4 -0
  46. data/lib/ddtrace/contrib/dalli/patcher.rb +1 -5
  47. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +7 -2
  48. data/lib/ddtrace/contrib/delayed_job/ext.rb +5 -2
  49. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +7 -2
  50. data/lib/ddtrace/contrib/elasticsearch/ext.rb +5 -2
  51. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +5 -2
  52. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +7 -2
  53. data/lib/ddtrace/contrib/ethon/easy_patch.rb +4 -2
  54. data/lib/ddtrace/contrib/ethon/ext.rb +5 -2
  55. data/lib/ddtrace/contrib/ethon/multi_patch.rb +4 -0
  56. data/lib/ddtrace/contrib/excon/configuration/settings.rb +7 -2
  57. data/lib/ddtrace/contrib/excon/ext.rb +5 -2
  58. data/lib/ddtrace/contrib/excon/middleware.rb +4 -0
  59. data/lib/ddtrace/contrib/extensions.rb +11 -1
  60. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +7 -2
  61. data/lib/ddtrace/contrib/faraday/ext.rb +5 -2
  62. data/lib/ddtrace/contrib/faraday/middleware.rb +9 -3
  63. data/lib/ddtrace/contrib/faraday/patcher.rb +13 -5
  64. data/lib/ddtrace/contrib/grape/configuration/settings.rb +7 -3
  65. data/lib/ddtrace/contrib/grape/endpoint.rb +6 -4
  66. data/lib/ddtrace/contrib/grape/ext.rb +5 -2
  67. data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
  68. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +7 -2
  69. data/lib/ddtrace/contrib/graphql/ext.rb +5 -2
  70. data/lib/ddtrace/contrib/graphql/patcher.rb +6 -3
  71. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +7 -2
  72. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +1 -1
  73. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +5 -3
  74. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -0
  75. data/lib/ddtrace/contrib/grpc/ext.rb +5 -2
  76. data/lib/ddtrace/contrib/grpc/patcher.rb +1 -5
  77. data/lib/ddtrace/contrib/http/configuration/settings.rb +7 -2
  78. data/lib/ddtrace/contrib/http/ext.rb +5 -2
  79. data/lib/ddtrace/contrib/http/instrumentation.rb +16 -7
  80. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +32 -0
  81. data/lib/ddtrace/contrib/httprb/ext.rb +17 -0
  82. data/lib/ddtrace/contrib/httprb/instrumentation.rb +163 -0
  83. data/lib/ddtrace/contrib/httprb/integration.rb +43 -0
  84. data/lib/ddtrace/contrib/httprb/patcher.rb +35 -0
  85. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +30 -0
  86. data/lib/ddtrace/contrib/kafka/consumer_event.rb +14 -0
  87. data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +14 -0
  88. data/lib/ddtrace/contrib/kafka/event.rb +51 -0
  89. data/lib/ddtrace/contrib/kafka/events.rb +44 -0
  90. data/lib/ddtrace/contrib/kafka/events/connection/request.rb +34 -0
  91. data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +41 -0
  92. data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +39 -0
  93. data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +39 -0
  94. data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +29 -0
  95. data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +29 -0
  96. data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +29 -0
  97. data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +32 -0
  98. data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +35 -0
  99. data/lib/ddtrace/contrib/kafka/ext.rb +41 -0
  100. data/lib/ddtrace/contrib/kafka/integration.rb +39 -0
  101. data/lib/ddtrace/contrib/kafka/patcher.rb +26 -0
  102. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +7 -2
  103. data/lib/ddtrace/contrib/mongodb/ext.rb +5 -2
  104. data/lib/ddtrace/contrib/mongodb/instrumentation.rb +1 -2
  105. data/lib/ddtrace/contrib/mongodb/subscribers.rb +4 -0
  106. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +7 -2
  107. data/lib/ddtrace/contrib/mysql2/ext.rb +5 -2
  108. data/lib/ddtrace/contrib/mysql2/instrumentation.rb +5 -1
  109. data/lib/ddtrace/contrib/patcher.rb +14 -8
  110. data/lib/ddtrace/contrib/presto/configuration/settings.rb +7 -2
  111. data/lib/ddtrace/contrib/presto/ext.rb +5 -2
  112. data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -0
  113. data/lib/ddtrace/contrib/que/configuration/settings.rb +42 -0
  114. data/lib/ddtrace/contrib/que/ext.rb +30 -0
  115. data/lib/ddtrace/contrib/que/integration.rb +42 -0
  116. data/lib/ddtrace/contrib/que/patcher.rb +24 -0
  117. data/lib/ddtrace/contrib/que/tracer.rb +56 -0
  118. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +7 -2
  119. data/lib/ddtrace/contrib/racecar/event.rb +4 -0
  120. data/lib/ddtrace/contrib/racecar/events.rb +2 -0
  121. data/lib/ddtrace/contrib/racecar/events/consume.rb +27 -0
  122. data/lib/ddtrace/contrib/racecar/ext.rb +6 -2
  123. data/lib/ddtrace/contrib/rack/configuration/settings.rb +7 -2
  124. data/lib/ddtrace/contrib/rack/ext.rb +5 -2
  125. data/lib/ddtrace/contrib/rack/middlewares.rb +17 -12
  126. data/lib/ddtrace/contrib/rails/configuration/settings.rb +10 -12
  127. data/lib/ddtrace/contrib/rails/ext.rb +6 -2
  128. data/lib/ddtrace/contrib/rails/framework.rb +14 -21
  129. data/lib/ddtrace/contrib/rails/log_injection.rb +81 -0
  130. data/lib/ddtrace/contrib/rails/middlewares.rb +7 -2
  131. data/lib/ddtrace/contrib/rails/patcher.rb +15 -0
  132. data/lib/ddtrace/contrib/rake/configuration/settings.rb +7 -3
  133. data/lib/ddtrace/contrib/rake/ext.rb +5 -2
  134. data/lib/ddtrace/contrib/redis/configuration/settings.rb +7 -2
  135. data/lib/ddtrace/contrib/redis/ext.rb +5 -2
  136. data/lib/ddtrace/contrib/redis/patcher.rb +1 -1
  137. data/lib/ddtrace/contrib/redis/tags.rb +4 -0
  138. data/lib/ddtrace/contrib/resque/configuration/settings.rb +7 -2
  139. data/lib/ddtrace/contrib/resque/ext.rb +5 -2
  140. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +7 -2
  141. data/lib/ddtrace/contrib/rest_client/ext.rb +5 -2
  142. data/lib/ddtrace/contrib/rest_client/request_patch.rb +6 -2
  143. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +7 -2
  144. data/lib/ddtrace/contrib/sequel/database.rb +4 -2
  145. data/lib/ddtrace/contrib/sequel/dataset.rb +3 -2
  146. data/lib/ddtrace/contrib/sequel/ext.rb +6 -2
  147. data/lib/ddtrace/contrib/sequel/utils.rb +35 -6
  148. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +7 -2
  149. data/lib/ddtrace/contrib/shoryuken/ext.rb +5 -2
  150. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +7 -2
  151. data/lib/ddtrace/contrib/sidekiq/ext.rb +6 -2
  152. data/lib/ddtrace/contrib/sidekiq/patcher.rb +8 -1
  153. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +1 -0
  154. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +7 -2
  155. data/lib/ddtrace/contrib/sinatra/env.rb +5 -4
  156. data/lib/ddtrace/contrib/sinatra/ext.rb +5 -2
  157. data/lib/ddtrace/contrib/sinatra/tracer.rb +21 -42
  158. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +50 -23
  159. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +32 -0
  160. data/lib/ddtrace/contrib/sneakers/ext.rb +22 -0
  161. data/lib/ddtrace/contrib/sneakers/integration.rb +41 -0
  162. data/lib/ddtrace/contrib/sneakers/patcher.rb +24 -0
  163. data/lib/ddtrace/contrib/sneakers/tracer.rb +58 -0
  164. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +7 -2
  165. data/lib/ddtrace/contrib/sucker_punch/ext.rb +5 -2
  166. data/lib/ddtrace/contrib/sucker_punch/patcher.rb +1 -1
  167. data/lib/ddtrace/diagnostics/environment_logger.rb +278 -0
  168. data/lib/ddtrace/environment.rb +17 -3
  169. data/lib/ddtrace/ext/diagnostics.rb +3 -0
  170. data/lib/ddtrace/ext/environment.rb +2 -0
  171. data/lib/ddtrace/ext/integration.rb +8 -0
  172. data/lib/ddtrace/ext/runtime.rb +1 -0
  173. data/lib/ddtrace/ext/transport.rb +1 -0
  174. data/lib/ddtrace/logger.rb +1 -1
  175. data/lib/ddtrace/opentracer/distributed_headers.rb +1 -1
  176. data/lib/ddtrace/pin.rb +25 -2
  177. data/lib/ddtrace/pipeline/span_filter.rb +15 -15
  178. data/lib/ddtrace/propagation/grpc_propagator.rb +2 -2
  179. data/lib/ddtrace/runtime/metrics.rb +24 -6
  180. data/lib/ddtrace/sampler.rb +4 -2
  181. data/lib/ddtrace/span.rb +162 -27
  182. data/lib/ddtrace/tracer.rb +18 -12
  183. data/lib/ddtrace/transport/http.rb +15 -0
  184. data/lib/ddtrace/transport/http/adapters/net.rb +16 -2
  185. data/lib/ddtrace/transport/http/adapters/test.rb +6 -0
  186. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +4 -0
  187. data/lib/ddtrace/transport/http/statistics.rb +14 -1
  188. data/lib/ddtrace/transport/response.rb +11 -0
  189. data/lib/ddtrace/transport/traces.rb +7 -2
  190. data/lib/ddtrace/utils.rb +7 -3
  191. data/lib/ddtrace/version.rb +1 -1
  192. data/lib/ddtrace/workers/async.rb +2 -2
  193. data/lib/ddtrace/workers/loop.rb +1 -1
  194. data/lib/ddtrace/workers/polling.rb +1 -1
  195. data/lib/ddtrace/workers/trace_writer.rb +3 -0
  196. data/lib/ddtrace/writer.rb +33 -12
  197. metadata +138 -2
@@ -41,11 +41,14 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency 'opentracing', '>= 0.4.1'
42
42
 
43
43
  # Development dependencies
44
+ spec.add_development_dependency 'concurrent-ruby' # Leave it open as we also have it as an integration and want Appraisal to control the version under test.
44
45
  spec.add_development_dependency 'rake', '>= 10.5'
45
46
  spec.add_development_dependency 'rubocop', '= 0.49.1' if RUBY_VERSION >= '2.1.0'
46
47
  spec.add_development_dependency 'rspec', '~> 3.0'
47
48
  spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
48
49
  spec.add_development_dependency 'minitest', '= 5.10.1'
50
+ spec.add_development_dependency 'minitest-around', '0.5.0'
51
+ spec.add_development_dependency 'minitest-stub_any_instance', '1.0.2'
49
52
  spec.add_development_dependency 'appraisal', '~> 2.2'
50
53
  spec.add_development_dependency 'yard', '~> 0.9'
51
54
  spec.add_development_dependency 'webmock', '~> 2.0'
@@ -59,8 +62,12 @@ Gem::Specification.new do |spec|
59
62
 
60
63
  # locking transitive dependency of webmock
61
64
  spec.add_development_dependency 'addressable', '~> 2.4.0'
65
+ spec.add_development_dependency 'benchmark-ips', '~> 2.8'
66
+ spec.add_development_dependency 'benchmark-memory', '~> 0.1'
67
+ spec.add_development_dependency 'memory_profiler', '~> 0.9'
62
68
  spec.add_development_dependency 'redcarpet', '~> 3.4' if RUBY_PLATFORM != 'java'
63
69
  spec.add_development_dependency 'pry', '~> 0.10.4'
64
70
  spec.add_development_dependency 'pry-stack_explorer', '~> 0.4.9.2'
71
+ spec.add_development_dependency 'simplecov', '~> 0.17'
65
72
  spec.add_development_dependency 'warning', '~> 1' if RUBY_VERSION >= '2.5.0'
66
73
  end
@@ -281,11 +281,11 @@ services:
281
281
  - bundle-jruby-9.2:/usr/local/bundle
282
282
  - gemfiles-jruby-9.2:/app/gemfiles
283
283
  ddagent:
284
- image: datadog/docker-dd-agent
284
+ image: datadog/agent
285
285
  environment:
286
286
  - DD_APM_ENABLED=true
287
287
  - DD_BIND_HOST=0.0.0.0
288
- - DD_API_KEY=invalid_key_but_this_is_fine
288
+ - DD_API_KEY=00000000000000000000000000000000
289
289
  expose:
290
290
  - "8125/udp"
291
291
  - "8126"
@@ -98,6 +98,22 @@ $ bundle exec appraisal contrib rake spec:redis'[--seed,1234]'
98
98
 
99
99
  This can be useful for replicating conditions from CI or isolating certain tests.
100
100
 
101
+ **Checking test coverage**
102
+
103
+ You can check test code coverage by creating a report _after_ running a test suite:
104
+ ```
105
+ # Run the desired test suite
106
+ $ bundle exec appraisal contrib rake spec:redis
107
+ # Generate report for the suite executed
108
+ $ bundle exec rake coverage:report
109
+ ```
110
+
111
+ A webpage will be generated at `coverage/report/index.html` with the resulting report.
112
+
113
+ Because you are likely not running all tests locally, your report will contain partial coverage results.
114
+ You *must* check the CI step `coverage` for the complete test coverage report, ensuring coverage is not
115
+ decreased.
116
+
101
117
  ### Checking code quality
102
118
 
103
119
  **Linting**
@@ -43,10 +43,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
43
43
  - [Grape](#grape)
44
44
  - [GraphQL](#graphql)
45
45
  - [gRPC](#grpc)
46
+ - [http.rb](#http-rb)
46
47
  - [MongoDB](#mongodb)
47
48
  - [MySQL2](#mysql2)
48
49
  - [Net/HTTP](#net-http)
49
50
  - [Presto](#presto)
51
+ - [Que](#que)
50
52
  - [Racecar](#racecar)
51
53
  - [Rack](#rack)
52
54
  - [Rails](#rails)
@@ -58,6 +60,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
58
60
  - [Sequel](#sequel)
59
61
  - [Sidekiq](#sidekiq)
60
62
  - [Sinatra](#sinatra)
63
+ - [Sneakers](#sneakers)
61
64
  - [Sucker Punch](#sucker-punch)
62
65
  - [Advanced configuration](#advanced-configuration)
63
66
  - [Tracer settings](#tracer-settings)
@@ -90,9 +93,9 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
90
93
  | | | 2.2 | Full | Latest |
91
94
  | | | 2.1 | Full | Latest |
92
95
  | | | 2.0 | Full | Latest |
93
- | | | 1.9.3 | Maintenance (until August 6th, 2020) | < 0.27.0 |
94
- | | | 1.9.1 | Maintenance (until August 6th, 2020) | < 0.27.0 |
95
- | JRuby | http://jruby.org/ | 9.2.0.0 | Alpha | Latest |
96
+ | | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
97
+ | | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
98
+ | JRuby | https://www.jruby.org | 9.2 | Full | Latest |
96
99
 
97
100
  **Supported web servers**:
98
101
 
@@ -325,41 +328,45 @@ end
325
328
 
326
329
  For a list of available integrations, and their configuration options, please refer to the following:
327
330
 
328
- | Name | Key | Versions Supported | How to configure | Gem source |
329
- | ------------------------ | -------------------------- | ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------ |
330
- | Action Cable | `action_cable` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
331
- | Action View | `action_view` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
332
- | Active Model Serializers | `active_model_serializers` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
333
- | Action Pack | `action_pack` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
334
- | Active Record | `active_record` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
335
- | Active Support | `active_support` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
336
- | AWS | `aws` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
337
- | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
338
- | Dalli | `dalli` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
339
- | DelayedJob | `delayed_job` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
340
- | Elasticsearch | `elasticsearch` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
341
- | Ethon | `ethon` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
342
- | Excon | `excon` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
343
- | Faraday | `faraday` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
344
- | Grape | `grape` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
345
- | GraphQL | `graphql` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
346
- | gRPC | `grpc` | `>= 1.7` | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
347
- | MongoDB | `mongo` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
348
- | MySQL2 | `mysql2` | `>= 0.3.21` | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
349
- | Net/HTTP | `http` | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
350
- | Presto | `presto` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
351
- | Racecar | `racecar` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
352
- | Rack | `rack` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
353
- | Rails | `rails` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
354
- | Rake | `rake` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
355
- | Redis | `redis` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
356
- | Resque | `resque` | `>= 1.0, < 2.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
357
- | Rest Client | `rest-client` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
358
- | Sequel | `sequel` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
359
- | Shoryuken | `shoryuken` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
360
- | Sidekiq | `sidekiq` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
361
- | Sinatra | `sinatra` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
362
- | Sucker Punch | `sucker_punch` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
331
+ | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
332
+ | ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
333
+ | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
334
+ | Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
335
+ | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
336
+ | Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
337
+ | Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
338
+ | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
339
+ | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
340
+ | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
341
+ | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
342
+ | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
343
+ | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
344
+ | Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
345
+ | Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
346
+ | Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
347
+ | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
348
+ | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
349
+ | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
350
+ | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
351
+ | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
352
+ | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
353
+ | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
354
+ | 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)* |
355
+ | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
356
+ | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
357
+ | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
358
+ | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
359
+ | Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
360
+ | Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
361
+ | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
362
+ | Resque | `resque` | `>= 1.0, < 2.0` | `>= 1.0, < 2.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
363
+ | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
364
+ | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
365
+ | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
366
+ | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
367
+ | Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
368
+ | Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
369
+ | Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
363
370
 
364
371
  ### Action Cable
365
372
 
@@ -381,7 +388,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
381
388
  | --- | ----------- | ------- |
382
389
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
383
390
  | `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
384
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
385
391
 
386
392
  ### Action View
387
393
 
@@ -402,7 +408,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
402
408
  | ---| --- | --- |
403
409
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
404
410
  | `service_name` | Service name used for rendering instrumentation. | `action_view` |
405
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
406
411
  | `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/'` |
407
412
 
408
413
  ### Active Model Serializers
@@ -425,7 +430,6 @@ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
425
430
  | --- | ----------- | ------- |
426
431
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
427
432
  | `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
428
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
429
433
 
430
434
  ### Action Pack
431
435
 
@@ -446,7 +450,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
446
450
  | ---| --- | --- |
447
451
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
448
452
  | `service_name` | Service name used for rendering instrumentation. | `action_pack` |
449
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
450
453
 
451
454
  ### Active Record
452
455
 
@@ -474,9 +477,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
474
477
  | Key | Description | Default |
475
478
  | ---| --- | --- |
476
479
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
477
- | `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'` |
480
+ | `orm_service_name` | Service name used for the mapping portion of query results to ActiveRecord objects. Inherits service name from parent by default. | _parent.service_name_ (e.g. `'mysql2'`) |
478
481
  | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
479
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
480
482
 
481
483
  **Configuring trace settings per database**
482
484
 
@@ -538,7 +540,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
538
540
  | ---| --- | --- |
539
541
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
540
542
  | `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
541
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
542
543
 
543
544
  ### AWS
544
545
 
@@ -562,7 +563,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
562
563
  | --- | ----------- | ------- |
563
564
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
564
565
  | `service_name` | Service name used for `aws` instrumentation | `'aws'` |
565
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
566
566
 
567
567
  ### Concurrent Ruby
568
568
 
@@ -589,7 +589,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
589
589
  | Key | Description | Default |
590
590
  | --- | ----------- | ------- |
591
591
  | `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
592
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
593
592
 
594
593
  ### Dalli
595
594
 
@@ -615,7 +614,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
615
614
  | --- | ----------- | ------- |
616
615
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
617
616
  | `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
618
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
619
617
 
620
618
  ### DelayedJob
621
619
 
@@ -637,7 +635,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
637
635
  | --- | ----------- | ------- |
638
636
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
639
637
  | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
640
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
641
638
 
642
639
  ### Elasticsearch
643
640
 
@@ -663,7 +660,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
663
660
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
664
661
  | `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. | `{}` |
665
662
  | `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
666
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
667
663
 
668
664
  ### Ethon
669
665
 
@@ -691,7 +687,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
691
687
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
692
688
  | `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
693
689
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
694
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
695
690
 
696
691
  ### Excon
697
692
 
@@ -725,7 +720,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
725
720
  | `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` |
726
721
  | `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
727
722
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
728
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
729
723
 
730
724
  **Configuring connections to use different settings**
731
725
 
@@ -789,7 +783,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
789
783
  | `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` |
790
784
  | `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
791
785
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
792
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
793
786
 
794
787
  ### Grape
795
788
 
@@ -822,7 +815,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
822
815
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
823
816
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
824
817
  | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
825
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
826
818
 
827
819
  ### GraphQL
828
820
 
@@ -847,7 +839,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
847
839
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
848
840
  | `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
849
841
  | `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. | `[]` |
850
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
851
842
 
852
843
  **Manually configuring GraphQL schemas**
853
844
 
@@ -926,7 +917,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
926
917
  | --- | ----------- | ------- |
927
918
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
928
919
  | `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
929
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
930
920
 
931
921
  **Configuring clients to use different settings**
932
922
 
@@ -946,6 +936,56 @@ alternate_client = Demo::Echo::Service.rpc_stub_class.new(
946
936
 
947
937
  The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
948
938
 
939
+ ### http.rb
940
+
941
+ The http.rb integration will trace any HTTP call using the Http.rb gem.
942
+
943
+ ```ruby
944
+ require 'http'
945
+ require 'ddtrace'
946
+ Datadog.configure do |c|
947
+ c.use :httprb, options
948
+ # optionally, specify a different service name for hostnames matching a regex
949
+ c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
950
+ httprb.service_name = 'user.example.com'
951
+ httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
952
+ end
953
+ end
954
+ ```
955
+
956
+ Where `options` is an optional `Hash` that accepts the following parameters:
957
+
958
+ | Key | Description | Default |
959
+ | --- | ----------- | ------- |
960
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
961
+ | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
962
+ | `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
963
+ | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
964
+
965
+ ### Kafka
966
+
967
+ The Kafka integration provides tracing of the `ruby-kafka` gem:
968
+
969
+ You can enable it through `Datadog.configure`:
970
+
971
+ ```ruby
972
+ require 'active_support/notifications' # required to enable 'ruby-kafka' instrumentation
973
+ require 'kafka'
974
+ require 'ddtrace'
975
+
976
+ Datadog.configure do |c|
977
+ c.use :kafka, options
978
+ end
979
+ ```
980
+
981
+ Where `options` is an optional `Hash` that accepts the following parameters:
982
+
983
+ | Key | Description | Default |
984
+ | --- | ----------- | ------- |
985
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
986
+ | `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
987
+ | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
988
+
949
989
  ### MongoDB
950
990
 
951
991
  The integration traces any `Command` that is sent from the [MongoDB Ruby Driver](https://github.com/mongodb/mongo-ruby-driver) to a MongoDB cluster. By extension, Object Document Mappers (ODM) such as Mongoid are automatically instrumented if they use the official Ruby driver. To activate the integration, simply:
@@ -974,7 +1014,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
974
1014
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
975
1015
  | `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] }` |
976
1016
  | `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
977
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
978
1017
 
979
1018
  ### MySQL2
980
1019
 
@@ -998,7 +1037,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
998
1037
  | --- | ----------- | ------- |
999
1038
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1000
1039
  | `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
1001
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1002
1040
 
1003
1041
  ### Net/HTTP
1004
1042
 
@@ -1034,7 +1072,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1034
1072
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1035
1073
  | `service_name` | Service name used for `http` instrumentation | `'net/http'` |
1036
1074
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1037
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1038
1075
 
1039
1076
  If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
1040
1077
 
@@ -1074,7 +1111,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1074
1111
  | --- | ----------- | ------- |
1075
1112
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1076
1113
  | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1077
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1114
+
1115
+ ### Que
1116
+
1117
+ The Que integration is a middleware which will trace job executions.
1118
+
1119
+ You can enable it through `Datadog.configure`:
1120
+
1121
+ ```ruby
1122
+ require 'ddtrace'
1123
+
1124
+ Datadog.configure do |c|
1125
+ c.use :que, options
1126
+ end
1127
+ ```
1128
+
1129
+ Where `options` is an optional `Hash` that accepts the following parameters:
1130
+
1131
+ | Key | Description | Default |
1132
+ | --- | ----------- | ------- |
1133
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1134
+ | `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1135
+ | `service_name` | Service name used for `que` instrumentation | `'que'` |
1136
+ | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
1137
+ | `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
1078
1138
 
1079
1139
  ### Racecar
1080
1140
 
@@ -1096,7 +1156,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1096
1156
  | --- | ----------- | ------- |
1097
1157
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1098
1158
  | `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
1099
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1100
1159
 
1101
1160
  ### Rack
1102
1161
 
@@ -1137,10 +1196,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1137
1196
  | `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` |
1138
1197
  | `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` |
1139
1198
  | `service_name` | Service name used for `rack` instrumentation | `'rack'` |
1140
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1141
1199
  | `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
1142
1200
 
1143
-
1144
1201
  **Configuring URL quantization behavior**
1145
1202
 
1146
1203
  ```ruby
@@ -1200,18 +1257,18 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1200
1257
  | `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
1201
1258
  | `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
1202
1259
  | `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/'` |
1203
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
1260
+ | `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
1204
1261
 
1205
1262
  **Supported versions**
1206
1263
 
1207
- | Ruby Versions | Supported Rails Versions |
1208
- | ------------- | ------------------------ |
1209
- | 2.0 | 3.0 - 3.2 |
1210
- | 2.1 | 3.0 - 4.2 |
1211
- | 2.2 - 2.3 | 3.0 - 5.2 |
1212
- | 2.4 | 4.2.8 - 5.2 |
1213
- | 2.5 | 4.2.8 - 6.0 |
1214
- | 2.6 - 2.7 | 5.0 - 6.0 |
1264
+ | MRI Versions | JRuby Versions | Rails Versions |
1265
+ | ------------- | -------------- | -------------- |
1266
+ | 2.0 | | 3.0 - 3.2 |
1267
+ | 2.1 | | 3.0 - 4.2 |
1268
+ | 2.2 - 2.3 | | 3.0 - 5.2 |
1269
+ | 2.4 | | 4.2.8 - 5.2 |
1270
+ | 2.5 | | 4.2.8 - 6.0 |
1271
+ | 2.6 - 2.7 | 9.2 | 5.0 - 6.0 |
1215
1272
 
1216
1273
  ### Rake
1217
1274
 
@@ -1243,7 +1300,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1243
1300
  | `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1244
1301
  | `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
1245
1302
  | `service_name` | Service name used for `rake` instrumentation | `'rake'` |
1246
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
1247
1303
 
1248
1304
  **Configuring task quantization behavior**
1249
1305
 
@@ -1302,11 +1358,17 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1302
1358
  | --- | ----------- | ------- |
1303
1359
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1304
1360
  | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1305
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1306
1361
 
1307
1362
  You can also set *per-instance* configuration as it follows:
1308
1363
 
1309
1364
  ```ruby
1365
+ require 'redis'
1366
+ require 'ddtrace'
1367
+
1368
+ Datadog.configure do |c|
1369
+ c.use :redis # Enabling integration instrumentation is still required
1370
+ end
1371
+
1310
1372
  customer_cache = Redis.new
1311
1373
  invoice_cache = Redis.new
1312
1374
 
@@ -1372,7 +1434,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1372
1434
  | --- | ----------- | ------- |
1373
1435
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1374
1436
  | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1375
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually, you don't need to set this. | `Datadog.tracer` |
1376
1437
  | `workers` | An array including all worker classes you want to trace (e.g. `[MyJob]`) | `[]` |
1377
1438
 
1378
1439
  ### Rest Client
@@ -1395,7 +1456,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1395
1456
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1396
1457
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1397
1458
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1398
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1399
1459
 
1400
1460
  ### Sequel
1401
1461
 
@@ -1429,7 +1489,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1429
1489
  | --- | ----------- | ------- |
1430
1490
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1431
1491
  | `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
1432
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1433
1492
 
1434
1493
  Only Ruby 2.0+ is supported.
1435
1494
 
@@ -1466,7 +1525,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1466
1525
  | --- | ----------- | ------- |
1467
1526
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1468
1527
  | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1469
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1470
1528
 
1471
1529
  ### Sidekiq
1472
1530
 
@@ -1490,7 +1548,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1490
1548
  | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1491
1549
  | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1492
1550
  | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
1493
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1494
1551
 
1495
1552
  ### Sinatra
1496
1553
 
@@ -1555,7 +1612,29 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
1555
1612
  | `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'] }` |
1556
1613
  | `resource_script_names` | Prepend resource names with script name | `false` |
1557
1614
  | `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
1558
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1615
+
1616
+ ### Sneakers
1617
+
1618
+ The Sneakers integration is a server-side middleware which will trace job executions.
1619
+
1620
+ You can enable it through `Datadog.configure`:
1621
+
1622
+ ```ruby
1623
+ require 'ddtrace'
1624
+
1625
+ Datadog.configure do |c|
1626
+ c.use :sneakers, options
1627
+ end
1628
+ ```
1629
+
1630
+ Where `options` is an optional `Hash` that accepts the following parameters:
1631
+
1632
+ | Key | Description | Default |
1633
+ | --- | ----------- | ------- |
1634
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1635
+ | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1636
+ | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1637
+ | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
1559
1638
 
1560
1639
  ### Sucker Punch
1561
1640
 
@@ -1578,7 +1657,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1578
1657
  | --- | ----------- | ------- |
1579
1658
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1580
1659
  | `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
1581
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1582
1660
 
1583
1661
  ## Advanced configuration
1584
1662
 
@@ -1606,12 +1684,14 @@ end
1606
1684
 
1607
1685
  Available options are:
1608
1686
 
1609
- - `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent.
1687
+ - `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent. Can be configured through the `DD_TRACE_ENABLED` environment variable. Defaults to `true`.
1610
1688
  - `hostname`: set the hostname of the trace agent.
1611
1689
  - `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
1612
1690
  - `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
1613
1691
  - `port`: set the port the trace agent is listening on.
1614
1692
  - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1693
+ - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1694
+ - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1615
1695
 
1616
1696
  #### Custom logging
1617
1697
 
@@ -1659,6 +1739,16 @@ This enables you to set this value on a per application basis, so you can have f
1659
1739
 
1660
1740
  Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
1661
1741
 
1742
+ ### Environment variables
1743
+
1744
+ Other Environment Variables:
1745
+
1746
+ - `DD_TRACE_AGENT_URL`: Sets the URL endpoint where traces are sent. Has priority over `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT` if set. e.g. `DD_TRACE_AGENT_URL=http://localhost:8126`.
1747
+ - `DD_TRACE_<INTEGRATION>_ENABLED`: Enables or disables an **activated** integration. Defaults to `true`.. e.g. `DD_TRACE_RAILS_ENABLED=false`. This option has no effects on integrations that have not been explicitly activated (e.g. `Datadog.configure{ |c| c.use :integration }`).on code. This environment variable can only be used to disable an integration.
1748
+ - `DD_TRACE_<INTEGRATION>_ANALYTICS_ENABLED`: Enables or disable App Analytics for a specific integration. Valid values are: true or false (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED=true`.
1749
+ - `DD_TRACE_<INTEGRATION>_ANALYTICS_SAMPLE_RATE`: Sets the App Analytics sampling rate for a specific integration. A floating number between 0.0 and 1.0 (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE=0.5`.
1750
+ - `DD_LOGS_INJECTION`: Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. Valid values are: `true` or `false`(default). e.g. `DD_LOGS_INJECTION=true`.
1751
+
1662
1752
  ### Sampling
1663
1753
 
1664
1754
  `ddtrace` can perform trace sampling. While the trace agent already samples traces to reduce bandwidth usage, client sampling reduces the performance overhead.
@@ -1809,7 +1899,7 @@ Service C:
1809
1899
 
1810
1900
  **Activating distributed tracing for integrations**
1811
1901
 
1812
- Many integrations included in `ddtrace` support distributed tracing. Distributed tracing is enabled by default, but can be activated via configuration settings.
1902
+ Many integrations included in `ddtrace` support distributed tracing. Distributed tracing is enabled by default in Agent v7 and most versions of Agent v6. If needed, you can activate distributed tracing with configuration settings.
1813
1903
 
1814
1904
  - If your application receives requests from services with distributed tracing activated, you must activate distributed tracing on the integrations that handle these requests (e.g. Rails)
1815
1905
  - If your application send requests to services with distributed tracing activated, you must activate distributed tracing on the integrations that send these requests (e.g. Faraday)
@@ -1824,6 +1914,7 @@ For more details on how to activate distributed tracing for integrations, see th
1824
1914
  - [Rack](#rack)
1825
1915
  - [Rails](#rails)
1826
1916
  - [Sinatra](#sinatra)
1917
+ - [http.rb](#http-rb)
1827
1918
 
1828
1919
  **Using the HTTP propagator**
1829
1920
 
@@ -1937,34 +2028,26 @@ Datadog::Pipeline.before_flush(
1937
2028
 
1938
2029
  ### Trace correlation
1939
2030
 
1940
- In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing. The tracer can produce a correlation identifier for the currently active trace via `active_correlation`, which can be used to decorate these other data sources.
2031
+ In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
2032
+
2033
+ #### For logging in Rails applications
2034
+
2035
+ ##### Automatic
2036
+
2037
+ For Rails applications using the default logger (`ActiveSupport::TaggedLogging`) or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
1941
2038
 
1942
2039
  ```ruby
1943
- # When a trace is active...
1944
- Datadog.tracer.trace('correlation.example') do
1945
- # Returns #<Datadog::Correlation::Identifier>
1946
- correlation = Datadog.tracer.active_correlation
1947
- correlation.trace_id # => 5963550561812073440
1948
- correlation.span_id # => 2232727802607726424
1949
- correlation.env # => 'production' (derived from DD_ENV)
1950
- correlation.service # => 'billing-api' (derived from DD_SERVICE)
1951
- correlation.version # => '2.5.17' (derived from DD_VERSION)
1952
- end
2040
+ # config/initializers/datadog.rb
2041
+ require 'ddtrace'
1953
2042
 
1954
- # When a trace isn't active...
1955
- correlation = Datadog.tracer.active_correlation
1956
- # Returns #<Datadog::Correlation::Identifier>
1957
- correlation = Datadog.tracer.active_correlation
1958
- correlation.trace_id # => 0
1959
- correlation.span_id # => 0
1960
- correlation.env # => 'production' (derived from DD_ENV)
1961
- correlation.service # => 'billing-api' (derived from DD_SERVICE)
1962
- correlation.version # => '2.5.17' (derived from DD_VERSION)
2043
+ Datadog.configure do |c|
2044
+ c.use :rails, log_injection: true
2045
+ end
1963
2046
  ```
1964
2047
 
1965
- #### For logging in Rails applications using Lograge (recommended)
2048
+ ##### Manual (Lograge)
1966
2049
 
1967
- After [setting up Lograge in a Rails application](https://docs.datadoghq.com/logs/log_collection/ruby/), modify the `custom_options` block in your environment configuration file (e.g. `config/environments/production.rb`) to add the trace IDs:
2050
+ After [setting up Lograge in a Rails application](https://docs.datadoghq.com/logs/log_collection/ruby/), manually modify the `custom_options` block in your environment configuration file (e.g. `config/environments/production.rb`) to add the trace IDs.
1968
2051
 
1969
2052
  ```ruby
1970
2053
  config.lograge.custom_options = lambda do |event|
@@ -1987,11 +2070,9 @@ config.lograge.custom_options = lambda do |event|
1987
2070
  end
1988
2071
  ```
1989
2072
 
1990
- #### For logging in Rails applications
1991
-
1992
- Rails applications which are configured with an `ActiveSupport::TaggedLogging` logger can append correlation IDs as tags to log output. The default Rails logger implements this tagged logging, making it easier to add correlation tags.
2073
+ ##### Manual (ActiveSupport::TaggedLogging)
1993
2074
 
1994
- In your Rails environment configuration file, add the following:
2075
+ Rails applications which are configured with the default `ActiveSupport::TaggedLogging` logger can append correlation IDs as tags to log output. To enable Trace Correlation with `ActiveSupport::TaggedLogging`, in your Rails environment configuration file, add the following:
1995
2076
 
1996
2077
  ```ruby
1997
2078
  Rails.application.configure do
@@ -2150,13 +2231,13 @@ end
2150
2231
 
2151
2232
  See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.
2152
2233
 
2153
- The stats sent will include:
2234
+ The stats are VM specific and will include:
2154
2235
 
2155
2236
  | Name | Type | Description |
2156
2237
  | -------------------------- | ------- | -------------------------------------------------------- |
2157
2238
  | `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
2158
2239
  | `runtime.ruby.thread_count` | `gauge` | Number of threads. |
2159
- | `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics (one per value in GC.stat) |
2240
+ | `runtime.ruby.gc.*`. | `gauge` | Garbage collection statistics: collected from `GC.stat`. |
2160
2241
 
2161
2242
  In addition, all metrics include the following tags:
2162
2243