ddtrace 0.42.0 → 0.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (356) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +274 -137
  3. data/.circleci/images/primary/Dockerfile-3.0.0 +73 -0
  4. data/.circleci/images/primary/{Dockerfile-jruby-9.2 → Dockerfile-jruby-9.2-latest} +2 -1
  5. data/.circleci/images/primary/Dockerfile-jruby-9.2.0.0 +73 -0
  6. data/.circleci/images/primary/Dockerfile-truffleruby-21.0.0 +73 -0
  7. data/.github/workflows/add-milestone-to-pull-requests.yml +42 -0
  8. data/.github/workflows/create-next-milestone.yml +20 -0
  9. data/.rubocop.yml +250 -7
  10. data/.rubocop_todo.yml +397 -0
  11. data/.simplecov +9 -0
  12. data/Appraisals +386 -142
  13. data/CHANGELOG.md +1218 -362
  14. data/CONTRIBUTING.md +1 -1
  15. data/Gemfile +55 -3
  16. data/LICENSE-3rdparty.csv +2 -0
  17. data/README.md +1 -0
  18. data/Rakefile +216 -29
  19. data/ddtrace.gemspec +4 -36
  20. data/docker-compose.yml +105 -7
  21. data/docs/DevelopmentGuide.md +30 -2
  22. data/docs/GettingStarted.md +242 -22
  23. data/integration/README.md +68 -0
  24. data/integration/apps/rack/.dockerignore +1 -0
  25. data/integration/apps/rack/.envrc.sample +1 -0
  26. data/integration/apps/rack/.gitignore +4 -0
  27. data/integration/apps/rack/.rspec +1 -0
  28. data/integration/apps/rack/Dockerfile +25 -0
  29. data/integration/apps/rack/Dockerfile-ci +11 -0
  30. data/integration/apps/rack/Gemfile +24 -0
  31. data/integration/apps/rack/README.md +93 -0
  32. data/integration/apps/rack/app/acme.rb +80 -0
  33. data/integration/apps/rack/app/datadog.rb +17 -0
  34. data/integration/apps/rack/bin/run +22 -0
  35. data/integration/apps/rack/bin/setup +17 -0
  36. data/integration/apps/rack/bin/test +24 -0
  37. data/integration/apps/rack/config.ru +6 -0
  38. data/integration/apps/rack/config/puma.rb +14 -0
  39. data/integration/apps/rack/config/unicorn.rb +23 -0
  40. data/integration/apps/rack/docker-compose.ci.yml +62 -0
  41. data/integration/apps/rack/docker-compose.yml +78 -0
  42. data/integration/apps/rack/script/build-images +38 -0
  43. data/integration/apps/rack/script/ci +50 -0
  44. data/integration/apps/rack/spec/integration/basic_spec.rb +10 -0
  45. data/integration/apps/rack/spec/spec_helper.rb +16 -0
  46. data/integration/apps/rack/spec/support/integration_helper.rb +22 -0
  47. data/integration/apps/rails-five/.dockerignore +1 -0
  48. data/integration/apps/rails-five/.env +3 -0
  49. data/integration/apps/rails-five/.envrc.sample +1 -0
  50. data/integration/apps/rails-five/.gitignore +30 -0
  51. data/integration/apps/rails-five/Dockerfile +25 -0
  52. data/integration/apps/rails-five/Dockerfile-ci +11 -0
  53. data/integration/apps/rails-five/Gemfile +104 -0
  54. data/integration/apps/rails-five/README.md +94 -0
  55. data/integration/apps/rails-five/Rakefile +6 -0
  56. data/integration/apps/rails-five/app/channels/application_cable/channel.rb +4 -0
  57. data/integration/apps/rails-five/app/channels/application_cable/connection.rb +4 -0
  58. data/integration/apps/rails-five/app/controllers/application_controller.rb +2 -0
  59. data/integration/apps/rails-five/app/controllers/basic_controller.rb +36 -0
  60. data/integration/apps/rails-five/app/controllers/concerns/.keep +0 -0
  61. data/integration/apps/rails-five/app/controllers/health_controller.rb +9 -0
  62. data/integration/apps/rails-five/app/controllers/jobs_controller.rb +12 -0
  63. data/integration/apps/rails-five/app/jobs/application_job.rb +2 -0
  64. data/integration/apps/rails-five/app/jobs/test_job.rb +12 -0
  65. data/integration/apps/rails-five/app/mailers/application_mailer.rb +4 -0
  66. data/integration/apps/rails-five/app/models/application_record.rb +3 -0
  67. data/integration/apps/rails-five/app/models/concerns/.keep +0 -0
  68. data/integration/apps/rails-five/app/models/test.rb +2 -0
  69. data/integration/apps/rails-five/app/views/layouts/mailer.html.erb +13 -0
  70. data/integration/apps/rails-five/app/views/layouts/mailer.text.erb +1 -0
  71. data/integration/apps/rails-five/bin/bundle +3 -0
  72. data/integration/apps/rails-five/bin/rails +9 -0
  73. data/integration/apps/rails-five/bin/rake +9 -0
  74. data/integration/apps/rails-five/bin/run +24 -0
  75. data/integration/apps/rails-five/bin/setup +27 -0
  76. data/integration/apps/rails-five/bin/spring +17 -0
  77. data/integration/apps/rails-five/bin/test +21 -0
  78. data/integration/apps/rails-five/bin/update +28 -0
  79. data/integration/apps/rails-five/config.ru +5 -0
  80. data/integration/apps/rails-five/config/application.rb +97 -0
  81. data/integration/apps/rails-five/config/boot.rb +4 -0
  82. data/integration/apps/rails-five/config/cable.yml +10 -0
  83. data/integration/apps/rails-five/config/credentials.yml.enc +1 -0
  84. data/integration/apps/rails-five/config/database.yml +28 -0
  85. data/integration/apps/rails-five/config/environment.rb +5 -0
  86. data/integration/apps/rails-five/config/environments/development.rb +51 -0
  87. data/integration/apps/rails-five/config/environments/production.rb +82 -0
  88. data/integration/apps/rails-five/config/environments/test.rb +43 -0
  89. data/integration/apps/rails-five/config/initializers/datadog.rb +18 -0
  90. data/integration/apps/rails-five/config/initializers/filter_parameter_logging.rb +4 -0
  91. data/integration/apps/rails-five/config/initializers/resque.rb +4 -0
  92. data/integration/apps/rails-five/config/initializers/rollbar.rb +5 -0
  93. data/integration/apps/rails-five/config/initializers/wrap_parameters.rb +14 -0
  94. data/integration/apps/rails-five/config/locales/en.yml +33 -0
  95. data/integration/apps/rails-five/config/puma.rb +24 -0
  96. data/integration/apps/rails-five/config/routes.rb +11 -0
  97. data/integration/apps/rails-five/config/spring.rb +6 -0
  98. data/integration/apps/rails-five/config/unicorn.rb +29 -0
  99. data/integration/apps/rails-five/db/migrate/20190927215052_create_tests.rb +11 -0
  100. data/integration/apps/rails-five/db/schema.rb +23 -0
  101. data/integration/apps/rails-five/db/seeds.rb +7 -0
  102. data/integration/apps/rails-five/docker-compose.ci.yml +98 -0
  103. data/integration/apps/rails-five/docker-compose.yml +100 -0
  104. data/integration/apps/rails-five/lib/tasks/.keep +0 -0
  105. data/integration/apps/rails-five/log/.keep +0 -0
  106. data/integration/apps/rails-five/public/robots.txt +1 -0
  107. data/integration/apps/rails-five/script/build-images +35 -0
  108. data/integration/apps/rails-five/script/ci +50 -0
  109. data/integration/apps/rails-five/spec/integration/basic_spec.rb +10 -0
  110. data/integration/apps/rails-five/spec/spec_helper.rb +16 -0
  111. data/integration/apps/rails-five/spec/support/integration_helper.rb +22 -0
  112. data/integration/apps/rails-five/storage/.keep +0 -0
  113. data/integration/apps/rails-five/tmp/.keep +0 -0
  114. data/integration/apps/rails-five/vendor/.keep +0 -0
  115. data/integration/apps/ruby/.dockerignore +1 -0
  116. data/integration/apps/ruby/.envrc.sample +1 -0
  117. data/integration/apps/ruby/.gitignore +2 -0
  118. data/integration/apps/ruby/Dockerfile +25 -0
  119. data/integration/apps/ruby/Dockerfile-ci +11 -0
  120. data/integration/apps/ruby/Gemfile +11 -0
  121. data/integration/apps/ruby/README.md +70 -0
  122. data/integration/apps/ruby/agent.yaml +3 -0
  123. data/integration/apps/ruby/app/datadog.rb +13 -0
  124. data/integration/apps/ruby/app/fibonacci.rb +58 -0
  125. data/integration/apps/ruby/bin/run +20 -0
  126. data/integration/apps/ruby/bin/setup +17 -0
  127. data/integration/apps/ruby/bin/test +21 -0
  128. data/integration/apps/ruby/docker-compose.ci.yml +51 -0
  129. data/integration/apps/ruby/docker-compose.yml +63 -0
  130. data/integration/apps/ruby/script/build-images +38 -0
  131. data/integration/apps/ruby/script/ci +50 -0
  132. data/integration/images/agent/Dockerfile +2 -0
  133. data/integration/images/agent/agent.yaml +3 -0
  134. data/integration/images/include/datadog/analyzer.rb +71 -0
  135. data/integration/images/include/datadog/demo_env.rb +101 -0
  136. data/integration/images/include/http-health-check +33 -0
  137. data/integration/images/ruby/2.0/Dockerfile +54 -0
  138. data/integration/images/ruby/2.1/Dockerfile +54 -0
  139. data/integration/images/ruby/2.2/Dockerfile +54 -0
  140. data/integration/images/ruby/2.3/Dockerfile +70 -0
  141. data/integration/images/ruby/2.4/Dockerfile +54 -0
  142. data/integration/images/ruby/2.5/Dockerfile +54 -0
  143. data/integration/images/ruby/2.6/Dockerfile +54 -0
  144. data/integration/images/ruby/2.7/Dockerfile +54 -0
  145. data/integration/images/ruby/3.0/Dockerfile +54 -0
  146. data/integration/images/wrk/Dockerfile +33 -0
  147. data/integration/images/wrk/scripts/entrypoint.sh +17 -0
  148. data/integration/images/wrk/scripts/scenarios/basic/default.lua +1 -0
  149. data/integration/images/wrk/scripts/scenarios/basic/fibonacci.lua +1 -0
  150. data/integration/script/build-images +43 -0
  151. data/lib/ddtrace.rb +10 -5
  152. data/lib/ddtrace/analytics.rb +2 -0
  153. data/lib/ddtrace/auto_instrument.rb +3 -0
  154. data/lib/ddtrace/auto_instrument_base.rb +6 -0
  155. data/lib/ddtrace/buffer.rb +4 -4
  156. data/lib/ddtrace/configuration.rb +108 -23
  157. data/lib/ddtrace/configuration/base.rb +1 -1
  158. data/lib/ddtrace/configuration/components.rb +2 -2
  159. data/lib/ddtrace/configuration/option_definition.rb +1 -3
  160. data/lib/ddtrace/configuration/options.rb +4 -7
  161. data/lib/ddtrace/configuration/settings.rb +21 -5
  162. data/lib/ddtrace/context.rb +23 -6
  163. data/lib/ddtrace/context_provider.rb +12 -2
  164. data/lib/ddtrace/contrib/action_cable/event.rb +1 -0
  165. data/lib/ddtrace/contrib/action_cable/integration.rb +7 -0
  166. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +1 -3
  167. data/lib/ddtrace/contrib/action_pack/integration.rb +7 -0
  168. data/lib/ddtrace/contrib/action_view/event.rb +1 -5
  169. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +1 -0
  170. data/lib/ddtrace/contrib/action_view/events/render_template.rb +1 -0
  171. data/lib/ddtrace/contrib/action_view/integration.rb +7 -0
  172. data/lib/ddtrace/contrib/action_view/utils.rb +1 -1
  173. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +101 -18
  174. data/lib/ddtrace/contrib/active_record/integration.rb +7 -0
  175. data/lib/ddtrace/contrib/active_record/utils.rb +68 -21
  176. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +104 -3
  177. data/lib/ddtrace/contrib/active_support/cache/patcher.rb +21 -0
  178. data/lib/ddtrace/contrib/active_support/ext.rb +3 -0
  179. data/lib/ddtrace/contrib/active_support/integration.rb +7 -1
  180. data/lib/ddtrace/contrib/active_support/notifications/event.rb +12 -1
  181. data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +1 -0
  182. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +9 -5
  183. data/lib/ddtrace/contrib/auto_instrument.rb +49 -0
  184. data/lib/ddtrace/contrib/aws/instrumentation.rb +2 -1
  185. data/lib/ddtrace/contrib/aws/patcher.rb +1 -1
  186. data/lib/ddtrace/contrib/aws/services.rb +3 -0
  187. data/lib/ddtrace/contrib/configurable.rb +63 -37
  188. data/lib/ddtrace/contrib/configuration/resolver.rb +70 -5
  189. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +20 -20
  190. data/lib/ddtrace/contrib/configuration/settings.rb +7 -6
  191. data/lib/ddtrace/contrib/cucumber/configuration/settings.rb +28 -0
  192. data/lib/ddtrace/contrib/cucumber/ext.rb +17 -0
  193. data/lib/ddtrace/contrib/cucumber/formatter.rb +98 -0
  194. data/lib/ddtrace/contrib/cucumber/instrumentation.rb +24 -0
  195. data/lib/ddtrace/contrib/cucumber/integration.rb +45 -0
  196. data/lib/ddtrace/contrib/cucumber/patcher.rb +23 -0
  197. data/lib/ddtrace/contrib/dalli/patcher.rb +0 -38
  198. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +1 -0
  199. data/lib/ddtrace/contrib/delayed_job/plugin.rb +2 -1
  200. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -0
  201. data/lib/ddtrace/contrib/elasticsearch/quantize.rb +3 -2
  202. data/lib/ddtrace/contrib/ethon/easy_patch.rb +11 -10
  203. data/lib/ddtrace/contrib/ethon/ext.rb +1 -0
  204. data/lib/ddtrace/contrib/excon/middleware.rb +9 -7
  205. data/lib/ddtrace/contrib/extensions.rb +53 -3
  206. data/lib/ddtrace/contrib/faraday/middleware.rb +1 -3
  207. data/lib/ddtrace/contrib/faraday/patcher.rb +0 -36
  208. data/lib/ddtrace/contrib/grape/configuration/settings.rb +7 -0
  209. data/lib/ddtrace/contrib/grape/endpoint.rb +47 -21
  210. data/lib/ddtrace/contrib/grape/ext.rb +1 -0
  211. data/lib/ddtrace/contrib/grape/patcher.rb +0 -42
  212. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +8 -8
  213. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +1 -0
  214. data/lib/ddtrace/contrib/grpc/patcher.rb +0 -36
  215. data/lib/ddtrace/contrib/http/circuit_breaker.rb +1 -3
  216. data/lib/ddtrace/contrib/http/instrumentation.rb +7 -7
  217. data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +32 -0
  218. data/lib/ddtrace/contrib/httpclient/ext.rb +17 -0
  219. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +147 -0
  220. data/lib/ddtrace/contrib/httpclient/integration.rb +43 -0
  221. data/lib/ddtrace/contrib/httpclient/patcher.rb +38 -0
  222. data/lib/ddtrace/contrib/httprb/instrumentation.rb +15 -21
  223. data/lib/ddtrace/contrib/httprb/patcher.rb +5 -2
  224. data/lib/ddtrace/contrib/kafka/event.rb +1 -1
  225. data/lib/ddtrace/contrib/mongodb/instrumentation.rb +2 -0
  226. data/lib/ddtrace/contrib/mongodb/subscribers.rb +2 -3
  227. data/lib/ddtrace/contrib/patchable.rb +18 -7
  228. data/lib/ddtrace/contrib/patcher.rb +9 -6
  229. data/lib/ddtrace/contrib/presto/patcher.rb +5 -2
  230. data/lib/ddtrace/contrib/qless/configuration/settings.rb +35 -0
  231. data/lib/ddtrace/contrib/qless/ext.rb +20 -0
  232. data/lib/ddtrace/contrib/qless/integration.rb +38 -0
  233. data/lib/ddtrace/contrib/qless/patcher.rb +35 -0
  234. data/lib/ddtrace/contrib/qless/qless_job.rb +73 -0
  235. data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +33 -0
  236. data/lib/ddtrace/contrib/que/configuration/settings.rb +1 -0
  237. data/lib/ddtrace/contrib/que/ext.rb +19 -19
  238. data/lib/ddtrace/contrib/que/tracer.rb +3 -2
  239. data/lib/ddtrace/contrib/racecar/event.rb +1 -0
  240. data/lib/ddtrace/contrib/rack/configuration/settings.rb +3 -3
  241. data/lib/ddtrace/contrib/rack/integration.rb +7 -0
  242. data/lib/ddtrace/contrib/rack/middlewares.rb +6 -11
  243. data/lib/ddtrace/contrib/rack/patcher.rb +1 -3
  244. data/lib/ddtrace/contrib/rack/request_queue.rb +6 -1
  245. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +10 -0
  246. data/lib/ddtrace/contrib/rails/patcher.rb +11 -4
  247. data/lib/ddtrace/contrib/rails/utils.rb +4 -0
  248. data/lib/ddtrace/contrib/rake/instrumentation.rb +4 -2
  249. data/lib/ddtrace/contrib/rake/integration.rb +1 -1
  250. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +14 -5
  251. data/lib/ddtrace/contrib/redis/configuration/settings.rb +5 -0
  252. data/lib/ddtrace/contrib/redis/ext.rb +1 -0
  253. data/lib/ddtrace/contrib/redis/patcher.rb +20 -3
  254. data/lib/ddtrace/contrib/redis/quantize.rb +28 -0
  255. data/lib/ddtrace/contrib/redis/tags.rb +5 -1
  256. data/lib/ddtrace/contrib/redis/vendor/LICENSE +20 -0
  257. data/lib/ddtrace/contrib/redis/vendor/resolver.rb +6 -7
  258. data/lib/ddtrace/contrib/registry.rb +2 -2
  259. data/lib/ddtrace/contrib/resque/configuration/settings.rb +1 -0
  260. data/lib/ddtrace/contrib/resque/integration.rb +1 -1
  261. data/lib/ddtrace/contrib/resque/resque_job.rb +3 -1
  262. data/lib/ddtrace/contrib/rest_client/request_patch.rb +1 -3
  263. data/lib/ddtrace/contrib/rspec/configuration/settings.rb +28 -0
  264. data/lib/ddtrace/contrib/rspec/example.rb +75 -0
  265. data/lib/ddtrace/contrib/rspec/ext.rb +16 -0
  266. data/lib/ddtrace/contrib/rspec/integration.rb +46 -0
  267. data/lib/ddtrace/contrib/rspec/patcher.rb +23 -0
  268. data/lib/ddtrace/contrib/sequel/utils.rb +5 -6
  269. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +1 -0
  270. data/lib/ddtrace/contrib/shoryuken/tracer.rb +3 -1
  271. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +1 -0
  272. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +5 -7
  273. data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -1
  274. data/lib/ddtrace/contrib/sinatra/env.rb +1 -3
  275. data/lib/ddtrace/contrib/sinatra/headers.rb +1 -3
  276. data/lib/ddtrace/contrib/sinatra/tracer.rb +1 -3
  277. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +5 -5
  278. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +1 -0
  279. data/lib/ddtrace/contrib/sneakers/ext.rb +11 -11
  280. data/lib/ddtrace/contrib/sneakers/tracer.rb +16 -21
  281. data/lib/ddtrace/contrib/status_code_matcher.rb +69 -0
  282. data/lib/ddtrace/correlation.rb +1 -0
  283. data/lib/ddtrace/diagnostics/environment_logger.rb +2 -1
  284. data/lib/ddtrace/distributed_tracing/headers/headers.rb +1 -0
  285. data/lib/ddtrace/distributed_tracing/headers/helpers.rb +1 -3
  286. data/lib/ddtrace/ext/app_types.rb +1 -0
  287. data/lib/ddtrace/ext/ci.rb +297 -0
  288. data/lib/ddtrace/ext/distributed.rb +8 -2
  289. data/lib/ddtrace/ext/git.rb +11 -0
  290. data/lib/ddtrace/ext/http.rb +1 -1
  291. data/lib/ddtrace/ext/runtime.rb +4 -1
  292. data/lib/ddtrace/ext/test.rb +24 -0
  293. data/lib/ddtrace/forced_tracing.rb +2 -0
  294. data/lib/ddtrace/logger.rb +1 -1
  295. data/lib/ddtrace/metrics.rb +10 -6
  296. data/lib/ddtrace/opentracer/distributed_headers.rb +3 -0
  297. data/lib/ddtrace/opentracer/span.rb +2 -6
  298. data/lib/ddtrace/opentracer/thread_local_scope.rb +1 -0
  299. data/lib/ddtrace/patcher.rb +25 -4
  300. data/lib/ddtrace/pin.rb +8 -61
  301. data/lib/ddtrace/pipeline/span_filter.rb +1 -1
  302. data/lib/ddtrace/propagation/grpc_propagator.rb +1 -0
  303. data/lib/ddtrace/propagation/http_propagator.rb +17 -2
  304. data/lib/ddtrace/quantization/http.rb +1 -0
  305. data/lib/ddtrace/runtime/cgroup.rb +2 -2
  306. data/lib/ddtrace/runtime/container.rb +27 -29
  307. data/lib/ddtrace/runtime/identity.rb +12 -5
  308. data/lib/ddtrace/sampler.rb +1 -1
  309. data/lib/ddtrace/sampling/rate_limiter.rb +65 -16
  310. data/lib/ddtrace/sampling/rule_sampler.rb +1 -0
  311. data/lib/ddtrace/span.rb +7 -7
  312. data/lib/ddtrace/sync_writer.rb +12 -12
  313. data/lib/ddtrace/tracer.rb +21 -6
  314. data/lib/ddtrace/transport/http.rb +15 -8
  315. data/lib/ddtrace/transport/http/adapters/net.rb +27 -8
  316. data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
  317. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +2 -4
  318. data/lib/ddtrace/transport/http/builder.rb +7 -1
  319. data/lib/ddtrace/transport/http/env.rb +8 -0
  320. data/lib/ddtrace/transport/http/traces.rb +2 -3
  321. data/lib/ddtrace/transport/io.rb +1 -1
  322. data/lib/ddtrace/transport/io/response.rb +1 -3
  323. data/lib/ddtrace/transport/io/traces.rb +6 -0
  324. data/lib/ddtrace/transport/traces.rb +18 -1
  325. data/lib/ddtrace/utils.rb +10 -11
  326. data/lib/ddtrace/utils/compression.rb +27 -0
  327. data/lib/ddtrace/utils/forking.rb +52 -0
  328. data/lib/ddtrace/utils/object_set.rb +41 -0
  329. data/lib/ddtrace/utils/only_once.rb +40 -0
  330. data/lib/ddtrace/utils/sequence.rb +17 -0
  331. data/lib/ddtrace/utils/string_table.rb +45 -0
  332. data/lib/ddtrace/utils/time.rb +32 -1
  333. data/lib/ddtrace/vendor/active_record/MIT-LICENSE +20 -0
  334. data/lib/ddtrace/vendor/multipart-post/LICENSE +11 -0
  335. data/lib/ddtrace/vendor/multipart-post/multipart.rb +12 -0
  336. data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +8 -0
  337. data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +116 -0
  338. data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +57 -0
  339. data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +135 -0
  340. data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +9 -0
  341. data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +32 -0
  342. data/lib/ddtrace/version.rb +1 -1
  343. data/lib/ddtrace/workers.rb +5 -0
  344. data/lib/ddtrace/workers/async.rb +11 -3
  345. data/lib/ddtrace/workers/loop.rb +17 -3
  346. data/lib/ddtrace/workers/polling.rb +1 -0
  347. data/lib/ddtrace/workers/queue.rb +1 -0
  348. data/lib/ddtrace/workers/runtime_metrics.rb +7 -3
  349. data/lib/ddtrace/workers/trace_writer.rb +10 -10
  350. data/lib/ddtrace/writer.rb +26 -5
  351. metadata +186 -373
  352. data/lib/ddtrace/augmentation.rb +0 -13
  353. data/lib/ddtrace/augmentation/method_wrapper.rb +0 -20
  354. data/lib/ddtrace/augmentation/method_wrapping.rb +0 -38
  355. data/lib/ddtrace/augmentation/shim.rb +0 -102
  356. data/lib/ddtrace/monkey.rb +0 -58
