ddtrace 0.54.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1125) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -16
  3. data/CHANGELOG.md +189 -2
  4. data/LICENSE-3rdparty.csv +3 -1
  5. data/README.md +4 -0
  6. data/bin/ddtracerb +5 -5
  7. data/ddtrace.gemspec +18 -6
  8. data/docs/0.x-trace.png +0 -0
  9. data/docs/1.0-trace.png +0 -0
  10. data/docs/AutoInstrumentation.md +36 -0
  11. data/docs/Deprecation.md +8 -0
  12. data/docs/DevelopmentGuide.md +1 -1
  13. data/docs/GettingStarted.md +574 -508
  14. data/docs/ProfilingDevelopment.md +20 -17
  15. data/docs/PublicApi.md +14 -0
  16. data/docs/UpgradeGuide.md +736 -0
  17. data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +118 -0
  18. data/ext/ddtrace_profiling_loader/extconf.rb +53 -0
  19. data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +31 -5
  20. data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +0 -8
  21. data/ext/ddtrace_profiling_native_extension/collectors_stack.c +278 -0
  22. data/ext/ddtrace_profiling_native_extension/extconf.rb +95 -55
  23. data/ext/ddtrace_profiling_native_extension/libddprof_helpers.h +13 -0
  24. data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +186 -0
  25. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +579 -7
  26. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +30 -0
  27. data/ext/ddtrace_profiling_native_extension/profiling.c +10 -1
  28. data/ext/ddtrace_profiling_native_extension/stack_recorder.c +139 -0
  29. data/ext/ddtrace_profiling_native_extension/stack_recorder.h +28 -0
  30. data/lib/datadog/appsec/assets/blocked.html +4 -0
  31. data/lib/datadog/appsec/assets/waf_rules/README.md +7 -0
  32. data/lib/datadog/appsec/assets/waf_rules/recommended.json +5638 -0
  33. data/lib/datadog/appsec/assets/waf_rules/risky.json +1499 -0
  34. data/lib/datadog/appsec/assets/waf_rules/strict.json +1298 -0
  35. data/lib/datadog/appsec/assets.rb +38 -0
  36. data/lib/datadog/appsec/autoload.rb +16 -0
  37. data/lib/datadog/appsec/configuration/settings.rb +194 -0
  38. data/lib/datadog/appsec/configuration.rb +80 -0
  39. data/lib/datadog/appsec/contrib/auto_instrument.rb +29 -0
  40. data/lib/datadog/appsec/contrib/configuration/settings.rb +20 -0
  41. data/lib/datadog/appsec/contrib/integration.rb +37 -0
  42. data/lib/datadog/appsec/contrib/patcher.rb +12 -0
  43. data/lib/datadog/appsec/contrib/rack/configuration/settings.rb +22 -0
  44. data/lib/datadog/appsec/contrib/rack/ext.rb +15 -0
  45. data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +169 -0
  46. data/lib/datadog/appsec/contrib/rack/integration.rb +49 -0
  47. data/lib/datadog/appsec/contrib/rack/patcher.rb +32 -0
  48. data/lib/datadog/appsec/contrib/rack/reactive/request.rb +87 -0
  49. data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +64 -0
  50. data/lib/datadog/appsec/contrib/rack/reactive/response.rb +64 -0
  51. data/lib/datadog/appsec/contrib/rack/request.rb +58 -0
  52. data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +41 -0
  53. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +112 -0
  54. data/lib/datadog/appsec/contrib/rack/response.rb +24 -0
  55. data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +22 -0
  56. data/lib/datadog/appsec/contrib/rails/ext.rb +15 -0
  57. data/lib/datadog/appsec/contrib/rails/framework.rb +30 -0
  58. data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +81 -0
  59. data/lib/datadog/appsec/contrib/rails/integration.rb +48 -0
  60. data/lib/datadog/appsec/contrib/rails/patcher.rb +158 -0
  61. data/lib/datadog/appsec/contrib/rails/reactive/action.rb +68 -0
  62. data/lib/datadog/appsec/contrib/rails/request.rb +33 -0
  63. data/lib/datadog/appsec/contrib/rails/request_middleware.rb +20 -0
  64. data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +22 -0
  65. data/lib/datadog/appsec/contrib/sinatra/ext.rb +15 -0
  66. data/lib/datadog/appsec/contrib/sinatra/framework.rb +34 -0
  67. data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +124 -0
  68. data/lib/datadog/appsec/contrib/sinatra/integration.rb +48 -0
  69. data/lib/datadog/appsec/contrib/sinatra/patcher.rb +144 -0
  70. data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +63 -0
  71. data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +20 -0
  72. data/lib/datadog/appsec/event.rb +121 -0
  73. data/lib/datadog/appsec/extensions.rb +118 -0
  74. data/lib/datadog/appsec/instrumentation/gateway.rb +44 -0
  75. data/lib/datadog/appsec/processor.rb +164 -0
  76. data/lib/datadog/appsec/rate_limiter.rb +60 -0
  77. data/lib/datadog/appsec/reactive/address_hash.rb +18 -0
  78. data/lib/datadog/appsec/reactive/engine.rb +44 -0
  79. data/lib/datadog/appsec/reactive/operation.rb +51 -0
  80. data/lib/datadog/appsec/reactive/subscriber.rb +18 -0
  81. data/lib/datadog/appsec.rb +23 -0
  82. data/lib/datadog/ci/configuration/components.rb +9 -8
  83. data/lib/datadog/ci/configuration/settings.rb +19 -3
  84. data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +4 -2
  85. data/lib/datadog/ci/contrib/cucumber/ext.rb +2 -0
  86. data/lib/datadog/ci/contrib/cucumber/formatter.rb +4 -9
  87. data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +2 -1
  88. data/lib/datadog/ci/contrib/cucumber/integration.rb +3 -2
  89. data/lib/datadog/ci/contrib/cucumber/patcher.rb +3 -2
  90. data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +4 -2
  91. data/lib/datadog/ci/contrib/rspec/example.rb +4 -9
  92. data/lib/datadog/ci/contrib/rspec/ext.rb +2 -0
  93. data/lib/datadog/ci/contrib/rspec/integration.rb +3 -2
  94. data/lib/datadog/ci/contrib/rspec/patcher.rb +3 -2
  95. data/lib/datadog/ci/ext/app_types.rb +2 -1
  96. data/lib/datadog/ci/ext/environment.rb +128 -110
  97. data/lib/datadog/ci/ext/settings.rb +2 -1
  98. data/lib/datadog/ci/ext/test.rb +1 -0
  99. data/lib/datadog/ci/extensions.rb +5 -4
  100. data/lib/datadog/ci/flush.rb +38 -0
  101. data/lib/datadog/ci/test.rb +15 -13
  102. data/lib/datadog/ci.rb +4 -1
  103. data/lib/datadog/core/buffer/cruby.rb +55 -0
  104. data/lib/datadog/core/buffer/random.rb +134 -0
  105. data/lib/datadog/core/buffer/thread_safe.rb +58 -0
  106. data/lib/datadog/core/chunker.rb +35 -0
  107. data/lib/datadog/core/configuration/agent_settings_resolver.rb +365 -0
  108. data/lib/datadog/core/configuration/base.rb +89 -0
  109. data/lib/datadog/core/configuration/components.rb +411 -0
  110. data/lib/datadog/core/configuration/dependency_resolver.rb +28 -0
  111. data/lib/datadog/core/configuration/option.rb +69 -0
  112. data/lib/datadog/core/configuration/option_definition.rb +126 -0
  113. data/lib/datadog/core/configuration/option_definition_set.rb +22 -0
  114. data/lib/datadog/core/configuration/option_set.rb +10 -0
  115. data/lib/datadog/core/configuration/options.rb +118 -0
  116. data/lib/datadog/core/configuration/settings.rb +618 -0
  117. data/lib/datadog/core/configuration.rb +286 -0
  118. data/lib/datadog/core/diagnostics/environment_logger.rb +283 -0
  119. data/lib/datadog/core/diagnostics/ext.rb +41 -0
  120. data/lib/datadog/core/diagnostics/health.rb +37 -0
  121. data/lib/datadog/core/encoding.rb +76 -0
  122. data/lib/datadog/core/environment/cgroup.rb +4 -1
  123. data/lib/datadog/core/environment/class_count.rb +1 -0
  124. data/lib/datadog/core/environment/container.rb +3 -1
  125. data/lib/datadog/core/environment/ext.rb +28 -9
  126. data/lib/datadog/core/environment/gc.rb +1 -0
  127. data/lib/datadog/core/environment/identity.rb +11 -4
  128. data/lib/datadog/core/environment/socket.rb +9 -2
  129. data/lib/datadog/core/environment/thread_count.rb +1 -0
  130. data/lib/datadog/core/environment/variable_helpers.rb +28 -2
  131. data/lib/datadog/core/environment/vm_cache.rb +1 -0
  132. data/lib/datadog/core/error.rb +101 -0
  133. data/lib/datadog/core/extensions.rb +16 -0
  134. data/lib/datadog/core/git/ext.rb +35 -0
  135. data/lib/datadog/core/logger.rb +46 -0
  136. data/lib/datadog/core/logging/ext.rb +11 -0
  137. data/lib/datadog/core/metrics/client.rb +198 -0
  138. data/lib/datadog/core/metrics/ext.rb +20 -0
  139. data/lib/datadog/core/metrics/helpers.rb +25 -0
  140. data/lib/datadog/core/metrics/logging.rb +44 -0
  141. data/lib/datadog/core/metrics/metric.rb +14 -0
  142. data/lib/datadog/core/metrics/options.rb +50 -0
  143. data/lib/datadog/core/pin.rb +75 -0
  144. data/lib/datadog/core/runtime/ext.rb +28 -0
  145. data/lib/datadog/core/runtime/metrics.rb +126 -0
  146. data/lib/datadog/core/utils/compression.rb +32 -0
  147. data/lib/datadog/core/utils/forking.rb +63 -0
  148. data/lib/datadog/core/utils/object_set.rb +43 -0
  149. data/lib/datadog/core/utils/only_once.rb +44 -0
  150. data/lib/datadog/core/utils/safe_dup.rb +27 -0
  151. data/lib/datadog/core/utils/sequence.rb +21 -0
  152. data/lib/datadog/core/utils/string_table.rb +49 -0
  153. data/lib/datadog/core/utils/time.rb +54 -0
  154. data/lib/datadog/core/utils.rb +115 -0
  155. data/lib/datadog/core/vendor/multipart-post/multipart/post/composite_read_io.rb +120 -0
  156. data/lib/datadog/core/vendor/multipart-post/multipart/post/multipartable.rb +61 -0
  157. data/lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb +139 -0
  158. data/lib/datadog/core/vendor/multipart-post/multipart/post/version.rb +13 -0
  159. data/lib/datadog/core/vendor/multipart-post/multipart/post.rb +12 -0
  160. data/lib/datadog/core/vendor/multipart-post/multipart.rb +16 -0
  161. data/lib/datadog/core/vendor/multipart-post/net/http/post/multipart.rb +36 -0
  162. data/lib/datadog/core/worker.rb +24 -0
  163. data/lib/datadog/core/workers/async.rb +182 -0
  164. data/lib/datadog/core/workers/interval_loop.rb +119 -0
  165. data/lib/datadog/core/workers/polling.rb +59 -0
  166. data/lib/datadog/core/workers/queue.rb +44 -0
  167. data/lib/datadog/core/workers/runtime_metrics.rb +62 -0
  168. data/lib/datadog/core.rb +80 -0
  169. data/lib/datadog/kit/enable_core_dumps.rb +50 -0
  170. data/lib/datadog/kit/identity.rb +63 -0
  171. data/lib/datadog/kit.rb +11 -0
  172. data/lib/datadog/opentracer/binary_propagator.rb +26 -0
  173. data/lib/datadog/opentracer/carrier.rb +9 -0
  174. data/lib/datadog/opentracer/distributed_headers.rb +58 -0
  175. data/lib/datadog/opentracer/global_tracer.rb +17 -0
  176. data/lib/datadog/opentracer/propagator.rb +26 -0
  177. data/lib/datadog/opentracer/rack_propagator.rb +72 -0
  178. data/lib/datadog/opentracer/scope.rb +18 -0
  179. data/lib/datadog/opentracer/scope_manager.rb +9 -0
  180. data/lib/datadog/opentracer/span.rb +101 -0
  181. data/lib/datadog/opentracer/span_context.rb +19 -0
  182. data/lib/datadog/opentracer/span_context_factory.rb +27 -0
  183. data/lib/datadog/opentracer/text_map_propagator.rb +87 -0
  184. data/lib/datadog/opentracer/thread_local_scope.rb +34 -0
  185. data/lib/datadog/opentracer/thread_local_scope_manager.rb +43 -0
  186. data/lib/datadog/opentracer/tracer.rb +212 -0
  187. data/lib/datadog/opentracer.rb +24 -0
  188. data/lib/datadog/profiling/backtrace_location.rb +34 -0
  189. data/lib/datadog/profiling/buffer.rb +43 -0
  190. data/lib/datadog/profiling/collectors/code_provenance.rb +114 -0
  191. data/lib/datadog/profiling/collectors/old_stack.rb +298 -0
  192. data/lib/datadog/profiling/collectors/stack.rb +16 -0
  193. data/lib/datadog/profiling/encoding/profile.rb +47 -0
  194. data/lib/datadog/profiling/event.rb +15 -0
  195. data/lib/datadog/profiling/events/stack.rb +82 -0
  196. data/lib/datadog/profiling/exporter.rb +25 -0
  197. data/lib/datadog/profiling/ext/forking.rb +99 -0
  198. data/lib/datadog/profiling/ext.rb +57 -0
  199. data/lib/datadog/profiling/flush.rb +69 -0
  200. data/lib/datadog/profiling/load_native_extension.rb +22 -0
  201. data/lib/datadog/profiling/native_extension.rb +41 -0
  202. data/lib/datadog/profiling/pprof/builder.rb +127 -0
  203. data/lib/datadog/profiling/pprof/converter.rb +104 -0
  204. data/lib/datadog/profiling/pprof/message_set.rb +16 -0
  205. data/lib/datadog/profiling/pprof/payload.rb +20 -0
  206. data/lib/datadog/profiling/pprof/pprof_pb.rb +83 -0
  207. data/lib/datadog/profiling/pprof/stack_sample.rb +141 -0
  208. data/lib/datadog/profiling/pprof/string_table.rb +12 -0
  209. data/lib/datadog/profiling/pprof/template.rb +120 -0
  210. data/lib/datadog/profiling/preload.rb +5 -0
  211. data/lib/datadog/profiling/profiler.rb +34 -0
  212. data/lib/datadog/profiling/recorder.rb +117 -0
  213. data/lib/datadog/profiling/scheduler.rb +151 -0
  214. data/lib/datadog/profiling/stack_recorder.rb +33 -0
  215. data/lib/datadog/profiling/tag_builder.rb +48 -0
  216. data/lib/datadog/profiling/tasks/exec.rb +50 -0
  217. data/lib/datadog/profiling/tasks/help.rb +18 -0
  218. data/lib/datadog/profiling/tasks/setup.rb +93 -0
  219. data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +45 -0
  220. data/lib/datadog/profiling/trace_identifiers/helper.rb +47 -0
  221. data/lib/datadog/profiling/transport/client.rb +16 -0
  222. data/lib/datadog/profiling/transport/http/api/endpoint.rb +107 -0
  223. data/lib/datadog/profiling/transport/http/api/instance.rb +38 -0
  224. data/lib/datadog/profiling/transport/http/api/spec.rb +42 -0
  225. data/lib/datadog/profiling/transport/http/api.rb +45 -0
  226. data/lib/datadog/profiling/transport/http/builder.rb +30 -0
  227. data/lib/datadog/profiling/transport/http/client.rb +35 -0
  228. data/lib/datadog/profiling/transport/http/response.rb +23 -0
  229. data/lib/datadog/profiling/transport/http.rb +112 -0
  230. data/lib/datadog/profiling/transport/io/client.rb +29 -0
  231. data/lib/datadog/profiling/transport/io/response.rb +18 -0
  232. data/lib/datadog/profiling/transport/io.rb +32 -0
  233. data/lib/datadog/profiling/transport/parcel.rb +19 -0
  234. data/lib/datadog/profiling/transport/request.rb +17 -0
  235. data/lib/datadog/profiling/transport/response.rb +10 -0
  236. data/lib/datadog/profiling.rb +170 -0
  237. data/lib/datadog/tracing/analytics.rb +25 -0
  238. data/lib/datadog/tracing/buffer.rb +132 -0
  239. data/lib/datadog/tracing/configuration/ext.rb +51 -0
  240. data/lib/datadog/tracing/context.rb +68 -0
  241. data/lib/datadog/tracing/context_provider.rb +66 -0
  242. data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +35 -0
  243. data/lib/datadog/tracing/contrib/action_cable/event.rb +72 -0
  244. data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +58 -0
  245. data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +63 -0
  246. data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +59 -0
  247. data/lib/datadog/tracing/contrib/action_cable/events.rb +37 -0
  248. data/lib/datadog/tracing/contrib/action_cable/ext.rb +32 -0
  249. data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +91 -0
  250. data/lib/datadog/tracing/contrib/action_cable/integration.rb +50 -0
  251. data/lib/datadog/tracing/contrib/action_cable/patcher.rb +31 -0
  252. data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +36 -0
  253. data/lib/datadog/tracing/contrib/action_mailer/event.rb +52 -0
  254. data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +60 -0
  255. data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +47 -0
  256. data/lib/datadog/tracing/contrib/action_mailer/events.rb +34 -0
  257. data/lib/datadog/tracing/contrib/action_mailer/ext.rb +33 -0
  258. data/lib/datadog/tracing/contrib/action_mailer/integration.rb +50 -0
  259. data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +29 -0
  260. data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +156 -0
  261. data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +29 -0
  262. data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +36 -0
  263. data/lib/datadog/tracing/contrib/action_pack/ext.rb +22 -0
  264. data/lib/datadog/tracing/contrib/action_pack/integration.rb +50 -0
  265. data/lib/datadog/tracing/contrib/action_pack/patcher.rb +27 -0
  266. data/lib/datadog/tracing/contrib/action_pack/utils.rb +40 -0
  267. data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +36 -0
  268. data/lib/datadog/tracing/contrib/action_view/event.rb +35 -0
  269. data/lib/datadog/tracing/contrib/action_view/events/render_partial.rb +54 -0
  270. data/lib/datadog/tracing/contrib/action_view/events/render_template.rb +57 -0
  271. data/lib/datadog/tracing/contrib/action_view/events.rb +34 -0
  272. data/lib/datadog/tracing/contrib/action_view/ext.rb +24 -0
  273. data/lib/datadog/tracing/contrib/action_view/instrumentation/partial_renderer.rb +78 -0
  274. data/lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb +91 -0
  275. data/lib/datadog/tracing/contrib/action_view/integration.rb +57 -0
  276. data/lib/datadog/tracing/contrib/action_view/patcher.rb +47 -0
  277. data/lib/datadog/tracing/contrib/action_view/utils.rb +36 -0
  278. data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +37 -0
  279. data/lib/datadog/tracing/contrib/active_job/event.rb +58 -0
  280. data/lib/datadog/tracing/contrib/active_job/events/discard.rb +50 -0
  281. data/lib/datadog/tracing/contrib/active_job/events/enqueue.rb +49 -0
  282. data/lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb +49 -0
  283. data/lib/datadog/tracing/contrib/active_job/events/enqueue_retry.rb +51 -0
  284. data/lib/datadog/tracing/contrib/active_job/events/perform.rb +49 -0
  285. data/lib/datadog/tracing/contrib/active_job/events/retry_stopped.rb +50 -0
  286. data/lib/datadog/tracing/contrib/active_job/events.rb +42 -0
  287. data/lib/datadog/tracing/contrib/active_job/ext.rb +39 -0
  288. data/lib/datadog/tracing/contrib/active_job/integration.rb +50 -0
  289. data/lib/datadog/tracing/contrib/active_job/log_injection.rb +26 -0
  290. data/lib/datadog/tracing/contrib/active_job/patcher.rb +36 -0
  291. data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +33 -0
  292. data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +69 -0
  293. data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +45 -0
  294. data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +47 -0
  295. data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +34 -0
  296. data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +24 -0
  297. data/lib/datadog/tracing/contrib/active_model_serializers/integration.rb +45 -0
  298. data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +33 -0
  299. data/lib/datadog/tracing/contrib/active_record/configuration/makara_resolver.rb +36 -0
  300. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +138 -0
  301. data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +39 -0
  302. data/lib/datadog/tracing/contrib/active_record/event.rb +30 -0
  303. data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +58 -0
  304. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +78 -0
  305. data/lib/datadog/tracing/contrib/active_record/events.rb +34 -0
  306. data/lib/datadog/tracing/contrib/active_record/ext.rb +29 -0
  307. data/lib/datadog/tracing/contrib/active_record/integration.rb +56 -0
  308. data/lib/datadog/tracing/contrib/active_record/patcher.rb +27 -0
  309. data/lib/datadog/tracing/contrib/active_record/utils.rb +128 -0
  310. data/lib/datadog/tracing/contrib/active_record/vendor/connection_specification.rb +307 -0
  311. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +270 -0
  312. data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +73 -0
  313. data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +47 -0
  314. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +35 -0
  315. data/lib/datadog/tracing/contrib/active_support/ext.rb +31 -0
  316. data/lib/datadog/tracing/contrib/active_support/integration.rb +51 -0
  317. data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +71 -0
  318. data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +71 -0
  319. data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +164 -0
  320. data/lib/datadog/tracing/contrib/active_support/patcher.rb +27 -0
  321. data/lib/datadog/tracing/contrib/analytics.rb +29 -0
  322. data/lib/datadog/tracing/contrib/auto_instrument.rb +53 -0
  323. data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +35 -0
  324. data/lib/datadog/tracing/contrib/aws/ext.rb +27 -0
  325. data/lib/datadog/tracing/contrib/aws/instrumentation.rb +95 -0
  326. data/lib/datadog/tracing/contrib/aws/integration.rb +47 -0
  327. data/lib/datadog/tracing/contrib/aws/parsed_context.rb +60 -0
  328. data/lib/datadog/tracing/contrib/aws/patcher.rb +57 -0
  329. data/lib/datadog/tracing/contrib/aws/services.rb +123 -0
  330. data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +23 -0
  331. data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +53 -0
  332. data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +16 -0
  333. data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +27 -0
  334. data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +43 -0
  335. data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +33 -0
  336. data/lib/datadog/tracing/contrib/configurable.rb +102 -0
  337. data/lib/datadog/tracing/contrib/configuration/resolver.rb +85 -0
  338. data/lib/datadog/tracing/contrib/configuration/resolvers/pattern_resolver.rb +43 -0
  339. data/lib/datadog/tracing/contrib/configuration/settings.rb +43 -0
  340. data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +35 -0
  341. data/lib/datadog/tracing/contrib/dalli/ext.rb +24 -0
  342. data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +58 -0
  343. data/lib/datadog/tracing/contrib/dalli/integration.rb +52 -0
  344. data/lib/datadog/tracing/contrib/dalli/patcher.rb +28 -0
  345. data/lib/datadog/tracing/contrib/dalli/quantize.rb +26 -0
  346. data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +38 -0
  347. data/lib/datadog/tracing/contrib/delayed_job/ext.rb +26 -0
  348. data/lib/datadog/tracing/contrib/delayed_job/integration.rb +43 -0
  349. data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +31 -0
  350. data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +101 -0
  351. data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +36 -0
  352. data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +26 -0
  353. data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +50 -0
  354. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +151 -0
  355. data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +89 -0
  356. data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +37 -0
  357. data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +177 -0
  358. data/lib/datadog/tracing/contrib/ethon/ext.rb +24 -0
  359. data/lib/datadog/tracing/contrib/ethon/integration.rb +48 -0
  360. data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +96 -0
  361. data/lib/datadog/tracing/contrib/ethon/patcher.rb +31 -0
  362. data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +38 -0
  363. data/lib/datadog/tracing/contrib/excon/ext.rb +21 -0
  364. data/lib/datadog/tracing/contrib/excon/integration.rb +48 -0
  365. data/lib/datadog/tracing/contrib/excon/middleware.rb +170 -0
  366. data/lib/datadog/tracing/contrib/excon/patcher.rb +31 -0
  367. data/lib/datadog/tracing/contrib/extensions.rb +197 -0
  368. data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +42 -0
  369. data/lib/datadog/tracing/contrib/faraday/connection.rb +22 -0
  370. data/lib/datadog/tracing/contrib/faraday/ext.rb +21 -0
  371. data/lib/datadog/tracing/contrib/faraday/integration.rb +48 -0
  372. data/lib/datadog/tracing/contrib/faraday/middleware.rb +93 -0
  373. data/lib/datadog/tracing/contrib/faraday/patcher.rb +56 -0
  374. data/lib/datadog/tracing/contrib/faraday/rack_builder.rb +22 -0
  375. data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +42 -0
  376. data/lib/datadog/tracing/contrib/grape/endpoint.rb +253 -0
  377. data/lib/datadog/tracing/contrib/grape/ext.rb +28 -0
  378. data/lib/datadog/tracing/contrib/grape/instrumentation.rb +37 -0
  379. data/lib/datadog/tracing/contrib/grape/integration.rb +44 -0
  380. data/lib/datadog/tracing/contrib/grape/patcher.rb +33 -0
  381. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +36 -0
  382. data/lib/datadog/tracing/contrib/graphql/ext.rb +19 -0
  383. data/lib/datadog/tracing/contrib/graphql/integration.rb +44 -0
  384. data/lib/datadog/tracing/contrib/graphql/patcher.rb +91 -0
  385. data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +37 -0
  386. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +84 -0
  387. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +90 -0
  388. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +104 -0
  389. data/lib/datadog/tracing/contrib/grpc/ext.rb +23 -0
  390. data/lib/datadog/tracing/contrib/grpc/integration.rb +43 -0
  391. data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +53 -0
  392. data/lib/datadog/tracing/contrib/grpc/patcher.rb +37 -0
  393. data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +44 -0
  394. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +37 -0
  395. data/lib/datadog/tracing/contrib/http/ext.rb +21 -0
  396. data/lib/datadog/tracing/contrib/http/instrumentation.rb +139 -0
  397. data/lib/datadog/tracing/contrib/http/integration.rb +49 -0
  398. data/lib/datadog/tracing/contrib/http/patcher.rb +30 -0
  399. data/lib/datadog/tracing/contrib/http_annotation_helper.rb +17 -0
  400. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +37 -0
  401. data/lib/datadog/tracing/contrib/httpclient/ext.rb +21 -0
  402. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +117 -0
  403. data/lib/datadog/tracing/contrib/httpclient/integration.rb +48 -0
  404. data/lib/datadog/tracing/contrib/httpclient/patcher.rb +42 -0
  405. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +37 -0
  406. data/lib/datadog/tracing/contrib/httprb/ext.rb +21 -0
  407. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +128 -0
  408. data/lib/datadog/tracing/contrib/httprb/integration.rb +48 -0
  409. data/lib/datadog/tracing/contrib/httprb/patcher.rb +42 -0
  410. data/lib/datadog/tracing/contrib/integration.rb +78 -0
  411. data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +35 -0
  412. data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +18 -0
  413. data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +18 -0
  414. data/lib/datadog/tracing/contrib/kafka/event.rb +52 -0
  415. data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +42 -0
  416. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +49 -0
  417. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +47 -0
  418. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +47 -0
  419. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/join_group.rb +37 -0
  420. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/leave_group.rb +37 -0
  421. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/sync_group.rb +37 -0
  422. data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +40 -0
  423. data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +43 -0
  424. data/lib/datadog/tracing/contrib/kafka/events.rb +48 -0
  425. data/lib/datadog/tracing/contrib/kafka/ext.rb +52 -0
  426. data/lib/datadog/tracing/contrib/kafka/integration.rb +44 -0
  427. data/lib/datadog/tracing/contrib/kafka/patcher.rb +29 -0
  428. data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +23 -0
  429. data/lib/datadog/tracing/contrib/lograge/ext.rb +15 -0
  430. data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +47 -0
  431. data/lib/datadog/tracing/contrib/lograge/integration.rb +50 -0
  432. data/lib/datadog/tracing/contrib/lograge/patcher.rb +29 -0
  433. data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +38 -0
  434. data/lib/datadog/tracing/contrib/mongodb/ext.rb +27 -0
  435. data/lib/datadog/tracing/contrib/mongodb/instrumentation.rb +47 -0
  436. data/lib/datadog/tracing/contrib/mongodb/integration.rb +48 -0
  437. data/lib/datadog/tracing/contrib/mongodb/parsers.rb +49 -0
  438. data/lib/datadog/tracing/contrib/mongodb/patcher.rb +34 -0
  439. data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +121 -0
  440. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +35 -0
  441. data/lib/datadog/tracing/contrib/mysql2/ext.rb +22 -0
  442. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +62 -0
  443. data/lib/datadog/tracing/contrib/mysql2/integration.rb +43 -0
  444. data/lib/datadog/tracing/contrib/mysql2/patcher.rb +31 -0
  445. data/lib/datadog/tracing/contrib/patchable.rb +109 -0
  446. data/lib/datadog/tracing/contrib/patcher.rb +74 -0
  447. data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +35 -0
  448. data/lib/datadog/tracing/contrib/presto/ext.rb +32 -0
  449. data/lib/datadog/tracing/contrib/presto/instrumentation.rb +125 -0
  450. data/lib/datadog/tracing/contrib/presto/integration.rb +43 -0
  451. data/lib/datadog/tracing/contrib/presto/patcher.rb +37 -0
  452. data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +40 -0
  453. data/lib/datadog/tracing/contrib/qless/ext.rb +26 -0
  454. data/lib/datadog/tracing/contrib/qless/integration.rb +43 -0
  455. data/lib/datadog/tracing/contrib/qless/patcher.rb +38 -0
  456. data/lib/datadog/tracing/contrib/qless/qless_job.rb +75 -0
  457. data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +32 -0
  458. data/lib/datadog/tracing/contrib/que/configuration/settings.rb +49 -0
  459. data/lib/datadog/tracing/contrib/que/ext.rb +34 -0
  460. data/lib/datadog/tracing/contrib/que/integration.rb +46 -0
  461. data/lib/datadog/tracing/contrib/que/patcher.rb +28 -0
  462. data/lib/datadog/tracing/contrib/que/tracer.rb +61 -0
  463. data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +35 -0
  464. data/lib/datadog/tracing/contrib/racecar/event.rb +79 -0
  465. data/lib/datadog/tracing/contrib/racecar/events/batch.rb +35 -0
  466. data/lib/datadog/tracing/contrib/racecar/events/consume.rb +35 -0
  467. data/lib/datadog/tracing/contrib/racecar/events/message.rb +35 -0
  468. data/lib/datadog/tracing/contrib/racecar/events.rb +36 -0
  469. data/lib/datadog/tracing/contrib/racecar/ext.rb +31 -0
  470. data/lib/datadog/tracing/contrib/racecar/integration.rb +44 -0
  471. data/lib/datadog/tracing/contrib/racecar/patcher.rb +29 -0
  472. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +51 -0
  473. data/lib/datadog/tracing/contrib/rack/ext.rb +25 -0
  474. data/lib/datadog/tracing/contrib/rack/integration.rb +50 -0
  475. data/lib/datadog/tracing/contrib/rack/middlewares.rb +255 -0
  476. data/lib/datadog/tracing/contrib/rack/patcher.rb +109 -0
  477. data/lib/datadog/tracing/contrib/rack/request_queue.rb +48 -0
  478. data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +12 -0
  479. data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +71 -0
  480. data/lib/datadog/tracing/contrib/rails/ext.rb +19 -0
  481. data/lib/datadog/tracing/contrib/rails/framework.rb +152 -0
  482. data/lib/datadog/tracing/contrib/rails/integration.rb +49 -0
  483. data/lib/datadog/tracing/contrib/rails/log_injection.rb +34 -0
  484. data/lib/datadog/tracing/contrib/rails/middlewares.rb +47 -0
  485. data/lib/datadog/tracing/contrib/rails/patcher.rb +121 -0
  486. data/lib/datadog/tracing/contrib/rails/railtie.rb +19 -0
  487. data/lib/datadog/tracing/contrib/rails/utils.rb +28 -0
  488. data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +36 -0
  489. data/lib/datadog/tracing/contrib/rake/ext.rb +26 -0
  490. data/lib/datadog/tracing/contrib/rake/instrumentation.rb +98 -0
  491. data/lib/datadog/tracing/contrib/rake/integration.rb +43 -0
  492. data/lib/datadog/tracing/contrib/rake/patcher.rb +34 -0
  493. data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +49 -0
  494. data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +40 -0
  495. data/lib/datadog/tracing/contrib/redis/ext.rb +26 -0
  496. data/lib/datadog/tracing/contrib/redis/instrumentation.rb +78 -0
  497. data/lib/datadog/tracing/contrib/redis/integration.rb +47 -0
  498. data/lib/datadog/tracing/contrib/redis/patcher.rb +35 -0
  499. data/lib/datadog/tracing/contrib/redis/quantize.rb +79 -0
  500. data/lib/datadog/tracing/contrib/redis/tags.rb +54 -0
  501. data/lib/datadog/tracing/contrib/redis/vendor/resolver.rb +162 -0
  502. data/lib/datadog/tracing/contrib/registerable.rb +50 -0
  503. data/lib/datadog/tracing/contrib/registry.rb +52 -0
  504. data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +37 -0
  505. data/lib/datadog/tracing/contrib/resque/ext.rb +21 -0
  506. data/lib/datadog/tracing/contrib/resque/integration.rb +48 -0
  507. data/lib/datadog/tracing/contrib/resque/patcher.rb +29 -0
  508. data/lib/datadog/tracing/contrib/resque/resque_job.rb +103 -0
  509. data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +36 -0
  510. data/lib/datadog/tracing/contrib/rest_client/ext.rb +21 -0
  511. data/lib/datadog/tracing/contrib/rest_client/integration.rb +43 -0
  512. data/lib/datadog/tracing/contrib/rest_client/patcher.rb +29 -0
  513. data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +105 -0
  514. data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +23 -0
  515. data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +15 -0
  516. data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +51 -0
  517. data/lib/datadog/tracing/contrib/semantic_logger/integration.rb +52 -0
  518. data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +29 -0
  519. data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +33 -0
  520. data/lib/datadog/tracing/contrib/sequel/database.rb +60 -0
  521. data/lib/datadog/tracing/contrib/sequel/dataset.rb +65 -0
  522. data/lib/datadog/tracing/contrib/sequel/ext.rb +22 -0
  523. data/lib/datadog/tracing/contrib/sequel/integration.rb +43 -0
  524. data/lib/datadog/tracing/contrib/sequel/patcher.rb +37 -0
  525. data/lib/datadog/tracing/contrib/sequel/utils.rb +87 -0
  526. data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +38 -0
  527. data/lib/datadog/tracing/contrib/shoryuken/ext.rb +25 -0
  528. data/lib/datadog/tracing/contrib/shoryuken/integration.rb +44 -0
  529. data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +28 -0
  530. data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +61 -0
  531. data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +53 -0
  532. data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +44 -0
  533. data/lib/datadog/tracing/contrib/sidekiq/ext.rb +38 -0
  534. data/lib/datadog/tracing/contrib/sidekiq/integration.rb +53 -0
  535. data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +71 -0
  536. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +34 -0
  537. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +34 -0
  538. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +33 -0
  539. data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +98 -0
  540. data/lib/datadog/tracing/contrib/sidekiq/tracing.rb +44 -0
  541. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +43 -0
  542. data/lib/datadog/tracing/contrib/sinatra/env.rb +66 -0
  543. data/lib/datadog/tracing/contrib/sinatra/ext.rb +32 -0
  544. data/lib/datadog/tracing/contrib/sinatra/framework.rb +118 -0
  545. data/lib/datadog/tracing/contrib/sinatra/headers.rb +35 -0
  546. data/lib/datadog/tracing/contrib/sinatra/integration.rb +43 -0
  547. data/lib/datadog/tracing/contrib/sinatra/patcher.rb +76 -0
  548. data/lib/datadog/tracing/contrib/sinatra/tracer.rb +159 -0
  549. data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +123 -0
  550. data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +38 -0
  551. data/lib/datadog/tracing/contrib/sneakers/ext.rb +26 -0
  552. data/lib/datadog/tracing/contrib/sneakers/integration.rb +46 -0
  553. data/lib/datadog/tracing/contrib/sneakers/patcher.rb +29 -0
  554. data/lib/datadog/tracing/contrib/sneakers/tracer.rb +58 -0
  555. data/lib/datadog/tracing/contrib/status_code_matcher.rb +75 -0
  556. data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +35 -0
  557. data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +28 -0
  558. data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +27 -0
  559. data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +105 -0
  560. data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +43 -0
  561. data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +37 -0
  562. data/lib/datadog/tracing/contrib/utils/database.rb +31 -0
  563. data/lib/datadog/tracing/contrib/utils/quantization/hash.rb +111 -0
  564. data/lib/datadog/tracing/contrib/utils/quantization/http.rb +99 -0
  565. data/lib/datadog/tracing/contrib.rb +76 -0
  566. data/lib/datadog/tracing/correlation.rb +100 -0
  567. data/lib/datadog/tracing/distributed/headers/b3.rb +55 -0
  568. data/lib/datadog/tracing/distributed/headers/b3_single.rb +67 -0
  569. data/lib/datadog/tracing/distributed/headers/datadog.rb +52 -0
  570. data/lib/datadog/tracing/distributed/headers/ext.rb +31 -0
  571. data/lib/datadog/tracing/distributed/helpers.rb +44 -0
  572. data/lib/datadog/tracing/distributed/parser.rb +70 -0
  573. data/lib/datadog/tracing/event.rb +78 -0
  574. data/lib/datadog/tracing/flush.rb +74 -0
  575. data/lib/datadog/tracing/metadata/analytics.rb +26 -0
  576. data/lib/datadog/tracing/metadata/errors.rb +24 -0
  577. data/lib/datadog/tracing/metadata/ext.rb +151 -0
  578. data/lib/datadog/tracing/metadata/tagging.rb +110 -0
  579. data/lib/datadog/tracing/metadata.rb +20 -0
  580. data/lib/datadog/tracing/pipeline/span_filter.rb +42 -0
  581. data/lib/datadog/tracing/pipeline/span_processor.rb +39 -0
  582. data/lib/datadog/tracing/pipeline.rb +65 -0
  583. data/lib/datadog/tracing/propagation/grpc.rb +88 -0
  584. data/lib/datadog/tracing/propagation/http.rb +109 -0
  585. data/lib/datadog/tracing/runtime/metrics.rb +19 -0
  586. data/lib/datadog/tracing/sampling/all_sampler.rb +25 -0
  587. data/lib/datadog/tracing/sampling/ext.rb +27 -0
  588. data/lib/datadog/tracing/sampling/matcher.rb +68 -0
  589. data/lib/datadog/tracing/sampling/priority_sampler.rb +112 -0
  590. data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +97 -0
  591. data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +41 -0
  592. data/lib/datadog/tracing/sampling/rate_limiter.rb +185 -0
  593. data/lib/datadog/tracing/sampling/rate_sampler.rb +55 -0
  594. data/lib/datadog/tracing/sampling/rule.rb +76 -0
  595. data/lib/datadog/tracing/sampling/rule_sampler.rb +131 -0
  596. data/lib/datadog/tracing/sampling/sampler.rb +44 -0
  597. data/lib/datadog/tracing/span.rb +212 -0
  598. data/lib/datadog/tracing/span_operation.rb +520 -0
  599. data/lib/datadog/tracing/sync_writer.rb +69 -0
  600. data/lib/datadog/tracing/trace_digest.rb +60 -0
  601. data/lib/datadog/tracing/trace_operation.rb +431 -0
  602. data/lib/datadog/tracing/trace_segment.rb +207 -0
  603. data/lib/datadog/tracing/tracer.rb +505 -0
  604. data/lib/datadog/tracing/workers/trace_writer.rb +195 -0
  605. data/lib/datadog/tracing/workers.rb +125 -0
  606. data/lib/datadog/tracing/writer.rb +180 -0
  607. data/lib/datadog/tracing.rb +142 -0
  608. data/lib/ddtrace/auto_instrument.rb +6 -2
  609. data/lib/ddtrace/auto_instrument_base.rb +1 -0
  610. data/lib/ddtrace/profiling/preload.rb +2 -2
  611. data/lib/ddtrace/transport/ext.rb +35 -0
  612. data/lib/ddtrace/transport/http/adapters/net.rb +3 -2
  613. data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
  614. data/lib/ddtrace/transport/http/adapters/test.rb +1 -0
  615. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +3 -2
  616. data/lib/ddtrace/transport/http/api/endpoint.rb +1 -0
  617. data/lib/ddtrace/transport/http/api/fallbacks.rb +1 -0
  618. data/lib/ddtrace/transport/http/api/instance.rb +1 -0
  619. data/lib/ddtrace/transport/http/api/map.rb +1 -0
  620. data/lib/ddtrace/transport/http/api/spec.rb +1 -0
  621. data/lib/ddtrace/transport/http/api.rb +5 -11
  622. data/lib/ddtrace/transport/http/builder.rb +3 -2
  623. data/lib/ddtrace/transport/http/client.rb +3 -1
  624. data/lib/ddtrace/transport/http/env.rb +1 -0
  625. data/lib/ddtrace/transport/http/response.rb +35 -4
  626. data/lib/ddtrace/transport/http/statistics.rb +1 -0
  627. data/lib/ddtrace/transport/http/traces.rb +3 -0
  628. data/lib/ddtrace/transport/http.rb +33 -28
  629. data/lib/ddtrace/transport/io/client.rb +4 -1
  630. data/lib/ddtrace/transport/io/response.rb +1 -0
  631. data/lib/ddtrace/transport/io/traces.rb +2 -1
  632. data/lib/ddtrace/transport/io.rb +3 -2
  633. data/lib/ddtrace/transport/parcel.rb +2 -0
  634. data/lib/ddtrace/transport/request.rb +1 -0
  635. data/lib/ddtrace/transport/response.rb +1 -0
  636. data/lib/ddtrace/transport/serializable_trace.rb +118 -0
  637. data/lib/ddtrace/transport/statistics.rb +6 -4
  638. data/lib/ddtrace/transport/trace_formatter.rb +187 -0
  639. data/lib/ddtrace/transport/traces.rb +15 -5
  640. data/lib/ddtrace/version.rb +14 -12
  641. data/lib/ddtrace.rb +9 -48
  642. metadata +604 -490
  643. data/.yardopts +0 -5
  644. data/lib/datadog/ci/context_flush.rb +0 -29
  645. data/lib/datadog/contrib.rb +0 -71
  646. data/lib/ddtrace/analytics.rb +0 -39
  647. data/lib/ddtrace/buffer.rb +0 -340
  648. data/lib/ddtrace/chunker.rb +0 -35
  649. data/lib/ddtrace/configuration/agent_settings_resolver.rb +0 -309
  650. data/lib/ddtrace/configuration/base.rb +0 -82
  651. data/lib/ddtrace/configuration/components.rb +0 -292
  652. data/lib/ddtrace/configuration/dependency_resolver.rb +0 -25
  653. data/lib/ddtrace/configuration/option.rb +0 -65
  654. data/lib/ddtrace/configuration/option_definition.rb +0 -122
  655. data/lib/ddtrace/configuration/option_definition_set.rb +0 -19
  656. data/lib/ddtrace/configuration/option_set.rb +0 -7
  657. data/lib/ddtrace/configuration/options.rb +0 -112
  658. data/lib/ddtrace/configuration/pin_setup.rb +0 -32
  659. data/lib/ddtrace/configuration/settings.rb +0 -413
  660. data/lib/ddtrace/configuration.rb +0 -195
  661. data/lib/ddtrace/context.rb +0 -334
  662. data/lib/ddtrace/context_flush.rb +0 -82
  663. data/lib/ddtrace/context_provider.rb +0 -62
  664. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +0 -31
  665. data/lib/ddtrace/contrib/action_cable/event.rb +0 -67
  666. data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +0 -50
  667. data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +0 -56
  668. data/lib/ddtrace/contrib/action_cable/events/transmit.rb +0 -51
  669. data/lib/ddtrace/contrib/action_cable/events.rb +0 -34
  670. data/lib/ddtrace/contrib/action_cable/ext.rb +0 -27
  671. data/lib/ddtrace/contrib/action_cable/instrumentation.rb +0 -78
  672. data/lib/ddtrace/contrib/action_cable/integration.rb +0 -46
  673. data/lib/ddtrace/contrib/action_cable/patcher.rb +0 -29
  674. data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +0 -32
  675. data/lib/ddtrace/contrib/action_mailer/event.rb +0 -50
  676. data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +0 -54
  677. data/lib/ddtrace/contrib/action_mailer/events/process.rb +0 -41
  678. data/lib/ddtrace/contrib/action_mailer/events.rb +0 -31
  679. data/lib/ddtrace/contrib/action_mailer/ext.rb +0 -32
  680. data/lib/ddtrace/contrib/action_mailer/integration.rb +0 -45
  681. data/lib/ddtrace/contrib/action_mailer/patcher.rb +0 -27
  682. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +0 -157
  683. data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +0 -26
  684. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +0 -33
  685. data/lib/ddtrace/contrib/action_pack/ext.rb +0 -20
  686. data/lib/ddtrace/contrib/action_pack/integration.rb +0 -46
  687. data/lib/ddtrace/contrib/action_pack/patcher.rb +0 -24
  688. data/lib/ddtrace/contrib/action_pack/utils.rb +0 -37
  689. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +0 -32
  690. data/lib/ddtrace/contrib/action_view/event.rb +0 -36
  691. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +0 -47
  692. data/lib/ddtrace/contrib/action_view/events/render_template.rb +0 -50
  693. data/lib/ddtrace/contrib/action_view/events.rb +0 -31
  694. data/lib/ddtrace/contrib/action_view/ext.rb +0 -21
  695. data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +0 -75
  696. data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +0 -168
  697. data/lib/ddtrace/contrib/action_view/integration.rb +0 -53
  698. data/lib/ddtrace/contrib/action_view/patcher.rb +0 -48
  699. data/lib/ddtrace/contrib/action_view/utils.rb +0 -33
  700. data/lib/ddtrace/contrib/active_job/configuration/settings.rb +0 -33
  701. data/lib/ddtrace/contrib/active_job/event.rb +0 -54
  702. data/lib/ddtrace/contrib/active_job/events/discard.rb +0 -46
  703. data/lib/ddtrace/contrib/active_job/events/enqueue.rb +0 -45
  704. data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +0 -45
  705. data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +0 -47
  706. data/lib/ddtrace/contrib/active_job/events/perform.rb +0 -45
  707. data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +0 -46
  708. data/lib/ddtrace/contrib/active_job/events.rb +0 -39
  709. data/lib/ddtrace/contrib/active_job/ext.rb +0 -32
  710. data/lib/ddtrace/contrib/active_job/integration.rb +0 -46
  711. data/lib/ddtrace/contrib/active_job/log_injection.rb +0 -21
  712. data/lib/ddtrace/contrib/active_job/patcher.rb +0 -33
  713. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +0 -31
  714. data/lib/ddtrace/contrib/active_model_serializers/event.rb +0 -69
  715. data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +0 -33
  716. data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +0 -36
  717. data/lib/ddtrace/contrib/active_model_serializers/events.rb +0 -31
  718. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +0 -21
  719. data/lib/ddtrace/contrib/active_model_serializers/integration.rb +0 -41
  720. data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +0 -30
  721. data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +0 -31
  722. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +0 -135
  723. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +0 -36
  724. data/lib/ddtrace/contrib/active_record/event.rb +0 -31
  725. data/lib/ddtrace/contrib/active_record/events/instantiation.rb +0 -61
  726. data/lib/ddtrace/contrib/active_record/events/sql.rb +0 -69
  727. data/lib/ddtrace/contrib/active_record/events.rb +0 -31
  728. data/lib/ddtrace/contrib/active_record/ext.rb +0 -25
  729. data/lib/ddtrace/contrib/active_record/integration.rb +0 -54
  730. data/lib/ddtrace/contrib/active_record/patcher.rb +0 -24
  731. data/lib/ddtrace/contrib/active_record/utils.rb +0 -124
  732. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +0 -259
  733. data/lib/ddtrace/contrib/active_support/cache/patcher.rb +0 -70
  734. data/lib/ddtrace/contrib/active_support/cache/redis.rb +0 -44
  735. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +0 -31
  736. data/lib/ddtrace/contrib/active_support/ext.rb +0 -28
  737. data/lib/ddtrace/contrib/active_support/integration.rb +0 -47
  738. data/lib/ddtrace/contrib/active_support/notifications/event.rb +0 -76
  739. data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +0 -68
  740. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +0 -164
  741. data/lib/ddtrace/contrib/active_support/patcher.rb +0 -24
  742. data/lib/ddtrace/contrib/analytics.rb +0 -25
  743. data/lib/ddtrace/contrib/auto_instrument.rb +0 -48
  744. data/lib/ddtrace/contrib/aws/configuration/settings.rb +0 -31
  745. data/lib/ddtrace/contrib/aws/ext.rb +0 -24
  746. data/lib/ddtrace/contrib/aws/instrumentation.rb +0 -91
  747. data/lib/ddtrace/contrib/aws/integration.rb +0 -43
  748. data/lib/ddtrace/contrib/aws/parsed_context.rb +0 -57
  749. data/lib/ddtrace/contrib/aws/patcher.rb +0 -54
  750. data/lib/ddtrace/contrib/aws/services.rb +0 -119
  751. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +0 -21
  752. data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +0 -42
  753. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +0 -13
  754. data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +0 -24
  755. data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +0 -39
  756. data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +0 -30
  757. data/lib/ddtrace/contrib/configurable.rb +0 -103
  758. data/lib/ddtrace/contrib/configuration/resolver.rb +0 -82
  759. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +0 -40
  760. data/lib/ddtrace/contrib/configuration/settings.rb +0 -56
  761. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +0 -31
  762. data/lib/ddtrace/contrib/dalli/ext.rb +0 -21
  763. data/lib/ddtrace/contrib/dalli/instrumentation.rb +0 -55
  764. data/lib/ddtrace/contrib/dalli/integration.rb +0 -39
  765. data/lib/ddtrace/contrib/dalli/patcher.rb +0 -26
  766. data/lib/ddtrace/contrib/dalli/quantize.rb +0 -23
  767. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +0 -33
  768. data/lib/ddtrace/contrib/delayed_job/ext.rb +0 -24
  769. data/lib/ddtrace/contrib/delayed_job/integration.rb +0 -39
  770. data/lib/ddtrace/contrib/delayed_job/patcher.rb +0 -29
  771. data/lib/ddtrace/contrib/delayed_job/plugin.rb +0 -85
  772. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +0 -32
  773. data/lib/ddtrace/contrib/elasticsearch/ext.rb +0 -23
  774. data/lib/ddtrace/contrib/elasticsearch/integration.rb +0 -40
  775. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +0 -123
  776. data/lib/ddtrace/contrib/elasticsearch/quantize.rb +0 -84
  777. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +0 -33
  778. data/lib/ddtrace/contrib/ethon/easy_patch.rb +0 -152
  779. data/lib/ddtrace/contrib/ethon/ext.rb +0 -20
  780. data/lib/ddtrace/contrib/ethon/integration.rb +0 -44
  781. data/lib/ddtrace/contrib/ethon/multi_patch.rb +0 -85
  782. data/lib/ddtrace/contrib/ethon/patcher.rb +0 -27
  783. data/lib/ddtrace/contrib/excon/configuration/settings.rb +0 -34
  784. data/lib/ddtrace/contrib/excon/ext.rb +0 -18
  785. data/lib/ddtrace/contrib/excon/integration.rb +0 -44
  786. data/lib/ddtrace/contrib/excon/middleware.rb +0 -164
  787. data/lib/ddtrace/contrib/excon/patcher.rb +0 -28
  788. data/lib/ddtrace/contrib/extensions.rb +0 -169
  789. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +0 -39
  790. data/lib/ddtrace/contrib/faraday/connection.rb +0 -19
  791. data/lib/ddtrace/contrib/faraday/ext.rb +0 -18
  792. data/lib/ddtrace/contrib/faraday/integration.rb +0 -44
  793. data/lib/ddtrace/contrib/faraday/middleware.rb +0 -86
  794. data/lib/ddtrace/contrib/faraday/patcher.rb +0 -54
  795. data/lib/ddtrace/contrib/faraday/rack_builder.rb +0 -19
  796. data/lib/ddtrace/contrib/grape/configuration/settings.rb +0 -39
  797. data/lib/ddtrace/contrib/grape/endpoint.rb +0 -246
  798. data/lib/ddtrace/contrib/grape/ext.rb +0 -24
  799. data/lib/ddtrace/contrib/grape/instrumentation.rb +0 -34
  800. data/lib/ddtrace/contrib/grape/integration.rb +0 -40
  801. data/lib/ddtrace/contrib/grape/patcher.rb +0 -32
  802. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +0 -33
  803. data/lib/ddtrace/contrib/graphql/ext.rb +0 -17
  804. data/lib/ddtrace/contrib/graphql/integration.rb +0 -40
  805. data/lib/ddtrace/contrib/graphql/patcher.rb +0 -61
  806. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +0 -32
  807. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +0 -59
  808. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +0 -80
  809. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +0 -79
  810. data/lib/ddtrace/contrib/grpc/ext.rb +0 -19
  811. data/lib/ddtrace/contrib/grpc/integration.rb +0 -39
  812. data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +0 -50
  813. data/lib/ddtrace/contrib/grpc/patcher.rb +0 -34
  814. data/lib/ddtrace/contrib/http/circuit_breaker.rb +0 -38
  815. data/lib/ddtrace/contrib/http/configuration/settings.rb +0 -33
  816. data/lib/ddtrace/contrib/http/ext.rb +0 -18
  817. data/lib/ddtrace/contrib/http/instrumentation.rb +0 -180
  818. data/lib/ddtrace/contrib/http/integration.rb +0 -46
  819. data/lib/ddtrace/contrib/http/patcher.rb +0 -27
  820. data/lib/ddtrace/contrib/http_annotation_helper.rb +0 -11
  821. data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +0 -33
  822. data/lib/ddtrace/contrib/httpclient/ext.rb +0 -18
  823. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +0 -148
  824. data/lib/ddtrace/contrib/httpclient/integration.rb +0 -44
  825. data/lib/ddtrace/contrib/httpclient/patcher.rb +0 -39
  826. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +0 -33
  827. data/lib/ddtrace/contrib/httprb/ext.rb +0 -18
  828. data/lib/ddtrace/contrib/httprb/instrumentation.rb +0 -158
  829. data/lib/ddtrace/contrib/httprb/integration.rb +0 -44
  830. data/lib/ddtrace/contrib/httprb/patcher.rb +0 -39
  831. data/lib/ddtrace/contrib/integration.rb +0 -17
  832. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +0 -31
  833. data/lib/ddtrace/contrib/kafka/consumer_event.rb +0 -15
  834. data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +0 -15
  835. data/lib/ddtrace/contrib/kafka/event.rb +0 -52
  836. data/lib/ddtrace/contrib/kafka/events/connection/request.rb +0 -35
  837. data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +0 -42
  838. data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +0 -40
  839. data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +0 -40
  840. data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +0 -30
  841. data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +0 -30
  842. data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +0 -30
  843. data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +0 -33
  844. data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +0 -36
  845. data/lib/ddtrace/contrib/kafka/events.rb +0 -45
  846. data/lib/ddtrace/contrib/kafka/ext.rb +0 -42
  847. data/lib/ddtrace/contrib/kafka/integration.rb +0 -40
  848. data/lib/ddtrace/contrib/kafka/patcher.rb +0 -27
  849. data/lib/ddtrace/contrib/lograge/configuration/settings.rb +0 -19
  850. data/lib/ddtrace/contrib/lograge/ext.rb +0 -11
  851. data/lib/ddtrace/contrib/lograge/instrumentation.rb +0 -39
  852. data/lib/ddtrace/contrib/lograge/integration.rb +0 -46
  853. data/lib/ddtrace/contrib/lograge/patcher.rb +0 -26
  854. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +0 -34
  855. data/lib/ddtrace/contrib/mongodb/ext.rb +0 -24
  856. data/lib/ddtrace/contrib/mongodb/instrumentation.rb +0 -70
  857. data/lib/ddtrace/contrib/mongodb/integration.rb +0 -44
  858. data/lib/ddtrace/contrib/mongodb/parsers.rb +0 -69
  859. data/lib/ddtrace/contrib/mongodb/patcher.rb +0 -32
  860. data/lib/ddtrace/contrib/mongodb/subscribers.rb +0 -112
  861. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +0 -31
  862. data/lib/ddtrace/contrib/mysql2/ext.rb +0 -19
  863. data/lib/ddtrace/contrib/mysql2/instrumentation.rb +0 -65
  864. data/lib/ddtrace/contrib/mysql2/integration.rb +0 -39
  865. data/lib/ddtrace/contrib/mysql2/patcher.rb +0 -28
  866. data/lib/ddtrace/contrib/patchable.rb +0 -71
  867. data/lib/ddtrace/contrib/patcher.rb +0 -66
  868. data/lib/ddtrace/contrib/presto/configuration/settings.rb +0 -31
  869. data/lib/ddtrace/contrib/presto/ext.rb +0 -29
  870. data/lib/ddtrace/contrib/presto/instrumentation.rb +0 -111
  871. data/lib/ddtrace/contrib/presto/integration.rb +0 -39
  872. data/lib/ddtrace/contrib/presto/patcher.rb +0 -34
  873. data/lib/ddtrace/contrib/qless/configuration/settings.rb +0 -36
  874. data/lib/ddtrace/contrib/qless/ext.rb +0 -21
  875. data/lib/ddtrace/contrib/qless/integration.rb +0 -39
  876. data/lib/ddtrace/contrib/qless/patcher.rb +0 -35
  877. data/lib/ddtrace/contrib/qless/qless_job.rb +0 -74
  878. data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +0 -34
  879. data/lib/ddtrace/contrib/que/configuration/settings.rb +0 -44
  880. data/lib/ddtrace/contrib/que/ext.rb +0 -31
  881. data/lib/ddtrace/contrib/que/integration.rb +0 -43
  882. data/lib/ddtrace/contrib/que/patcher.rb +0 -25
  883. data/lib/ddtrace/contrib/que/tracer.rb +0 -58
  884. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +0 -31
  885. data/lib/ddtrace/contrib/racecar/event.rb +0 -77
  886. data/lib/ddtrace/contrib/racecar/events/batch.rb +0 -28
  887. data/lib/ddtrace/contrib/racecar/events/consume.rb +0 -28
  888. data/lib/ddtrace/contrib/racecar/events/message.rb +0 -28
  889. data/lib/ddtrace/contrib/racecar/events.rb +0 -33
  890. data/lib/ddtrace/contrib/racecar/ext.rb +0 -26
  891. data/lib/ddtrace/contrib/racecar/integration.rb +0 -40
  892. data/lib/ddtrace/contrib/racecar/patcher.rb +0 -27
  893. data/lib/ddtrace/contrib/rack/configuration/settings.rb +0 -47
  894. data/lib/ddtrace/contrib/rack/ext.rb +0 -22
  895. data/lib/ddtrace/contrib/rack/integration.rb +0 -46
  896. data/lib/ddtrace/contrib/rack/middlewares.rb +0 -288
  897. data/lib/ddtrace/contrib/rack/patcher.rb +0 -106
  898. data/lib/ddtrace/contrib/rack/request_queue.rb +0 -45
  899. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +0 -10
  900. data/lib/ddtrace/contrib/rails/configuration/settings.rb +0 -101
  901. data/lib/ddtrace/contrib/rails/ext.rb +0 -18
  902. data/lib/ddtrace/contrib/rails/framework.rb +0 -172
  903. data/lib/ddtrace/contrib/rails/integration.rb +0 -45
  904. data/lib/ddtrace/contrib/rails/log_injection.rb +0 -42
  905. data/lib/ddtrace/contrib/rails/middlewares.rb +0 -44
  906. data/lib/ddtrace/contrib/rails/patcher.rb +0 -119
  907. data/lib/ddtrace/contrib/rails/railtie.rb +0 -18
  908. data/lib/ddtrace/contrib/rails/utils.rb +0 -25
  909. data/lib/ddtrace/contrib/rake/configuration/settings.rb +0 -32
  910. data/lib/ddtrace/contrib/rake/ext.rb +0 -22
  911. data/lib/ddtrace/contrib/rake/instrumentation.rb +0 -91
  912. data/lib/ddtrace/contrib/rake/integration.rb +0 -39
  913. data/lib/ddtrace/contrib/rake/patcher.rb +0 -31
  914. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +0 -46
  915. data/lib/ddtrace/contrib/redis/configuration/settings.rb +0 -36
  916. data/lib/ddtrace/contrib/redis/ext.rb +0 -23
  917. data/lib/ddtrace/contrib/redis/instrumentation.rb +0 -90
  918. data/lib/ddtrace/contrib/redis/integration.rb +0 -43
  919. data/lib/ddtrace/contrib/redis/patcher.rb +0 -33
  920. data/lib/ddtrace/contrib/redis/quantize.rb +0 -76
  921. data/lib/ddtrace/contrib/redis/tags.rb +0 -47
  922. data/lib/ddtrace/contrib/redis/vendor/resolver.rb +0 -159
  923. data/lib/ddtrace/contrib/registerable.rb +0 -33
  924. data/lib/ddtrace/contrib/registry.rb +0 -43
  925. data/lib/ddtrace/contrib/resque/configuration/settings.rb +0 -49
  926. data/lib/ddtrace/contrib/resque/ext.rb +0 -18
  927. data/lib/ddtrace/contrib/resque/integration.rb +0 -44
  928. data/lib/ddtrace/contrib/resque/patcher.rb +0 -30
  929. data/lib/ddtrace/contrib/resque/resque_job.rb +0 -104
  930. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +0 -32
  931. data/lib/ddtrace/contrib/rest_client/ext.rb +0 -18
  932. data/lib/ddtrace/contrib/rest_client/integration.rb +0 -39
  933. data/lib/ddtrace/contrib/rest_client/patcher.rb +0 -25
  934. data/lib/ddtrace/contrib/rest_client/request_patch.rb +0 -92
  935. data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +0 -19
  936. data/lib/ddtrace/contrib/semantic_logger/ext.rb +0 -11
  937. data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +0 -43
  938. data/lib/ddtrace/contrib/semantic_logger/integration.rb +0 -48
  939. data/lib/ddtrace/contrib/semantic_logger/patcher.rb +0 -26
  940. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +0 -29
  941. data/lib/ddtrace/contrib/sequel/database.rb +0 -64
  942. data/lib/ddtrace/contrib/sequel/dataset.rb +0 -64
  943. data/lib/ddtrace/contrib/sequel/ext.rb +0 -20
  944. data/lib/ddtrace/contrib/sequel/integration.rb +0 -39
  945. data/lib/ddtrace/contrib/sequel/patcher.rb +0 -34
  946. data/lib/ddtrace/contrib/sequel/utils.rb +0 -75
  947. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +0 -32
  948. data/lib/ddtrace/contrib/shoryuken/ext.rb +0 -22
  949. data/lib/ddtrace/contrib/shoryuken/integration.rb +0 -40
  950. data/lib/ddtrace/contrib/shoryuken/patcher.rb +0 -25
  951. data/lib/ddtrace/contrib/shoryuken/tracer.rb +0 -56
  952. data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +0 -44
  953. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +0 -38
  954. data/lib/ddtrace/contrib/sidekiq/ext.rb +0 -31
  955. data/lib/ddtrace/contrib/sidekiq/integration.rb +0 -49
  956. data/lib/ddtrace/contrib/sidekiq/patcher.rb +0 -68
  957. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +0 -30
  958. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +0 -30
  959. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +0 -29
  960. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +0 -66
  961. data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -45
  962. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +0 -40
  963. data/lib/ddtrace/contrib/sinatra/env.rb +0 -59
  964. data/lib/ddtrace/contrib/sinatra/ext.rb +0 -28
  965. data/lib/ddtrace/contrib/sinatra/headers.rb +0 -30
  966. data/lib/ddtrace/contrib/sinatra/integration.rb +0 -39
  967. data/lib/ddtrace/contrib/sinatra/patcher.rb +0 -30
  968. data/lib/ddtrace/contrib/sinatra/tracer.rb +0 -150
  969. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +0 -112
  970. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +0 -34
  971. data/lib/ddtrace/contrib/sneakers/ext.rb +0 -23
  972. data/lib/ddtrace/contrib/sneakers/integration.rb +0 -42
  973. data/lib/ddtrace/contrib/sneakers/patcher.rb +0 -25
  974. data/lib/ddtrace/contrib/sneakers/tracer.rb +0 -54
  975. data/lib/ddtrace/contrib/status_code_matcher.rb +0 -70
  976. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +0 -31
  977. data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +0 -25
  978. data/lib/ddtrace/contrib/sucker_punch/ext.rb +0 -22
  979. data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +0 -89
  980. data/lib/ddtrace/contrib/sucker_punch/integration.rb +0 -39
  981. data/lib/ddtrace/contrib/sucker_punch/patcher.rb +0 -44
  982. data/lib/ddtrace/correlation.rb +0 -40
  983. data/lib/ddtrace/diagnostics/environment_logger.rb +0 -280
  984. data/lib/ddtrace/diagnostics/health.rb +0 -34
  985. data/lib/ddtrace/distributed_tracing/headers/b3.rb +0 -45
  986. data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +0 -57
  987. data/lib/ddtrace/distributed_tracing/headers/datadog.rb +0 -43
  988. data/lib/ddtrace/distributed_tracing/headers/headers.rb +0 -72
  989. data/lib/ddtrace/distributed_tracing/headers/helpers.rb +0 -44
  990. data/lib/ddtrace/encoding.rb +0 -72
  991. data/lib/ddtrace/error.rb +0 -97
  992. data/lib/ddtrace/event.rb +0 -53
  993. data/lib/ddtrace/ext/analytics.rb +0 -13
  994. data/lib/ddtrace/ext/app_types.rb +0 -12
  995. data/lib/ddtrace/ext/correlation.rb +0 -12
  996. data/lib/ddtrace/ext/diagnostics.rb +0 -37
  997. data/lib/ddtrace/ext/distributed.rb +0 -40
  998. data/lib/ddtrace/ext/environment.rb +0 -24
  999. data/lib/ddtrace/ext/errors.rb +0 -11
  1000. data/lib/ddtrace/ext/forced_tracing.rb +0 -26
  1001. data/lib/ddtrace/ext/git.rb +0 -32
  1002. data/lib/ddtrace/ext/http.rb +0 -47
  1003. data/lib/ddtrace/ext/integration.rb +0 -9
  1004. data/lib/ddtrace/ext/manual_tracing.rb +0 -10
  1005. data/lib/ddtrace/ext/metrics.rb +0 -16
  1006. data/lib/ddtrace/ext/net.rb +0 -11
  1007. data/lib/ddtrace/ext/priority.rb +0 -19
  1008. data/lib/ddtrace/ext/profiling.rb +0 -57
  1009. data/lib/ddtrace/ext/runtime.rb +0 -25
  1010. data/lib/ddtrace/ext/sampling.rb +0 -17
  1011. data/lib/ddtrace/ext/sql.rb +0 -9
  1012. data/lib/ddtrace/ext/test.rb +0 -9
  1013. data/lib/ddtrace/ext/transport.rb +0 -32
  1014. data/lib/ddtrace/forced_tracing.rb +0 -39
  1015. data/lib/ddtrace/logger.rb +0 -41
  1016. data/lib/ddtrace/metrics.rb +0 -282
  1017. data/lib/ddtrace/opentelemetry/extensions.rb +0 -14
  1018. data/lib/ddtrace/opentelemetry/span.rb +0 -34
  1019. data/lib/ddtrace/opentracer/binary_propagator.rb +0 -25
  1020. data/lib/ddtrace/opentracer/carrier.rb +0 -7
  1021. data/lib/ddtrace/opentracer/distributed_headers.rb +0 -56
  1022. data/lib/ddtrace/opentracer/global_tracer.rb +0 -16
  1023. data/lib/ddtrace/opentracer/propagator.rb +0 -23
  1024. data/lib/ddtrace/opentracer/rack_propagator.rb +0 -61
  1025. data/lib/ddtrace/opentracer/scope.rb +0 -16
  1026. data/lib/ddtrace/opentracer/scope_manager.rb +0 -7
  1027. data/lib/ddtrace/opentracer/span.rb +0 -95
  1028. data/lib/ddtrace/opentracer/span_context.rb +0 -15
  1029. data/lib/ddtrace/opentracer/span_context_factory.rb +0 -24
  1030. data/lib/ddtrace/opentracer/text_map_propagator.rb +0 -76
  1031. data/lib/ddtrace/opentracer/thread_local_scope.rb +0 -32
  1032. data/lib/ddtrace/opentracer/thread_local_scope_manager.rb +0 -41
  1033. data/lib/ddtrace/opentracer/tracer.rb +0 -209
  1034. data/lib/ddtrace/opentracer.rb +0 -22
  1035. data/lib/ddtrace/patcher.rb +0 -69
  1036. data/lib/ddtrace/pin.rb +0 -86
  1037. data/lib/ddtrace/pipeline/span_filter.rb +0 -39
  1038. data/lib/ddtrace/pipeline/span_processor.rb +0 -21
  1039. data/lib/ddtrace/pipeline.rb +0 -47
  1040. data/lib/ddtrace/profiling/backtrace_location.rb +0 -33
  1041. data/lib/ddtrace/profiling/buffer.rb +0 -42
  1042. data/lib/ddtrace/profiling/collectors/stack.rb +0 -301
  1043. data/lib/ddtrace/profiling/encoding/profile.rb +0 -46
  1044. data/lib/ddtrace/profiling/event.rb +0 -14
  1045. data/lib/ddtrace/profiling/events/stack.rb +0 -81
  1046. data/lib/ddtrace/profiling/exporter.rb +0 -24
  1047. data/lib/ddtrace/profiling/ext/forking.rb +0 -98
  1048. data/lib/ddtrace/profiling/flush.rb +0 -44
  1049. data/lib/ddtrace/profiling/native_extension.rb +0 -40
  1050. data/lib/ddtrace/profiling/pprof/builder.rb +0 -126
  1051. data/lib/ddtrace/profiling/pprof/converter.rb +0 -103
  1052. data/lib/ddtrace/profiling/pprof/message_set.rb +0 -15
  1053. data/lib/ddtrace/profiling/pprof/payload.rb +0 -19
  1054. data/lib/ddtrace/profiling/pprof/pprof_pb.rb +0 -82
  1055. data/lib/ddtrace/profiling/pprof/stack_sample.rb +0 -140
  1056. data/lib/ddtrace/profiling/pprof/string_table.rb +0 -11
  1057. data/lib/ddtrace/profiling/pprof/template.rb +0 -119
  1058. data/lib/ddtrace/profiling/profiler.rb +0 -31
  1059. data/lib/ddtrace/profiling/recorder.rb +0 -96
  1060. data/lib/ddtrace/profiling/scheduler.rb +0 -134
  1061. data/lib/ddtrace/profiling/tasks/setup.rb +0 -90
  1062. data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +0 -42
  1063. data/lib/ddtrace/profiling/trace_identifiers/helper.rb +0 -46
  1064. data/lib/ddtrace/profiling/transport/client.rb +0 -15
  1065. data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +0 -101
  1066. data/lib/ddtrace/profiling/transport/http/api/instance.rb +0 -37
  1067. data/lib/ddtrace/profiling/transport/http/api/spec.rb +0 -41
  1068. data/lib/ddtrace/profiling/transport/http/api.rb +0 -44
  1069. data/lib/ddtrace/profiling/transport/http/builder.rb +0 -29
  1070. data/lib/ddtrace/profiling/transport/http/client.rb +0 -34
  1071. data/lib/ddtrace/profiling/transport/http/response.rb +0 -22
  1072. data/lib/ddtrace/profiling/transport/http.rb +0 -111
  1073. data/lib/ddtrace/profiling/transport/io/client.rb +0 -28
  1074. data/lib/ddtrace/profiling/transport/io/response.rb +0 -17
  1075. data/lib/ddtrace/profiling/transport/io.rb +0 -31
  1076. data/lib/ddtrace/profiling/transport/parcel.rb +0 -18
  1077. data/lib/ddtrace/profiling/transport/request.rb +0 -16
  1078. data/lib/ddtrace/profiling/transport/response.rb +0 -9
  1079. data/lib/ddtrace/profiling.rb +0 -149
  1080. data/lib/ddtrace/propagation/grpc_propagator.rb +0 -75
  1081. data/lib/ddtrace/propagation/http_propagator.rb +0 -91
  1082. data/lib/ddtrace/quantization/hash.rb +0 -104
  1083. data/lib/ddtrace/quantization/http.rb +0 -90
  1084. data/lib/ddtrace/runtime/metrics.rb +0 -135
  1085. data/lib/ddtrace/sampler.rb +0 -303
  1086. data/lib/ddtrace/sampling/matcher.rb +0 -58
  1087. data/lib/ddtrace/sampling/rate_limiter.rb +0 -177
  1088. data/lib/ddtrace/sampling/rule.rb +0 -62
  1089. data/lib/ddtrace/sampling/rule_sampler.rb +0 -133
  1090. data/lib/ddtrace/sampling.rb +0 -3
  1091. data/lib/ddtrace/span.rb +0 -445
  1092. data/lib/ddtrace/sync_writer.rb +0 -69
  1093. data/lib/ddtrace/tasks/exec.rb +0 -47
  1094. data/lib/ddtrace/tasks/help.rb +0 -15
  1095. data/lib/ddtrace/tracer.rb +0 -449
  1096. data/lib/ddtrace/utils/compression.rb +0 -28
  1097. data/lib/ddtrace/utils/database.rb +0 -26
  1098. data/lib/ddtrace/utils/forking.rb +0 -53
  1099. data/lib/ddtrace/utils/object_set.rb +0 -40
  1100. data/lib/ddtrace/utils/only_once.rb +0 -41
  1101. data/lib/ddtrace/utils/sequence.rb +0 -18
  1102. data/lib/ddtrace/utils/string_table.rb +0 -46
  1103. data/lib/ddtrace/utils/time.rb +0 -51
  1104. data/lib/ddtrace/utils.rb +0 -80
  1105. data/lib/ddtrace/vendor/active_record/connection_specification.rb +0 -302
  1106. data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +0 -117
  1107. data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +0 -58
  1108. data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +0 -136
  1109. data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +0 -10
  1110. data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +0 -9
  1111. data/lib/ddtrace/vendor/multipart-post/multipart.rb +0 -13
  1112. data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +0 -33
  1113. data/lib/ddtrace/worker.rb +0 -21
  1114. data/lib/ddtrace/workers/async.rb +0 -175
  1115. data/lib/ddtrace/workers/loop.rb +0 -132
  1116. data/lib/ddtrace/workers/polling.rb +0 -56
  1117. data/lib/ddtrace/workers/queue.rb +0 -41
  1118. data/lib/ddtrace/workers/runtime_metrics.rb +0 -65
  1119. data/lib/ddtrace/workers/trace_writer.rb +0 -200
  1120. data/lib/ddtrace/workers.rb +0 -123
  1121. data/lib/ddtrace/writer.rb +0 -200
  1122. /data/lib/{ddtrace → datadog/core}/vendor/multipart-post/LICENSE +0 -0
  1123. /data/lib/{ddtrace → datadog}/profiling/pprof/pprof.proto +0 -0
  1124. /data/lib/{ddtrace/vendor/active_record → datadog/tracing/contrib/active_record/vendor}/MIT-LICENSE +0 -0
  1125. /data/lib/{ddtrace → datadog/tracing}/contrib/redis/vendor/LICENSE +0 -0
