ddtrace 0.45.0 → 0.52.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (586) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +22 -0
  3. data/.gitignore +7 -1
  4. data/CHANGELOG.md +406 -1
  5. data/CONTRIBUTING.md +1 -5
  6. data/LICENSE-3rdparty.csv +2 -0
  7. data/bin/ddtracerb +15 -0
  8. data/ddtrace.gemspec +19 -38
  9. data/docs/DevelopmentGuide.md +43 -0
  10. data/docs/GettingStarted.md +164 -76
  11. data/docs/ProfilingDevelopment.md +107 -0
  12. data/ext/ddtrace_profiling_native_extension/extconf.rb +28 -0
  13. data/ext/ddtrace_profiling_native_extension/profiling.c +17 -0
  14. data/lib/datadog/ci/configuration/components.rb +31 -0
  15. data/lib/datadog/ci/configuration/settings.rb +37 -0
  16. data/lib/datadog/ci/context_flush.rb +29 -0
  17. data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +31 -0
  18. data/lib/datadog/ci/contrib/cucumber/ext.rb +20 -0
  19. data/lib/datadog/ci/contrib/cucumber/formatter.rb +98 -0
  20. data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +27 -0
  21. data/lib/datadog/ci/contrib/cucumber/integration.rb +48 -0
  22. data/lib/datadog/ci/contrib/cucumber/patcher.rb +26 -0
  23. data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +31 -0
  24. data/lib/datadog/ci/contrib/rspec/example.rb +74 -0
  25. data/lib/datadog/ci/contrib/rspec/ext.rb +19 -0
  26. data/lib/datadog/ci/contrib/rspec/integration.rb +49 -0
  27. data/lib/datadog/ci/contrib/rspec/patcher.rb +26 -0
  28. data/lib/datadog/ci/ext/app_types.rb +10 -0
  29. data/lib/datadog/ci/ext/environment.rb +443 -0
  30. data/lib/datadog/ci/ext/settings.rb +11 -0
  31. data/lib/datadog/ci/ext/test.rb +35 -0
  32. data/lib/datadog/ci/extensions.rb +18 -0
  33. data/lib/datadog/ci/test.rb +77 -0
  34. data/lib/datadog/ci.rb +17 -0
  35. data/lib/datadog/contrib.rb +69 -0
  36. data/lib/datadog/core/environment/cgroup.rb +52 -0
  37. data/lib/datadog/core/environment/class_count.rb +20 -0
  38. data/lib/datadog/core/environment/container.rb +91 -0
  39. data/lib/datadog/core/environment/ext.rb +27 -0
  40. data/lib/datadog/core/environment/gc.rb +19 -0
  41. data/lib/datadog/core/environment/identity.rb +51 -0
  42. data/lib/datadog/core/environment/socket.rb +17 -0
  43. data/lib/datadog/core/environment/thread_count.rb +19 -0
  44. data/lib/datadog/core/environment/variable_helpers.rb +42 -0
  45. data/lib/ddtrace/analytics.rb +3 -0
  46. data/lib/ddtrace/auto_instrument.rb +2 -0
  47. data/lib/ddtrace/auto_instrument_base.rb +1 -0
  48. data/lib/ddtrace/buffer.rb +10 -8
  49. data/lib/ddtrace/chunker.rb +1 -0
  50. data/lib/ddtrace/configuration/agent_settings_resolver.rb +231 -0
  51. data/lib/ddtrace/configuration/base.rb +9 -11
  52. data/lib/ddtrace/configuration/components.rb +167 -26
  53. data/lib/ddtrace/configuration/dependency_resolver.rb +1 -0
  54. data/lib/ddtrace/configuration/option.rb +1 -0
  55. data/lib/ddtrace/configuration/option_definition.rb +2 -3
  56. data/lib/ddtrace/configuration/option_definition_set.rb +1 -0
  57. data/lib/ddtrace/configuration/option_set.rb +1 -0
  58. data/lib/ddtrace/configuration/options.rb +7 -9
  59. data/lib/ddtrace/configuration/pin_setup.rb +1 -0
  60. data/lib/ddtrace/configuration/settings.rb +128 -10
  61. data/lib/ddtrace/configuration.rb +118 -26
  62. data/lib/ddtrace/context.rb +23 -20
  63. data/lib/ddtrace/context_flush.rb +15 -2
  64. data/lib/ddtrace/context_provider.rb +1 -1
  65. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +1 -0
  66. data/lib/ddtrace/contrib/action_cable/event.rb +6 -4
  67. data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +1 -0
  68. data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +1 -0
  69. data/lib/ddtrace/contrib/action_cable/events/transmit.rb +1 -0
  70. data/lib/ddtrace/contrib/action_cable/events.rb +1 -0
  71. data/lib/ddtrace/contrib/action_cable/ext.rb +1 -0
  72. data/lib/ddtrace/contrib/action_cable/instrumentation.rb +1 -0
  73. data/lib/ddtrace/contrib/action_cable/integration.rb +1 -0
  74. data/lib/ddtrace/contrib/action_cable/patcher.rb +1 -0
  75. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +22 -13
  76. data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +2 -1
  77. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +1 -0
  78. data/lib/ddtrace/contrib/action_pack/ext.rb +1 -0
  79. data/lib/ddtrace/contrib/action_pack/integration.rb +1 -0
  80. data/lib/ddtrace/contrib/action_pack/patcher.rb +1 -0
  81. data/lib/ddtrace/contrib/action_pack/utils.rb +2 -1
  82. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +1 -0
  83. data/lib/ddtrace/contrib/action_view/event.rb +4 -3
  84. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +1 -0
  85. data/lib/ddtrace/contrib/action_view/events/render_template.rb +1 -0
  86. data/lib/ddtrace/contrib/action_view/events.rb +1 -0
  87. data/lib/ddtrace/contrib/action_view/ext.rb +1 -0
  88. data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +1 -0
  89. data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +1 -0
  90. data/lib/ddtrace/contrib/action_view/integration.rb +1 -0
  91. data/lib/ddtrace/contrib/action_view/patcher.rb +5 -4
  92. data/lib/ddtrace/contrib/action_view/utils.rb +2 -1
  93. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +1 -0
  94. data/lib/ddtrace/contrib/active_model_serializers/event.rb +3 -2
  95. data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +1 -0
  96. data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +1 -0
  97. data/lib/ddtrace/contrib/active_model_serializers/events.rb +1 -0
  98. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +1 -0
  99. data/lib/ddtrace/contrib/active_model_serializers/integration.rb +1 -0
  100. data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +1 -0
  101. data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +31 -0
  102. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +108 -18
  103. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +1 -0
  104. data/lib/ddtrace/contrib/active_record/event.rb +3 -2
  105. data/lib/ddtrace/contrib/active_record/events/instantiation.rb +1 -0
  106. data/lib/ddtrace/contrib/active_record/events/sql.rb +1 -0
  107. data/lib/ddtrace/contrib/active_record/events.rb +1 -0
  108. data/lib/ddtrace/contrib/active_record/ext.rb +1 -0
  109. data/lib/ddtrace/contrib/active_record/integration.rb +1 -0
  110. data/lib/ddtrace/contrib/active_record/patcher.rb +1 -0
  111. data/lib/ddtrace/contrib/active_record/utils.rb +5 -3
  112. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +1 -0
  113. data/lib/ddtrace/contrib/active_support/cache/patcher.rb +8 -7
  114. data/lib/ddtrace/contrib/active_support/cache/redis.rb +2 -5
  115. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +1 -0
  116. data/lib/ddtrace/contrib/active_support/ext.rb +1 -0
  117. data/lib/ddtrace/contrib/active_support/integration.rb +1 -0
  118. data/lib/ddtrace/contrib/active_support/notifications/event.rb +5 -3
  119. data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +3 -1
  120. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +10 -5
  121. data/lib/ddtrace/contrib/active_support/patcher.rb +1 -0
  122. data/lib/ddtrace/contrib/analytics.rb +1 -0
  123. data/lib/ddtrace/contrib/auto_instrument.rb +4 -3
  124. data/lib/ddtrace/contrib/aws/configuration/settings.rb +1 -0
  125. data/lib/ddtrace/contrib/aws/ext.rb +1 -0
  126. data/lib/ddtrace/contrib/aws/instrumentation.rb +30 -0
  127. data/lib/ddtrace/contrib/aws/integration.rb +1 -0
  128. data/lib/ddtrace/contrib/aws/parsed_context.rb +1 -0
  129. data/lib/ddtrace/contrib/aws/patcher.rb +6 -0
  130. data/lib/ddtrace/contrib/aws/services.rb +3 -0
  131. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +1 -0
  132. data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +1 -0
  133. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
  134. data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +1 -0
  135. data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +1 -0
  136. data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +3 -1
  137. data/lib/ddtrace/contrib/configurable.rb +65 -40
  138. data/lib/ddtrace/contrib/configuration/resolver.rb +71 -5
  139. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +20 -20
  140. data/lib/ddtrace/contrib/configuration/settings.rb +8 -6
  141. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +1 -0
  142. data/lib/ddtrace/contrib/dalli/ext.rb +1 -0
  143. data/lib/ddtrace/contrib/dalli/instrumentation.rb +2 -1
  144. data/lib/ddtrace/contrib/dalli/integration.rb +1 -0
  145. data/lib/ddtrace/contrib/dalli/patcher.rb +2 -39
  146. data/lib/ddtrace/contrib/dalli/quantize.rb +1 -0
  147. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +1 -0
  148. data/lib/ddtrace/contrib/delayed_job/ext.rb +1 -0
  149. data/lib/ddtrace/contrib/delayed_job/integration.rb +1 -0
  150. data/lib/ddtrace/contrib/delayed_job/patcher.rb +1 -0
  151. data/lib/ddtrace/contrib/delayed_job/plugin.rb +1 -1
  152. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +1 -0
  153. data/lib/ddtrace/contrib/elasticsearch/ext.rb +1 -0
  154. data/lib/ddtrace/contrib/elasticsearch/integration.rb +1 -0
  155. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +2 -0
  156. data/lib/ddtrace/contrib/elasticsearch/quantize.rb +6 -2
  157. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +1 -0
  158. data/lib/ddtrace/contrib/ethon/easy_patch.rb +7 -6
  159. data/lib/ddtrace/contrib/ethon/ext.rb +1 -0
  160. data/lib/ddtrace/contrib/ethon/integration.rb +1 -0
  161. data/lib/ddtrace/contrib/ethon/multi_patch.rb +2 -1
  162. data/lib/ddtrace/contrib/ethon/patcher.rb +4 -2
  163. data/lib/ddtrace/contrib/excon/configuration/settings.rb +1 -0
  164. data/lib/ddtrace/contrib/excon/ext.rb +1 -0
  165. data/lib/ddtrace/contrib/excon/integration.rb +1 -0
  166. data/lib/ddtrace/contrib/excon/middleware.rb +3 -6
  167. data/lib/ddtrace/contrib/excon/patcher.rb +1 -0
  168. data/lib/ddtrace/contrib/extensions.rb +64 -14
  169. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +1 -0
  170. data/lib/ddtrace/contrib/faraday/connection.rb +1 -0
  171. data/lib/ddtrace/contrib/faraday/ext.rb +1 -0
  172. data/lib/ddtrace/contrib/faraday/integration.rb +1 -0
  173. data/lib/ddtrace/contrib/faraday/middleware.rb +2 -3
  174. data/lib/ddtrace/contrib/faraday/patcher.rb +3 -38
  175. data/lib/ddtrace/contrib/faraday/rack_builder.rb +1 -0
  176. data/lib/ddtrace/contrib/grape/configuration/settings.rb +1 -0
  177. data/lib/ddtrace/contrib/grape/endpoint.rb +34 -31
  178. data/lib/ddtrace/contrib/grape/ext.rb +1 -0
  179. data/lib/ddtrace/contrib/grape/instrumentation.rb +4 -3
  180. data/lib/ddtrace/contrib/grape/integration.rb +1 -0
  181. data/lib/ddtrace/contrib/grape/patcher.rb +2 -43
  182. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +1 -0
  183. data/lib/ddtrace/contrib/graphql/ext.rb +1 -0
  184. data/lib/ddtrace/contrib/graphql/integration.rb +1 -0
  185. data/lib/ddtrace/contrib/graphql/patcher.rb +1 -0
  186. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +2 -0
  187. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +1 -0
  188. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -4
  189. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +13 -8
  190. data/lib/ddtrace/contrib/grpc/ext.rb +1 -0
  191. data/lib/ddtrace/contrib/grpc/integration.rb +1 -0
  192. data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +1 -0
  193. data/lib/ddtrace/contrib/grpc/patcher.rb +3 -37
  194. data/lib/ddtrace/contrib/http/circuit_breaker.rb +2 -3
  195. data/lib/ddtrace/contrib/http/configuration/settings.rb +1 -0
  196. data/lib/ddtrace/contrib/http/ext.rb +1 -0
  197. data/lib/ddtrace/contrib/http/instrumentation.rb +7 -6
  198. data/lib/ddtrace/contrib/http/integration.rb +1 -0
  199. data/lib/ddtrace/contrib/http/patcher.rb +2 -1
  200. data/lib/ddtrace/contrib/http_annotation_helper.rb +1 -0
  201. data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +1 -0
  202. data/lib/ddtrace/contrib/httpclient/ext.rb +1 -0
  203. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +16 -20
  204. data/lib/ddtrace/contrib/httpclient/integration.rb +1 -0
  205. data/lib/ddtrace/contrib/httpclient/patcher.rb +8 -4
  206. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +1 -0
  207. data/lib/ddtrace/contrib/httprb/ext.rb +1 -0
  208. data/lib/ddtrace/contrib/httprb/instrumentation.rb +16 -21
  209. data/lib/ddtrace/contrib/httprb/integration.rb +1 -0
  210. data/lib/ddtrace/contrib/httprb/patcher.rb +8 -4
  211. data/lib/ddtrace/contrib/integration.rb +4 -3
  212. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +1 -0
  213. data/lib/ddtrace/contrib/kafka/consumer_event.rb +1 -0
  214. data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +1 -0
  215. data/lib/ddtrace/contrib/kafka/event.rb +3 -2
  216. data/lib/ddtrace/contrib/kafka/events/connection/request.rb +1 -0
  217. data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +1 -0
  218. data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +1 -0
  219. data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +1 -0
  220. data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +1 -0
  221. data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +1 -0
  222. data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +1 -0
  223. data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +1 -0
  224. data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +1 -0
  225. data/lib/ddtrace/contrib/kafka/events.rb +1 -0
  226. data/lib/ddtrace/contrib/kafka/ext.rb +1 -0
  227. data/lib/ddtrace/contrib/kafka/integration.rb +1 -0
  228. data/lib/ddtrace/contrib/kafka/patcher.rb +1 -0
  229. data/lib/ddtrace/contrib/lograge/configuration/settings.rb +19 -0
  230. data/lib/ddtrace/contrib/lograge/ext.rb +11 -0
  231. data/lib/ddtrace/contrib/lograge/instrumentation.rb +39 -0
  232. data/lib/ddtrace/contrib/lograge/integration.rb +46 -0
  233. data/lib/ddtrace/contrib/{cucumber → lograge}/patcher.rb +7 -4
  234. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +1 -0
  235. data/lib/ddtrace/contrib/mongodb/ext.rb +1 -0
  236. data/lib/ddtrace/contrib/mongodb/instrumentation.rb +5 -2
  237. data/lib/ddtrace/contrib/mongodb/integration.rb +1 -0
  238. data/lib/ddtrace/contrib/mongodb/parsers.rb +1 -0
  239. data/lib/ddtrace/contrib/mongodb/patcher.rb +3 -2
  240. data/lib/ddtrace/contrib/mongodb/subscribers.rb +3 -3
  241. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +1 -0
  242. data/lib/ddtrace/contrib/mysql2/ext.rb +1 -0
  243. data/lib/ddtrace/contrib/mysql2/instrumentation.rb +2 -1
  244. data/lib/ddtrace/contrib/mysql2/integration.rb +1 -0
  245. data/lib/ddtrace/contrib/mysql2/patcher.rb +2 -1
  246. data/lib/ddtrace/contrib/patchable.rb +3 -2
  247. data/lib/ddtrace/contrib/patcher.rb +12 -8
  248. data/lib/ddtrace/contrib/presto/configuration/settings.rb +1 -0
  249. data/lib/ddtrace/contrib/presto/ext.rb +1 -0
  250. data/lib/ddtrace/contrib/presto/instrumentation.rb +2 -1
  251. data/lib/ddtrace/contrib/presto/integration.rb +1 -0
  252. data/lib/ddtrace/contrib/presto/patcher.rb +7 -3
  253. data/lib/ddtrace/contrib/qless/configuration/settings.rb +1 -0
  254. data/lib/ddtrace/contrib/qless/ext.rb +1 -0
  255. data/lib/ddtrace/contrib/qless/integration.rb +1 -0
  256. data/lib/ddtrace/contrib/qless/patcher.rb +5 -5
  257. data/lib/ddtrace/contrib/qless/qless_job.rb +2 -0
  258. data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +2 -0
  259. data/lib/ddtrace/contrib/que/configuration/settings.rb +1 -0
  260. data/lib/ddtrace/contrib/que/ext.rb +20 -19
  261. data/lib/ddtrace/contrib/que/integration.rb +1 -0
  262. data/lib/ddtrace/contrib/que/patcher.rb +1 -0
  263. data/lib/ddtrace/contrib/que/tracer.rb +2 -1
  264. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +1 -0
  265. data/lib/ddtrace/contrib/racecar/event.rb +4 -2
  266. data/lib/ddtrace/contrib/racecar/events/batch.rb +1 -0
  267. data/lib/ddtrace/contrib/racecar/events/consume.rb +1 -0
  268. data/lib/ddtrace/contrib/racecar/events/message.rb +1 -0
  269. data/lib/ddtrace/contrib/racecar/events.rb +1 -0
  270. data/lib/ddtrace/contrib/racecar/ext.rb +1 -0
  271. data/lib/ddtrace/contrib/racecar/integration.rb +1 -0
  272. data/lib/ddtrace/contrib/racecar/patcher.rb +1 -0
  273. data/lib/ddtrace/contrib/rack/configuration/settings.rb +4 -3
  274. data/lib/ddtrace/contrib/rack/ext.rb +1 -0
  275. data/lib/ddtrace/contrib/rack/integration.rb +1 -0
  276. data/lib/ddtrace/contrib/rack/middlewares.rb +7 -11
  277. data/lib/ddtrace/contrib/rack/patcher.rb +2 -3
  278. data/lib/ddtrace/contrib/rack/request_queue.rb +1 -0
  279. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +1 -0
  280. data/lib/ddtrace/contrib/rails/configuration/settings.rb +1 -0
  281. data/lib/ddtrace/contrib/rails/ext.rb +1 -0
  282. data/lib/ddtrace/contrib/rails/framework.rb +26 -1
  283. data/lib/ddtrace/contrib/rails/integration.rb +1 -0
  284. data/lib/ddtrace/contrib/rails/log_injection.rb +1 -40
  285. data/lib/ddtrace/contrib/rails/middlewares.rb +1 -0
  286. data/lib/ddtrace/contrib/rails/patcher.rb +18 -11
  287. data/lib/ddtrace/contrib/rails/railtie.rb +1 -0
  288. data/lib/ddtrace/contrib/rails/utils.rb +1 -0
  289. data/lib/ddtrace/contrib/rake/configuration/settings.rb +1 -0
  290. data/lib/ddtrace/contrib/rake/ext.rb +1 -0
  291. data/lib/ddtrace/contrib/rake/instrumentation.rb +6 -3
  292. data/lib/ddtrace/contrib/rake/integration.rb +1 -0
  293. data/lib/ddtrace/contrib/rake/patcher.rb +2 -1
  294. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +12 -4
  295. data/lib/ddtrace/contrib/redis/configuration/settings.rb +1 -0
  296. data/lib/ddtrace/contrib/redis/ext.rb +1 -0
  297. data/lib/ddtrace/contrib/redis/integration.rb +1 -0
  298. data/lib/ddtrace/contrib/redis/patcher.rb +1 -0
  299. data/lib/ddtrace/contrib/redis/quantize.rb +2 -0
  300. data/lib/ddtrace/contrib/redis/tags.rb +1 -0
  301. data/lib/ddtrace/contrib/redis/vendor/LICENSE +20 -0
  302. data/lib/ddtrace/contrib/redis/vendor/resolver.rb +7 -7
  303. data/lib/ddtrace/contrib/registerable.rb +5 -4
  304. data/lib/ddtrace/contrib/registry.rb +3 -2
  305. data/lib/ddtrace/contrib/resque/configuration/settings.rb +18 -1
  306. data/lib/ddtrace/contrib/resque/ext.rb +1 -0
  307. data/lib/ddtrace/contrib/resque/integration.rb +2 -1
  308. data/lib/ddtrace/contrib/resque/patcher.rb +5 -4
  309. data/lib/ddtrace/contrib/resque/resque_job.rb +25 -1
  310. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +1 -0
  311. data/lib/ddtrace/contrib/rest_client/ext.rb +1 -0
  312. data/lib/ddtrace/contrib/rest_client/integration.rb +1 -0
  313. data/lib/ddtrace/contrib/rest_client/patcher.rb +3 -1
  314. data/lib/ddtrace/contrib/rest_client/request_patch.rb +3 -4
  315. data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +19 -0
  316. data/lib/ddtrace/contrib/semantic_logger/ext.rb +11 -0
  317. data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +43 -0
  318. data/lib/ddtrace/contrib/semantic_logger/integration.rb +48 -0
  319. data/lib/ddtrace/contrib/semantic_logger/patcher.rb +26 -0
  320. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +1 -0
  321. data/lib/ddtrace/contrib/sequel/database.rb +2 -1
  322. data/lib/ddtrace/contrib/sequel/dataset.rb +2 -1
  323. data/lib/ddtrace/contrib/sequel/ext.rb +1 -0
  324. data/lib/ddtrace/contrib/sequel/integration.rb +1 -0
  325. data/lib/ddtrace/contrib/sequel/patcher.rb +3 -2
  326. data/lib/ddtrace/contrib/sequel/utils.rb +6 -6
  327. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +2 -0
  328. data/lib/ddtrace/contrib/shoryuken/ext.rb +1 -0
  329. data/lib/ddtrace/contrib/shoryuken/integration.rb +1 -0
  330. data/lib/ddtrace/contrib/shoryuken/patcher.rb +1 -0
  331. data/lib/ddtrace/contrib/shoryuken/tracer.rb +8 -4
  332. data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +1 -0
  333. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +1 -0
  334. data/lib/ddtrace/contrib/sidekiq/ext.rb +1 -0
  335. data/lib/ddtrace/contrib/sidekiq/integration.rb +1 -0
  336. data/lib/ddtrace/contrib/sidekiq/patcher.rb +1 -0
  337. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +3 -7
  338. data/lib/ddtrace/contrib/sidekiq/tracing.rb +1 -1
  339. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +1 -0
  340. data/lib/ddtrace/contrib/sinatra/env.rb +2 -3
  341. data/lib/ddtrace/contrib/sinatra/ext.rb +1 -0
  342. data/lib/ddtrace/contrib/sinatra/headers.rb +2 -3
  343. data/lib/ddtrace/contrib/sinatra/integration.rb +1 -0
  344. data/lib/ddtrace/contrib/sinatra/patcher.rb +3 -1
  345. data/lib/ddtrace/contrib/sinatra/tracer.rb +14 -6
  346. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +11 -4
  347. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +1 -0
  348. data/lib/ddtrace/contrib/sneakers/ext.rb +12 -11
  349. data/lib/ddtrace/contrib/sneakers/integration.rb +1 -0
  350. data/lib/ddtrace/contrib/sneakers/patcher.rb +1 -0
  351. data/lib/ddtrace/contrib/sneakers/tracer.rb +3 -4
  352. data/lib/ddtrace/contrib/status_code_matcher.rb +6 -3
  353. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +1 -0
  354. data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +5 -6
  355. data/lib/ddtrace/contrib/sucker_punch/ext.rb +1 -0
  356. data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +5 -0
  357. data/lib/ddtrace/contrib/sucker_punch/integration.rb +1 -0
  358. data/lib/ddtrace/contrib/sucker_punch/patcher.rb +2 -0
  359. data/lib/ddtrace/correlation.rb +3 -1
  360. data/lib/ddtrace/diagnostics/environment_logger.rb +9 -7
  361. data/lib/ddtrace/diagnostics/health.rb +1 -0
  362. data/lib/ddtrace/distributed_tracing/headers/b3.rb +1 -0
  363. data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +1 -0
  364. data/lib/ddtrace/distributed_tracing/headers/datadog.rb +1 -0
  365. data/lib/ddtrace/distributed_tracing/headers/headers.rb +2 -0
  366. data/lib/ddtrace/distributed_tracing/headers/helpers.rb +2 -3
  367. data/lib/ddtrace/encoding.rb +3 -0
  368. data/lib/ddtrace/error.rb +78 -8
  369. data/lib/ddtrace/event.rb +1 -0
  370. data/lib/ddtrace/ext/analytics.rb +1 -0
  371. data/lib/ddtrace/ext/app_types.rb +1 -1
  372. data/lib/ddtrace/ext/correlation.rb +1 -0
  373. data/lib/ddtrace/ext/diagnostics.rb +1 -0
  374. data/lib/ddtrace/ext/distributed.rb +2 -1
  375. data/lib/ddtrace/ext/environment.rb +8 -0
  376. data/lib/ddtrace/ext/errors.rb +1 -0
  377. data/lib/ddtrace/ext/forced_tracing.rb +1 -0
  378. data/lib/ddtrace/ext/git.rb +10 -1
  379. data/lib/ddtrace/ext/http.rb +2 -1
  380. data/lib/ddtrace/ext/integration.rb +1 -0
  381. data/lib/ddtrace/ext/manual_tracing.rb +1 -0
  382. data/lib/ddtrace/ext/metrics.rb +1 -0
  383. data/lib/ddtrace/ext/net.rb +1 -0
  384. data/lib/ddtrace/ext/priority.rb +1 -0
  385. data/lib/ddtrace/ext/profiling.rb +56 -0
  386. data/lib/ddtrace/ext/runtime.rb +1 -7
  387. data/lib/ddtrace/ext/sampling.rb +1 -0
  388. data/lib/ddtrace/ext/sql.rb +1 -0
  389. data/lib/ddtrace/ext/test.rb +3 -18
  390. data/lib/ddtrace/ext/transport.rb +3 -0
  391. data/lib/ddtrace/forced_tracing.rb +3 -0
  392. data/lib/ddtrace/logger.rb +2 -1
  393. data/lib/ddtrace/metrics.rb +84 -24
  394. data/lib/ddtrace/opentelemetry/extensions.rb +2 -1
  395. data/lib/ddtrace/opentelemetry/span.rb +1 -0
  396. data/lib/ddtrace/opentracer/binary_propagator.rb +1 -0
  397. data/lib/ddtrace/opentracer/carrier.rb +1 -0
  398. data/lib/ddtrace/opentracer/distributed_headers.rb +4 -0
  399. data/lib/ddtrace/opentracer/global_tracer.rb +1 -0
  400. data/lib/ddtrace/opentracer/propagator.rb +1 -0
  401. data/lib/ddtrace/opentracer/rack_propagator.rb +1 -0
  402. data/lib/ddtrace/opentracer/scope.rb +1 -0
  403. data/lib/ddtrace/opentracer/scope_manager.rb +1 -0
  404. data/lib/ddtrace/opentracer/span.rb +3 -6
  405. data/lib/ddtrace/opentracer/span_context.rb +1 -0
  406. data/lib/ddtrace/opentracer/span_context_factory.rb +1 -0
  407. data/lib/ddtrace/opentracer/text_map_propagator.rb +1 -0
  408. data/lib/ddtrace/opentracer/thread_local_scope.rb +2 -0
  409. data/lib/ddtrace/opentracer/thread_local_scope_manager.rb +1 -0
  410. data/lib/ddtrace/opentracer/tracer.rb +1 -0
  411. data/lib/ddtrace/opentracer.rb +21 -39
  412. data/lib/ddtrace/patcher.rb +28 -6
  413. data/lib/ddtrace/pin.rb +9 -61
  414. data/lib/ddtrace/pipeline/span_filter.rb +2 -1
  415. data/lib/ddtrace/pipeline/span_processor.rb +1 -0
  416. data/lib/ddtrace/pipeline.rb +1 -0
  417. data/lib/ddtrace/profiling/backtrace_location.rb +33 -0
  418. data/lib/ddtrace/profiling/buffer.rb +42 -0
  419. data/lib/ddtrace/profiling/collectors/stack.rb +257 -0
  420. data/lib/ddtrace/profiling/encoding/profile.rb +38 -0
  421. data/lib/ddtrace/profiling/event.rb +14 -0
  422. data/lib/ddtrace/profiling/events/stack.rb +81 -0
  423. data/lib/ddtrace/profiling/exporter.rb +24 -0
  424. data/lib/ddtrace/profiling/ext/cpu.rb +67 -0
  425. data/lib/ddtrace/profiling/ext/cthread.rb +156 -0
  426. data/lib/ddtrace/profiling/ext/forking.rb +98 -0
  427. data/lib/ddtrace/profiling/flush.rb +44 -0
  428. data/lib/ddtrace/profiling/native_extension.rb +18 -0
  429. data/lib/ddtrace/profiling/pprof/builder.rb +120 -0
  430. data/lib/ddtrace/profiling/pprof/converter.rb +90 -0
  431. data/lib/ddtrace/profiling/pprof/message_set.rb +15 -0
  432. data/lib/ddtrace/profiling/pprof/payload.rb +19 -0
  433. data/lib/ddtrace/profiling/pprof/pprof.proto +212 -0
  434. data/lib/ddtrace/profiling/pprof/pprof_pb.rb +82 -0
  435. data/lib/ddtrace/profiling/pprof/stack_sample.rb +117 -0
  436. data/lib/ddtrace/profiling/pprof/string_table.rb +11 -0
  437. data/lib/ddtrace/profiling/pprof/template.rb +119 -0
  438. data/lib/ddtrace/profiling/preload.rb +4 -0
  439. data/lib/ddtrace/profiling/profiler.rb +31 -0
  440. data/lib/ddtrace/profiling/recorder.rb +96 -0
  441. data/lib/ddtrace/profiling/scheduler.rb +134 -0
  442. data/lib/ddtrace/profiling/tasks/setup.rb +82 -0
  443. data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +41 -0
  444. data/lib/ddtrace/profiling/trace_identifiers/helper.rb +46 -0
  445. data/lib/ddtrace/profiling/transport/client.rb +15 -0
  446. data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +101 -0
  447. data/lib/ddtrace/profiling/transport/http/api/instance.rb +37 -0
  448. data/lib/ddtrace/profiling/transport/http/api/spec.rb +41 -0
  449. data/lib/ddtrace/profiling/transport/http/api.rb +44 -0
  450. data/lib/ddtrace/profiling/transport/http/builder.rb +29 -0
  451. data/lib/ddtrace/profiling/transport/http/client.rb +34 -0
  452. data/lib/ddtrace/profiling/transport/http/response.rb +22 -0
  453. data/lib/ddtrace/profiling/transport/http.rb +120 -0
  454. data/lib/ddtrace/profiling/transport/io/client.rb +28 -0
  455. data/lib/ddtrace/profiling/transport/io/response.rb +17 -0
  456. data/lib/ddtrace/profiling/transport/io.rb +31 -0
  457. data/lib/ddtrace/profiling/transport/parcel.rb +18 -0
  458. data/lib/ddtrace/profiling/transport/request.rb +16 -0
  459. data/lib/ddtrace/profiling/transport/response.rb +9 -0
  460. data/lib/ddtrace/profiling.rb +151 -0
  461. data/lib/ddtrace/propagation/grpc_propagator.rb +2 -0
  462. data/lib/ddtrace/propagation/http_propagator.rb +3 -2
  463. data/lib/ddtrace/quantization/hash.rb +1 -0
  464. data/lib/ddtrace/quantization/http.rb +4 -0
  465. data/lib/ddtrace/runtime/metrics.rb +21 -14
  466. data/lib/ddtrace/sampler.rb +2 -1
  467. data/lib/ddtrace/sampling/matcher.rb +1 -0
  468. data/lib/ddtrace/sampling/rate_limiter.rb +1 -0
  469. data/lib/ddtrace/sampling/rule.rb +2 -1
  470. data/lib/ddtrace/sampling/rule_sampler.rb +6 -10
  471. data/lib/ddtrace/sampling.rb +1 -0
  472. data/lib/ddtrace/span.rb +44 -19
  473. data/lib/ddtrace/sync_writer.rb +17 -15
  474. data/lib/ddtrace/tasks/exec.rb +47 -0
  475. data/lib/ddtrace/tasks/help.rb +15 -0
  476. data/lib/ddtrace/tracer.rb +48 -50
  477. data/lib/ddtrace/transport/http/adapters/net.rb +28 -8
  478. data/lib/ddtrace/transport/http/adapters/registry.rb +2 -0
  479. data/lib/ddtrace/transport/http/adapters/test.rb +1 -0
  480. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +3 -4
  481. data/lib/ddtrace/transport/http/api/endpoint.rb +1 -0
  482. data/lib/ddtrace/transport/http/api/fallbacks.rb +1 -0
  483. data/lib/ddtrace/transport/http/api/instance.rb +1 -0
  484. data/lib/ddtrace/transport/http/api/map.rb +1 -0
  485. data/lib/ddtrace/transport/http/api/spec.rb +1 -0
  486. data/lib/ddtrace/transport/http/api.rb +1 -0
  487. data/lib/ddtrace/transport/http/builder.rb +8 -1
  488. data/lib/ddtrace/transport/http/client.rb +3 -1
  489. data/lib/ddtrace/transport/http/env.rb +9 -0
  490. data/lib/ddtrace/transport/http/response.rb +1 -0
  491. data/lib/ddtrace/transport/http/statistics.rb +3 -2
  492. data/lib/ddtrace/transport/http/traces.rb +6 -6
  493. data/lib/ddtrace/transport/http.rb +51 -38
  494. data/lib/ddtrace/transport/io/client.rb +17 -9
  495. data/lib/ddtrace/transport/io/response.rb +2 -3
  496. data/lib/ddtrace/transport/io/traces.rb +10 -1
  497. data/lib/ddtrace/transport/io.rb +2 -1
  498. data/lib/ddtrace/transport/parcel.rb +7 -0
  499. data/lib/ddtrace/transport/request.rb +1 -0
  500. data/lib/ddtrace/transport/response.rb +1 -0
  501. data/lib/ddtrace/transport/statistics.rb +1 -0
  502. data/lib/ddtrace/transport/traces.rb +21 -3
  503. data/lib/ddtrace/utils/compression.rb +28 -0
  504. data/lib/ddtrace/utils/database.rb +1 -0
  505. data/lib/ddtrace/utils/forking.rb +2 -1
  506. data/lib/ddtrace/utils/object_set.rb +40 -0
  507. data/lib/ddtrace/utils/only_once.rb +41 -0
  508. data/lib/ddtrace/utils/sequence.rb +18 -0
  509. data/lib/ddtrace/utils/string_table.rb +46 -0
  510. data/lib/ddtrace/utils/time.rb +34 -2
  511. data/lib/ddtrace/utils.rb +14 -2
  512. data/lib/ddtrace/vendor/active_record/MIT-LICENSE +20 -0
  513. data/lib/ddtrace/vendor/active_record/connection_specification.rb +1 -0
  514. data/lib/ddtrace/vendor/multipart-post/LICENSE +11 -0
  515. data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +117 -0
  516. data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +58 -0
  517. data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +136 -0
  518. data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +10 -0
  519. data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +9 -0
  520. data/lib/ddtrace/vendor/multipart-post/multipart.rb +13 -0
  521. data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +33 -0
  522. data/lib/ddtrace/version.rb +15 -2
  523. data/lib/ddtrace/worker.rb +1 -0
  524. data/lib/ddtrace/workers/async.rb +15 -5
  525. data/lib/ddtrace/workers/loop.rb +32 -5
  526. data/lib/ddtrace/workers/polling.rb +13 -5
  527. data/lib/ddtrace/workers/queue.rb +3 -1
  528. data/lib/ddtrace/workers/runtime_metrics.rb +15 -1
  529. data/lib/ddtrace/workers/trace_writer.rb +14 -16
  530. data/lib/ddtrace/workers.rb +8 -2
  531. data/lib/ddtrace/writer.rb +14 -7
  532. data/lib/ddtrace.rb +20 -56
  533. metadata +130 -446
  534. data/.circleci/config.yml +0 -566
  535. data/.circleci/images/primary/Dockerfile-2.0.0 +0 -73
  536. data/.circleci/images/primary/Dockerfile-2.1.10 +0 -73
  537. data/.circleci/images/primary/Dockerfile-2.2.10 +0 -73
  538. data/.circleci/images/primary/Dockerfile-2.3.8 +0 -75
  539. data/.circleci/images/primary/Dockerfile-2.4.6 +0 -73
  540. data/.circleci/images/primary/Dockerfile-2.5.6 +0 -73
  541. data/.circleci/images/primary/Dockerfile-2.6.4 +0 -73
  542. data/.circleci/images/primary/Dockerfile-2.7.0 +0 -73
  543. data/.circleci/images/primary/Dockerfile-3.0.0 +0 -73
  544. data/.circleci/images/primary/Dockerfile-jruby-9.2 +0 -77
  545. data/.dockerignore +0 -1
  546. data/.env +0 -26
  547. data/.github/CODEOWNERS +0 -1
  548. data/.github/workflows/add-milestone-to-pull-requests.yml +0 -42
  549. data/.github/workflows/create-next-milestone.yml +0 -20
  550. data/.gitlab-ci.yml +0 -27
  551. data/.rspec +0 -1
  552. data/.rubocop.yml +0 -85
  553. data/.simplecov +0 -41
  554. data/Appraisals +0 -1350
  555. data/Gemfile +0 -9
  556. data/Rakefile +0 -993
  557. data/benchmarks/postgres_database.yml +0 -9
  558. data/benchmarks/sidekiq_test.rb +0 -154
  559. data/docker-compose.yml +0 -400
  560. data/lib/ddtrace/augmentation/method_wrapper.rb +0 -20
  561. data/lib/ddtrace/augmentation/method_wrapping.rb +0 -38
  562. data/lib/ddtrace/augmentation/shim.rb +0 -102
  563. data/lib/ddtrace/augmentation.rb +0 -13
  564. data/lib/ddtrace/contrib/cucumber/configuration/settings.rb +0 -38
  565. data/lib/ddtrace/contrib/cucumber/ext.rb +0 -19
  566. data/lib/ddtrace/contrib/cucumber/formatter.rb +0 -104
  567. data/lib/ddtrace/contrib/cucumber/instrumentation.rb +0 -24
  568. data/lib/ddtrace/contrib/cucumber/integration.rb +0 -45
  569. data/lib/ddtrace/contrib/rspec/configuration/settings.rb +0 -38
  570. data/lib/ddtrace/contrib/rspec/example.rb +0 -61
  571. data/lib/ddtrace/contrib/rspec/example_group.rb +0 -61
  572. data/lib/ddtrace/contrib/rspec/ext.rb +0 -19
  573. data/lib/ddtrace/contrib/rspec/integration.rb +0 -46
  574. data/lib/ddtrace/contrib/rspec/patcher.rb +0 -25
  575. data/lib/ddtrace/environment.rb +0 -41
  576. data/lib/ddtrace/ext/ci.rb +0 -297
  577. data/lib/ddtrace/monkey.rb +0 -58
  578. data/lib/ddtrace/runtime/cgroup.rb +0 -44
  579. data/lib/ddtrace/runtime/class_count.rb +0 -17
  580. data/lib/ddtrace/runtime/container.rb +0 -73
  581. data/lib/ddtrace/runtime/gc.rb +0 -16
  582. data/lib/ddtrace/runtime/identity.rb +0 -40
  583. data/lib/ddtrace/runtime/object_space.rb +0 -19
  584. data/lib/ddtrace/runtime/socket.rb +0 -14
  585. data/lib/ddtrace/runtime/thread_count.rb +0 -16
  586. data/tasks/release_gem.rake +0 -28