data/ddtrace.gemspec CHANGED
@@ -33,42 +33,10 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
34
  spec.require_paths = ['lib']
35
35
 
36
- spec.add_dependency 'msgpack'
37
-
38
- # Optional extensions
39
- # TODO: Move this to Appraisals?
40
- spec.add_development_dependency 'dogstatsd-ruby', '>= 3.3.0'
41
- spec.add_development_dependency 'opentracing', '>= 0.4.1'
42
-
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.
45
- spec.add_development_dependency 'rake', '>= 10.5'
46
- spec.add_development_dependency 'rubocop', '= 0.49.1' if RUBY_VERSION >= '2.1.0'
47
- spec.add_development_dependency 'rspec', '~> 3.0'
48
- spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
49
- spec.add_development_dependency 'ruby-prof', '~> 1.4' if RUBY_PLATFORM != 'java' && RUBY_VERSION >= '2.4.0'
50
- spec.add_development_dependency 'minitest', '= 5.10.1'
51
- spec.add_development_dependency 'minitest-around', '0.5.0'
52
- spec.add_development_dependency 'minitest-stub_any_instance', '1.0.2'
53
- spec.add_development_dependency 'appraisal', '~> 2.2'
54
- spec.add_development_dependency 'yard', '~> 0.9'
55
- spec.add_development_dependency 'webmock', '~> 2.0'
56
- spec.add_development_dependency 'builder'
57
- if RUBY_PLATFORM != 'java'
58
- spec.add_development_dependency 'sqlite3', '~> 1.3.6'
36
+ if RUBY_VERSION >= '2.2.0'
37
+ spec.add_dependency 'msgpack'
59
38
  else