@@ -1,3 +1,5 @@
1
+ ***Version 1.0.0 has been released. Check out our [upgrade guide](https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide.md#from-0x-to-10) for more details.***
2
+
1
3
  # Datadog Ruby Trace Client
2
4
 
3
5
  `ddtrace` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
@@ -9,6 +11,8 @@ For the general APM documentation, see our [setup documentation][setup docs].
9
11
 
10
12
  For more information about what APM looks like once your application is sending information to Datadog, take a look at [Visualizing your APM data][visualization docs].
11
13
 
14
+ For the library API documentation, see our [YARD documentation][yard docs].
15
+
12
16
  To contribute, check out the [contribution guidelines][contribution docs] and [development guide][development docs].
13
17
 
14
18
  [setup docs]: https://docs.datadoghq.com/tracing/
@@ -16,22 +20,27 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
16
20
  [visualization docs]: https://docs.datadoghq.com/tracing/visualization/
17
21
  [contribution docs]: https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md
18
22
  [development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/docs/DevelopmentGuide.md
23
+ [yard docs]: https://www.rubydoc.info/gems/ddtrace/
19
24
 
20
25
  ## Table of Contents
21
26
 
22
27
  - [Compatibility](#compatibility)
23
28
  - [Installation](#installation)
24
- - [Quickstart for Rails applications](#quickstart-for-rails-applications)
25
- - [Quickstart for Ruby applications](#quickstart-for-ruby-applications)
26
- - [Quickstart for OpenTracing](#quickstart-for-opentracing)
29
+ - [Setup the Datadog Agent for tracing](#setup-the-datadog-agent-for-tracing)
30
+ - [Instrument your application](#instrument-your-application)
31
+ - [Rails applications](#rails-applications)
32
+ - [Ruby applications](#ruby-applications)
33
+ - [Configuring OpenTracing](#configuring-opentracing)
34
+ - [Configuring OpenTelemetry](#configuring-opentelemetry)
35
+ - [Connect your application to the Datadog Agent](#connect-your-application-to-the-datadog-agent)
27
36
  - [Manual instrumentation](#manual-instrumentation)
28
37
  - [Integration instrumentation](#integration-instrumentation)
29
38
  - [Action Cable](#action-cable)
30
- - [Action View](#action-view)
31
39
  - [Action Mailer](#action-mailer)
32
- - [Active Model Serializers](#active-model-serializers)
33
40
  - [Action Pack](#action-pack)
41
+ - [Action View](#action-view)
34
42
  - [Active Job](#active-job)
43
+ - [Active Model Serializers](#active-model-serializers)
35
44
  - [Active Record](#active-record)
36
45
  - [Active Support](#active-support)
37
46
  - [AWS](#aws)
@@ -49,6 +58,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
49
58
  - [http.rb](#httprb)
50
59
  - [httpclient](#httpclient)
51
60
  - [httpx](#httpx)
61
+ - [Kafka](#kafka)
52
62
  - [MongoDB](#mongodb)
53
63
  - [MySQL2](#mysql2)
54
64
  - [Net/HTTP](#nethttp)
@@ -60,20 +70,19 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
60
70
  - [Rails](#rails)
61
71
  - [Rake](#rake)
62
72
  - [Redis](#redis)
63
- - [Rest Client](#rest-client)
64
73
  - [Resque](#resque)
74
+ - [Rest Client](#rest-client)
65
75
  - [RSpec](#rspec)
66
- - [Shoryuken](#shoryuken)
67
76
  - [Sequel](#sequel)
77
+ - [Shoryuken](#shoryuken)
68
78
  - [Sidekiq](#sidekiq)
69
79
  - [Sinatra](#sinatra)
70
80
  - [Sneakers](#sneakers)
71
81
  - [Sucker Punch](#sucker-punch)
72
- - [Advanced configuration](#advanced-configuration)
73
- - [Tracer settings](#tracer-settings)
82
+ - [Additional configuration](#additional-configuration)
74
83
  - [Custom logging](#custom-logging)
75
84
  - [Environment and tags](#environment-and-tags)
76
- - [Environment variables](#environment-variables)
85
+ - [Debugging and diagnostics](#debugging-and-diagnostics)
77
86
  - [Sampling](#sampling)
78
87
  - [Application-side sampling](#application-side-sampling)
79
88
  - [Priority sampling](#priority-sampling)
@@ -96,11 +105,18 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
96
105
 
97
106
  ## Compatibility
98
107
 
108
+ <!--
109
+ Note: Please replicate any changes to this section also to
110
+ https://github.com/datadog/documentation/blob/master/content/en/tracing/setup_overview/compatibility_requirements/ruby.md
111
+ so that they remain in sync.
112
+ -->
113
+
99
114
  **Supported Ruby interpreters**:
100
115
 
101
116
  | Type | Documentation | Version | Support type | Gem version support |
102
117
  | ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
103
- | MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
118
+ | MRI | https://www.ruby-lang.org/ | 3.1 | Full | Latest |
119
+ | | | 3.0 | Full | Latest |
104
120
  | | | 2.7 | Full | Latest |
105
121
  | | | 2.6 | Full | Latest |
106
122
  | | | 2.5 | Full | Latest |
@@ -111,7 +127,8 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
111
127
  | | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
112
128
  | | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
113
129
  | | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
114
- | JRuby | https://www.jruby.org | 9.2 | Full | Latest |
130
+ | JRuby | https://www.jruby.org | 9.3 | Full | Latest |
131
+ | | | 9.2 | Full | Latest |
115
132
 
116
133
  **Supported web servers**:
117
134
 
@@ -135,73 +152,106 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
135
152
 
136
153
  *EOL* indicates support is no longer provided.
137
154
 
155
+ ### Apple macOS support
156
+
157
+ Use of `ddtrace` on macOS is supported for development, but not for production deployments.
158
+
138
159
  ### Microsoft Windows support
139
160
 
140
- Using `ddtrace ` on Microsoft Windows is currently unsupported. We'll still accept community contributions and issues,
161
+ Using `ddtrace` on Microsoft Windows is currently unsupported. We'll still accept community contributions and issues,
141
162
  but will consider them as having low priority.
142
163
 
143
164
  ## Installation
144
165
 
145
- The following steps will help you quickly start tracing your Ruby application.
166
+ Adding tracing to your Ruby application only takes a few quick steps:
146
167
 
147
- ### Configure the Datadog Agent for APM
168
+ 1. Setup the Datadog Agent for tracing
169
+ 2. Instrument your application
170
+ 3. Connect your application to the Datadog Agent
148
171
 
149
- Before downloading tracing on your application, [install the Datadog Agent on the host](https://docs.datadoghq.com/agent/). The Ruby APM tracer sends trace data through the Datadog Agent.
172
+ ### Setup the Datadog Agent for tracing
150
173
 
151
- 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.
174
+ Before installing `ddtrace`, [install the Datadog Agent](https://docs.datadoghq.com/agent/), to which `ddtrace` will send trace data.
152
175
 
153
- #### Containers
176
+ Then configure the Datadog Agent to accept traces. To do this, either:
154
177
 
155
- 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).
178
+ - Set `DD_APM_ENABLED=true` in the agent's environment
156
179
 
157
- 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:
180
+ OR
158
181
 
159
- 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`.
182
+ - Add `apm_enabled: true` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
160
183
 
184
+ *Additionally, in containerized environments...*
161
185
 
162
- ### Quickstart for Rails applications
186
+ - Set `DD_APM_NON_LOCAL_TRAFFIC=true` in the agent's environment
163
187
 
164
- #### Automatic instrumentation
188
+ OR
165
189
 
166
- 1. Add the `ddtrace` gem to your Gemfile:
190
+ - Add `apm_non_local_traffic: true` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file).
167
191
 
168
- ```ruby
169
- source 'https://rubygems.org'
170
- gem 'ddtrace', require: 'ddtrace/auto_instrument'
171
- ```
192
+ 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.
172
193
 
173
- 2. Install the gem with `bundle install`
194
+ #### Configuring trace data ingestion
195
+
196
+ The Datadog agent will listen for traces via HTTP on port `8126` by default.
197
+
198
+ You may change the protocol or port the agent listens for trace data using the following:
199
+
200
+ **For HTTP over TCP**:
201
+
202
+ - Set `DD_APM_RECEIVER_PORT=<port>` in the agent's environment
203
+
204
+ OR
205
+
206
+ - Add `apm_config: receiver_port: <port>` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
174
207
 
175
- 3. You can configure, override, or disable any specific integration settings by also adding a Rails manual instrumentation configuration file (next).
208
+ **For Unix Domain Socket (UDS)**:
176
209
 
177
- #### Manual instrumentation
210
+ - Set `DD_APM_RECEIVER_SOCKET=<path-to-socket-file>`
211
+
212
+ OR
213
+
214
+ - Add `apm_config: receiver_socket: <path-to-socket-file>` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
215
+
216
+ ### Instrument your application
217
+
218
+ #### Rails applications
178
219
 
179
220
  1. Add the `ddtrace` gem to your Gemfile:
180
221
 
181
222
  ```ruby
182
223
  source 'https://rubygems.org'
183
- gem 'ddtrace'
224
+ gem 'ddtrace', require: 'ddtrace/auto_instrument'
184
225
  ```
185
226
 
186
227
  2. Install the gem with `bundle install`
228
+
187
229
  3. Create a `config/initializers/datadog.rb` file containing:
188
230
 
189
231
  ```ruby
190
232
  Datadog.configure do |c|
191
- # This will activate auto-instrumentation for Rails
192
- c.use :rails
233
+ # Add additional configuration here.
234
+ # Activate integrations, change tracer settings, etc...
193
235
  end
194
236
  ```
195
237
 
196
- You can also activate additional integrations here (see [Integration instrumentation](#integration-instrumentation))
238
+ Using this block you can:
197
239
 
198
- ### Quickstart for Ruby applications
240
+ - [Add additional configuration settings](#additional-configuration)
241
+ - [Activate or reconfigure instrumentation](#integration-instrumentation)
199
242
 
200
- #### Automatic instrumentation
243
+ #### Ruby applications
201
244
 
202
- 1. Install the gem with `gem install ddtrace`
203
- 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
204
- 3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
245
+ 1. Add the `ddtrace` gem to your Gemfile:
246
+
247
+ ```ruby
248
+ source 'https://rubygems.org'
249
+ gem 'ddtrace'
250
+ ```
251
+
252
+ 2. Install the gem with `bundle install`
253
+ 3. `require` any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
254
+ 4. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
205
255
 
206
256
  ```ruby
207
257
  # Example frameworks and libraries
@@ -212,41 +262,42 @@ Install and configure the Datadog Agent to receive traces from your now instrume
212
262
  require 'ddtrace/auto_instrument'
213
263
  ```
214
264
 
215
- You can configure, override, or disable any specific integration settings by also adding a Ruby manual configuration block (next).
216
-
217
- #### Manual instrumentation
218
-
219
- 1. Install the gem with `gem install ddtrace`
220
- 2. Add a configuration block to your Ruby application:
265
+ 5. Add a configuration block to your application:
221
266
 
222
267
  ```ruby
223
- require 'ddtrace'
224
268
  Datadog.configure do |c|
225
- # Configure the tracer here.
269
+ # Add additional configuration here.
226
270
  # Activate integrations, change tracer settings, etc...
227
- # By default without additional configuration, nothing will be traced.
228
271
  end
229
272
  ```
230
273
 
231
- 3. Add or activate instrumentation by doing either of the following:
232
- - Activate integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
233
- - Add manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
274
+ Using this block you can:
275
+
276
+ - [Add additional configuration settings](#additional-configuration)
277
+ - [Activate or reconfigure instrumentation](#integration-instrumentation)
278
+
279
+ #### Configuring OpenTracing
234
280
 
235
- ### Quickstart for OpenTracing
281
+ 1. Add the `ddtrace` gem to your Gemfile:
282
+
283
+ ```ruby
284
+ source 'https://rubygems.org'
285
+ gem 'ddtrace'
286
+ ```
236
287
 
237
- 1. Install the gem with `gem install ddtrace`
238
- 2. To your OpenTracing configuration file, add the following:
288
+ 2. Install the gem with `bundle install`
289
+ 3. To your OpenTracing configuration file, add the following:
239
290
 
240
291
  ```ruby
241
292
  require 'opentracing'
242
- require 'ddtrace'
243
- require 'ddtrace/opentracer'
293
+ require 'datadog/tracing'
294
+ require 'datadog/opentracer'
244
295
 
245
296
  # Activate the Datadog tracer for OpenTracing
246
297
  OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new
247
298
  ```
248
299
 
249
- 3. (Optional) Add a configuration block to your Ruby application to configure Datadog with:
300
+ 4. Add a configuration block to your application:
250
301
 
251
302
  ```ruby
252
303
  Datadog.configure do |c|
@@ -258,9 +309,29 @@ Install and configure the Datadog Agent to receive traces from your now instrume
258
309
  end
259
310
  ```
260
311
 
261
- 4. (Optional) Add or activate additional instrumentation by doing either of the following:
262
- - Activate Datadog integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
263
- - Add Datadog manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
312
+ Using this block you can:
313
+
314
+ - [Add additional Datadog configuration settings](#additional-configuration)
315
+ - [Activate or reconfigure Datadog instrumentation](#integration-instrumentation)
316
+
317
+ #### Configuring OpenTelemetry
318
+
319
+ You can send OpenTelemetry traces directly to the Datadog agent (without `ddtrace`) by using OTLP. Check out our documentation on [OTLP ingest in the Datadog Agent](https://docs.datadoghq.com/tracing/setup_overview/open_standards/#otlp-ingest-in-datadog-agent) for details.
320
+
321
+ ### Connect your application to the Datadog Agent
322
+
323
+ By default, `ddtrace` will connect to the agent using the first available settings in the listed priority:
324
+
325
+ 1. Via any explicitly provided configuration settings (hostname/port/transport)
326
+ 2. Via Unix Domain Socket (UDS) located at `/var/run/datadog/apm.socket`
327
+ 3. Via HTTP over TCP to `127.0.0.1:8126`
328
+
329
+ If your Datadog Agent is listening at any of these locations, no further configuration should be required.
330
+
331
+ If your agent runs on a different host or container than your application, or you would like to send traces via a different protocol, you will need to configure your application accordingly.
332
+
333
+ - [How to send trace data via HTTP over TCP to agent](#changing-default-agent-hostname-and-port)
334
+ - [How to send trace data via Unix Domain Socket (UDS) to agent](#using-the-unix-domain-socket-uds-adapter)
264
335
 
265
336
  ### Final steps for installation
266
337
 
@@ -270,10 +341,10 @@ After setting up, your services will appear on the [APM services page](https://a
270
341
 
271
342
  If you aren't using a supported framework instrumentation, you may want to manually instrument your code.
272
343
 
273
- To trace any Ruby code, you can use the `Datadog.tracer.trace` method:
344
+ To trace any Ruby code, you can use the `Datadog::Tracing.trace` method:
274
345
 
275
346
  ```ruby
276
- Datadog.tracer.trace(name, options) do |span|
347
+ Datadog::Tracing.trace(name, options) do |span, trace|
277
348
  # Wrap this block around the code you want to instrument
278
349
  # Additionally, you can modify the span here.
279
350
  # e.g. Change the resource name, set tags, etc...
@@ -285,14 +356,15 @@ Where `name` should be a `String` that describes the generic kind of operation b
285
356
  And `options` is an optional `Hash` that accepts the following parameters:
286
357
 
287
358
  | Key | Type | Description | Default |
288
- | --- | --- | --- | --- |
289
- | `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
290
- | `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. |
291
- | `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
292
- | `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
293
- | `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
294
- | `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
295
- | `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? }` |
359
+ | --------------- | ----------------------- | --- | --- |
360
+ | `autostart` | `Bool` | Whether the time measurement should be started automatically. If `false`, user must call `span.start`. | `true` |
361
+ | `continue_from` | `Datadog::TraceDigest` | Continues a trace that originated from another execution context. TraceDigest describes the continuation point. | `nil` |
362
+ | `on_error` | `Proc` | Overrides error handling behavior, when a span 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? }` |
363
+ | `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. |
364
+ | `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
365
+ | `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
366
+ | `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
367
+ | `type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
296
368
 
297
369
  It's highly recommended you set both `service` and `resource` at a minimum. Spans without a `service` or `resource` as `nil` will be discarded by the Datadog agent.
298
370
 
@@ -300,9 +372,9 @@ Example of manual instrumentation in action:
300
372
 
301
373
  ```ruby
302
374
  get '/posts' do
303
- Datadog.tracer.trace('web.request', service: 'my-blog', resource: 'GET /posts') do |span|
375
+ Datadog::Tracing.trace('web.request', service: 'my-blog', resource: 'GET /posts') do |span|
304
376
  # Trace the activerecord call
305
- Datadog.tracer.trace('posts.fetch') do
377
+ Datadog::Tracing.trace('posts.fetch') do
306
378
  @posts = Posts.order(created_at: :desc).limit(10)
307
379
  end
308
380
 
@@ -311,7 +383,7 @@ get '/posts' do
311
383
  span.set_tag('posts.count', @posts.length)
312
384
 
313
385
  # Trace the template rendering
314
- Datadog.tracer.trace('template.render') do
386
+ Datadog::Tracing.trace('template.render') do
315
387
  erb :index
316
388
  end
317
389
  end
@@ -320,37 +392,36 @@ end
320
392
 
321
393
  ### Asynchronous tracing
322
394
 
323
- It might not always be possible to wrap `Datadog.tracer.trace` around a block of code. Some event or notification based instrumentation might only notify you when an event begins or ends.
395
+ It might not always be possible to wrap `Datadog::Tracing.trace` around a block of code. Some event or notification based instrumentation might only notify you when an event begins or ends.
324
396
 
325
- To trace these operations, you can trace code asynchronously by calling `Datadog.tracer.trace` without a block:
397
+ To trace these operations, you can trace code asynchronously by calling `Datadog::Tracing.trace` without a block:
326
398
 
327
399
  ```ruby
328
400
  # Some instrumentation framework calls this after an event finishes...
329
401
  def db_query(start, finish, query)
330
- span = Datadog.tracer.trace('database.query')
402
+ span = Datadog::Tracing.trace('database.query', start_time: start)
331
403
  span.resource = query
332
- span.start_time = start
333
404
  span.finish(finish)
334
405
  end
335
406
  ```
336
407
 
337
- Calling `Datadog.tracer.trace` without a block will cause the function to return a `Datadog::Span` that is started, but not finished. You can then modify this span however you wish, then close it `finish`.
408
+ Calling `Datadog::Tracing.trace` without a block will cause the function to return a `Datadog::SpanOperation` that is started, but not finished. You can then modify this span however you wish, then close it `finish`.
338
409
 
339
410
  *You must not leave any unfinished spans.* If any spans are left open when the trace completes, the trace will be discarded. You can [activate debug mode](#tracer-settings) to check for warnings if you suspect this might be happening.
340
411
 
341
- To avoid this scenario when handling start/finish events, you can use `Datadog.tracer.active_span` to get the current active span.
412
+ To avoid this scenario when handling start/finish events, you can use `Datadog::Tracing.active_span` to get the current active span.
342
413
 
343
414
  ```ruby
344
415
  # e.g. ActiveSupport::Notifications calls this when an event starts
345
416
  def start(name, id, payload)
346
417
  # Start a span
347
- Datadog.tracer.trace(name)
418
+ Datadog::Tracing.trace(name)
348
419
  end
349
420
 
350
421
  # e.g. ActiveSupport::Notifications calls this when an event finishes
351
422
  def finish(name, id, payload)
352
423
  # Retrieve current active span (thread-safe)
353
- current_span = Datadog.tracer.active_span
424
+ current_span = Datadog::Tracing.active_span
354
425
  unless current_span.nil?
355
426
  current_span.resource = payload[:query]
356
427
  current_span.finish
@@ -364,17 +435,16 @@ You can tag additional information to the current active span from any method. N
364
435
  ```ruby
365
436
  # e.g. adding tag to active span
366
437
 
367
- current_span = Datadog.tracer.active_span
438
+ current_span = Datadog::Tracing.active_span
368
439
  current_span.set_tag('my_tag', 'my_value') unless current_span.nil?
369
440
  ```
370
441
 
371
- You can also get the root span of the current active trace using the `active_root_span` method. This method will return `nil` if there is no active trace.
442
+ You can also get the current active trace using the `active_trace` method. This method will return `nil` if there is no active trace.
372
443
 
373
444
  ```ruby
374
- # e.g. adding tag to active root span
445
+ # e.g. accessing active trace
375
446
 
376
- current_root_span = Datadog.tracer.active_root_span
377
- current_root_span.set_tag('my_tag', 'my_value') unless current_root_span.nil?
447
+ current_trace = Datadog::Tracing.active_trace
378
448
  ```
379
449
 
380
450
  ## Integration instrumentation
@@ -384,7 +454,7 @@ Many popular libraries and frameworks are supported out-of-the-box, which can be
384
454
  ```ruby
385
455
  Datadog.configure do |c|
386
456
  # Activates and configures an integration
387
- c.use :integration_name, options
457
+ c.tracing.instrument :integration_name, options
388
458
  end
389
459
  ```
390
460
 
@@ -392,94 +462,92 @@ end
392
462
 
393
463
  For a list of available integrations, and their configuration options, please refer to the following:
394
464
 
395
- | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
396
- | ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
397
- | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
398
- | Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
399
- | Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
400
- | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
401
- | Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
402
- | Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
403
- | Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
404
- | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
405
- | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
406
- | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
407
- | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
408
- | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
409
- | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
410
- | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
411
- | Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
412
- | Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
413
- | Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
414
- | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
415
- | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
416
- | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
417
- | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
418
- | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
419
- | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
420
- | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
421
- | Makara (through Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
422
- | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
423
- | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
424
- | 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)* |
425
- | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
426
- | Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
427
- | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
428
- | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
429
- | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
430
- | Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
431
- | Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
432
- | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
433
- | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
434
- | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
435
- | RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
436
- | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
437
- | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
438
- | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
439
- | Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
440
- | Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
441
- | Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
442
-
443
- ### Action Cable
444
-
445
- The Action Cable integration traces broadcast messages and channel actions.
446
-
447
- You can enable it through `Datadog.configure`:
465
+ <!--
466
+ Note: Please replicate any changes to this section also to
467
+ https://github.com/datadog/documentation/blob/master/content/en/tracing/setup_overview/compatibility_requirements/ruby.md
468
+ so that they remain in sync.
469
+ -->
470
+
471
+ | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
472
+ | -------------------------- | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
473
+ | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
474
+ | Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
475
+ | Action Pack | `action_pack` | `>= 3.2` | `>= 3.2` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
476
+ | Action View | `action_view` | `>= 3.2` | `>= 3.2` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
477
+ | Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
478
+ | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
479
+ | Active Record | `active_record` | `>= 3.2` | `>= 3.2` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
480
+ | Active Support | `active_support` | `>= 3.2` | `>= 3.2` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
481
+ | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
482
+ | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
483
+ | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
484
+ | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
485
+ | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
486
+ | Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
487
+ | Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
488
+ | Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
489
+ | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
490
+ | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
491
+ | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
492
+ | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
493
+ | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
494
+ | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
495
+ | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
496
+ | Makara (via Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
497
+ | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
498
+ | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
499
+ | 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)* |
500
+ | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
501
+ | Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
502
+ | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
503
+ | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
504
+ | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
505
+ | Rails | `rails` | `>= 3.2` | `>= 3.2` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
506
+ | Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
507
+ | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
508
+ | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
509
+ | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
510
+ | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
511
+ | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
512
+ | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
513
+ | Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
514
+ | Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
515
+ | Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
516
+
517
+ #### CI Visibility
518
+
519
+ For Datadog CI Visibility, library instrumentation can be activated and configured by using the following `Datadog.configure` API:
448
520
 
449
521
  ```ruby
450
- require 'ddtrace'
451
-
452
522
  Datadog.configure do |c|
453
- c.use :action_cable, options
523
+ # Activates and configures an integration
524
+ c.ci.instrument :integration_name, options
454
525
  end
455
526
  ```
456
527
 
457
- Where `options` is an optional `Hash` that accepts the following parameters:
528
+ `options` is a `Hash` of integration-specific configuration settings.
458
529
 
459
- | Key | Description | Default |
460
- | --- | ----------- | ------- |
461
- | `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
530
+ These are the available CI Visibility integrations:
462
531
 
463
- ### Action View
532
+ | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
533
+ |-----------|------------|-------------------------|---------------------------|---------------------|-----------------------------------------------------|
534
+ | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
535
+ | RSpec | `rspec` | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)* | *[Link](https://github.com/rspec/rspec)* |
464
536
 
465
- Most of the time, Active Support is set up as part of Rails, but it can be activated separately:
537
+ ### Action Cable
538
+
539
+ The Action Cable integration traces broadcast messages and channel actions.
540
+
541
+ You can enable it through `Datadog.configure`:
466
542
 
467
543
  ```ruby
468
- require 'actionview'
469
544
  require 'ddtrace'
470
545
 
471
546
  Datadog.configure do |c|
472
- c.use :action_view, options
547
+ c.tracing.instrument :action_cable
473
548
  end
474
549
  ```
475
550
 
476
- Where `options` is an optional `Hash` that accepts the following parameters:
477
-
478
- | Key | Description | Default |
479
- | ---| --- | --- |
480
- | `service_name` | Service name used for rendering instrumentation. | `action_view` |
481
- | `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/'` |
482
-
483
551
  ### Action Mailer
484
552
 
485
553
  The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
@@ -488,8 +556,8 @@ You can enable it through `Datadog.configure`:
488
556
 
489
557
  ```ruby
490
558
  require 'ddtrace'
491
- Datadog.configure do |c|
492
- c.use :action_mailer, options
559
+ Datadog.configure do |c|
560
+ c.tracing.instrument :action_mailer, options
493
561
  end
494
562
  ```
495
563
 
@@ -498,39 +566,31 @@ Where `options` is an optional `Hash` that accepts the following parameters:
498
566
  | Key | Description | Default |
499
567
  | --- | ----------- | ------- |
500
568
  | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
501
- | `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
502
569
  | `email_data` | Whether or not to append additional email payload metadata to `action_mailer.deliver` spans. Fields include `['subject', 'to', 'from', 'bcc', 'cc', 'date', 'perform_deliveries']`. | `false` |
503
570
 
504
- ### Active Model Serializers
571
+ ### Action Pack
505
572
 
506
- The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
573
+ Most of the time, Action Pack is set up as part of Rails, but it can be activated separately:
507
574
 
508
575
  ```ruby
509
- require 'active_model_serializers'
576
+ require 'actionpack'
510
577
  require 'ddtrace'
511
578
 
512
579
  Datadog.configure do |c|
513
- c.use :active_model_serializers, options
580
+ c.tracing.instrument :action_pack
514
581
  end
515
-
516
- my_object = MyModel.new(name: 'my object')
517
- ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
518
582
  ```
519
583
 
520
- | Key | Description | Default |
521
- | --- | ----------- | ------- |
522
- | `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
523
-
524
- ### Action Pack
584
+ ### Action View
525
585
 
526
- Most of the time, Action Pack is set up as part of Rails, but it can be activated separately:
586
+ Most of the time, Action View is set up as part of Rails, but it can be activated separately:
527
587
 
528
588
  ```ruby
529
- require 'actionpack'
589
+ require 'actionview'
530
590
  require 'ddtrace'
531
591
 
532
592
  Datadog.configure do |c|
533
- c.use :action_pack, options
593
+ c.tracing.instrument :action_view, options
534
594
  end
535
595
  ```
536
596
 
@@ -538,7 +598,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
538
598
 
539
599
  | Key | Description | Default |
540
600
  | ---| --- | --- |
541
- | `service_name` | Service name used for rendering instrumentation. | `action_pack` |
601
+ | `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/'` |
542
602
 
543
603
  ### Active Job
544
604
 
@@ -549,18 +609,27 @@ require 'active_job'
549
609
  require 'ddtrace'
550
610
 
551
611
  Datadog.configure do |c|
552
- c.use :active_job, options
612
+ c.tracing.instrument :active_job
553
613
  end
554
614
 
555
615
  ExampleJob.perform_later
556
616
  ```
557
617
 
558
- Where `options` is an optional `Hash` that accepts the following parameters:
618
+ ### Active Model Serializers
559
619
 
560
- | Key | Description | Default |
561
- | --- | ----------- | ------- |
562
- | `service_name` | Service name used for `active_job` instrumentation | `'active_job'` |
563
- | `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Active Job 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` |
620
+ The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
621
+
622
+ ```ruby
623
+ require 'active_model_serializers'
624
+ require 'ddtrace'
625
+
626
+ Datadog.configure do |c|
627
+ c.tracing.instrument :active_model_serializers
628
+ end
629
+
630
+ my_object = MyModel.new(name: 'my object')
631
+ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
632
+ ```
564
633
 
565
634
  ### Active Record
566
635
 
@@ -573,7 +642,7 @@ require 'active_record'
573
642
  require 'ddtrace'
574
643
 
575
644
  Datadog.configure do |c|
576
- c.use :active_record, options
645
+ c.tracing.instrument :active_record, options
577
646
  end
578
647
 
579
648
  Dir::Tmpname.create(['test', '.sqlite']) do |db|
@@ -587,7 +656,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
587
656
 
588
657
  | Key | Description | Default |
589
658
  | ---| --- | --- |
590
- | `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'`) |
591
659
  | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
592
660
 
593
661
  **Configuring trace settings per database**
@@ -603,22 +671,22 @@ You can configure trace settings per database connection by using the `describes
603
671
  Datadog.configure do |c|
604
672
  # Symbol matching your database connection in config/database.yml
605
673
  # Only available if you are using Rails with ActiveRecord.
606
- c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
674
+ c.tracing.instrument :active_record, describes: :secondary_database, service_name: 'secondary-db'
607
675
 
608
676
  # Block configuration pattern.
609
- c.use :active_record, describes: :secondary_database do |second_db|
677
+ c.tracing.instrument :active_record, describes: :secondary_database do |second_db|
610
678
  second_db.service_name = 'secondary-db'
611
679
  end
612
680
 
613
681
  # Connection string with the following connection settings:
614
682
  # adapter, username, host, port, database
615
683
  # Other fields are ignored.
616
- c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
684
+ c.tracing.instrument :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
617
685
 
618
686
  # Hash with following connection settings:
619
687
  # adapter, username, host, port, database
620
688
  # Other fields are ignored.
621
- c.use :active_record, describes: {
689
+ c.tracing.instrument :active_record, describes: {
622
690
  adapter: 'mysql2',
623
691
  host: '127.0.0.1',
624
692
  port: '3306',
@@ -628,8 +696,8 @@ Datadog.configure do |c|
628
696
  service_name: 'secondary-db'
629
697
 
630
698
  # If using the `makara` gem, it's possible to match on connection `role`:
631
- c.use :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
632
- c.use :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
699
+ c.tracing.instrument :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
700
+ c.tracing.instrument :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
633
701
  end
634
702
  ```
635
703
 
@@ -638,23 +706,23 @@ You can also create configurations based on partial matching of database connect
638
706
  ```ruby
639
707
  Datadog.configure do |c|
640
708
  # Matches any connection on host `127.0.0.1`.
641
- c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
709
+ c.tracing.instrument :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
642
710
 
643
711
  # Matches any `mysql2` connection.
644
- c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
712
+ c.tracing.instrument :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
645
713
 
646
714
  # Matches any `mysql2` connection to the `reports` database.
647
715
  #
648
716
  # In case of multiple matching `describe` configurations, the latest one applies.
649
717
  # In this case a connection with both adapter `mysql` and database `reports`
650
718
  # will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
651
- c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
719
+ c.tracing.instrument :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
652
720
  end
653
721
  ```
654
722
 
655
723
  When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
656
724
 
657
- 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.
725
+ 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.tracing.instrument :active_record` instead.
658
726
 
659
727
  ### Active Support
660
728
 
@@ -665,7 +733,7 @@ require 'activesupport'
665
733
  require 'ddtrace'
666
734
 
667
735
  Datadog.configure do |c|
668
- c.use :active_support, options
736
+ c.tracing.instrument :active_support, options
669
737
  end
670
738
 
671
739
  cache = ActiveSupport::Cache::MemoryStore.new
@@ -687,7 +755,7 @@ require 'aws-sdk'
687
755
  require 'ddtrace'
688
756
 
689
757
  Datadog.configure do |c|
690
- c.use :aws, options
758
+ c.tracing.instrument :aws, options
691
759
  end
692
760
 
693
761
  # Perform traced call
@@ -711,21 +779,15 @@ To activate your integration, use the `Datadog.configure` method:
711
779
  # Inside Rails initializer or equivalent
712
780
  Datadog.configure do |c|
713
781
  # Patches ::Concurrent::Future to use ExecutorService that propagates context
714
- c.use :concurrent_ruby, options
782
+ c.tracing.instrument :concurrent_ruby
715
783
  end
716
784
 
717
785
  # Pass context into code executed within Concurrent::Future
718
- Datadog.tracer.trace('outer') do
719
- Concurrent::Future.execute { Datadog.tracer.trace('inner') { } }.wait
786
+ Datadog::Tracing.trace('outer') do
787
+ Concurrent::Future.execute { Datadog::Tracing.trace('inner') { } }.wait
720
788
  end
721
789
  ```
722
790
 
723
- Where `options` is an optional `Hash` that accepts the following parameters:
724
-
725
- | Key | Description | Default |
726
- | --- | ----------- | ------- |
727
- | `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
728
-
729
791
  ### Cucumber
730
792
 
731
793
  Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
@@ -738,7 +800,7 @@ require 'ddtrace'
738
800
 
739
801
  # Configure default Cucumber integration
740
802
  Datadog.configure do |c|
741
- c.use :cucumber, options
803
+ c.ci.instrument :cucumber, options
742
804
  end
743
805
 
744
806
  # Example of how to attach tags from scenario to active span
@@ -771,7 +833,7 @@ require 'ddtrace'
771
833
 
772
834
  # Configure default Dalli tracing behavior
773
835
  Datadog.configure do |c|
774
- c.use :dalli, options
836
+ c.tracing.instrument :dalli, options
775
837
  end
776
838
 
777
839
  # Configure Dalli tracing behavior for single client
@@ -795,7 +857,7 @@ You can enable it through `Datadog.configure`:
795
857
  require 'ddtrace'
796
858
 
797
859
  Datadog.configure do |c|
798
- c.use :delayed_job, options
860
+ c.tracing.instrument :delayed_job, options
799
861
  end
800
862
  ```
801
863
 
@@ -803,8 +865,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
803
865
 
804
866
  | Key | Description | Default |
805
867
  | --- | ----------- | ------- |
806
- | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
807
- | `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
808
868
  | `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? }` |
809
869
 
810
870
  ### Elasticsearch
@@ -816,12 +876,15 @@ require 'elasticsearch/transport'
816
876
  require 'ddtrace'
817
877
 
818
878
  Datadog.configure do |c|
819
- c.use :elasticsearch, options
879
+ c.tracing.instrument :elasticsearch, options
820
880
  end
821
881
 
822
882
  # Perform a query to Elasticsearch
823
883
  client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
824
884
  response = client.perform_request 'GET', '_cluster/health'
885
+
886
+ # In case you want to override the global configuration for a certain client instance
887
+ Datadog.configure_onto(client.transport, **options)
825
888
  ```
826
889
 
827
890
  Where `options` is an optional `Hash` that accepts the following parameters:
@@ -839,10 +902,10 @@ The `ethon` integration will trace any HTTP request through `Easy` or `Multi` ob
839
902
  require 'ddtrace'
840
903
 
841
904
  Datadog.configure do |c|
842
- c.use :ethon, options
905
+ c.tracing.instrument :ethon, options
843
906
 
844
907
  # optionally, specify a different service name for hostnames matching a regex
845
- c.use :ethon, describes: /user-[^.]+\.example\.com/ do |ethon|
908
+ c.tracing.instrument :ethon, describes: /user-[^.]+\.example\.com/ do |ethon|
846
909
  ethon.service_name = 'user.example.com'
847
910
  ethon.split_by_domain = false # Only necessary if split_by_domain is true by default
848
911
  end
@@ -867,10 +930,10 @@ require 'ddtrace'
867
930
 
868
931
  # Configure default Excon tracing behavior
869
932
  Datadog.configure do |c|
870
- c.use :excon, options
933
+ c.tracing.instrument :excon, options
871
934
 
872
935
  # optionally, specify a different service name for hostnames matching a regex
873
- c.use :excon, describes: /user-[^.]+\.example\.com/ do |excon|
936
+ c.tracing.instrument :excon, describes: /user-[^.]+\.example\.com/ do |excon|
874
937
  excon.service_name = 'user.example.com'
875
938
  excon.split_by_domain = false # Only necessary if split_by_domain is true by default
876
939
  end
@@ -897,7 +960,7 @@ If you use multiple connections with Excon, you can give each of them different
897
960
  # Wrap the Datadog tracing middleware around the default middleware stack
898
961
  Excon.new(
899
962
  'http://example.com',
900
- middlewares: Datadog::Contrib::Excon::Middleware.with(options).around_default_stack
963
+ middlewares: Datadog::Tracing::Contrib::Excon::Middleware.with(options).around_default_stack
901
964
  )
902
965
 
903
966
  # Insert the middleware into a custom middleware stack.
@@ -906,7 +969,7 @@ Excon.new(
906
969
  'http://example.com',
907
970
  middlewares: [
908
971
  Excon::Middleware::ResponseParser,
909
- Datadog::Contrib::Excon::Middleware.with(options),
972
+ Datadog::Tracing::Contrib::Excon::Middleware.with(options),
910
973
  Excon::Middleware::Idempotent
911
974
  ]
912
975
  )
@@ -924,10 +987,10 @@ require 'ddtrace'
924
987
 
925
988
  # Configure default Faraday tracing behavior
926
989
  Datadog.configure do |c|
927
- c.use :faraday, options
990
+ c.tracing.instrument :faraday, options
928
991
 
929
992
  # optionally, specify a different service name for hostnames matching a regex
930
- c.use :faraday, describes: /user-[^.]+\.example\.com/ do |faraday|
993
+ c.tracing.instrument :faraday, describes: /user-[^.]+\.example\.com/ do |faraday|
931
994
  faraday.service_name = 'user.example.com'
932
995
  faraday.split_by_domain = false # Only necessary if split_by_domain is true by default
933
996
  end
@@ -963,7 +1026,7 @@ require 'grape'
963
1026
  require 'ddtrace'
964
1027
 
965
1028
  Datadog.configure do |c|
966
- c.use :grape, options
1029
+ c.tracing.instrument :grape, options
967
1030
  end
968
1031
 
969
1032
  # Then define your application
@@ -980,7 +1043,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
980
1043
  | Key | Description | Default |
981
1044
  | --- | ----------- | ------- |
982
1045
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
983
- | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
984
1046
  | `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` |
985
1047
 
986
1048
  ### GraphQL
@@ -992,7 +1054,7 @@ To activate your integration, use the `Datadog.configure` method:
992
1054
  ```ruby
993
1055
  # Inside Rails initializer or equivalent
994
1056
  Datadog.configure do |c|
995
- c.use :graphql, schemas: [YourSchema], options
1057
+ c.tracing.instrument :graphql, schemas: [YourSchema], options
996
1058
  end
997
1059
 
998
1060
  # Then run a GraphQL query
@@ -1003,7 +1065,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
1003
1065
 
1004
1066
  | Key | Description | Default |
1005
1067
  | --- | ----------- | ------- |
1006
- | `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
1007
1068
  | `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. | `[]` |
1008
1069
 
1009
1070
  **Manually configuring GraphQL schemas**
@@ -1063,7 +1124,7 @@ require 'grpc'
1063
1124
  require 'ddtrace'
1064
1125
 
1065
1126
  Datadog.configure do |c|
1066
- c.use :grpc, options
1127
+ c.tracing.instrument :grpc, options
1067
1128
  end
1068
1129
 
1069
1130
  # Server side
@@ -1089,7 +1150,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1089
1150
  In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
1090
1151
 
1091
1152
  ```ruby
1092
- configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
1153
+ configured_interceptor = Datadog::Tracing::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
1093
1154
  c.service_name = "Alternate"
1094
1155
  end
1095
1156
 
@@ -1110,9 +1171,9 @@ The http.rb integration will trace any HTTP call using the Http.rb gem.
1110
1171
  require 'http'
1111
1172
  require 'ddtrace'
1112
1173
  Datadog.configure do |c|
1113
- c.use :httprb, options
1174
+ c.tracing.instrument :httprb, options
1114
1175
  # optionally, specify a different service name for hostnames matching a regex
1115
- c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
1176
+ c.tracing.instrument :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
1116
1177
  httprb.service_name = 'user.example.com'
1117
1178
  httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
1118
1179
  end
@@ -1135,9 +1196,9 @@ The httpclient integration will trace any HTTP call using the httpclient gem.
1135
1196
  require 'httpclient'
1136
1197
  require 'ddtrace'
1137
1198
  Datadog.configure do |c|
1138
- c.use :httpclient, options
1199
+ c.tracing.instrument :httpclient, options
1139
1200
  # optionally, specify a different service name for hostnames matching a regex
1140
- c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
1201
+ c.tracing.instrument :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
1141
1202
  httpclient.service_name = 'user.example.com'
1142
1203
  httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
1143
1204
  end
@@ -1161,10 +1222,10 @@ require "ddtrace"
1161
1222
  require "httpx/adapters/datadog"
1162
1223
 
1163
1224
  Datadog.configure do |c|
1164
- c.use :httpx
1225
+ c.tracing.instrument :httpx
1165
1226
 
1166
1227
  # optionally, specify a different service name for hostnames matching a regex
1167
- c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
1228
+ c.tracing.instrument :httpx, describes: /user-[^.]+\.example\.com/ do |http|
1168
1229
  http.service_name = 'user.example.com'
1169
1230
  http.split_by_domain = false # Only necessary if split_by_domain is true by default
1170
1231
  end
@@ -1183,17 +1244,10 @@ require 'kafka'
1183
1244
  require 'ddtrace'
1184
1245
 
1185
1246
  Datadog.configure do |c|
1186
- c.use :kafka, options
1247
+ c.tracing.instrument :kafka
1187
1248
  end
1188
1249
  ```
1189
1250
 
1190
- Where `options` is an optional `Hash` that accepts the following parameters:
1191
-
1192
- | Key | Description | Default |
1193
- | --- | ----------- | ------- |
1194
- | `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
1195
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1196
-
1197
1251
  ### MongoDB
1198
1252
 
1199
1253
  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:
@@ -1203,7 +1257,7 @@ require 'mongo'
1203
1257
  require 'ddtrace'
1204
1258
 
1205
1259
  Datadog.configure do |c|
1206
- c.use :mongo, options
1260
+ c.tracing.instrument :mongo, options
1207
1261
  end
1208
1262
 
1209
1263
  # Create a MongoDB client and use it as usual
@@ -1212,7 +1266,7 @@ collection = client[:people]
1212
1266
  collection.insert_one({ name: 'Steve' })
1213
1267
 
1214
1268
  # In case you want to override the global configuration for a certain client instance
1215
- Datadog.configure(client, options)
1269
+ Datadog.configure_onto(client, **options)
1216
1270
  ```
1217
1271
 
1218
1272
  Where `options` is an optional `Hash` that accepts the following parameters:
@@ -1234,10 +1288,10 @@ You can configure trace settings per connection by using the `describes` option:
1234
1288
 
1235
1289
  Datadog.configure do |c|
1236
1290
  # Network connection string
1237
- c.use :mongo, describes: '127.0.0.1:27017', service_name: 'mongo-primary'
1291
+ c.tracing.instrument :mongo, describes: '127.0.0.1:27017', service_name: 'mongo-primary'
1238
1292
 
1239
1293
  # Network connection regular expression
1240
- c.use :mongo, describes: /localhost.*/, service_name: 'mongo-secondary'
1294
+ c.tracing.instrument :mongo, describes: /localhost.*/, service_name: 'mongo-secondary'
1241
1295
  end
1242
1296
 
1243
1297
  client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
@@ -1262,7 +1316,7 @@ require 'mysql2'
1262
1316
  require 'ddtrace'
1263
1317
 
1264
1318
  Datadog.configure do |c|
1265
- c.use :mysql2, options
1319
+ c.tracing.instrument :mysql2, options
1266
1320
  end
1267
1321
 
1268
1322
  client = Mysql2::Client.new(:host => "localhost", :username => "root")
@@ -1284,10 +1338,10 @@ require 'net/http'
1284
1338
  require 'ddtrace'
1285
1339
 
1286
1340
  Datadog.configure do |c|
1287
- c.use :http, options
1341
+ c.tracing.instrument :http, options
1288
1342
 
1289
1343
  # optionally, specify a different service name for hostnames matching a regex
1290
- c.use :http, describes: /user-[^.]+\.example\.com/ do |http|
1344
+ c.tracing.instrument :http, describes: /user-[^.]+\.example\.com/ do |http|
1291
1345
  http.service_name = 'user.example.com'
1292
1346
  http.split_by_domain = false # Only necessary if split_by_domain is true by default
1293
1347
  end
@@ -1309,11 +1363,11 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1309
1363
  | `service_name` | Service name used for `http` instrumentation | `'net/http'` |
1310
1364
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1311
1365
 
1312
- If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
1366
+ If you wish to configure each connection object individually, you may use the `Datadog.configure_onto` as it follows:
1313
1367
 
1314
1368
  ```ruby
1315
1369
  client = Net::HTTP.new(host, port)
1316
- Datadog.configure(client, options)
1370
+ Datadog.configure_onto(client, **options)
1317
1371
  ```
1318
1372
 
1319
1373
  ### Presto
@@ -1325,7 +1379,7 @@ require 'presto-client'
1325
1379
  require 'ddtrace'
1326
1380
 
1327
1381
  Datadog.configure do |c|
1328
- c.use :presto, options
1382
+ c.tracing.instrument :presto, options
1329
1383
  end
1330
1384
 
1331
1385
  client = Presto::Client.new(
@@ -1357,7 +1411,7 @@ To add tracing to a Qless job:
1357
1411
  require 'ddtrace'
1358
1412
 
1359
1413
  Datadog.configure do |c|
1360
- c.use :qless, options
1414
+ c.tracing.instrument :qless, options
1361
1415
  end
1362
1416
  ```
1363
1417
 
@@ -1365,7 +1419,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1365
1419
 
1366
1420
  | Key | Description | Default |
1367
1421
  | --- | ----------- | ------- |
1368
- | `service_name` | Service name used for `qless` instrumentation | `'qless'` |
1369
1422
  | `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
1370
1423
  | `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
1371
1424
 
@@ -1379,7 +1432,7 @@ You can enable it through `Datadog.configure`:
1379
1432
  require 'ddtrace'
1380
1433
 
1381
1434
  Datadog.configure do |c|
1382
- c.use :que, options
1435
+ c.tracing.instrument :que, options
1383
1436
  end
1384
1437
  ```
1385
1438
 
@@ -1388,7 +1441,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1388
1441
  | Key | Description | Default |
1389
1442
  | --- | ----------- | ------- |
1390
1443
  | `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1391
- | `service_name` | Service name used for `que` instrumentation | `'que'` |
1392
1444
  | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
1393
1445
  | `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
1394
1446
  | `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? }` |
@@ -1403,7 +1455,7 @@ You can enable it through `Datadog.configure`:
1403
1455
  require 'ddtrace'
1404
1456
 
1405
1457
  Datadog.configure do |c|
1406
- c.use :racecar, options
1458
+ c.tracing.instrument :racecar, options
1407
1459
  end
1408
1460
  ```
1409
1461
 
@@ -1424,10 +1476,10 @@ This integration is automatically activated with web frameworks like Rails. If y
1424
1476
  require 'ddtrace'
1425
1477
 
1426
1478
  Datadog.configure do |c|
1427
- c.use :rack, options
1479
+ c.tracing.instrument :rack, options
1428
1480
  end
1429
1481
 
1430
- use Datadog::Contrib::Rack::TraceMiddleware
1482
+ use Datadog::Tracing::Contrib::Rack::TraceMiddleware
1431
1483
 
1432
1484
  app = proc do |env|
1433
1485
  [ 200, {'Content-Type' => 'text/plain'}, ['OK'] ]
@@ -1450,7 +1502,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1450
1502
  | `quantize.query.exclude` | Defines which values should be removed entirely. Excludes nothing by default. May be an Array of strings, or `:all` to remove the query string entirely. Option must be nested inside the `query` option. | `nil` |
1451
1503
  | `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` |
1452
1504
  | `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` |
1453
- | `service_name` | Service name used for `rack` instrumentation | `'rack'` |
1454
1505
  | `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
1455
1506
 
1456
1507
  **Configuring URL quantization behavior**
@@ -1463,23 +1514,23 @@ Datadog.configure do |c|
1463
1514
 
1464
1515
  # Show values for any query string parameter matching 'category_id' exactly
1465
1516
  # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by
1466
- c.use :rack, quantize: { query: { show: ['category_id'] } }
1517
+ c.tracing.instrument :rack, quantize: { query: { show: ['category_id'] } }
1467
1518
 
1468
1519
  # Show all values for all query string parameters
1469
1520
  # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by=asc
1470
- c.use :rack, quantize: { query: { show: :all } }
1521
+ c.tracing.instrument :rack, quantize: { query: { show: :all } }
1471
1522
 
1472
1523
  # Totally exclude any query string parameter matching 'sort_by' exactly
1473
1524
  # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id
1474
- c.use :rack, quantize: { query: { exclude: ['sort_by'] } }
1525
+ c.tracing.instrument :rack, quantize: { query: { exclude: ['sort_by'] } }
1475
1526
 
1476
1527
  # Remove the query string entirely
1477
1528
  # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path
1478
- c.use :rack, quantize: { query: { exclude: :all } }
1529
+ c.tracing.instrument :rack, quantize: { query: { exclude: :all } }
1479
1530
 
1480
1531
  # Show URL fragments
1481
1532
  # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by#featured
1482
- c.use :rack, quantize: { fragment: :show }
1533
+ c.tracing.instrument :rack, quantize: { fragment: :show }
1483
1534
  end
1484
1535
  ```
1485
1536
 
@@ -1494,7 +1545,7 @@ To enable the Rails instrumentation, create an initializer file in your `config/
1494
1545
  require 'ddtrace'
1495
1546
 
1496
1547
  Datadog.configure do |c|
1497
- c.use :rails, options
1548
+ c.tracing.instrument :rails, options
1498
1549
  end
1499
1550
  ```
1500
1551
 
@@ -1503,23 +1554,20 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1503
1554
  | Key | Description | Default |
1504
1555
  | --- | ----------- | ------- |
1505
1556
  | `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
1506
- | `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
1507
1557
  | `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
1508
1558
  | `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` |
1509
1559
  | `exception_controller` | Class or Module which identifies a custom exception controller class. Tracer provides improved error behavior when it can identify custom exception controllers. By default, without this option, it 'guesses' what a custom exception controller looks like. Providing this option aids this identification. | `nil` |
1510
- | `job_service` | Service name used when tracing ActiveJob activity. | `<app_name>-active_job` |
1511
1560
  | `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
1512
1561
  | `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
1513
1562
  | `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
1514
1563
  | `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/'` |
1515
- | `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` |
1516
1564
 
1517
1565
  **Supported versions**
1518
1566
 
1519
1567
  | MRI Versions | JRuby Versions | Rails Versions |
1520
1568
  | ------------- | -------------- | -------------- |
1521
- | 2.1 | | 3.0 - 4.2 |
1522
- | 2.2 - 2.3 | | 3.0 - 5.2 |
1569
+ | 2.1 | | 3.2 - 4.2 |
1570
+ | 2.2 - 2.3 | | 3.2 - 5.2 |
1523
1571
  | 2.4 | | 4.2.8 - 5.2 |
1524
1572
  | 2.5 | | 4.2.8 - 6.1 |
1525
1573
  | 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
@@ -1537,7 +1585,7 @@ require 'rake'
1537
1585
  require 'ddtrace'
1538
1586
 
1539
1587
  Datadog.configure do |c|
1540
- c.use :rake, options
1588
+ c.tracing.instrument :rake, options
1541
1589
  end
1542
1590
 
1543
1591
  task :my_task do
@@ -1565,27 +1613,27 @@ Datadog.configure do |c|
1565
1613
  # Default behavior: all arguments are quantized.
1566
1614
  # `rake.invoke.args` tag --> ['?']
1567
1615
  # `rake.execute.args` tag --> { one: '?', two: '?', three: '?' }
1568
- c.use :rake
1616
+ c.tracing.instrument :rake
1569
1617
 
1570
1618
  # Show values for any argument matching :two exactly
1571
1619
  # `rake.invoke.args` tag --> ['?']
1572
1620
  # `rake.execute.args` tag --> { one: '?', two: 'bar', three: '?' }
1573
- c.use :rake, quantize: { args: { show: [:two] } }
1621
+ c.tracing.instrument :rake, quantize: { args: { show: [:two] } }
1574
1622
 
1575
1623
  # Show all values for all arguments.
1576
1624
  # `rake.invoke.args` tag --> ['foo', 'bar', 'baz']
1577
1625
  # `rake.execute.args` tag --> { one: 'foo', two: 'bar', three: 'baz' }
1578
- c.use :rake, quantize: { args: { show: :all } }
1626
+ c.tracing.instrument :rake, quantize: { args: { show: :all } }
1579
1627
 
1580
1628
  # Totally exclude any argument matching :three exactly
1581
1629
  # `rake.invoke.args` tag --> ['?']
1582
1630
  # `rake.execute.args` tag --> { one: '?', two: '?' }
1583
- c.use :rake, quantize: { args: { exclude: [:three] } }
1631
+ c.tracing.instrument :rake, quantize: { args: { exclude: [:three] } }
1584
1632
 
1585
1633
  # Remove the arguments entirely
1586
1634
  # `rake.invoke.args` tag --> ['?']
1587
1635
  # `rake.execute.args` tag --> {}
1588
- c.use :rake, quantize: { args: { exclude: :all } }
1636
+ c.tracing.instrument :rake, quantize: { args: { exclude: :all } }
1589
1637
  end
1590
1638
  ```
1591
1639
 
@@ -1598,7 +1646,7 @@ require 'redis'
1598
1646
  require 'ddtrace'
1599
1647
 
1600
1648
  Datadog.configure do |c|
1601
- c.use :redis, options
1649
+ c.tracing.instrument :redis, options
1602
1650
  end
1603
1651
 
1604
1652
  # Perform Redis commands
@@ -1620,14 +1668,14 @@ require 'redis'
1620
1668
  require 'ddtrace'
1621
1669
 
1622
1670
  Datadog.configure do |c|
1623
- c.use :redis # Enabling integration instrumentation is still required
1671
+ c.tracing.instrument :redis # Enabling integration instrumentation is still required
1624
1672
  end
1625
1673
 
1626
1674
  customer_cache = Redis.new
1627
1675
  invoice_cache = Redis.new
1628
1676
 
1629
- Datadog.configure(customer_cache, service_name: 'customer-cache')
1630
- Datadog.configure(invoice_cache, service_name: 'invoice-cache')
1677
+ Datadog.configure_onto(customer_cache, service_name: 'customer-cache')
1678
+ Datadog.configure_onto(invoice_cache, service_name: 'invoice-cache')
1631
1679
 
1632
1680
  # Traced call will belong to `customer-cache` service
1633
1681
  customer_cache.get(...)
@@ -1647,23 +1695,23 @@ You can configure trace settings per connection by using the `describes` option:
1647
1695
 
1648
1696
  Datadog.configure do |c|
1649
1697
  # The default configuration for any redis client
1650
- c.use :redis, service_name: 'redis-default'
1698
+ c.tracing.instrument :redis, service_name: 'redis-default'
1651
1699
 
1652
1700
  # The configuration matching a given unix socket.
1653
- c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
1701
+ c.tracing.instrument :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
1654
1702
 
1655
1703
  # For network connections, only these fields are considered during matching:
1656
1704
  # scheme, host, port, db
1657
1705
  # Other fields are ignored.
1658
1706
 
1659
1707
  # Network connection string
1660
- c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
1661
- c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
1708
+ c.tracing.instrument :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
1709
+ c.tracing.instrument :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
1662
1710
  # Network client hash
1663
- c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
1711
+ c.tracing.instrument :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
1664
1712
  # Only a subset of the connection hash
1665
- c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
1666
- c.use :redis, describes: { host: ENV['SIDEKIQ_CACHE_HOST'] }, service_name: 'redis-sidekiq'
1713
+ c.tracing.instrument :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
1714
+ c.tracing.instrument :redis, describes: { host: ENV['SIDEKIQ_CACHE_HOST'] }, service_name: 'redis-sidekiq'
1667
1715
  end
1668
1716
  ```
1669
1717
 
@@ -1680,7 +1728,7 @@ require 'resque'
1680
1728
  require 'ddtrace'
1681
1729
 
1682
1730
  Datadog.configure do |c|
1683
- c.use :resque, **options
1731
+ c.tracing.instrument :resque, **options
1684
1732
  end
1685
1733
  ```
1686
1734
 
@@ -1688,9 +1736,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1688
1736
 
1689
1737
  | Key | Description | Default |
1690
1738
  | --- | ----------- | ------- |
1691
- | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1692
1739
  | `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? }` |
1693
- | `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
1694
1740
 
1695
1741
  ### Rest Client
1696
1742
 
@@ -1701,7 +1747,7 @@ require 'rest_client'
1701
1747
  require 'ddtrace'
1702
1748
 
1703
1749
  Datadog.configure do |c|
1704
- c.use :rest_client, options
1750
+ c.tracing.instrument :rest_client, options
1705
1751
  end
1706
1752
  ```
1707
1753
 
@@ -1724,7 +1770,7 @@ require 'ddtrace'
1724
1770
 
1725
1771
  # Configure default RSpec integration
1726
1772
  Datadog.configure do |c|
1727
- c.use :rspec, options
1773
+ c.ci.instrument :rspec, options
1728
1774
  end
1729
1775
  ```
1730
1776
 
@@ -1754,7 +1800,7 @@ database.create_table :articles do
1754
1800
  end
1755
1801
 
1756
1802
  Datadog.configure do |c|
1757
- c.use :sequel, options
1803
+ c.tracing.instrument :sequel, options
1758
1804
  end
1759
1805
 
1760
1806
  # Perform a query
@@ -1777,8 +1823,8 @@ sqlite_database = Sequel.sqlite
1777
1823
  postgres_database = Sequel.connect('postgres://user:password@host:port/database_name')
1778
1824
 
1779
1825
  # Configure each database with different service names
1780
- Datadog.configure(sqlite_database, service_name: 'my-sqlite-db')
1781
- Datadog.configure(postgres_database, service_name: 'my-postgres-db')
1826
+ Datadog.configure_onto(sqlite_database, service_name: 'my-sqlite-db')
1827
+ Datadog.configure_onto(postgres_database, service_name: 'my-postgres-db')
1782
1828
  ```
1783
1829
 
1784
1830
  ### Shoryuken
@@ -1791,7 +1837,7 @@ You can enable it through `Datadog.configure`:
1791
1837
  require 'ddtrace'
1792
1838
 
1793
1839
  Datadog.configure do |c|
1794
- c.use :shoryuken, options
1840
+ c.tracing.instrument :shoryuken, options
1795
1841
  end
1796
1842
  ```
1797
1843
 
@@ -1799,7 +1845,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1799
1845
 
1800
1846
  | Key | Description | Default |
1801
1847
  | --- | ----------- | ------- |
1802
- | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1803
1848
  | `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
1804
1849
  | `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? }` |
1805
1850
 
@@ -1813,7 +1858,7 @@ You can enable it through `Datadog.configure`:
1813
1858
  require 'ddtrace'
1814
1859
 
1815
1860
  Datadog.configure do |c|
1816
- c.use :sidekiq, options
1861
+ c.tracing.instrument :sidekiq, options
1817
1862
  end
1818
1863
  ```
1819
1864
 
@@ -1821,10 +1866,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1821
1866
 
1822
1867
  | Key | Description | Default |
1823
1868
  | --- | ----------- | ------- |
1824
- | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1825
- | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1826
1869
  | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
1827
1870
  | `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? }` |
1871
+ | `quantize` | Hash containing options for quantization of job arguments. | `{}` |
1828
1872
 
1829
1873
  ### Sinatra
1830
1874
 
@@ -1839,7 +1883,7 @@ require 'sinatra'
1839
1883
  require 'ddtrace'
1840
1884
 
1841
1885
  Datadog.configure do |c|
1842
- c.use :sinatra, options
1886
+ c.tracing.instrument :sinatra, options
1843
1887
  end
1844
1888
 
1845
1889
  get '/' do
@@ -1854,11 +1898,11 @@ require 'sinatra/base'
1854
1898
  require 'ddtrace'
1855
1899
 
1856
1900
  Datadog.configure do |c|
1857
- c.use :sinatra, options
1901
+ c.tracing.instrument :sinatra, options
1858
1902
  end
1859
1903
 
1860
1904
  class NestedApp < Sinatra::Base
1861
- register Datadog::Contrib::Sinatra::Tracer
1905
+ register Datadog::Tracing::Contrib::Sinatra::Tracer
1862
1906
 
1863
1907
  get '/nested' do
1864
1908
  'Hello from nested app!'
@@ -1866,7 +1910,7 @@ class NestedApp < Sinatra::Base
1866
1910
  end
1867
1911
 
1868
1912
  class App < Sinatra::Base
1869
- register Datadog::Contrib::Sinatra::Tracer
1913
+ register Datadog::Tracing::Contrib::Sinatra::Tracer
1870
1914
 
1871
1915
  use NestedApp
1872
1916
 
@@ -1876,7 +1920,7 @@ class App < Sinatra::Base
1876
1920
  end
1877
1921
  ```
1878
1922
 
1879
- Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
1923
+ Ensure you register `Datadog::Tracing::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
1880
1924
 
1881
1925
  #### Instrumentation options
1882
1926
 
@@ -1887,7 +1931,6 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
1887
1931
  | `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` |
1888
1932
  | `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'] }` |
1889
1933
  | `resource_script_names` | Prepend resource names with script name | `false` |
1890
- | `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
1891
1934
 
1892
1935
  ### Sneakers
1893
1936
 
@@ -1899,7 +1942,7 @@ You can enable it through `Datadog.configure`:
1899
1942
  require 'ddtrace'
1900
1943
 
1901
1944
  Datadog.configure do |c|
1902
- c.use :sneakers, options
1945
+ c.tracing.instrument :sneakers, options
1903
1946
  end
1904
1947
  ```
1905
1948
 
@@ -1908,7 +1951,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1908
1951
  | Key | Description | Default |
1909
1952
  | --- | ----------- | ------- |
1910
1953
  | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1911
- | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1912
1954
  | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
1913
1955
  | `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? }` |
1914
1956
 
@@ -1920,63 +1962,57 @@ The `sucker_punch` integration traces all scheduled jobs:
1920
1962
  require 'ddtrace'
1921
1963
 
1922
1964
  Datadog.configure do |c|
1923
- c.use :sucker_punch, options
1965
+ c.tracing.instrument :sucker_punch
1924
1966
  end
1925
1967
 
1926
1968
  # Execution of this job is traced
1927
1969
  LogJob.perform_async('login')
1928
1970
  ```
1929
1971
 
1930
- Where `options` is an optional `Hash` that accepts the following parameters:
1931
-
1932
- | Key | Description | Default |
1933
- | --- | ----------- | ------- |
1934
- | `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
1972
+ ## Additional configuration
1935
1973
 
1936
- ## Advanced configuration
1937
-
1938
- ### Tracer settings
1939
-
1940
- To change the default behavior of the Datadog tracer, you can provide custom options inside the `Datadog.configure` block as in:
1974
+ To change the default behavior of Datadog tracing, you can set environment variables, or provide custom options inside a `Datadog.configure` block, e.g.:
1941
1975
 
1942
1976
  ```ruby
1943
- # config/initializers/datadog-tracer.rb
1944
-
1945
1977
  Datadog.configure do |c|
1946
- c.tracer.enabled = true
1947
- c.tracer.hostname = 'my-agent'
1948
- c.tracer.port = 8126
1949
-
1950
- # Ensure all traces are ingested by Datadog
1951
- c.sampling.default_rate = 1.0 # Recommended
1952
- c.sampling.rate_limit = 200
1953
- # or provide a custom implementation (overrides c.sampling settings)
1954
- c.tracer.sampler = Datadog::AllSampler.new
1955
-
1956
- # Breaks down very large traces into smaller batches
1957
- c.tracer.partial_flush.enabled = false
1958
-
1959
- # You can specify your own tracer
1960
- c.tracer.instance = Datadog::Tracer.new
1961
-
1962
- # To enable debug mode
1963
- c.diagnostics.debug = true
1964
- end
1965
- ```
1966
-
1967
- Available options are:
1968
-
1969
- - `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`.
1970
- - `hostname`: set the hostname of the trace agent.
1971
- - `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
1972
- - `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
1973
- - `port`: set the port the trace agent is listening on.
1974
- - `sampling.default_rate`: default tracer sampling rate, between `0.0` (0%) and `1.0` (100%, recommended). `1.0` or Tracing without Limits™, allows you to send all of your traffic and retention can be [configured within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/). When this configuration is not set, the Datadog agent will keep an intelligent assortment of diverse traces.
1975
- - `sampling.rate_limit`: maximum number of traces per second to sample. Defaults to 100 per second.
1976
- - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1977
- - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1978
- - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1979
- - `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 }`.
1978
+ c.service = 'billing-api'
1979
+ c.env = ENV['RACK_ENV']
1980
+
1981
+ c.tracing.report_hostname = true
1982
+ c.tracing.test_mode.enabled = (ENV['RACK_ENV'] == 'test')
1983
+ end
1984
+ ```
1985
+
1986
+ **Available configuration options:**
1987
+
1988
+ | Setting | Env Var | Default | Description |
1989
+ |---------------------------------------------------------|--------------------------------|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1990
+ | **Global** | | | |
1991
+ | `agent.host` | `DD_AGENT_HOST` | `127.0.0.1` | Hostname of agent to where trace data will be sent. |
1992
+ | `agent.port` | `DD_TRACE_AGENT_PORT` | `8126` | Port of agent host to where trace data will be sent. |
1993
+ | | `DD_TRACE_AGENT_URL` | `nil` | Sets the URL endpoint where traces are sent. Has priority over `agent.host` and `agent.port`. |
1994
+ | `diagnostics.debug` | `DD_TRACE_DEBUG` | `false` | Enables or disables debug mode. Prints verbose logs. **NOT recommended for production or other sensitive environments.** See [Debugging and diagnostics](#debugging-and-diagnostics) for more details. |
1995
+ | `diagnostics.startup_logs.enabled` | `DD_TRACE_STARTUP_LOGS` | `nil` | Prints startup configuration and diagnostics to log. For assessing state of tracing at application startup. See [Debugging and diagnostics](#debugging-and-diagnostics) for more details. |
1996
+ | `env` | `DD_ENV` | `nil` | Your application environment. (e.g. `production`, `staging`, etc.) This value is set as a tag on all traces. |
1997
+ | `service` | `DD_SERVICE` | *Ruby filename* | Your application's default service name. (e.g. `billing-api`) This value is set as a tag on all traces. |
1998
+ | `tags` | `DD_TAGS` | `nil` | Custom tags in value pairs separated by `,` (e.g. `layer:api,team:intake`) These tags are set on all traces. See [Environment and tags](#environment-and-tags) for more details. |
1999
+ | `time_now_provider` | | `->{ Time.now }` | Changes how time is retrieved. See [Setting the time provider](#Setting the time provider) for more details. |
2000
+ | `version` | `DD_VERSION` | `nil` | Your application version (e.g. `2.5`, `202003181415`, `1.3-alpha`, etc.) This value is set as a tag on all traces. |
2001
+ | **Tracing** | | | |
2002
+ | `tracing.analytics.enabled` | `DD_TRACE_ANALYTICS_ENABLED` | `nil` | Enables or disables trace analytics. See [Sampling](#sampling) for more details. |
2003
+ | `tracing.distributed_tracing.propagation_extract_style` | `DD_PROPAGATION_STYLE_EXTRACT` | `['Datadog','B3','B3 single header']` | Distributed tracing header formats to extract. See [Distributed Tracing](#distributed-tracing) for more details. |
2004
+ | `tracing.distributed_tracing.propagation_inject_style` | `DD_PROPAGATION_STYLE_INJECT` | `['Datadog']` | Distributed tracing header formats to inject. See [Distributed Tracing](#distributed-tracing) for more details. |
2005
+ | `tracing.enabled` | `DD_TRACE_ENABLED` | `true` | Enables or disables tracing. If set to `false` instrumentation will still run, but no traces are sent to the trace agent. |
2006
+ | `tracing.instrument(<integration-name>, <options...>)` | | | Activates instrumentation for a specific library. See [Integration instrumentation](#integration-instrumentation) for more details. |
2007
+ | `tracing.log_injection` | `DD_LOGS_INJECTION` | `true` | Injects [Trace Correlation](#trace-correlation) information into Rails logs if present. Supports the default logger (`ActiveSupport::TaggedLogging`), `lograge`, and `semantic_logger`. |
2008
+ | `tracing.partial_flush.enabled` | | `false` | Enables or disables partial flushing. Partial flushing submits completed portions of a trace to the agent. Used when tracing instruments long running tasks (e.g. jobs) with many spans. |
2009
+ | `tracing.partial_flush.min_spans_threshold` | | `500` | The number of spans that must be completed in a trace before partial flushing submits those completed spans. |
2010
+ | `tracing.sampler` | | `nil` | Advanced usage only. Sets a custom `Datadog::Tracing::Sampling::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior. See [Application-side sampling](#application-side-sampling) for details. |
2011
+ | `tracing.sampling.default_rate` | `DD_TRACE_SAMPLE_RATE` | `nil` | Sets the trace sampling rate between `0.0` (0%) and `1.0` (100%). See [Application-side sampling](#application-side-sampling) for details. |
2012
+ | `tracing.sampling.rate_limit` | `DD_TRACE_RATE_LIMIT` | `100` (per second) | Sets a maximum number of traces per second to sample. Set a rate limit to avoid the ingestion volume overages in the case of traffic spikes. |
2013
+ | `tracing.report_hostname` | `DD_TRACE_REPORT_HOSTNAME` | `false` | Adds hostname tag to traces. |
2014
+ | `tracing.test_mode.enabled` | `DD_TRACE_TEST_MODE_ENABLED` | `false` | Enables or disables test mode, for use of tracing in test suites. |
2015
+ | `tracing.test_mode.trace_flush` | | `nil` | Object that determines trace flushing behavior. |
1980
2016
 
1981
2017
  #### Custom logging
1982
2018
 
@@ -1989,18 +2025,16 @@ Additionally, it is possible to override the default logger and replace it by a
1989
2025
  ```ruby
1990
2026
  f = File.new("my-custom.log", "w+") # Log messages should go there
1991
2027
  Datadog.configure do |c|
1992
- c.logger = Logger.new(f) # Overriding the default logger
2028
+ c.logger.instance = Logger.new(f) # Overriding the default logger
1993
2029
  c.logger.level = ::Logger::INFO
1994
2030
  end
1995
2031
 
1996
2032
  Datadog.logger.info { "this is typically called by tracing code" }
1997
2033
  ```
1998
2034
 
1999
- ### Environment and tags
2035
+ #### Environment and tags
2000
2036
 
2001
- By default, the trace agent (not this library, but the program running in the background collecting data from various clients) uses the tags set in the agent config file, see our [environments tutorial](https://app.datadoghq.com/apm/docs/tutorials/environments) for details.
2002
-
2003
- You can configure the application to automatically tag your traces and metrics, using the following environment variables:
2037
+ By default, the trace agent (not this library, but the program running in the background collecting data from various clients) uses the tags set in the agent config file. You can configure the application to automatically tag your traces and metrics, using the following environment variables:
2004
2038
 
2005
2039
  - `DD_ENV`: Your application environment (e.g. `production`, `staging`, etc.)
2006
2040
  - `DD_SERVICE`: Your application's default service name (e.g. `billing-api`)
@@ -2024,69 +2058,100 @@ This enables you to set this value on a per application basis, so you can have f
2024
2058
 
2025
2059
  Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
2026
2060
 
2027
- ### Environment variables
2061
+ #### Debugging and diagnostics
2028
2062
 
2029
- Other Environment Variables:
2063
+ There are two different suggested means of producing diagnostics for tracing:
2030
2064
 
2031
- - `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`.
2032
- - `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.
2033
- - `DD_TRACE_SAMPLE_RATE`: Sets the trace sampling rate between `0.0` (0%) and `1.0` (100%, recommended). `1.0` or Tracing without Limits™, allows you to send all of your traffic and retention can be [configured within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/). When this configuration is not set, the Datadog agent will keep an intelligent assortment of diverse traces.
2034
- - `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`.
2065
+ ##### Enabling debug mode
2035
2066
 
2036
- ### Sampling
2067
+ Switching the library into debug mode will produce verbose, detailed logs about tracing activity, including any suppressed errors. This output can be helpful in identifying errors, or confirming trace output to the agent.
2068
+
2069
+ You can enable this via `diagnostics.debug = true` or `DD_TRACE_DEBUG`.
2070
+
2071
+ ```ruby
2072
+ Datadog.configure { |c| c.diagnostics.debug = true }
2073
+ ```
2074
+
2075
+ **We do NOT recommend use of this feature in production or other sensitive environments**, as it can be very verbose under load. It's best to use this in a controlled environment where you can control application load.
2076
+
2077
+ ##### Enabling startup logs
2037
2078
 
2038
- Datadog's Tracing without Limits™ allows you to send all of your traffic and [configure retention within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/).
2079
+ Startup logs produce a report of tracing state when the application is initially configured. This can be helpful for confirming that configuration and instrumentation is activated correctly.
2039
2080
 
2040
- We recommend setting the environment variable `DD_TRACE_SAMPLE_RATE=1.0` in all new applications using `ddtrace`.
2081
+ You can enable this via `diagnostics.startup_logs.enabled = true` or `DD_TRACE_STARTUP_LOGS`.
2041
2082
 
2042
- App Analytics, previously configured with the `analytics_enabled` setting, is deprecated in favor of Tracing without Limits™. Documentation for this [deprecated configuration is still available](https://docs.datadoghq.com/tracing/legacy_app_analytics/).
2083
+ ```ruby
2084
+ Datadog.configure { |c| c.diagnostics.startup_logs.enabled = true }
2085
+ ```
2086
+
2087
+ By default, this will be activated whenever `ddtrace` detects the application is running in a non-development environment.
2088
+
2089
+ ### Sampling
2043
2090
 
2044
2091
  #### Application-side sampling
2045
2092
 
2046
2093
  While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
2047
2094
 
2048
- This will **reduce visibility and is not recommended**. See [DD_TRACE_SAMPLE_RATE](#environment-variables) for the recommended sampling approach.
2095
+ The default sampling rate can be set between `0.0` (0%) and `1.0` (100%). Configure the rate in order to control the volume of traces sent to Datadog. When this configuration is not set, the Datadog agent will distribute a default sampling rate of 10 traces per second.
2096
+
2097
+ Set this value via `DD_TRACE_SAMPLE_RATE` or `Datadog.configure { |c| c.tracing.sampling.default_rate = <value> }`.
2049
2098
 
2050
- `Datadog::RateSampler` samples a ratio of the traces. For example:
2099
+ Alternatively, you may provide your own sampler. The `Datadog::Tracing::Sampling::RateSampler` samples a ratio of the traces. For example:
2051
2100
 
2052
2101
  ```ruby
2053
2102
  # Sample rate is between 0 (nothing sampled) to 1 (everything sampled).
2054
- sampler = Datadog::RateSampler.new(0.5) # sample 50% of the traces
2103
+ sampler = Datadog::Tracing::Sampling::RateSampler.new(0.5) # sample 50% of the traces
2055
2104
 
2056
2105
  Datadog.configure do |c|
2057
- c.tracer.sampler = sampler
2106
+ c.tracing.sampler = sampler
2058
2107
  end
2059
2108
  ```
2060
2109
 
2110
+ See [Additional Configuration](#additional-configuration) for more details about these settings.
2111
+
2061
2112
  #### Priority sampling
2062
2113
 
2063
2114
  Priority sampling decides whether to keep a trace by using a priority attribute propagated for distributed traces. Its value indicates to the Agent and the backend about how important the trace is.
2064
2115
 
2065
2116
  The sampler can set the priority to the following values:
2066
2117
 
2067
- - `Datadog::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
2068
- - `Datadog::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
2118
+ - `Datadog::Tracing::Sampling::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
2119
+ - `Datadog::Tracing::Sampling::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
2069
2120
 
2070
2121
  Priority sampling is enabled by default. Enabling it ensures that your sampled distributed traces will be complete. Once enabled, the sampler will automatically assign a priority of 0 or 1 to traces, depending on their service and volume.
2071
2122
 
2072
- You can also set this priority manually to either drop a non-interesting trace or to keep an important one. For that, set the `context#sampling_priority` to:
2123
+ You can also set this priority manually to either drop a non-interesting trace or to keep an important one. For that, set the `TraceOperation#sampling_priority` to:
2073
2124
 
2074
- - `Datadog::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
2075
- - `Datadog::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
2125
+ - `Datadog::Tracing::Sampling::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
2126
+ - `Datadog::Tracing::Sampling::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
2076
2127
 
2077
2128
  When not using [distributed tracing](#distributed-tracing), you may change the priority at any time, as long as the trace incomplete. But it has to be done before any context propagation (fork, RPC calls) to be useful in a distributed context. Changing the priority after the context has been propagated causes different parts of a distributed trace to use different priorities. Some parts might be kept, some parts might be rejected, and this can cause the trace to be partially stored and remain incomplete.
2078
2129
 
2079
- If you change the priority, we recommend you do it as soon as possible - when the root span has just been created.
2130
+ For this reason, if you change the priority, we recommend you do it as early as possible.
2131
+
2132
+ To change the sampling priority, you can use the following methods:
2133
+
2134
+ ```ruby
2135
+ # Rejects the active trace
2136
+ Datadog::Tracing.reject!
2137
+
2138
+ # Keeps the active trace
2139
+ Datadog::Tracing.keep!
2140
+ ```
2141
+
2142
+ It's safe to use `Datadog::Tracing.reject!` and `Datadog::Tracing.keep!` when no trace is active.
2143
+
2144
+ You can also reject a specific trace instance:
2080
2145
 
2081
2146
  ```ruby
2082
2147
  # First, grab the active span
2083
- span = Datadog.tracer.active_span
2148
+ trace = Datadog::Tracing.active_trace
2084
2149
 
2085
- # Indicate to reject the trace
2086
- span.context.sampling_priority = Datadog::Ext::Priority::USER_REJECT
2150
+ # Rejects the trace
2151
+ trace.reject!
2087
2152
 
2088
- # Indicate to keep the trace
2089
- span.context.sampling_priority = Datadog::Ext::Priority::USER_KEEP
2153
+ # Keeps the trace
2154
+ trace.keep!
2090
2155
  ```
2091
2156
 
2092
2157
  ### Distributed Tracing
@@ -2191,6 +2256,33 @@ Service C:
2191
2256
  Priority: 1
2192
2257
  ```
2193
2258
 
2259
+ **Distributed header formats**
2260
+
2261
+ Tracing supports the following distributed trace formats:
2262
+
2263
+ - `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG` (Default)
2264
+ - `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3`
2265
+ - `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER`
2266
+
2267
+ You can enable/disable the use of these formats via `Datadog.configure`:
2268
+
2269
+ ```ruby
2270
+ Datadog.configure do |c|
2271
+ # List of header formats that should be extracted
2272
+ c.tracing.distributed_tracing.propagation_extract_style = [
2273
+ Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
2274
+ Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3,
2275
+ Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER
2276
+
2277
+ ]
2278
+
2279
+ # List of header formats that should be injected
2280
+ c.tracing.distributed_tracing.propagation_inject_style = [
2281
+ Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG
2282
+ ]
2283
+ end
2284
+ ```
2285
+
2194
2286
  **Activating distributed tracing for integrations**
2195
2287
 
2196
2288
  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.
@@ -2214,24 +2306,24 @@ For more details on how to activate distributed tracing for integrations, see th
2214
2306
 
2215
2307
  **Using the HTTP propagator**
2216
2308
 
2217
- To make the process of propagating this metadata easier, you can use the `Datadog::HTTPPropagator` module.
2309
+ To make the process of propagating this metadata easier, you can use the `Datadog::Tracing::Propagation::HTTP` module.
2218
2310
 
2219
2311
  On the client:
2220
2312
 
2221
2313
  ```ruby
2222
- Datadog.tracer.trace('web.call') do |span|
2223
- # Inject span context into headers (`env` must be a Hash)
2224
- Datadog::HTTPPropagator.inject!(span.context, env)
2314
+ Datadog::Tracing.trace('web.call') do |span, trace|
2315
+ # Inject trace headers into request headers (`env` must be a Hash)
2316
+ Datadog::Tracing::Propagation::HTTP.inject!(trace.to_digest, env)
2225
2317
  end
2226
2318
  ```
2227
2319
 
2228
2320
  On the server:
2229
2321
 
2230
2322
  ```ruby
2231
- Datadog.tracer.trace('web.work') do |span|
2232
- # Build a context from headers (`env` must be a Hash)
2233
- context = HTTPPropagator.extract(request.env)
2234
- Datadog.tracer.provider.context = context if context.trace_id
2323
+ trace_digest = Datadog::Tracing::Propagation::HTTP.extract(request.env)
2324
+
2325
+ Datadog::Tracing.trace('web.work', continue_from: trace_digest) do |span|
2326
+ # Do web work...
2235
2327
  end
2236
2328
  ```
2237
2329
 
@@ -2257,147 +2349,87 @@ Then you must enable the request queuing feature, by setting `request_queuing: t
2257
2349
 
2258
2350
  ### Processing Pipeline
2259
2351
 
2260
- Some applications might require that traces be altered or filtered out before they are sent upstream. The processing pipeline allows users to create *processors* to define such behavior.
2261
-
2262
- Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
2263
-
2264
- For example:
2265
-
2266
- ```ruby
2267
- lambda_processor = ->(trace) do
2268
- # Processing logic...
2269
- trace
2270
- end
2271
-
2272
- class MyCustomProcessor
2273
- def call(trace)
2274
- # Processing logic...
2275
- trace
2276
- end
2277
- end
2278
- custom_processor = MyFancyProcessor.new
2279
- ```
2280
-
2281
- `#call` blocks of processors *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
2282
-
2283
- These processors must then be added to the pipeline via `Datadog::Pipeline.before_flush`:
2284
-
2285
- ```ruby
2286
- Datadog::Pipeline.before_flush(lambda_processor, custom_processor)
2287
- ```
2288
-
2289
- You can also define processors using the short-hand block syntax for `Datadog::Pipeline.before_flush`:
2290
-
2291
- ```ruby
2292
- Datadog::Pipeline.before_flush do |trace|
2293
- trace.delete_if { |span| span.name =~ /forbidden/ }
2294
- end
2295
- ```
2352
+ Some applications might require that traces be altered or filtered out before they are sent to Datadog. The processing pipeline allows you to create *processors* to define such behavior.
2296
2353
 
2297
2354
  #### Filtering
2298
2355
 
2299
- You can use the `Datadog::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
2356
+ You can use the `Datadog::Tracing::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
2300
2357
 
2301
2358
  ```ruby
2302
- Datadog::Pipeline.before_flush(
2359
+ Datadog::Tracing.before_flush(
2303
2360
  # Remove spans that match a particular resource
2304
- Datadog::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
2361
+ Datadog::Tracing::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
2305
2362
  # Remove spans that are trafficked to localhost
2306
- Datadog::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
2363
+ Datadog::Tracing::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
2307
2364
  )
2308
2365
  ```
2309
2366
 
2310
2367
  #### Processing
2311
2368
 
2312
- You can use the `Datadog::Pipeline::SpanProcessor` processor to modify spans:
2369
+ You can use the `Datadog::Tracing::Pipeline::SpanProcessor` processor to modify spans:
2313
2370
 
2314
2371
  ```ruby
2315
- Datadog::Pipeline.before_flush(
2372
+ Datadog::Tracing.before_flush(
2316
2373
  # Strip matching text from the resource field
2317
- Datadog::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
2374
+ Datadog::Tracing::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
2318
2375
  )
2319
2376
  ```
2320
2377
 
2321
- ### Trace correlation
2378
+ #### Custom processor
2322
2379
 
2323
- In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
2324
-
2325
- #### For logging in Rails applications
2326
-
2327
- ##### Automatic
2380
+ Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
2328
2381
 
2329
- For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `semantic_logger`, 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`:
2382
+ For example, using the short-hand block syntax:
2330
2383
 
2331
2384
  ```ruby
2332
- # config/initializers/datadog.rb
2333
- require 'ddtrace'
2334
-
2335
- Datadog.configure do |c|
2336
- c.use :rails, log_injection: true
2385
+ Datadog::Tracing.before_flush do |trace|
2386
+ # Processing logic...
2387
+ trace
2337
2388
  end
2338
2389
  ```
2339
2390
 
2340
- ##### Manual (Lograge)
2341
-
2342
- 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.
2391
+ For a custom processor class:
2343
2392
 
2344
2393
  ```ruby
2345
- config.lograge.custom_options = lambda do |event|
2346
- # Retrieves trace information for current thread
2347
- correlation = Datadog.tracer.active_correlation
2348
-
2349
- {
2350
- # Adds IDs as tags to log output
2351
- :dd => {
2352
- # To preserve precision during JSON serialization, use strings for large numbers
2353
- :trace_id => correlation.trace_id.to_s,
2354
- :span_id => correlation.span_id.to_s,
2355
- :env => correlation.env.to_s,
2356
- :service => correlation.service.to_s,
2357
- :version => correlation.version.to_s
2358
- },
2359
- :ddsource => ["ruby"],
2360
- :params => event.payload[:params].reject { |k| %w(controller action).include? k }
2361
- }
2394
+ class MyCustomProcessor
2395
+ def call(trace)
2396
+ # Processing logic...
2397
+ trace
2398
+ end
2362
2399
  end
2400
+
2401
+ Datadog::Tracing.before_flush(MyCustomProcessor.new)
2363
2402
  ```
2364
2403
 
2365
- ##### Manual (ActiveSupport::TaggedLogging)
2404
+ In both cases, the processor method *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
2366
2405
 
2367
- 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:
2406
+ ### Trace correlation
2368
2407
 
2369
- ```ruby
2370
- Rails.application.configure do
2371
- config.log_tags = [proc { Datadog.tracer.active_correlation.to_s }]
2372
- end
2408
+ In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
2373
2409
 
2374
- # Given:
2375
- # DD_ENV = 'production' (The name of the environment your application is running in.)
2376
- # DD_SERVICE = 'billing-api' (Default service name of your application.)
2377
- # DD_VERSION = '2.5.17' (The version of your application.)
2410
+ #### For logging in Rails applications
2378
2411
 
2379
- # Web requests will produce:
2380
- # [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Started GET "/articles" for 172.22.0.1 at 2019-01-16 18:50:57 +0000
2381
- # [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Processing by ArticlesController#index as */*
2382
- # [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Article Load (0.5ms) SELECT "articles".* FROM "articles"
2383
- # [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Completed 200 OK in 7ms (Views: 5.5ms | ActiveRecord: 0.5ms)
2384
- ```
2412
+ ##### Automatic
2413
+
2414
+ For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `lograge` or `semantic_logger`, trace correlation injection is enabled by default.
2415
+
2416
+ It can be disabled by setting the environment variable `DD_LOGS_INJECTION=false`.
2385
2417
 
2386
2418
  #### For logging in Ruby applications
2387
2419
 
2388
- To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog.tracer.active_correlation`, then add them to the message.
2420
+ To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog::Tracing.correlation`, then add them to the message.
2389
2421
 
2390
2422
  To properly correlate with Datadog logging, be sure the following is present in the log message, in order as they appear:
2391
2423
 
2392
- - `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.tracer.active_correlation.env`. Omit if no environment is configured.
2393
- - `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog.tracer.active_correlation.service`. Omit if no default service name is configured.
2394
- - `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog.tracer.active_correlation.version`. Omit if no application version is configured.
2395
- - `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog.tracer.active_correlation.trace_id` or `0` if no trace is active during logging.
2396
- - `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog.tracer.active_correlation.span_id` or `0` if no trace is active during logging.
2424
+ - `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog::Tracing.correlation.env`. Omit if no environment is configured.
2425
+ - `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog::Tracing.correlation.service`. Omit if no default service name is configured.
2426
+ - `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog::Tracing.correlation.version`. Omit if no application version is configured.
2427
+ - `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog::Tracing.correlation.trace_id` or `0` if no trace is active during logging.
2428
+ - `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog::Tracing.correlation.span_id` or `0` if no trace is active during logging.
2397
2429
 
2398
- By default, `Datadog::Correlation::Identifier#to_s` will return `dd.env=<ENV> dd.service=<SERVICE> dd.version=<VERSION> dd.trace_id=<TRACE_ID> dd.span_id=<SPAN_ID>`.
2430
+ `Datadog::Tracing.log_correlation` will return `dd.env=<ENV> dd.service=<SERVICE> dd.version=<VERSION> dd.trace_id=<TRACE_ID> dd.span_id=<SPAN_ID>`.
2399
2431
 
2400
- If a trace is not active and the application environment & version is not configured, it will return `dd.trace_id=0 dd.span_id=0 dd.env= dd.version=`.
2432
+ If a trace is not active and the application environment & version is not configured, it will return `dd.env= dd.service= dd.version= dd.trace_id=0 dd.span_id=0`.
2401
2433
 
2402
2434
  An example of this in practice:
2403
2435
 
@@ -2412,7 +2444,7 @@ ENV['DD_VERSION'] = '2.5.17'
2412
2444
  logger = Logger.new(STDOUT)
2413
2445
  logger.progname = 'my_app'
2414
2446
  logger.formatter = proc do |severity, datetime, progname, msg|
2415
- "[#{datetime}][#{progname}][#{severity}][#{Datadog.tracer.active_correlation}] #{msg}\n"
2447
+ "[#{datetime}][#{progname}][#{severity}][#{Datadog::Tracing.log_correlation}] #{msg}\n"
2416
2448
  end
2417
2449
 
2418
2450
  # When no trace is active
@@ -2420,17 +2452,34 @@ logger.warn('This is an untraced operation.')
2420
2452
  # [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=0 dd.span_id=0] This is an untraced operation.
2421
2453
 
2422
2454
  # When a trace is active
2423
- Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.') }
2455
+ Datadog::Tracing.trace('my.operation') { logger.warn('This is a traced operation.') }
2424
2456
  # [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=8545847825299552251 dd.span_id=3711755234730770098] This is a traced operation.
2425
2457
  ```
2426
2458
 
2427
2459
  ### Configuring the transport layer
2428
2460
 
2429
- By default, the tracer submits trace data using the Unix socket `/var/run/datadog/apm.socket`, if one is created by the Agent. Otherwise, it connects via HTTP to `127.0.0.1:8126`, the default TCP location the Agent listens on.
2461
+ By default, `ddtrace` will connect to the agent using the first available settings in the listed priority:
2462
+
2463
+ 1. Via any explicitly provided configuration settings (hostname/port/transport)
2464
+ 2. Via Unix Domain Socket (UDS) located at `/var/run/datadog/apm.socket`
2465
+ 3. Via HTTP over TCP to `127.0.0.1:8126`
2430
2466
 
2431
2467
  However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
2432
2468
 
2433
- Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
2469
+ #### Changing default agent hostname and port
2470
+
2471
+ To change the agent host or port, provide `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`.
2472
+
2473
+ OR within a `Datadog.configure` block, provide the following settings:
2474
+
2475
+ ```ruby
2476
+ Datadog.configure do |c|
2477
+ c.agent.host = '127.0.0.1'
2478
+ c.agent.port = 8126
2479
+ end
2480
+ ```
2481
+
2482
+ See [Additional Configuration](#additional-configuration) for more details.
2434
2483
 
2435
2484
  #### Using the Net::HTTP adapter
2436
2485
 
@@ -2438,14 +2487,14 @@ The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default t
2438
2487
 
2439
2488
  ```ruby
2440
2489
  Datadog.configure do |c|
2441
- c.tracer.transport_options = proc { |t|
2490
+ c.tracing.transport_options = proc { |t|
2442
2491
  # Hostname, port, and additional options. :timeout is in seconds.
2443
2492
  t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
2444
2493
  }
2445
2494
  end
2446
2495
  ```
2447
2496
 
2448
- #### Using the Unix socket adapter
2497
+ #### Using the Unix Domain Socket (UDS) adapter
2449
2498
 
2450
2499
  The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
2451
2500
 
@@ -2453,7 +2502,7 @@ To use, first configure your trace agent to listen by Unix socket, then configur
2453
2502
 
2454
2503
  ```ruby
2455
2504
  Datadog.configure do |c|
2456
- c.tracer.transport_options = proc { |t|
2505
+ c.tracing.transport_options = proc { |t|
2457
2506
  # Provide local path to trace agent Unix socket
2458
2507
  t.adapter :unix, '/tmp/ddagent/trace.sock'
2459
2508
  }
@@ -2466,7 +2515,7 @@ The `Test` adapter is a no-op transport that can optionally buffer requests. For
2466
2515
 
2467
2516
  ```ruby
2468
2517
  Datadog.configure do |c|
2469
- c.tracer.transport_options = proc { |t|
2518
+ c.tracing.transport_options = proc { |t|
2470
2519
  # Set transport to no-op mode. Does not retain traces.
2471
2520
  t.adapter :test
2472
2521
 
@@ -2483,7 +2532,7 @@ Custom adapters can be configured with:
2483
2532
 
2484
2533
  ```ruby
2485
2534
  Datadog.configure do |c|
2486
- c.tracer.transport_options = proc { |t|
2535
+ c.tracing.transport_options = proc { |t|
2487
2536
  # Initialize and pass an instance of the adapter
2488
2537
  custom_adapter = CustomAdapter.new
2489
2538
  t.adapter custom_adapter
@@ -2491,6 +2540,23 @@ Datadog.configure do |c|
2491
2540
  end
2492
2541
  ```
2493
2542
 
2543
+ ### Setting the time provider
2544
+
2545
+ By default, tracing uses a monotonic clock to measure the duration of spans, and timestamps (`->{ Time.now }`) for the start and end time.
2546
+
2547
+ When testing, it might be helpful to use a different time provider.
2548
+
2549
+ To change the function that provides timestamps, configure the following:
2550
+
2551
+ ```ruby
2552
+ Datadog.configure do |c|
2553
+ # For Timecop, for example, `->{ Time.now_without_mock_time }` allows the tracer to use the real wall time.
2554
+ c.time_now_provider = -> { Time.now_without_mock_time }
2555
+ end
2556
+ ```
2557
+
2558
+ Span duration calculation will still use the system monotonic clock when available, thus not being affected by this setting.
2559
+
2494
2560
  ### Metrics
2495
2561
 
2496
2562
  The tracer and its integrations can produce some additional metrics that can provide useful insight into the performance of your application. These metrics are collected with `dogstatsd-ruby`, and can be sent to the same Datadog agent to which you send your traces.
@@ -2544,7 +2610,7 @@ In addition, all metrics include the following tags:
2544
2610
 
2545
2611
  ### OpenTracing
2546
2612
 
2547
- For setting up Datadog with OpenTracing, see out [Quickstart for OpenTracing](#quickstart-for-opentracing) section for details.
2613
+ For setting up Datadog with OpenTracing, see our [Configuring OpenTracing](#configuring-opentracing) section for details.
2548
2614
 
2549
2615
  **Configuring Datadog tracer settings**
2550
2616
 
@@ -2552,10 +2618,10 @@ The underlying Datadog tracer can be configured by passing options (which match
2552
2618
 
2553
2619
  ```ruby
2554
2620
  # Where `options` is a Hash of options provided to Datadog::Tracer
2555
- OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(options)
2621
+ OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(**options)
2556
2622
  ```
2557
2623
 
2558
- It can also be configured by using `Datadog.configure` described in the [Tracer settings](#tracer-settings) section.
2624
+ It can also be configured by using `Datadog.configure` described in the [Additional Configuration](#additional-configuration) section.
2559
2625
 
2560
2626
  **Activating and configuring integrations**
2561
2627
 
@@ -2597,11 +2663,11 @@ Without this flag, profiles for short-lived Resque jobs will not be available as
2597
2663
 
2598
2664
  By default, Datadog limits the size of trace payloads to prevent memory overhead within instrumented applications. As a result, traces containing thousands of operations may not be sent to Datadog.
2599
2665
 
2600
- If traces are missing, enable [debug mode](#tracer-settings) to check if messages containing `"Dropping trace. Payload too large"` are logged.
2666
+ If traces are missing, enable [debug mode](#debugging-and-diagnostics) to check if messages containing `"Dropping trace. Payload too large"` are logged.
2601
2667
 
2602
- Since debug mode is verbose, Datadog does not recommend leaving this enabled or enabling this in production. Disable it after confirming. You can inspect the [Datadog Agent logs](https://docs.datadoghq.com/agent/guide/agent-log-files/) for similar messages.
2668
+ Since debug mode is verbose, **Datadog does not recommend leaving this enabled or enabling this in production.** Disable it after confirming. You can inspect the [Datadog Agent logs](https://docs.datadoghq.com/agent/guide/agent-log-files/) for similar messages.
2603
2669
 
2604
- If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#tracer-settings) setting to break down large traces into smaller chunks.
2670
+ If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#additional-configuration) setting to break down large traces into smaller chunks.
2605
2671
 
2606
2672
  ### Stack level too deep
2607
2673
 
@@ -2611,7 +2677,7 @@ In Ruby version 1.9.3 and earlier, "monkey-patching" often involved the use of [
2611
2677
 
2612
2678
  In Ruby 2.0, the [`Module#prepend`](https://ruby-doc.org/core-3.0.0/Module.html#method-i-prepend) feature was introduced. This feature avoids destructive method rewriting and allows multiple "monkey patches" on the same method. Consequently, it has become the safest, preferred means to "monkey patch" code.
2613
2679
 
2614
- Datadog instrumentation almost exclusively uses the `Module#prepend` feature to add instrumentation non-destructively. However, some libraries (typically those supporting Ruby < 2.0) still use `alias_method` which can create conflicts with Datadog instrumentation, often resulting in `SystemStackError` or `stack level too deep` errors.
2680
+ Datadog instrumentation almost exclusively uses the `Module#prepend` feature to add instrumentation non-destructively. However, some other libraries (typically those supporting Ruby < 2.0) still use `alias_method` which can create conflicts with Datadog instrumentation, often resulting in `SystemStackError` or `stack level too deep` errors.
2615
2681
 
2616
2682
  As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
2617
2683