@@ -46,6 +46,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
46
46
  - [gRPC](#grpc)
47
47
  - [http.rb](#http-rb)
48
48
  - [httpclient](#httpclient)
49
+ - [httpx](#httpx)
49
50
  - [MongoDB](#mongodb)
50
51
  - [MySQL2](#mysql2)
51
52
  - [Net/HTTP](#net-http)
@@ -70,7 +71,9 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
70
71
  - [Tracer settings](#tracer-settings)
71
72
  - [Custom logging](#custom-logging)
72
73
  - [Environment and tags](#environment-and-tags)
74
+ - [Environment variables](#environment-variables)
73
75
  - [Sampling](#sampling)
76
+ - [Application-side sampling](#application-side-sampling)
74
77
  - [Priority sampling](#priority-sampling)
75
78
  - [Distributed tracing](#distributed-tracing)
76
79
  - [HTTP request queuing](#http-request-queuing)
@@ -82,6 +85,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
82
85
  - [Metrics](#metrics)
83
86
  - [For application runtime](#for-application-runtime)
84
87
  - [OpenTracing](#opentracing)
88
+ - [Profiling](#profiling)
89
+ - [Troubleshooting](#troubleshooting)
90
+ - [Profiling Resque jobs](#profiling-resque-jobs)
91
+ - [Known issues and suggested configurations](#known-issues-and-suggested-configurations)
92
+ - [Payload too large](#payload-too-large)
93
+ - [Stack level too deep](#stack-level-too-deep)
85
94
 
86
95
  ## Compatibility
87
96
 
@@ -97,7 +106,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
97
106
  | | | 2.3 | Full | Latest |
98
107
  | | | 2.2 | Full | Latest |
99
108
  | | | 2.1 | Full | Latest |
100
- | | | 2.0 | Full | Latest |
109
+ | | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
101
110
  | | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
102
111
  | | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
103
112
  | JRuby | https://www.jruby.org | 9.2 | Full | Latest |
@@ -145,7 +154,7 @@ Install and configure the Datadog Agent to receive traces from your now instrume
145
154
 
146
155
  ### Quickstart for Rails applications
147
156
 
148
- #### Rails Auto Instrument all Integrations
157
+ #### Automatic instrumentation
149
158
 
150
159
  1. Add the `ddtrace` gem to your Gemfile:
151
160
 
@@ -158,7 +167,7 @@ Install and configure the Datadog Agent to receive traces from your now instrume
158
167
 
159
168
  3. You can configure, override, or disable any specific integration settings by also adding a [Rails Manual Configuration](#rails-manual-configuration) file.
160
169
 
161
- #### Rails Manual Configuration
170
+ #### Manual instrumentation
162
171
 
163
172
  1. Add the `ddtrace` gem to your Gemfile:
164
173
 
@@ -181,10 +190,10 @@ Install and configure the Datadog Agent to receive traces from your now instrume
181
190
 
182
191
  ### Quickstart for Ruby applications
183
192
 
184
- #### Ruby Auto Instrument all Integrations
193
+ #### Automatic instrumentation
185
194
 
186
195
  1. Install the gem with `gem install ddtrace`
187
- 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
196
+ 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
188
197
  3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
189
198
 
190
199
  ```ruby
@@ -195,10 +204,10 @@ Install and configure the Datadog Agent to receive traces from your now instrume
195
204
 
196
205
  require 'ddtrace/auto_instrument'
197
206
  ```
198
-
207
+
199
208
  You can configure, override, or disable any specific integration settings by also adding a [Ruby Manual Configuration Block](#ruby-manual-configuration).
200
209
 
201
- #### Ruby Manual Configuration
210
+ #### Manual instrumentation
202
211
 
203
212
  1. Install the gem with `gem install ddtrace`
204
213
  2. Add a configuration block to your Ruby application:
@@ -398,7 +407,9 @@ For a list of available integrations, and their configuration options, please re
398
407
  | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
399
408
  | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#http-rb)* | *[Link](https://github.com/httprb/http)* |
400
409
  | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
410
+ | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
401
411
  | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
412
+ | Makara (through Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
402
413
  | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
403
414
  | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
404
415
  | 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)* |
@@ -438,7 +449,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
438
449
 
439
450
  | Key | Description | Default |
440
451
  | --- | ----------- | ------- |
441
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
442
452
  | `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
443
453
 
444
454
  ### Action View
@@ -458,7 +468,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
458
468
 
459
469
  | Key | Description | Default |
460
470
  | ---| --- | --- |
461
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
462
471
  | `service_name` | Service name used for rendering instrumentation. | `action_view` |
463
472
  | `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/'` |
464
473
 
@@ -480,7 +489,6 @@ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
480
489
 
481
490
  | Key | Description | Default |
482
491
  | --- | ----------- | ------- |
483
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
484
492
  | `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
485
493
 
486
494
  ### Action Pack
@@ -500,7 +508,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
500
508
 
501
509
  | Key | Description | Default |
502
510
  | ---| --- | --- |
503
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
504
511
  | `service_name` | Service name used for rendering instrumentation. | `action_pack` |
505
512
 
506
513
  ### Active Record
@@ -528,7 +535,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
528
535
 
529
536
  | Key | Description | Default |
530
537
  | ---| --- | --- |
531
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
532
538
  | `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'`) |
533
539
  | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
534
540
 
@@ -547,16 +553,19 @@ Datadog.configure do |c|
547
553
  # Only available if you are using Rails with ActiveRecord.
548
554
  c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
549
555
 
556
+ # Block configuration pattern.
550
557
  c.use :active_record, describes: :secondary_database do |second_db|
551
558
  second_db.service_name = 'secondary-db'
552
559
  end
553
560
 
554
561
  # Connection string with the following connection settings:
555
- # Adapter, user, host, port, database
562
+ # adapter, username, host, port, database
563
+ # Other fields are ignored.
556
564
  c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
557
565
 
558
- # Hash with following connection settings
559
- # Adapter, user, host, port, database
566
+ # Hash with following connection settings:
567
+ # adapter, username, host, port, database
568
+ # Other fields are ignored.
560
569
  c.use :active_record, describes: {
561
570
  adapter: 'mysql2',
562
571
  host: '127.0.0.1',
@@ -565,9 +574,34 @@ Datadog.configure do |c|
565
574
  username: 'root'
566
575
  },
567
576
  service_name: 'secondary-db'
577
+
578
+ # If using the `makara` gem, it's possible to match on connection `role`:
579
+ c.use :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
580
+ c.use :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
568
581
  end
569
582
  ```
570
583
 
584
+ You can also create configurations based on partial matching of database connection fields:
585
+
586
+ ```ruby
587
+ Datadog.configure do |c|
588
+ # Matches any connection on host `127.0.0.1`.
589
+ c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
590
+
591
+ # Matches any `mysql2` connection.
592
+ c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
593
+
594
+ # Matches any `mysql2` connection to the `reports` database.
595
+ #
596
+ # In case of multiple matching `describe` configurations, the latest one applies.
597
+ # In this case a connection with both adapter `mysql` and database `reports`
598
+ # will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
599
+ c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
600
+ end
601
+ ```
602
+
603
+ When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
604
+
571
605
  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.
572
606
 
573
607
  ### Active Support
@@ -590,7 +624,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
590
624
 
591
625
  | Key | Description | Default |
592
626
  | ---| --- | --- |
593
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
594
627
  | `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
595
628
 
596
629
  ### AWS
@@ -613,7 +646,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
613
646
 
614
647
  | Key | Description | Default |
615
648
  | --- | ----------- | ------- |
616
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
617
649
  | `service_name` | Service name used for `aws` instrumentation | `'aws'` |
618
650
 
619
651
  ### Concurrent Ruby
@@ -673,7 +705,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
673
705
 
674
706
  | Key | Description | Default |
675
707
  | --- | ----------- | ------- |
676
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `true` |
677
708
  | `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
678
709
  | `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
679
710
  | `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
@@ -700,7 +731,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
700
731
 
701
732
  | Key | Description | Default |
702
733
  | --- | ----------- | ------- |
703
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
704
734
  | `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
705
735
 
706
736
  ### DelayedJob
@@ -721,7 +751,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
721
751
 
722
752
  | Key | Description | Default |
723
753
  | --- | ----------- | ------- |
724
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
725
754
  | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
726
755
  | `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
727
756
  | `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? }` |
@@ -747,7 +776,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
747
776
 
748
777
  | Key | Description | Default |
749
778
  | --- | ----------- | ------- |
750
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
751
779
  | `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` |
752
780
  | `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
753
781
 
@@ -773,7 +801,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
773
801
 
774
802
  | Key | Description | Default |
775
803
  | --- | ----------- | ------- |
776
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
777
804
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
778
805
  | `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
779
806
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
@@ -805,7 +832,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
805
832
 
806
833
  | Key | Description | Default |
807
834
  | --- | ----------- | ------- |
808
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
809
835
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
810
836
  | `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
811
837
  | `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
@@ -868,7 +894,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
868
894
 
869
895
  | Key | Description | Default |
870
896
  | --- | ----------- | ------- |
871
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
872
897
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
873
898
  | `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
874
899
  | `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
@@ -902,7 +927,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
902
927
 
903
928
  | Key | Description | Default |
904
929
  | --- | ----------- | ------- |
905
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
906
930
  | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
907
931
  | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
908
932
  | `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` |
@@ -927,7 +951,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
927
951
 
928
952
  | Key | Description | Default |
929
953
  | --- | ----------- | ------- |
930
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
931
954
  | `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
932
955
  | `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. | `[]` |
933
956
 
@@ -1006,8 +1029,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1006
1029
 
1007
1030
  | Key | Description | Default |
1008
1031
  | --- | ----------- | ------- |
1009
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1010
1032
  | `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
1033
+ | `error_handler` | Custom error handler invoked when a request is an error. A `Proc` that accepts `span` and `error` parameters. Sets error on the span by default. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
1011
1034
 
1012
1035
  **Configuring clients to use different settings**
1013
1036
 
@@ -1048,7 +1071,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1048
1071
 
1049
1072
  | Key | Description | Default |
1050
1073
  | --- | ----------- | ------- |
1051
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1052
1074
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1053
1075
  | `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
1054
1076
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
@@ -1058,7 +1080,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1058
1080
  The httpclient integration will trace any HTTP call using the httpclient gem.
1059
1081
 
1060
1082
  ```ruby
1061
- require 'http'
1083
+ require 'httpclient'
1062
1084
  require 'ddtrace'
1063
1085
  Datadog.configure do |c|
1064
1086
  c.use :httpclient, options
@@ -1074,11 +1096,29 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1074
1096
 
1075
1097
  | Key | Description | Default |
1076
1098
  | --- | ----------- | ------- |
1077
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1078
1099
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1079
1100
  | `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
1080
1101
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1081
1102
 
1103
+ ### httpx
1104
+
1105
+ `httpx` maintains its [own integration with `ddtrace`](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter):
1106
+
1107
+ ```ruby
1108
+ require "ddtrace"
1109
+ require "httpx/adapters/datadog"
1110
+
1111
+ Datadog.configure do |c|
1112
+ c.use :httpx
1113
+
1114
+ # optionally, specify a different service name for hostnames matching a regex
1115
+ c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
1116
+ http.service_name = 'user.example.com'
1117
+ http.split_by_domain = false # Only necessary if split_by_domain is true by default
1118
+ end
1119
+ end
1120
+ ```
1121
+
1082
1122
  ### Kafka
1083
1123
 
1084
1124
  The Kafka integration provides tracing of the `ruby-kafka` gem:
@@ -1099,7 +1139,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1099
1139
 
1100
1140
  | Key | Description | Default |
1101
1141
  | --- | ----------- | ------- |
1102
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1103
1142
  | `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
1104
1143
  | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1105
1144
 
@@ -1128,7 +1167,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1128
1167
 
1129
1168
  | Key | Description | Default |
1130
1169
  | --- | ----------- | ------- |
1131
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1132
1170
  | `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{ show: [:collection, :database, :operation] }` |
1133
1171
  | `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
1134
1172
 
@@ -1152,7 +1190,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1152
1190
 
1153
1191
  | Key | Description | Default |
1154
1192
  | --- | ----------- | ------- |
1155
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1156
1193
  | `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
1157
1194
 
1158
1195
  ### Net/HTTP
@@ -1185,7 +1222,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1185
1222
 
1186
1223
  | Key | Description | Default |
1187
1224
  | --- | ----------- | ------- |
1188
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1189
1225
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1190
1226
  | `service_name` | Service name used for `http` instrumentation | `'net/http'` |
1191
1227
  | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
@@ -1226,7 +1262,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1226
1262
 
1227
1263
  | Key | Description | Default |
1228
1264
  | --- | ----------- | ------- |
1229
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1230
1265
  | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1231
1266
 
1232
1267
  ### Qless
@@ -1247,7 +1282,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1247
1282
 
1248
1283
  | Key | Description | Default |
1249
1284
  | --- | ----------- | ------- |
1250
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1251
1285
  | `service_name` | Service name used for `qless` instrumentation | `'qless'` |
1252
1286
  | `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
1253
1287
  | `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
@@ -1270,7 +1304,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1270
1304
 
1271
1305
  | Key | Description | Default |
1272
1306
  | --- | ----------- | ------- |
1273
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1274
1307
  | `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1275
1308
  | `service_name` | Service name used for `que` instrumentation | `'que'` |
1276
1309
  | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
@@ -1295,7 +1328,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1295
1328
 
1296
1329
  | Key | Description | Default |
1297
1330
  | --- | ----------- | ------- |
1298
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1299
1331
  | `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
1300
1332
 
1301
1333
  ### Rack
@@ -1325,7 +1357,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1325
1357
 
1326
1358
  | Key | Description | Default |
1327
1359
  | --- | ----------- | ------- |
1328
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1329
1360
  | `application` | Your Rack application. Required for `middleware_names`. | `nil` |
1330
1361
  | `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` |
1331
1362
  | `headers` | Hash of HTTP request or response headers to add as tags to the `rack.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
@@ -1388,7 +1419,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1388
1419
 
1389
1420
  | Key | Description | Default |
1390
1421
  | --- | ----------- | ------- |
1391
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `nil` |
1392
1422
  | `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
1393
1423
  | `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
1394
1424
  | `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
@@ -1438,7 +1468,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1438
1468
 
1439
1469
  | Key | Description | Default |
1440
1470
  | --- | ----------- | ------- |
1441
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1442
1471
  | `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1443
1472
  | `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
1444
1473
  | `service_name` | Service name used for `rake` instrumentation | `'rake'` |
@@ -1498,7 +1527,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1498
1527
 
1499
1528
  | Key | Description | Default |
1500
1529
  | --- | ----------- | ------- |
1501
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1502
1530
  | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1503
1531
  | `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
1504
1532
 
@@ -1538,12 +1566,17 @@ Datadog.configure do |c|
1538
1566
  # The default configuration for any redis client
1539
1567
  c.use :redis, service_name: 'redis-default'
1540
1568
 
1541
- # The configuration matching a given unix socket
1569
+ # The configuration matching a given unix socket.
1542
1570
  c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
1543
1571
 
1544
- # Connection string
1545
- c.use :redis, describes: { url: 'redis://127.0.0.1:6379/0' }, service_name: 'redis-connection-string'
1546
- # Client host, port, db, scheme
1572
+ # For network connections, only these fields are considered during matching:
1573
+ # scheme, host, port, db
1574
+ # Other fields are ignored.
1575
+
1576
+ # Network connection string
1577
+ c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
1578
+ c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
1579
+ # Network client hash
1547
1580
  c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
1548
1581
  # Only a subset of the connection hash
1549
1582
  c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
@@ -1551,6 +1584,8 @@ Datadog.configure do |c|
1551
1584
  end
1552
1585
  ```
1553
1586
 
1587
+ When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
1588
+
1554
1589
  ### Resque
1555
1590
 
1556
1591
  The Resque integration uses Resque hooks that wraps the `perform` method.
@@ -1558,16 +1593,11 @@ The Resque integration uses Resque hooks that wraps the `perform` method.
1558
1593
  To add tracing to a Resque job:
1559
1594
 
1560
1595
  ```ruby
1596
+ require 'resque'
1561
1597
  require 'ddtrace'
1562
1598
 
1563
- class MyJob
1564
- def self.perform(*args)
1565
- # do_something
1566
- end
1567
- end
1568
-
1569
1599
  Datadog.configure do |c|
1570
- c.use :resque, options
1600
+ c.use :resque, **options
1571
1601
  end
1572
1602
  ```
1573
1603
 
@@ -1575,10 +1605,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1575
1605
 
1576
1606
  | Key | Description | Default |
1577
1607
  | --- | ----------- | ------- |
1578
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
1579
1608
  | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1580
- | `workers` | An array including all worker classes you want to trace (e.g. `[MyJob]`) | `[]` |
1581
1609
  | `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? }` |
1610
+ | `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
1582
1611
 
1583
1612
  ### Rest Client
1584
1613
 
@@ -1597,7 +1626,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1597
1626
 
1598
1627
  | Key | Description | Default |
1599
1628
  | --- | ----------- | ------- |
1600
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1601
1629
  | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1602
1630
  | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1603
1631
 
@@ -1621,7 +1649,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1621
1649
 
1622
1650
  | Key | Description | Default |
1623
1651
  | --- | ----------- | ------- |
1624
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `true` |
1625
1652
  | `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1626
1653
  | `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
1627
1654
  | `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
@@ -1656,11 +1683,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1656
1683
 
1657
1684
  | Key | Description | Default |
1658
1685
  | --- | ----------- | ------- |
1659
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1660
1686
  | `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
1661
1687
 
1662
- Only Ruby 2.0+ is supported.
1663
-
1664
1688
  **Configuring databases to use different settings**
1665
1689
 
1666
1690
  If you use multiple databases with Sequel, you can give each of them different settings by configuring their respective `Sequel::Database` objects:
@@ -1692,8 +1716,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1692
1716
 
1693
1717
  | Key | Description | Default |
1694
1718
  | --- | ----------- | ------- |
1695
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1696
1719
  | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1720
+ | `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
1697
1721
  | `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? }` |
1698
1722
 
1699
1723
  ### Sidekiq
@@ -1714,7 +1738,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1714
1738
 
1715
1739
  | Key | Description | Default |
1716
1740
  | --- | ----------- | ------- |
1717
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1718
1741
  | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1719
1742
  | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1720
1743
  | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
@@ -1778,7 +1801,6 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
1778
1801
 
1779
1802
  | Key | Description | Default |
1780
1803
  | --- | ----------- | ------- |
1781
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
1782
1804
  | `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` |
1783
1805
  | `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'] }` |
1784
1806
  | `resource_script_names` | Prepend resource names with script name | `false` |
@@ -1802,7 +1824,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1802
1824
 
1803
1825
  | Key | Description | Default |
1804
1826
  | --- | ----------- | ------- |
1805
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1806
1827
  | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1807
1828
  | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1808
1829
  | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
@@ -1827,7 +1848,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
1827
1848
 
1828
1849
  | Key | Description | Default |
1829
1850
  | --- | ----------- | ------- |
1830
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
1831
1851
  | `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
1832
1852
 
1833
1853
  ## Advanced configuration
@@ -1843,13 +1863,20 @@ Datadog.configure do |c|
1843
1863
  c.tracer.enabled = true
1844
1864
  c.tracer.hostname = 'my-agent'
1845
1865
  c.tracer.port = 8126
1846
- c.tracer.partial_flush.enabled = false
1866
+
1867
+ # Ensure all traces are ingested by Datadog
1868
+ c.sampling.default_rate = 1.0 # Recommended
1869
+ c.sampling.rate_limit = 200
1870
+ # or provide a custom implementation (overrides c.sampling settings)
1847
1871
  c.tracer.sampler = Datadog::AllSampler.new
1848
1872
 
1849
- # OR for advanced use cases, you can specify your own tracer:
1873
+ # Breaks down very large traces into smaller batches
1874
+ c.tracer.partial_flush.enabled = false
1875
+
1876
+ # You can specify your own tracer
1850
1877
  c.tracer.instance = Datadog::Tracer.new
1851
1878
 
1852
- # To enable debug mode:
1879
+ # To enable debug mode
1853
1880
  c.diagnostics.debug = true
1854
1881
  end
1855
1882
  ```
@@ -1861,9 +1888,12 @@ Available options are:
1861
1888
  - `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
1862
1889
  - `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
1863
1890
  - `port`: set the port the trace agent is listening on.
1891
+ - `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.
1892
+ - `sampling.rate_limit`: maximum number of traces per second to sample. Defaults to 100 per second.
1864
1893
  - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1865
1894
  - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1866
1895
  - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1896
+ - `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 }`.
1867
1897
 
1868
1898
  #### Custom logging
1869
1899
 
@@ -1917,13 +1947,22 @@ Other Environment Variables:
1917
1947
 
1918
1948
  - `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`.
1919
1949
  - `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.
1920
- - `DD_TRACE_<INTEGRATION>_ANALYTICS_ENABLED`: Enables or disable App Analytics for a specific integration. Valid values are: true or false (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED=true`.
1921
- - `DD_TRACE_<INTEGRATION>_ANALYTICS_SAMPLE_RATE`: Sets the App Analytics sampling rate for a specific integration. A floating number between 0.0 and 1.0 (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE=0.5`.
1950
+ - `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.
1922
1951
  - `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`.
1923
1952
 
1924
1953
  ### Sampling
1925
1954
 
1926
- `ddtrace` can perform trace sampling. While the trace agent already samples traces to reduce bandwidth usage, client sampling reduces the performance overhead.
1955
+ 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/).
1956
+
1957
+ We recommend setting the environment variable `DD_TRACE_SAMPLE_RATE=1.0` in all new applications using `ddtrace`.
1958
+
1959
+ 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/).
1960
+
1961
+ #### Application-side sampling
1962
+
1963
+ While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
1964
+
1965
+ This will **reduce visibility and is not recommended**. See [DD_TRACE_SAMPLE_RATE](#environment-variables) for the recommended sampling approach.
1927
1966
 
1928
1967
  `Datadog::RateSampler` samples a ratio of the traces. For example:
1929
1968
 
@@ -2081,13 +2120,14 @@ For more details on how to activate distributed tracing for integrations, see th
2081
2120
 
2082
2121
  - [Excon](#excon)
2083
2122
  - [Faraday](#faraday)
2084
- - [Rest Client](#restclient)
2123
+ - [Rest Client](#rest-client)
2085
2124
  - [Net/HTTP](#nethttp)
2086
2125
  - [Rack](#rack)
2087
2126
  - [Rails](#rails)
2088
2127
  - [Sinatra](#sinatra)
2089
2128
  - [http.rb](#http-rb)
2090
2129
  - [httpclient](#httpclient)
2130
+ - [httpx](#httpx)
2091
2131
 
2092
2132
  **Using the HTTP propagator**
2093
2133
 
@@ -2203,7 +2243,7 @@ In many cases, such as logging, it may be useful to correlate trace IDs to other
2203
2243
 
2204
2244
  ##### Automatic
2205
2245
 
2206
- For Rails applications using the default logger (`ActiveSupport::TaggedLogging`) or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
2246
+ 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`:
2207
2247
 
2208
2248
  ```ruby
2209
2249
  # config/initializers/datadog.rb
@@ -2214,8 +2254,6 @@ Datadog.configure do |c|
2214
2254
  end
2215
2255
  ```
2216
2256
 
2217
- _Note:_ For `lograge` users who have also defined `lograge.custom_options` in an `initializers/lograge.rb` configuration file, due to the order that Rails loads initializers (alphabetical), automatic trace correlation may not take effect, since `initializers/datadog.rb` would be overwritten by the `initializers/lograge.rb` initializer. To support automatic trace correlation with _existing_ `lograge.custom_options`, use the [Manual (Lograge)](#manual-lograge) configuration below.
2218
-
2219
2257
  ##### Manual (Lograge)
2220
2258
 
2221
2259
  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.
@@ -2375,7 +2413,7 @@ The tracer and its integrations can produce some additional metrics that can pro
2375
2413
  To configure your application for metrics collection:
2376
2414
 
2377
2415
  1. [Configure your Datadog agent for StatsD](https://docs.datadoghq.com/developers/dogstatsd/#setup)
2378
- 2. Add `gem 'dogstatsd-ruby'` to your Gemfile
2416
+ 2. Add `gem 'dogstatsd-ruby', '~> 5.2'` to your Gemfile
2379
2417
 
2380
2418
  #### For application runtime
2381
2419
 
@@ -2445,3 +2483,53 @@ However, additional instrumentation provided by Datadog can be activated alongsi
2445
2483
  | `OpenTracing::FORMAT_TEXT_MAP` | Yes | |
2446
2484
  | `OpenTracing::FORMAT_RACK` | Yes | Because of the loss of resolution in the Rack format, please note that baggage items with names containing either upper case characters or `-` will be converted to lower case and `_` in a round-trip respectively. We recommend avoiding these characters or accommodating accordingly on the receiving end. |
2447
2485
  | `OpenTracing::FORMAT_BINARY` | No | |
2486
+
2487
+ ### Profiling
2488
+
2489
+ *Currently available as BETA feature.*
2490
+
2491
+ `ddtrace` can produce profiles that measure method-level application resource usage within production environments. These profiles can give insight into resources spent in Ruby code outside of existing trace instrumentation.
2492
+
2493
+ **Setup**
2494
+
2495
+ To get started with profiling, follow the [Profiler Getting Started Guide](https://docs.datadoghq.com/tracing/profiler/getting_started/?code-lang=ruby).
2496
+
2497
+ #### Troubleshooting
2498
+
2499
+ If you run into issues with profiling, please check the [Profiler Troubleshooting Guide](https://docs.datadoghq.com/tracing/profiler/profiler_troubleshooting/?code-lang=ruby).
2500
+
2501
+ #### Profiling Resque jobs
2502
+
2503
+ When profiling [Resque](https://github.com/resque/resque) jobs, you should set the `RUN_AT_EXIT_HOOKS=1` option described in the [Resque](https://github.com/resque/resque/blob/v2.0.0/docs/HOOKS.md#worker-hooks) documentation.
2504
+
2505
+ Without this flag, profiles for short-lived Resque jobs will not be available as Resque kills worker processes before they have a chance to submit this information.
2506
+
2507
+ ## Known issues and suggested configurations
2508
+
2509
+ ### Payload too large
2510
+
2511
+ 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.
2512
+
2513
+ If traces are missing, enable [debug mode](#tracer-settings) to check if messages containing `"Dropping trace. Payload too large"` are logged.
2514
+
2515
+ 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.
2516
+
2517
+ 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.
2518
+
2519
+ ### Stack level too deep
2520
+
2521
+ Datadog tracing collects trace data by adding instrumentation into other common libraries (e.g. Rails, Rack, etc.) Some libraries provide APIs to add this instrumentation, but some do not. In order to add instrumentation into libraries lacking an instrumentation API, Datadog uses a technique called "monkey-patching" to modify the code of that library.
2522
+
2523
+ In Ruby version 1.9.3 and earlier, "monkey-patching" often involved the use of [`alias_method`](https://ruby-doc.org/core-3.0.0/Module.html#method-i-alias_method), also known as *method rewriting*, to destructively replace existing Ruby methods. However, this practice would often create conflicts & errors if two libraries attempted to "rewrite" the same method. (e.g. two different APM packages trying to instrument the same method.)
2524
+
2525
+ 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.
2526
+
2527
+ 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.
2528
+
2529
+ As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
2530
+
2531
+ * `rack-mini-profiler`: [Net::HTTP stack level too deep errors](https://github.com/MiniProfiler/rack-mini-profiler#nethttp-stack-level-too-deep-errors).
2532
+
2533
+ For libraries without a known workaround, consider removing the library using `alias` or `Module#alias_method` or separating libraries into different environments for testing.
2534
+
2535
+ For any further questions or to report an occurence of this issue, please [reach out to Datadog support](https://docs.datadoghq.com/help)