60
- spec.add_development_dependency 'jdbc-sqlite3', '~> 3'
39
+ # msgpack 1.4 fails for Ruby 2.0 and 2.1: https://github.com/msgpack/msgpack-ruby/issues/205
40
+ spec.add_dependency 'msgpack', '< 1.4'
61
41
  end
62
- spec.add_development_dependency 'climate_control', '~> 0.2.0'
63
-
64
- # locking transitive dependency of webmock
65
- spec.add_development_dependency 'addressable', '~> 2.4.0'
66
- spec.add_development_dependency 'benchmark-ips', '~> 2.8'
67
- spec.add_development_dependency 'benchmark-memory', '~> 0.1'
68
- spec.add_development_dependency 'memory_profiler', '~> 0.9'
69
- 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'
72
- spec.add_development_dependency 'simplecov', '~> 0.17'
73
- spec.add_development_dependency 'warning', '~> 1' if RUBY_VERSION >= '2.5.0'
74
42
  end
data/docker-compose.yml CHANGED
@@ -248,9 +248,100 @@ 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
- tracer-jruby-9.2:
253
- image: marcotc/docker-library:ddtrace_rb_jruby_9_2
280
+ tracer-jruby-9.2.0.0:
281
+ image: marcotc/docker-library:ddtrace_rb_jruby_9_2_0_0
282
+ command: /bin/bash
283
+ depends_on:
284
+ - ddagent
285
+ - elasticsearch
286
+ - memcached
287
+ - mongodb
288
+ - mysql
289
+ - postgres
290
+ - presto
291
+ - redis
292
+ env_file: ./.env
293
+ environment:
294
+ - BUNDLE_GEMFILE=/app/Gemfile
295
+ - DD_AGENT_HOST=ddagent
296
+ - TEST_DATADOG_INTEGRATION=1
297
+ - TEST_ELASTICSEARCH_HOST=elasticsearch
298
+ - TEST_MEMCACHED_HOST=memcached
299
+ - TEST_MONGODB_HOST=mongodb
300
+ - TEST_MYSQL_HOST=mysql
301
+ - TEST_POSTGRES_HOST=postgres
302
+ - TEST_PRESTO_HOST=presto
303
+ - TEST_PRESTO_PORT=8080
304
+ - TEST_REDIS_HOST=redis
305
+ stdin_open: true
306
+ tty: true
307
+ volumes:
308
+ - .:/app
309
+ - bundle-jruby-9.2.0.0:/usr/local/bundle
310
+ - gemfiles-jruby-9.2.0.0:/app/gemfiles
311
+ tracer-jruby-9.2-latest:
312
+ image: marcotc/docker-library:ddtrace_rb_jruby_9_2_11_1
313
+ command: /bin/bash
314
+ depends_on:
315
+ - ddagent
316
+ - elasticsearch
317
+ - memcached
318
+ - mongodb
319
+ - mysql
320
+ - postgres
321
+ - presto
322
+ - redis
323
+ env_file: ./.env
324
+ environment:
325
+ - BUNDLE_GEMFILE=/app/Gemfile
326
+ - DD_AGENT_HOST=ddagent
327
+ - TEST_DATADOG_INTEGRATION=1
328
+ - TEST_ELASTICSEARCH_HOST=elasticsearch
329
+ - TEST_MEMCACHED_HOST=memcached
330
+ - TEST_MONGODB_HOST=mongodb
331
+ - TEST_MYSQL_HOST=mysql
332
+ - TEST_POSTGRES_HOST=postgres
333
+ - TEST_PRESTO_HOST=presto
334
+ - TEST_PRESTO_PORT=8080
335
+ - TEST_REDIS_HOST=redis
336
+ stdin_open: true
337
+ tty: true
338
+ volumes:
339
+ - .:/app
340
+ - bundle-jruby-9.2-latest:/usr/local/bundle
341
+ - gemfiles-jruby-9.2-latest:/app/gemfiles
342
+ # TruffleRuby
343
+ tracer-truffleruby-21.0.0:
344
+ image: ivoanjo/docker-library:ddtrace_rb_truffleruby_21_0_0
254
345
  command: /bin/bash
255
346
  depends_on:
256
347
  - ddagent
@@ -278,8 +369,8 @@ services:
278
369
  tty: true
279
370
  volumes:
280
371
  - .:/app
281
- - bundle-jruby-9.2:/usr/local/bundle
282
- - gemfiles-jruby-9.2:/app/gemfiles
372
+ - bundle-truffleruby-21.0.0:/usr/local/bundle
373
+ - gemfiles-truffleruby-21.0.0:/app/gemfiles
283
374
  ddagent:
284
375
  image: datadog/agent
285
376
  environment:
@@ -338,7 +429,8 @@ services:
338
429
  ports:
339
430
  - "${TEST_POSTGRES_PORT}:5432"
340
431
  presto:
341
- image: prestosql/presto
432
+ # Move to trinodb/trino after https://github.com/treasure-data/presto-client-ruby/issues/64 is resolved.
433
+ image: starburstdata/presto:332-e.9
342
434
  expose:
343
435
  - "8080"
344
436
  ports:
@@ -358,7 +450,10 @@ volumes:
358
450
  bundle-2.5:
359
451
  bundle-2.6:
360
452
  bundle-2.7:
361
- bundle-jruby-9.2:
453
+ bundle-3.0:
454
+ bundle-jruby-9.2.0.0:
455
+ bundle-jruby-9.2-latest:
456
+ bundle-truffleruby-21.0.0:
362
457
  gemfiles-2.0:
363
458
  gemfiles-2.1:
364
459
  gemfiles-2.2:
@@ -367,4 +462,7 @@ volumes:
367
462
  gemfiles-2.5:
368
463
  gemfiles-2.6:
369
464
  gemfiles-2.7:
370
- gemfiles-jruby-9.2:
465
+ gemfiles-3.0:
466
+ gemfiles-jruby-9.2.0.0:
467
+ gemfiles-jruby-9.2-latest:
468
+ gemfiles-truffleruby-21.0.0:
@@ -114,6 +114,34 @@ Because you are likely not running all tests locally, your report will contain p
114
114
  You *must* check the CI step `coverage` for the complete test coverage report, ensuring coverage is not
115
115
  decreased.
116
116
 
117
+ **Ensuring tests don't leak resources**
118
+
119
+ Tests execution can create resources that are hard to track: threads, sockets, files, etc. Because these resources can come
120
+ from the both the test setup as well as the code under test, making sure all resources are properly disposed is important
121
+ to prevent the application from inadvertently creating cumulative resources during its execution.
122
+
123
+ When running tests that utilize threads, you might see an error message similar to this one:
124
+
125
+ ```
126
+ Test leaked 1 thread: "Datadog::Workers::AsyncTransport integration tests"
127
+ Ensure all threads are terminated when test finishes:
128
+ 1: #<Thread:0x00007fcbc99863d0 /Users/marco.costa/work/dd-trace-rb/spec/spec_helper.rb:145 sleep> (Thread)
129
+ Thread Creation Site:
130
+ ./dd-trace-rb/spec/ddtrace/workers_integration_spec.rb:245:in 'new'
131
+ ./dd-trace-rb/spec/ddtrace/workers_integration_spec.rb:245:in 'block (4 levels) in <top (required)>'
132
+ Thread Backtrace:
133
+ ./dd-trace-rb/spec/ddtrace/workers_integration_spec.rb:262:in 'sleep'
134
+ .dd-trace-rb/spec/ddtrace/workers_integration_spec.rb:262:in 'block (5 levels) in <top (required)>'
135
+ ./dd-trace-rb/spec/spec_helper.rb:147:in 'block in initialize'
136
+ ```
137
+
138
+ This means that this test did not finish all threads by the time the test had finished. In this case, the thread
139
+ creation can be traced to `workers_integration_spec.rb:245:in 'new'`. The thread itself is sleeping at `workers_integration_spec.rb:262:in 'sleep'`.
140
+
141
+ The actionable in this case would be to ensure that the thread created in `workers_integration_spec.rb:245` is properly terminated by invoking `Thread#join` during the test tear down, which will wait for the thread to finish before returning.
142
+
143
+ Depending on the situation, the thread in question might need to be forced to terminate. It's recommended to have a mechanism in place to terminate it (a shared variable that changes value when the thread should exit), but as a last resort, `Thread#terminate` forces the thread to finish. Keep in mind that regardless of the termination method, `Thread#join` must be called to ensure that the thread has completely finished its shutdown process.
144
+
117
145
  ### Checking code quality
118
146
 
119
147
  **Linting**
@@ -151,9 +179,9 @@ To get started quickly, it's perfectly fine to copy-paste an existing integratio
151
179
 
152
180
  Once you have it working in your application, you can [add unit tests](#writing-tests), [run them locally](#running-tests), and [check for code quality](#checking-code-quality) using Docker Compose.
153
181
 
154
- Then [open a pull request](https://github.com/DataDog/dd-trace-rb/CONTRIBUTING.md#have-a-patch) and be sure to add the following to the description:
182
+ Then [open a pull request](../CONTRIBUTING.md#have-a-patch) and be sure to add the following to the description:
155
183
 
156
- - [Documentation](https://github.com/DataDog/dd-trace-rb/docs/GettingStarted.md) for the integration, including versions supported.
184
+ - [Documentation](./GettingStarted.md) for the integration, including versions supported.
157
185
  - Links to the repository/website of the library being integrated
158
186
  - Screenshots showing a sample trace
159
187
  - Any additional code snippets, sample apps, benchmarks, or other resources that demonstrate its implementation are a huge plus!
@@ -34,6 +34,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
34
34
  - [Active Support](#active-support)
35
35
  - [AWS](#aws)
36
36
  - [Concurrent Ruby](#concurrent-ruby)
37
+ - [Cucumber](#cucumber)
37
38
  - [Dalli](#dalli)
38
39
  - [DelayedJob](#delayedjob)
39
40
  - [Elasticsearch](#elasticsearch)
@@ -44,10 +45,13 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
44
45
  - [GraphQL](#graphql)
45
46
  - [gRPC](#grpc)
46
47
  - [http.rb](#http-rb)
48
+ - [httpclient](#httpclient)
49
+ - [httpx](#httpx)
47
50
  - [MongoDB](#mongodb)
48
51
  - [MySQL2](#mysql2)
49
52
  - [Net/HTTP](#net-http)
50
53
  - [Presto](#presto)
54
+ - [Qless](#qless)
51
55
  - [Que](#que)
52
56
  - [Racecar](#racecar)
53
57
  - [Rack](#rack)
@@ -56,6 +60,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
56
60
  - [Redis](#redis)
57
61
  - [Rest Client](#rest-client)
58
62
  - [Resque](#resque)
63
+ - [RSpec](#rspec)
59
64
  - [Shoryuken](#shoryuken)
60
65
  - [Sequel](#sequel)
61
66
  - [Sidekiq](#sidekiq)
@@ -85,7 +90,8 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
85
90
 
86
91
  | Type | Documentation | Version | Support type | Gem version support |
87
92
  | ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
88
- | MRI | https://www.ruby-lang.org/ | 2.7 | Full | Latest |
93
+ | MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
94
+ | | | 2.7 | Full | Latest |
89
95
  | | | 2.6 | Full | Latest |
90
96
  | | | 2.5 | Full | Latest |
91
97
  | | | 2.4 | Full | Latest |
@@ -123,14 +129,38 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
123
129
 
124
130
  The following steps will help you quickly start tracing your Ruby application.
125
131
 
126
- ### Setup the Datadog Agent
132
+ ### Configure the Datadog Agent for APM
127
133
 
128
134
  Before downloading tracing on your application, install the Datadog Agent. The Ruby APM tracer sends trace data through the Datadog Agent.
129
135
 
130
- [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/).
136
+ 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.
137
+
138
+ #### Containers
139
+
140
+ 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).
141
+
142
+ 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:
143
+
144
+ 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`.
145
+
131
146
 
132
147
  ### Quickstart for Rails applications
133
148
 
149
+ #### Automatic instrumentation
150
+
151
+ 1. Add the `ddtrace` gem to your Gemfile:
152
+
153
+ ```ruby
154
+ source 'https://rubygems.org'
155
+ gem 'ddtrace', require: 'ddtrace/auto_instrument'
156
+ ```
157
+
158
+ 2. Install the gem with `bundle install`
159
+
160
+ 3. You can configure, override, or disable any specific integration settings by also adding a [Rails Manual Configuration](#rails-manual-configuration) file.
161
+
162
+ #### Manual instrumentation
163
+
134
164
  1. Add the `ddtrace` gem to your Gemfile:
135
165
 
136
166
  ```ruby
@@ -152,6 +182,25 @@ Before downloading tracing on your application, install the Datadog Agent. The R
152
182
 
153
183
  ### Quickstart for Ruby applications
154
184
 
185
+ #### Automatic instrumentation
186
+
187
+ 1. Install the gem with `gem install ddtrace`
188
+ 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
189
+ 3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
190
+
191
+ ```ruby
192
+ # Example frameworks and libraries
193
+ require 'sinatra'
194
+ require 'faraday'
195
+ require 'redis'
196
+
197
+ require 'ddtrace/auto_instrument'
198
+ ```
199
+
200
+ You can configure, override, or disable any specific integration settings by also adding a [Ruby Manual Configuration Block](#ruby-manual-configuration).
201
+
202
+ #### Manual instrumentation
203
+
155
204
  1. Install the gem with `gem install ddtrace`
156
205
  2. Add a configuration block to your Ruby application:
157
206
 
@@ -226,7 +275,7 @@ And `options` is an optional `Hash` that accepts the following parameters:
226
275
  | `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. |
227
276
  | `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
228
277
  | `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
229
- | `start_time` | `Integer` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now.utc` |
278
+ | `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
230
279
  | `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
231
280
  | `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? }` |
232
281
 
@@ -338,6 +387,7 @@ For a list of available integrations, and their configuration options, please re
338
387
  | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
339
388
  | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
340
389
  | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
390
+ | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
341
391
  | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
342
392
  | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
343
393
  | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
@@ -348,11 +398,14 @@ For a list of available integrations, and their configuration options, please re
348
398
  | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
349
399
  | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
350
400
  | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
401
+ | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
402
+ | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
351
403
  | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
352
404
  | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
353
405
  | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
354
406
  | 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
407
  | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
408
+ | Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
356
409
  | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
357
410
  | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
358
411
  | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
@@ -361,6 +414,7 @@ For a list of available integrations, and their configuration options, please re
361
414
  | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
362
415
  | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
363
416
  | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
417
+ | RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
364
418
  | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
365
419
  | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
366
420
  | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
@@ -494,17 +548,20 @@ Datadog.configure do |c|
494
548
  # Symbol matching your database connection in config/database.yml
495
549
  # Only available if you are using Rails with ActiveRecord.
496
550
  c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
497
-
551
+
552
+ # Block configuration pattern.
498
553
  c.use :active_record, describes: :secondary_database do |second_db|
499
554
  second_db.service_name = 'secondary-db'
500
555
  end
501
556
 
502
557
  # Connection string with the following connection settings:
503
- # Adapter, user, host, port, database
558
+ # adapter, username, host, port, database
559
+ # Other fields are ignored.
504
560
  c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
505
561
 
506
- # Hash with following connection settings
507
- # Adapter, user, host, port, database
562
+ # Hash with following connection settings:
563
+ # adapter, username, host, port, database
564
+ # Other fields are ignored.
508
565
  c.use :active_record, describes: {
509
566
  adapter: 'mysql2',
510
567
  host: '127.0.0.1',
@@ -516,6 +573,27 @@ Datadog.configure do |c|
516
573
  end
517
574
  ```
518
575
 
576
+ You can also create configurations based on partial matching of database connection fields:
577
+
578
+ ```ruby
579
+ Datadog.configure do |c|
580
+ # Matches any connection on host `127.0.0.1`.
581
+ c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
582
+
583
+ # Matches any `mysql2` connection.
584
+ c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
585
+
586
+ # Matches any `mysql2` connection to the `reports` database.
587
+ #
588
+ # In case of multiple matching `describe` configurations, the latest one applies.
589
+ # In this case a connection with both adapter `mysql` and database `reports`
590
+ # will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
591
+ c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
592
+ end
593
+ ```
594
+
595
+ When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
596
+
519
597
  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.
520
598
 
521
599
  ### Active Support
@@ -590,6 +668,41 @@ Where `options` is an optional `Hash` that accepts the following parameters:
590
668
  | --- | ----------- | ------- |
591
669
  | `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
592
670
 
671
+ ### Cucumber
672
+
673
+ Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
674
+
675
+ To activate your integration, use the `Datadog.configure` method:
676
+
677
+ ```ruby
678
+ require 'cucumber'
679
+ require 'ddtrace'
680
+
681
+ # Configure default Cucumber integration
682
+ Datadog.configure do |c|
683
+ c.use :cucumber, options
684
+ end
685
+
686
+ # Example of how to attach tags from scenario to active span
687
+ Around do |scenario, block|
688
+ active_span = Datadog.configuration[:cucumber][:tracer].active_span
689
+ unless active_span.nil?
690
+ scenario.tags.filter { |tag| tag.include? ':' }.each do |tag|
691
+ active_span.set_tag(*tag.name.split(':', 2))
692
+ end
693
+ end
694
+ block.call
695
+ end
696
+ ```
697
+
698
+ Where `options` is an optional `Hash` that accepts the following parameters:
699
+
700
+ | Key | Description | Default |
701
+ | --- | ----------- | ------- |
702
+ | `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
703
+ | `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
704
+ | `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
705
+
593
706
  ### Dalli
594
707
 
595
708
  Dalli integration will trace all calls to your `memcached` server:
@@ -636,6 +749,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
636
749
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
637
750
  | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
638
751
  | `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
752
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
639
753
 
640
754
  ### Elasticsearch
641
755
 
@@ -816,6 +930,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
816
930
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
817
931
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
818
932
  | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
933
+ | `error_statuses`| Defines a status code or range of status codes which should be marked as errors. `'404,405,500-599'` or `[404,405,'500-599']` | `nil` |
819
934
 
820
935
  ### GraphQL
821
936
 
@@ -963,6 +1078,51 @@ Where `options` is an optional `Hash` that accepts the following parameters:
963
1078
  | `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
964
1079
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
965
1080
 
1081
+ ### httpclient
1082
+
1083
+ The httpclient integration will trace any HTTP call using the httpclient gem.
1084
+
1085
+ ```ruby
1086
+ require 'httpclient'
1087
+ require 'ddtrace'
1088
+ Datadog.configure do |c|
1089
+ c.use :httpclient, options
1090
+ # optionally, specify a different service name for hostnames matching a regex
1091
+ c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
1092
+ httpclient.service_name = 'user.example.com'
1093
+ httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
1094
+ end
1095
+ end
1096
+ ```
1097
+
1098
+ Where `options` is an optional `Hash` that accepts the following parameters:
1099
+
1100
+ | Key | Description | Default |
1101
+ | --- | ----------- | ------- |
1102
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1103
+ | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1104
+ | `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
1105
+ | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1106
+
1107
+ ### httpx
1108
+
1109
+ `httpx` maintains its [own integration with `ddtrace`](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter):
1110
+
1111
+ ```ruby
1112
+ require "ddtrace"
1113
+ require "httpx/adapters/datadog"
1114
+
1115
+ Datadog.configure do |c|
1116
+ c.use :httpx
1117
+
1118
+ # optionally, specify a different service name for hostnames matching a regex
1119
+ c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
1120
+ http.service_name = 'user.example.com'
1121
+ http.split_by_domain = false # Only necessary if split_by_domain is true by default
1122
+ end
1123
+ end
1124
+ ```
1125
+
966
1126
  ### Kafka
967
1127
 
968
1128
  The Kafka integration provides tracing of the `ruby-kafka` gem:
@@ -1113,6 +1273,29 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1113
1273
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1114
1274
  | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1115
1275
 
1276
+ ### Qless
1277
+
1278
+ The Qless integration uses lifecycle hooks to trace job executions.
1279
+
1280
+ To add tracing to a Qless job:
1281
+
1282
+ ```ruby
1283
+ require 'ddtrace'
1284
+
1285
+ Datadog.configure do |c|
1286
+ c.use :qless, options
1287
+ end
1288
+ ```
1289
+
1290
+ Where `options` is an optional `Hash` that accepts the following parameters:
1291
+
1292
+ | Key | Description | Default |
1293
+ | --- | ----------- | ------- |
1294
+ | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1295
+ | `service_name` | Service name used for `qless` instrumentation | `'qless'` |
1296
+ | `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
1297
+ | `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
1298
+
1116
1299
  ### Que
1117
1300
 
1118
1301
  The Que integration is a middleware which will trace job executions.
@@ -1136,6 +1319,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1136
1319
  | `service_name` | Service name used for `que` instrumentation | `'que'` |
1137
1320
  | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
1138
1321
  | `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
1322
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1139
1323
 
1140
1324
  ### Racecar
1141
1325
 
@@ -1189,7 +1373,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1189
1373
  | `application` | Your Rack application. Required for `middleware_names`. | `nil` |
1190
1374
  | `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` |
1191
1375
  | `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'] }` |
1192
- | `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` |
1376
+ | `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` |
1193
1377
  | `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
1194
1378
  | `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. | `{}` |
1195
1379
  | `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` |
@@ -1268,8 +1452,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1268
1452
  | 2.1 | | 3.0 - 4.2 |
1269
1453
  | 2.2 - 2.3 | | 3.0 - 5.2 |
1270
1454
  | 2.4 | | 4.2.8 - 5.2 |
1271
- | 2.5 | | 4.2.8 - 6.0 |
1272
- | 2.6 - 2.7 | 9.2 | 5.0 - 6.0 |
1455
+ | 2.5 | | 4.2.8 - 6.1 |
1456
+ | 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
1457
+ | 3.0 | | 6.1 |
1273
1458
 
1274
1459
  ### Rake
1275
1460
 
@@ -1359,6 +1544,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1359
1544
  | --- | ----------- | ------- |
1360
1545
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1361
1546
  | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1547
+ | `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
1362
1548
 
1363
1549
  You can also set *per-instance* configuration as it follows:
1364
1550
 
@@ -1396,12 +1582,17 @@ Datadog.configure do |c|
1396
1582
  # The default configuration for any redis client
1397
1583
  c.use :redis, service_name: 'redis-default'
1398
1584
 
1399
- # The configuration matching a given unix socket
1585
+ # The configuration matching a given unix socket.
1400
1586
  c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
1401
1587
 
1402
- # Connection string
1403
- c.use :redis, describes: { url: 'redis://127.0.0.1:6379/0' }, service_name: 'redis-connection-string'
1404
- # Client host, port, db, scheme
1588
+ # For network connections, only these fields are considered during matching:
1589
+ # scheme, host, port, db
1590
+ # Other fields are ignored.
1591
+
1592
+ # Network connection string
1593
+ c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
1594
+ c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
1595
+ # Network client hash
1405
1596
  c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
1406
1597
  # Only a subset of the connection hash
1407
1598
  c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
@@ -1409,6 +1600,8 @@ Datadog.configure do |c|
1409
1600
  end
1410
1601
  ```
1411
1602
 
1603
+ When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
1604
+
1412
1605
  ### Resque
1413
1606
 
1414
1607
  The Resque integration uses Resque hooks that wraps the `perform` method.
@@ -1436,6 +1629,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1436
1629
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1437
1630
  | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1438
1631
  | `workers` | An array including all worker classes you want to trace (e.g. `[MyJob]`) | `[]` |
1632
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1439
1633
 
1440
1634
  ### Rest Client
1441
1635
 
@@ -1458,6 +1652,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1458
1652
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1459
1653
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1460
1654
 
1655
+ ### RSpec
1656
+
1657
+ RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
1658
+
1659
+ To activate your integration, use the `Datadog.configure` method:
1660
+
1661
+ ```ruby
1662
+ require 'rspec'
1663
+ require 'ddtrace'
1664
+
1665
+ # Configure default RSpec integration
1666
+ Datadog.configure do |c|
1667
+ c.use :rspec, options
1668
+ end
1669
+ ```
1670
+
1671
+ Where `options` is an optional `Hash` that accepts the following parameters:
1672
+
1673
+ | Key | Description | Default |
1674
+ | --- | ----------- | ------- |
1675
+ | `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1676
+ | `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
1677
+ | `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
1678
+
1461
1679
  ### Sequel
1462
1680
 
1463
1681
  The Sequel integration traces queries made to your database.
@@ -1526,6 +1744,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1526
1744
  | --- | ----------- | ------- |
1527
1745
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1528
1746
  | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1747
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1529
1748
 
1530
1749
  ### Sidekiq
1531
1750
 
@@ -1549,6 +1768,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1549
1768
  | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1550
1769
  | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1551
1770
  | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
1771
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1552
1772
 
1553
1773
  ### Sinatra
1554
1774
 
@@ -1636,6 +1856,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1636
1856
  | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1637
1857
  | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1638
1858
  | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
1859
+ | `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1639
1860
 
1640
1861
  ### Sucker Punch
1641
1862
 
@@ -1693,6 +1914,7 @@ Available options are:
1693
1914
  - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1694
1915
  - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1695
1916
  - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1917
+ - `time_now_provider`: when testing, it might be helpful to use a different time provider. For Timecop, for example, `->{ Time.now_without_mock_time }` allows the tracer to use the real wall time. Span duration calculation will still use the system monotonic clock when available, thus not being affected by this setting. Defaults to `->{ Time.now }`.
1696
1918
 
1697
1919
  #### Custom logging
1698
1920
 
@@ -1916,6 +2138,8 @@ For more details on how to activate distributed tracing for integrations, see th
1916
2138
  - [Rails](#rails)
1917
2139
  - [Sinatra](#sinatra)
1918
2140
  - [http.rb](#http-rb)
2141
+ - [httpclient](#httpclient)
2142
+ - [httpx](#httpx)
1919
2143
 
1920
2144
  **Using the HTTP propagator**
1921
2145
 
@@ -1944,9 +2168,7 @@ end
1944
2168
 
1945
2169
  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.
1946
2170
 
1947
- This functionality is **experimental** and deactivated by default.
1948
-
1949
- 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:
2171
+ 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:
1950
2172
 
1951
2173
  ```
1952
2174
  # /etc/nginx/conf.d/ruby_service.conf
@@ -1960,9 +2182,7 @@ server {
1960
2182
  }
1961
2183
  ```
1962
2184
 
1963
- Then you must enable the request queuing feature in the integration handling the request.
1964
-
1965
- For Rack-based applications, see the [documentation](#rack) for details for enabling this feature.
2185
+ 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.
1966
2186
 
1967
2187
  ### Processing Pipeline
1968
2188
 
@@ -2050,7 +2270,7 @@ _Note:_ For `lograge` users who have also defined `lograge.custom_options` in an
2050
2270
 
2051
2271
  ##### Manual (Lograge)
2052
2272
 
2053
- 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.
2273
+ 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.
2054
2274
 
2055
2275
  ```ruby
2056
2276
  config.lograge.custom_options = lambda do |event|