ddtrace 0.54.2 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1222) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +654 -2
  3. data/LICENSE-3rdparty.csv +7 -1
  4. data/README.md +10 -1
  5. data/bin/ddtracerb +5 -5
  6. data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +134 -0
  7. data/ext/ddtrace_profiling_loader/extconf.rb +72 -0
  8. data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +79 -9
  9. data/ext/ddtrace_profiling_native_extension/clock_id.h +22 -1
  10. data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +33 -10
  11. data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +11 -2
  12. data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +821 -0
  13. data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.c +142 -0
  14. data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.h +14 -0
  15. data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c +241 -0
  16. data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.h +3 -0
  17. data/ext/ddtrace_profiling_native_extension/collectors_stack.c +379 -0
  18. data/ext/ddtrace_profiling_native_extension/collectors_stack.h +20 -0
  19. data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +978 -0
  20. data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +14 -0
  21. data/ext/ddtrace_profiling_native_extension/extconf.rb +155 -115
  22. data/ext/ddtrace_profiling_native_extension/helpers.h +17 -0
  23. data/ext/ddtrace_profiling_native_extension/http_transport.c +347 -0
  24. data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +25 -0
  25. data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +319 -0
  26. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +706 -9
  27. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +42 -0
  28. data/ext/ddtrace_profiling_native_extension/profiling.c +231 -2
  29. data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +110 -0
  30. data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +89 -0
  31. data/ext/ddtrace_profiling_native_extension/setup_signal_handler.c +115 -0
  32. data/ext/ddtrace_profiling_native_extension/setup_signal_handler.h +11 -0
  33. data/ext/ddtrace_profiling_native_extension/stack_recorder.c +591 -0
  34. data/ext/ddtrace_profiling_native_extension/stack_recorder.h +14 -0
  35. data/ext/ddtrace_profiling_native_extension/time_helpers.c +17 -0
  36. data/ext/ddtrace_profiling_native_extension/time_helpers.h +10 -0
  37. data/lib/datadog/appsec/assets/blocked.html +99 -0
  38. data/lib/datadog/appsec/assets/blocked.json +1 -0
  39. data/lib/datadog/appsec/assets/blocked.text +5 -0
  40. data/lib/datadog/appsec/assets/waf_rules/README.md +7 -0
  41. data/lib/datadog/appsec/assets/waf_rules/recommended.json +6724 -0
  42. data/lib/datadog/appsec/assets/waf_rules/strict.json +1590 -0
  43. data/lib/datadog/appsec/assets.rb +36 -0
  44. data/lib/datadog/appsec/autoload.rb +11 -0
  45. data/lib/datadog/appsec/component.rb +41 -0
  46. data/lib/datadog/appsec/configuration/settings.rb +216 -0
  47. data/lib/datadog/appsec/configuration.rb +88 -0
  48. data/lib/datadog/appsec/contrib/auto_instrument.rb +25 -0
  49. data/lib/datadog/appsec/contrib/configuration/settings.rb +18 -0
  50. data/lib/datadog/appsec/contrib/integration.rb +35 -0
  51. data/lib/datadog/appsec/contrib/patcher.rb +10 -0
  52. data/lib/datadog/appsec/contrib/rack/configuration/settings.rb +20 -0
  53. data/lib/datadog/appsec/contrib/rack/ext.rb +13 -0
  54. data/lib/datadog/appsec/contrib/rack/gateway/request.rb +97 -0
  55. data/lib/datadog/appsec/contrib/rack/gateway/response.rb +30 -0
  56. data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +176 -0
  57. data/lib/datadog/appsec/contrib/rack/integration.rb +47 -0
  58. data/lib/datadog/appsec/contrib/rack/patcher.rb +32 -0
  59. data/lib/datadog/appsec/contrib/rack/reactive/request.rb +80 -0
  60. data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +63 -0
  61. data/lib/datadog/appsec/contrib/rack/reactive/response.rb +63 -0
  62. data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +43 -0
  63. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +153 -0
  64. data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +20 -0
  65. data/lib/datadog/appsec/contrib/rails/ext.rb +13 -0
  66. data/lib/datadog/appsec/contrib/rails/framework.rb +28 -0
  67. data/lib/datadog/appsec/contrib/rails/gateway/request.rb +67 -0
  68. data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +86 -0
  69. data/lib/datadog/appsec/contrib/rails/integration.rb +46 -0
  70. data/lib/datadog/appsec/contrib/rails/patcher.rb +159 -0
  71. data/lib/datadog/appsec/contrib/rails/reactive/action.rb +69 -0
  72. data/lib/datadog/appsec/contrib/rails/request.rb +34 -0
  73. data/lib/datadog/appsec/contrib/rails/request_middleware.rb +18 -0
  74. data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +20 -0
  75. data/lib/datadog/appsec/contrib/sinatra/ext.rb +14 -0
  76. data/lib/datadog/appsec/contrib/sinatra/framework.rb +32 -0
  77. data/lib/datadog/appsec/contrib/sinatra/gateway/request.rb +17 -0
  78. data/lib/datadog/appsec/contrib/sinatra/gateway/route_params.rb +23 -0
  79. data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +131 -0
  80. data/lib/datadog/appsec/contrib/sinatra/integration.rb +46 -0
  81. data/lib/datadog/appsec/contrib/sinatra/patcher.rb +159 -0
  82. data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +64 -0
  83. data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +18 -0
  84. data/lib/datadog/appsec/event.rb +113 -0
  85. data/lib/datadog/appsec/ext.rb +9 -0
  86. data/lib/datadog/appsec/extensions.rb +146 -0
  87. data/lib/datadog/appsec/instrumentation/gateway/argument.rb +24 -0
  88. data/lib/datadog/appsec/instrumentation/gateway.rb +64 -0
  89. data/lib/datadog/appsec/instrumentation.rb +9 -0
  90. data/lib/datadog/appsec/monitor/gateway/watcher.rb +86 -0
  91. data/lib/datadog/appsec/monitor/reactive/set_user.rb +61 -0
  92. data/lib/datadog/appsec/monitor.rb +11 -0
  93. data/lib/datadog/appsec/processor.rb +243 -0
  94. data/lib/datadog/appsec/rate_limiter.rb +58 -0
  95. data/lib/datadog/appsec/reactive/address_hash.rb +22 -0
  96. data/lib/datadog/appsec/reactive/engine.rb +47 -0
  97. data/lib/datadog/appsec/reactive/operation.rb +68 -0
  98. data/lib/datadog/appsec/reactive/subscriber.rb +19 -0
  99. data/lib/datadog/appsec/response.rb +61 -0
  100. data/lib/datadog/appsec/utils/http/media_range.rb +199 -0
  101. data/lib/datadog/appsec/utils/http/media_type.rb +85 -0
  102. data/lib/datadog/appsec/utils/http.rb +9 -0
  103. data/lib/datadog/appsec/utils.rb +7 -0
  104. data/lib/datadog/appsec.rb +41 -0
  105. data/lib/datadog/ci/configuration/components.rb +8 -9
  106. data/lib/datadog/ci/configuration/settings.rb +19 -5
  107. data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +4 -4
  108. data/lib/datadog/ci/contrib/cucumber/ext.rb +1 -1
  109. data/lib/datadog/ci/contrib/cucumber/formatter.rb +8 -15
  110. data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +2 -3
  111. data/lib/datadog/ci/contrib/cucumber/integration.rb +5 -6
  112. data/lib/datadog/ci/contrib/cucumber/patcher.rb +3 -4
  113. data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +4 -4
  114. data/lib/datadog/ci/contrib/rspec/example.rb +8 -15
  115. data/lib/datadog/ci/contrib/rspec/ext.rb +1 -1
  116. data/lib/datadog/ci/contrib/rspec/integration.rb +5 -6
  117. data/lib/datadog/ci/contrib/rspec/patcher.rb +3 -4
  118. data/lib/datadog/ci/ext/app_types.rb +1 -2
  119. data/lib/datadog/ci/ext/environment.rb +181 -127
  120. data/lib/datadog/ci/ext/settings.rb +1 -2
  121. data/lib/datadog/ci/ext/test.rb +0 -1
  122. data/lib/datadog/ci/extensions.rb +6 -7
  123. data/lib/datadog/ci/flush.rb +36 -0
  124. data/lib/datadog/ci/test.rb +15 -15
  125. data/lib/datadog/ci.rb +6 -5
  126. data/lib/datadog/core/buffer/cruby.rb +53 -0
  127. data/lib/datadog/core/buffer/random.rb +132 -0
  128. data/lib/datadog/core/buffer/thread_safe.rb +56 -0
  129. data/lib/datadog/core/chunker.rb +33 -0
  130. data/lib/datadog/core/configuration/agent_settings_resolver.rb +345 -0
  131. data/lib/datadog/core/configuration/base.rb +99 -0
  132. data/lib/datadog/core/configuration/components.rb +158 -0
  133. data/lib/datadog/core/configuration/dependency_resolver.rb +26 -0
  134. data/lib/datadog/core/configuration/ext.rb +24 -0
  135. data/lib/datadog/core/configuration/option.rb +67 -0
  136. data/lib/datadog/core/configuration/option_definition.rb +133 -0
  137. data/lib/datadog/core/configuration/option_definition_set.rb +20 -0
  138. data/lib/datadog/core/configuration/option_set.rb +8 -0
  139. data/lib/datadog/core/configuration/options.rb +116 -0
  140. data/lib/datadog/core/configuration/settings.rb +455 -0
  141. data/lib/datadog/core/configuration.rb +285 -0
  142. data/lib/datadog/core/diagnostics/environment_logger.rb +286 -0
  143. data/lib/datadog/core/diagnostics/health.rb +17 -0
  144. data/lib/datadog/core/encoding.rb +72 -0
  145. data/lib/datadog/core/environment/cgroup.rb +4 -5
  146. data/lib/datadog/core/environment/class_count.rb +0 -1
  147. data/lib/datadog/core/environment/container.rb +3 -5
  148. data/lib/datadog/core/environment/ext.rb +28 -11
  149. data/lib/datadog/core/environment/gc.rb +0 -1
  150. data/lib/datadog/core/environment/identity.rb +11 -6
  151. data/lib/datadog/core/environment/platform.rb +38 -0
  152. data/lib/datadog/core/environment/socket.rb +7 -2
  153. data/lib/datadog/core/environment/thread_count.rb +0 -1
  154. data/lib/datadog/core/environment/variable_helpers.rb +84 -12
  155. data/lib/datadog/core/environment/vm_cache.rb +17 -1
  156. data/lib/datadog/core/error.rb +99 -0
  157. data/lib/datadog/core/extensions.rb +14 -0
  158. data/lib/datadog/core/git/ext.rb +33 -0
  159. data/lib/datadog/core/header_collection.rb +41 -0
  160. data/lib/datadog/core/logger.rb +44 -0
  161. data/lib/datadog/core/logging/ext.rb +11 -0
  162. data/lib/datadog/core/metrics/client.rb +197 -0
  163. data/lib/datadog/core/metrics/ext.rb +16 -0
  164. data/lib/datadog/core/metrics/helpers.rb +23 -0
  165. data/lib/datadog/core/metrics/logging.rb +42 -0
  166. data/lib/datadog/core/metrics/metric.rb +12 -0
  167. data/lib/datadog/core/metrics/options.rb +48 -0
  168. data/lib/datadog/core/pin.rb +73 -0
  169. data/lib/datadog/core/runtime/ext.rb +28 -0
  170. data/lib/datadog/core/runtime/metrics.rb +140 -0
  171. data/lib/datadog/core/telemetry/client.rb +77 -0
  172. data/lib/datadog/core/telemetry/collector.rb +231 -0
  173. data/lib/datadog/core/telemetry/emitter.rb +46 -0
  174. data/lib/datadog/core/telemetry/event.rb +67 -0
  175. data/lib/datadog/core/telemetry/ext.rb +9 -0
  176. data/lib/datadog/core/telemetry/heartbeat.rb +35 -0
  177. data/lib/datadog/core/telemetry/http/adapters/net.rb +111 -0
  178. data/lib/datadog/core/telemetry/http/env.rb +18 -0
  179. data/lib/datadog/core/telemetry/http/ext.rb +20 -0
  180. data/lib/datadog/core/telemetry/http/response.rb +64 -0
  181. data/lib/datadog/core/telemetry/http/transport.rb +51 -0
  182. data/lib/datadog/core/telemetry/v1/app_event.rb +50 -0
  183. data/lib/datadog/core/telemetry/v1/application.rb +86 -0
  184. data/lib/datadog/core/telemetry/v1/configuration.rb +25 -0
  185. data/lib/datadog/core/telemetry/v1/dependency.rb +36 -0
  186. data/lib/datadog/core/telemetry/v1/host.rb +51 -0
  187. data/lib/datadog/core/telemetry/v1/integration.rb +58 -0
  188. data/lib/datadog/core/telemetry/v1/product.rb +28 -0
  189. data/lib/datadog/core/telemetry/v1/telemetry_request.rb +100 -0
  190. data/lib/datadog/core/utils/compression.rb +34 -0
  191. data/lib/datadog/core/utils/forking.rb +61 -0
  192. data/lib/datadog/core/utils/network.rb +140 -0
  193. data/lib/datadog/core/utils/object_set.rb +41 -0
  194. data/lib/datadog/core/utils/only_once.rb +42 -0
  195. data/lib/datadog/core/utils/safe_dup.rb +25 -0
  196. data/lib/datadog/core/utils/sequence.rb +24 -0
  197. data/lib/datadog/core/utils/string_table.rb +47 -0
  198. data/lib/datadog/core/utils/time.rb +50 -0
  199. data/lib/datadog/core/utils.rb +92 -0
  200. data/lib/datadog/core/vendor/ipaddr.rb +78 -0
  201. data/lib/datadog/core/vendor/multipart-post/multipart/post/composite_read_io.rb +118 -0
  202. data/lib/datadog/core/vendor/multipart-post/multipart/post/multipartable.rb +59 -0
  203. data/lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb +137 -0
  204. data/lib/datadog/core/vendor/multipart-post/multipart/post/version.rb +11 -0
  205. data/lib/datadog/core/vendor/multipart-post/multipart/post.rb +10 -0
  206. data/lib/datadog/core/vendor/multipart-post/multipart.rb +14 -0
  207. data/lib/datadog/core/vendor/multipart-post/net/http/post/multipart.rb +34 -0
  208. data/lib/datadog/core/worker.rb +22 -0
  209. data/lib/datadog/core/workers/async.rb +178 -0
  210. data/lib/datadog/core/workers/interval_loop.rb +117 -0
  211. data/lib/datadog/core/workers/polling.rb +57 -0
  212. data/lib/datadog/core/workers/queue.rb +42 -0
  213. data/lib/datadog/core/workers/runtime_metrics.rb +60 -0
  214. data/lib/datadog/core.rb +45 -0
  215. data/lib/datadog/kit/appsec/events.rb +74 -0
  216. data/lib/datadog/kit/enable_core_dumps.rb +50 -0
  217. data/lib/datadog/kit/identity.rb +70 -0
  218. data/lib/datadog/kit.rb +9 -0
  219. data/lib/datadog/opentelemetry/api/context.rb +186 -0
  220. data/lib/datadog/opentelemetry/api/trace/span.rb +14 -0
  221. data/lib/datadog/opentelemetry/sdk/configurator.rb +37 -0
  222. data/lib/datadog/opentelemetry/sdk/id_generator.rb +26 -0
  223. data/lib/datadog/opentelemetry/sdk/propagator.rb +90 -0
  224. data/lib/datadog/opentelemetry/sdk/span_processor.rb +91 -0
  225. data/lib/datadog/opentelemetry.rb +47 -0
  226. data/lib/datadog/opentracer/binary_propagator.rb +24 -0
  227. data/lib/datadog/opentracer/carrier.rb +7 -0
  228. data/lib/datadog/opentracer/distributed_headers.rb +54 -0
  229. data/lib/datadog/opentracer/global_tracer.rb +15 -0
  230. data/lib/datadog/opentracer/propagator.rb +24 -0
  231. data/lib/datadog/opentracer/rack_propagator.rb +71 -0
  232. data/lib/datadog/opentracer/scope.rb +16 -0
  233. data/lib/datadog/opentracer/scope_manager.rb +7 -0
  234. data/lib/datadog/opentracer/span.rb +99 -0
  235. data/lib/datadog/opentracer/span_context.rb +17 -0
  236. data/lib/datadog/opentracer/span_context_factory.rb +25 -0
  237. data/lib/datadog/opentracer/text_map_propagator.rb +86 -0
  238. data/lib/datadog/opentracer/thread_local_scope.rb +32 -0
  239. data/lib/datadog/opentracer/thread_local_scope_manager.rb +64 -0
  240. data/lib/datadog/opentracer/tracer.rb +212 -0
  241. data/lib/datadog/opentracer.rb +22 -0
  242. data/lib/datadog/profiling/backtrace_location.rb +32 -0
  243. data/lib/datadog/profiling/buffer.rb +41 -0
  244. data/lib/datadog/profiling/collectors/code_provenance.rb +113 -0
  245. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +96 -0
  246. data/lib/datadog/profiling/collectors/dynamic_sampling_rate.rb +12 -0
  247. data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +66 -0
  248. data/lib/datadog/profiling/collectors/old_stack.rb +301 -0
  249. data/lib/datadog/profiling/collectors/stack.rb +11 -0
  250. data/lib/datadog/profiling/collectors/thread_context.rb +46 -0
  251. data/lib/datadog/profiling/component.rb +161 -0
  252. data/lib/datadog/profiling/encoding/profile.rb +41 -0
  253. data/lib/datadog/profiling/event.rb +13 -0
  254. data/lib/datadog/profiling/events/stack.rb +80 -0
  255. data/lib/datadog/profiling/exporter.rb +83 -0
  256. data/lib/datadog/profiling/ext/forking.rb +96 -0
  257. data/lib/datadog/profiling/ext.rb +43 -0
  258. data/lib/datadog/profiling/flush.rb +36 -0
  259. data/lib/datadog/profiling/http_transport.rb +130 -0
  260. data/lib/datadog/profiling/load_native_extension.rb +20 -0
  261. data/lib/datadog/profiling/native_extension.rb +39 -0
  262. data/lib/datadog/profiling/old_recorder.rb +107 -0
  263. data/lib/datadog/profiling/pprof/builder.rb +125 -0
  264. data/lib/datadog/profiling/pprof/converter.rb +102 -0
  265. data/lib/datadog/profiling/pprof/message_set.rb +14 -0
  266. data/lib/datadog/profiling/pprof/payload.rb +18 -0
  267. data/lib/datadog/profiling/pprof/pprof_pb.rb +81 -0
  268. data/lib/datadog/profiling/pprof/stack_sample.rb +139 -0
  269. data/lib/datadog/profiling/pprof/string_table.rb +10 -0
  270. data/lib/datadog/profiling/pprof/template.rb +118 -0
  271. data/lib/datadog/profiling/preload.rb +3 -0
  272. data/lib/datadog/profiling/profiler.rb +39 -0
  273. data/lib/datadog/profiling/scheduler.rb +128 -0
  274. data/lib/datadog/profiling/stack_recorder.rb +74 -0
  275. data/lib/datadog/profiling/tag_builder.rb +51 -0
  276. data/lib/datadog/profiling/tasks/exec.rb +48 -0
  277. data/lib/datadog/profiling/tasks/help.rb +16 -0
  278. data/lib/datadog/profiling/tasks/setup.rb +84 -0
  279. data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +43 -0
  280. data/lib/datadog/profiling/trace_identifiers/helper.rb +45 -0
  281. data/lib/datadog/profiling.rb +210 -0
  282. data/lib/datadog/tracing/analytics.rb +23 -0
  283. data/lib/datadog/tracing/buffer.rb +128 -0
  284. data/lib/datadog/tracing/client_ip.rb +61 -0
  285. data/lib/datadog/tracing/component.rb +176 -0
  286. data/lib/datadog/tracing/configuration/ext.rb +94 -0
  287. data/lib/datadog/tracing/configuration/settings.rb +451 -0
  288. data/lib/datadog/tracing/context.rb +66 -0
  289. data/lib/datadog/tracing/context_provider.rb +80 -0
  290. data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +33 -0
  291. data/lib/datadog/tracing/contrib/action_cable/event.rb +69 -0
  292. data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +56 -0
  293. data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +61 -0
  294. data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +57 -0
  295. data/lib/datadog/tracing/contrib/action_cable/events.rb +35 -0
  296. data/lib/datadog/tracing/contrib/action_cable/ext.rb +30 -0
  297. data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +88 -0
  298. data/lib/datadog/tracing/contrib/action_cable/integration.rb +48 -0
  299. data/lib/datadog/tracing/contrib/action_cable/patcher.rb +29 -0
  300. data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +34 -0
  301. data/lib/datadog/tracing/contrib/action_mailer/event.rb +50 -0
  302. data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +58 -0
  303. data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +45 -0
  304. data/lib/datadog/tracing/contrib/action_mailer/events.rb +32 -0
  305. data/lib/datadog/tracing/contrib/action_mailer/ext.rb +31 -0
  306. data/lib/datadog/tracing/contrib/action_mailer/integration.rb +48 -0
  307. data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +27 -0
  308. data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +158 -0
  309. data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +27 -0
  310. data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +34 -0
  311. data/lib/datadog/tracing/contrib/action_pack/ext.rb +20 -0
  312. data/lib/datadog/tracing/contrib/action_pack/integration.rb +48 -0
  313. data/lib/datadog/tracing/contrib/action_pack/patcher.rb +25 -0
  314. data/lib/datadog/tracing/contrib/action_pack/utils.rb +38 -0
  315. data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +34 -0
  316. data/lib/datadog/tracing/contrib/action_view/event.rb +33 -0
  317. data/lib/datadog/tracing/contrib/action_view/events/render_partial.rb +52 -0
  318. data/lib/datadog/tracing/contrib/action_view/events/render_template.rb +55 -0
  319. data/lib/datadog/tracing/contrib/action_view/events.rb +32 -0
  320. data/lib/datadog/tracing/contrib/action_view/ext.rb +22 -0
  321. data/lib/datadog/tracing/contrib/action_view/instrumentation/partial_renderer.rb +76 -0
  322. data/lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb +89 -0
  323. data/lib/datadog/tracing/contrib/action_view/integration.rb +55 -0
  324. data/lib/datadog/tracing/contrib/action_view/patcher.rb +45 -0
  325. data/lib/datadog/tracing/contrib/action_view/utils.rb +34 -0
  326. data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +35 -0
  327. data/lib/datadog/tracing/contrib/active_job/event.rb +56 -0
  328. data/lib/datadog/tracing/contrib/active_job/events/discard.rb +48 -0
  329. data/lib/datadog/tracing/contrib/active_job/events/enqueue.rb +47 -0
  330. data/lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb +47 -0
  331. data/lib/datadog/tracing/contrib/active_job/events/enqueue_retry.rb +49 -0
  332. data/lib/datadog/tracing/contrib/active_job/events/perform.rb +47 -0
  333. data/lib/datadog/tracing/contrib/active_job/events/retry_stopped.rb +48 -0
  334. data/lib/datadog/tracing/contrib/active_job/events.rb +40 -0
  335. data/lib/datadog/tracing/contrib/active_job/ext.rb +37 -0
  336. data/lib/datadog/tracing/contrib/active_job/integration.rb +48 -0
  337. data/lib/datadog/tracing/contrib/active_job/log_injection.rb +22 -0
  338. data/lib/datadog/tracing/contrib/active_job/patcher.rb +34 -0
  339. data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +31 -0
  340. data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +66 -0
  341. data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +43 -0
  342. data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +45 -0
  343. data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +32 -0
  344. data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +22 -0
  345. data/lib/datadog/tracing/contrib/active_model_serializers/integration.rb +43 -0
  346. data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +30 -0
  347. data/lib/datadog/tracing/contrib/active_record/configuration/makara_resolver.rb +34 -0
  348. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +136 -0
  349. data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +37 -0
  350. data/lib/datadog/tracing/contrib/active_record/event.rb +28 -0
  351. data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +56 -0
  352. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +76 -0
  353. data/lib/datadog/tracing/contrib/active_record/events.rb +32 -0
  354. data/lib/datadog/tracing/contrib/active_record/ext.rb +27 -0
  355. data/lib/datadog/tracing/contrib/active_record/integration.rb +54 -0
  356. data/lib/datadog/tracing/contrib/active_record/patcher.rb +25 -0
  357. data/lib/datadog/tracing/contrib/active_record/utils.rb +126 -0
  358. data/lib/datadog/tracing/contrib/active_record/vendor/connection_specification.rb +305 -0
  359. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +278 -0
  360. data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +71 -0
  361. data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +45 -0
  362. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +33 -0
  363. data/lib/datadog/tracing/contrib/active_support/ext.rb +29 -0
  364. data/lib/datadog/tracing/contrib/active_support/integration.rb +49 -0
  365. data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +69 -0
  366. data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +69 -0
  367. data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +162 -0
  368. data/lib/datadog/tracing/contrib/active_support/patcher.rb +25 -0
  369. data/lib/datadog/tracing/contrib/analytics.rb +27 -0
  370. data/lib/datadog/tracing/contrib/auto_instrument.rb +51 -0
  371. data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +36 -0
  372. data/lib/datadog/tracing/contrib/aws/ext.rb +26 -0
  373. data/lib/datadog/tracing/contrib/aws/instrumentation.rb +94 -0
  374. data/lib/datadog/tracing/contrib/aws/integration.rb +45 -0
  375. data/lib/datadog/tracing/contrib/aws/parsed_context.rb +58 -0
  376. data/lib/datadog/tracing/contrib/aws/patcher.rb +55 -0
  377. data/lib/datadog/tracing/contrib/aws/services.rb +119 -0
  378. data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +21 -0
  379. data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +51 -0
  380. data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +14 -0
  381. data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +25 -0
  382. data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +41 -0
  383. data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +30 -0
  384. data/lib/datadog/tracing/contrib/configurable.rb +100 -0
  385. data/lib/datadog/tracing/contrib/configuration/resolver.rb +83 -0
  386. data/lib/datadog/tracing/contrib/configuration/resolvers/pattern_resolver.rb +41 -0
  387. data/lib/datadog/tracing/contrib/configuration/settings.rb +39 -0
  388. data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +36 -0
  389. data/lib/datadog/tracing/contrib/dalli/ext.rb +24 -0
  390. data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +61 -0
  391. data/lib/datadog/tracing/contrib/dalli/integration.rb +50 -0
  392. data/lib/datadog/tracing/contrib/dalli/patcher.rb +26 -0
  393. data/lib/datadog/tracing/contrib/dalli/quantize.rb +24 -0
  394. data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +36 -0
  395. data/lib/datadog/tracing/contrib/delayed_job/ext.rb +26 -0
  396. data/lib/datadog/tracing/contrib/delayed_job/integration.rb +41 -0
  397. data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +35 -0
  398. data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +106 -0
  399. data/lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb +32 -0
  400. data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +38 -0
  401. data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +27 -0
  402. data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +48 -0
  403. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +152 -0
  404. data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +85 -0
  405. data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +40 -0
  406. data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +174 -0
  407. data/lib/datadog/tracing/contrib/ethon/ext.rb +23 -0
  408. data/lib/datadog/tracing/contrib/ethon/integration.rb +46 -0
  409. data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +95 -0
  410. data/lib/datadog/tracing/contrib/ethon/patcher.rb +28 -0
  411. data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +40 -0
  412. data/lib/datadog/tracing/contrib/excon/ext.rb +20 -0
  413. data/lib/datadog/tracing/contrib/excon/integration.rb +46 -0
  414. data/lib/datadog/tracing/contrib/excon/middleware.rb +169 -0
  415. data/lib/datadog/tracing/contrib/excon/patcher.rb +29 -0
  416. data/lib/datadog/tracing/contrib/ext.rb +30 -0
  417. data/lib/datadog/tracing/contrib/extensions.rb +197 -0
  418. data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +44 -0
  419. data/lib/datadog/tracing/contrib/faraday/connection.rb +20 -0
  420. data/lib/datadog/tracing/contrib/faraday/ext.rb +20 -0
  421. data/lib/datadog/tracing/contrib/faraday/integration.rb +46 -0
  422. data/lib/datadog/tracing/contrib/faraday/middleware.rb +91 -0
  423. data/lib/datadog/tracing/contrib/faraday/patcher.rb +54 -0
  424. data/lib/datadog/tracing/contrib/faraday/rack_builder.rb +20 -0
  425. data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +40 -0
  426. data/lib/datadog/tracing/contrib/grape/endpoint.rb +248 -0
  427. data/lib/datadog/tracing/contrib/grape/ext.rb +26 -0
  428. data/lib/datadog/tracing/contrib/grape/instrumentation.rb +35 -0
  429. data/lib/datadog/tracing/contrib/grape/integration.rb +42 -0
  430. data/lib/datadog/tracing/contrib/grape/patcher.rb +31 -0
  431. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +34 -0
  432. data/lib/datadog/tracing/contrib/graphql/ext.rb +17 -0
  433. data/lib/datadog/tracing/contrib/graphql/integration.rb +42 -0
  434. data/lib/datadog/tracing/contrib/graphql/patcher.rb +88 -0
  435. data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +41 -0
  436. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +97 -0
  437. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +88 -0
  438. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +105 -0
  439. data/lib/datadog/tracing/contrib/grpc/distributed/fetcher.rb +26 -0
  440. data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +42 -0
  441. data/lib/datadog/tracing/contrib/grpc/ext.rb +25 -0
  442. data/lib/datadog/tracing/contrib/grpc/integration.rb +48 -0
  443. data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +51 -0
  444. data/lib/datadog/tracing/contrib/grpc/patcher.rb +32 -0
  445. data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +45 -0
  446. data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +20 -0
  447. data/lib/datadog/tracing/contrib/hanami/ext.rb +22 -0
  448. data/lib/datadog/tracing/contrib/hanami/integration.rb +42 -0
  449. data/lib/datadog/tracing/contrib/hanami/patcher.rb +31 -0
  450. data/lib/datadog/tracing/contrib/hanami/plugin.rb +21 -0
  451. data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +39 -0
  452. data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +42 -0
  453. data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +41 -0
  454. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +45 -0
  455. data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +38 -0
  456. data/lib/datadog/tracing/contrib/http/distributed/propagation.rb +37 -0
  457. data/lib/datadog/tracing/contrib/http/ext.rb +21 -0
  458. data/lib/datadog/tracing/contrib/http/instrumentation.rb +135 -0
  459. data/lib/datadog/tracing/contrib/http/integration.rb +47 -0
  460. data/lib/datadog/tracing/contrib/http/patcher.rb +28 -0
  461. data/lib/datadog/tracing/contrib/http_annotation_helper.rb +15 -0
  462. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +45 -0
  463. data/lib/datadog/tracing/contrib/httpclient/ext.rb +21 -0
  464. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +115 -0
  465. data/lib/datadog/tracing/contrib/httpclient/integration.rb +46 -0
  466. data/lib/datadog/tracing/contrib/httpclient/patcher.rb +40 -0
  467. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +45 -0
  468. data/lib/datadog/tracing/contrib/httprb/ext.rb +21 -0
  469. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +126 -0
  470. data/lib/datadog/tracing/contrib/httprb/integration.rb +46 -0
  471. data/lib/datadog/tracing/contrib/httprb/patcher.rb +40 -0
  472. data/lib/datadog/tracing/contrib/integration.rb +76 -0
  473. data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +33 -0
  474. data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +17 -0
  475. data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +16 -0
  476. data/lib/datadog/tracing/contrib/kafka/event.rb +51 -0
  477. data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +40 -0
  478. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +47 -0
  479. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +45 -0
  480. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +45 -0
  481. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/join_group.rb +35 -0
  482. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/leave_group.rb +35 -0
  483. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/sync_group.rb +35 -0
  484. data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +39 -0
  485. data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +42 -0
  486. data/lib/datadog/tracing/contrib/kafka/events.rb +46 -0
  487. data/lib/datadog/tracing/contrib/kafka/ext.rb +51 -0
  488. data/lib/datadog/tracing/contrib/kafka/integration.rb +42 -0
  489. data/lib/datadog/tracing/contrib/kafka/patcher.rb +27 -0
  490. data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +21 -0
  491. data/lib/datadog/tracing/contrib/lograge/ext.rb +13 -0
  492. data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +44 -0
  493. data/lib/datadog/tracing/contrib/lograge/integration.rb +48 -0
  494. data/lib/datadog/tracing/contrib/lograge/patcher.rb +27 -0
  495. data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +40 -0
  496. data/lib/datadog/tracing/contrib/mongodb/ext.rb +33 -0
  497. data/lib/datadog/tracing/contrib/mongodb/instrumentation.rb +45 -0
  498. data/lib/datadog/tracing/contrib/mongodb/integration.rb +46 -0
  499. data/lib/datadog/tracing/contrib/mongodb/parsers.rb +47 -0
  500. data/lib/datadog/tracing/contrib/mongodb/patcher.rb +32 -0
  501. data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +125 -0
  502. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +48 -0
  503. data/lib/datadog/tracing/contrib/mysql2/ext.rb +22 -0
  504. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +75 -0
  505. data/lib/datadog/tracing/contrib/mysql2/integration.rb +41 -0
  506. data/lib/datadog/tracing/contrib/mysql2/patcher.rb +29 -0
  507. data/lib/datadog/tracing/contrib/patchable.rb +107 -0
  508. data/lib/datadog/tracing/contrib/patcher.rb +84 -0
  509. data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +48 -0
  510. data/lib/datadog/tracing/contrib/pg/ext.rb +31 -0
  511. data/lib/datadog/tracing/contrib/pg/instrumentation.rb +166 -0
  512. data/lib/datadog/tracing/contrib/pg/integration.rb +41 -0
  513. data/lib/datadog/tracing/contrib/pg/patcher.rb +29 -0
  514. data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +36 -0
  515. data/lib/datadog/tracing/contrib/presto/ext.rb +32 -0
  516. data/lib/datadog/tracing/contrib/presto/instrumentation.rb +125 -0
  517. data/lib/datadog/tracing/contrib/presto/integration.rb +41 -0
  518. data/lib/datadog/tracing/contrib/presto/patcher.rb +35 -0
  519. data/lib/datadog/tracing/contrib/propagation/sql_comment/comment.rb +41 -0
  520. data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +31 -0
  521. data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +26 -0
  522. data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +45 -0
  523. data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +38 -0
  524. data/lib/datadog/tracing/contrib/qless/ext.rb +24 -0
  525. data/lib/datadog/tracing/contrib/qless/integration.rb +41 -0
  526. data/lib/datadog/tracing/contrib/qless/patcher.rb +34 -0
  527. data/lib/datadog/tracing/contrib/qless/qless_job.rb +75 -0
  528. data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +28 -0
  529. data/lib/datadog/tracing/contrib/que/configuration/settings.rb +47 -0
  530. data/lib/datadog/tracing/contrib/que/ext.rb +32 -0
  531. data/lib/datadog/tracing/contrib/que/integration.rb +44 -0
  532. data/lib/datadog/tracing/contrib/que/patcher.rb +26 -0
  533. data/lib/datadog/tracing/contrib/que/tracer.rb +63 -0
  534. data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +33 -0
  535. data/lib/datadog/tracing/contrib/racecar/event.rb +77 -0
  536. data/lib/datadog/tracing/contrib/racecar/events/batch.rb +36 -0
  537. data/lib/datadog/tracing/contrib/racecar/events/consume.rb +33 -0
  538. data/lib/datadog/tracing/contrib/racecar/events/message.rb +36 -0
  539. data/lib/datadog/tracing/contrib/racecar/events.rb +34 -0
  540. data/lib/datadog/tracing/contrib/racecar/ext.rb +30 -0
  541. data/lib/datadog/tracing/contrib/racecar/integration.rb +42 -0
  542. data/lib/datadog/tracing/contrib/racecar/patcher.rb +27 -0
  543. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +49 -0
  544. data/lib/datadog/tracing/contrib/rack/ext.rb +28 -0
  545. data/lib/datadog/tracing/contrib/rack/header_collection.rb +35 -0
  546. data/lib/datadog/tracing/contrib/rack/integration.rb +48 -0
  547. data/lib/datadog/tracing/contrib/rack/middlewares.rb +347 -0
  548. data/lib/datadog/tracing/contrib/rack/patcher.rb +117 -0
  549. data/lib/datadog/tracing/contrib/rack/request_queue.rb +46 -0
  550. data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +10 -0
  551. data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +72 -0
  552. data/lib/datadog/tracing/contrib/rails/ext.rb +17 -0
  553. data/lib/datadog/tracing/contrib/rails/framework.rb +146 -0
  554. data/lib/datadog/tracing/contrib/rails/integration.rb +47 -0
  555. data/lib/datadog/tracing/contrib/rails/log_injection.rb +30 -0
  556. data/lib/datadog/tracing/contrib/rails/middlewares.rb +44 -0
  557. data/lib/datadog/tracing/contrib/rails/patcher.rb +118 -0
  558. data/lib/datadog/tracing/contrib/rails/railtie.rb +17 -0
  559. data/lib/datadog/tracing/contrib/rails/utils.rb +26 -0
  560. data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +49 -0
  561. data/lib/datadog/tracing/contrib/rake/ext.rb +24 -0
  562. data/lib/datadog/tracing/contrib/rake/instrumentation.rb +101 -0
  563. data/lib/datadog/tracing/contrib/rake/integration.rb +41 -0
  564. data/lib/datadog/tracing/contrib/rake/patcher.rb +31 -0
  565. data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +47 -0
  566. data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +41 -0
  567. data/lib/datadog/tracing/contrib/redis/ext.rb +27 -0
  568. data/lib/datadog/tracing/contrib/redis/instrumentation.rb +86 -0
  569. data/lib/datadog/tracing/contrib/redis/integration.rb +78 -0
  570. data/lib/datadog/tracing/contrib/redis/patcher.rb +77 -0
  571. data/lib/datadog/tracing/contrib/redis/quantize.rb +80 -0
  572. data/lib/datadog/tracing/contrib/redis/tags.rb +54 -0
  573. data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +70 -0
  574. data/lib/datadog/tracing/contrib/redis/vendor/resolver.rb +160 -0
  575. data/lib/datadog/tracing/contrib/registerable.rb +48 -0
  576. data/lib/datadog/tracing/contrib/registry.rb +50 -0
  577. data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +35 -0
  578. data/lib/datadog/tracing/contrib/resque/ext.rb +19 -0
  579. data/lib/datadog/tracing/contrib/resque/integration.rb +46 -0
  580. data/lib/datadog/tracing/contrib/resque/patcher.rb +27 -0
  581. data/lib/datadog/tracing/contrib/resque/resque_job.rb +104 -0
  582. data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +40 -0
  583. data/lib/datadog/tracing/contrib/rest_client/ext.rb +20 -0
  584. data/lib/datadog/tracing/contrib/rest_client/integration.rb +41 -0
  585. data/lib/datadog/tracing/contrib/rest_client/patcher.rb +26 -0
  586. data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +104 -0
  587. data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +21 -0
  588. data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +13 -0
  589. data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +48 -0
  590. data/lib/datadog/tracing/contrib/semantic_logger/integration.rb +50 -0
  591. data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +27 -0
  592. data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +31 -0
  593. data/lib/datadog/tracing/contrib/sequel/database.rb +57 -0
  594. data/lib/datadog/tracing/contrib/sequel/dataset.rb +62 -0
  595. data/lib/datadog/tracing/contrib/sequel/ext.rb +20 -0
  596. data/lib/datadog/tracing/contrib/sequel/integration.rb +41 -0
  597. data/lib/datadog/tracing/contrib/sequel/patcher.rb +35 -0
  598. data/lib/datadog/tracing/contrib/sequel/utils.rb +85 -0
  599. data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +36 -0
  600. data/lib/datadog/tracing/contrib/shoryuken/ext.rb +24 -0
  601. data/lib/datadog/tracing/contrib/shoryuken/integration.rb +42 -0
  602. data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +26 -0
  603. data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +63 -0
  604. data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +57 -0
  605. data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +42 -0
  606. data/lib/datadog/tracing/contrib/sidekiq/ext.rb +42 -0
  607. data/lib/datadog/tracing/contrib/sidekiq/integration.rb +51 -0
  608. data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +76 -0
  609. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +54 -0
  610. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +34 -0
  611. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/redis_info.rb +32 -0
  612. data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_poller.rb +55 -0
  613. data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +102 -0
  614. data/lib/datadog/tracing/contrib/sidekiq/tracing.rb +42 -0
  615. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +41 -0
  616. data/lib/datadog/tracing/contrib/sinatra/env.rb +53 -0
  617. data/lib/datadog/tracing/contrib/sinatra/ext.rb +34 -0
  618. data/lib/datadog/tracing/contrib/sinatra/framework.rb +114 -0
  619. data/lib/datadog/tracing/contrib/sinatra/headers.rb +33 -0
  620. data/lib/datadog/tracing/contrib/sinatra/integration.rb +41 -0
  621. data/lib/datadog/tracing/contrib/sinatra/patcher.rb +73 -0
  622. data/lib/datadog/tracing/contrib/sinatra/tracer.rb +84 -0
  623. data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +125 -0
  624. data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +36 -0
  625. data/lib/datadog/tracing/contrib/sneakers/ext.rb +25 -0
  626. data/lib/datadog/tracing/contrib/sneakers/integration.rb +44 -0
  627. data/lib/datadog/tracing/contrib/sneakers/patcher.rb +27 -0
  628. data/lib/datadog/tracing/contrib/sneakers/tracer.rb +60 -0
  629. data/lib/datadog/tracing/contrib/status_code_matcher.rb +73 -0
  630. data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +33 -0
  631. data/lib/datadog/tracing/contrib/stripe/ext.rb +26 -0
  632. data/lib/datadog/tracing/contrib/stripe/integration.rb +43 -0
  633. data/lib/datadog/tracing/contrib/stripe/patcher.rb +28 -0
  634. data/lib/datadog/tracing/contrib/stripe/request.rb +67 -0
  635. data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +33 -0
  636. data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +26 -0
  637. data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +25 -0
  638. data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +102 -0
  639. data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +41 -0
  640. data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +33 -0
  641. data/lib/datadog/tracing/contrib/utils/database.rb +29 -0
  642. data/lib/datadog/tracing/contrib/utils/quantization/hash.rb +109 -0
  643. data/lib/datadog/tracing/contrib/utils/quantization/http.rb +177 -0
  644. data/lib/datadog/tracing/contrib.rb +77 -0
  645. data/lib/datadog/tracing/correlation.rb +112 -0
  646. data/lib/datadog/tracing/diagnostics/ext.rb +34 -0
  647. data/lib/datadog/tracing/diagnostics/health.rb +38 -0
  648. data/lib/datadog/tracing/distributed/b3_multi.rb +72 -0
  649. data/lib/datadog/tracing/distributed/b3_single.rb +68 -0
  650. data/lib/datadog/tracing/distributed/datadog.rb +200 -0
  651. data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +84 -0
  652. data/lib/datadog/tracing/distributed/fetcher.rb +21 -0
  653. data/lib/datadog/tracing/distributed/headers/ext.rb +34 -0
  654. data/lib/datadog/tracing/distributed/helpers.rb +65 -0
  655. data/lib/datadog/tracing/distributed/none.rb +18 -0
  656. data/lib/datadog/tracing/distributed/propagation.rb +126 -0
  657. data/lib/datadog/tracing/distributed/trace_context.rb +373 -0
  658. data/lib/datadog/tracing/event.rb +76 -0
  659. data/lib/datadog/tracing/flush.rb +94 -0
  660. data/lib/datadog/tracing/metadata/analytics.rb +24 -0
  661. data/lib/datadog/tracing/metadata/errors.rb +22 -0
  662. data/lib/datadog/tracing/metadata/ext.rb +182 -0
  663. data/lib/datadog/tracing/metadata/tagging.rb +129 -0
  664. data/lib/datadog/tracing/metadata.rb +18 -0
  665. data/lib/datadog/tracing/pipeline/span_filter.rb +44 -0
  666. data/lib/datadog/tracing/pipeline/span_processor.rb +37 -0
  667. data/lib/datadog/tracing/pipeline.rb +63 -0
  668. data/lib/datadog/tracing/propagation/http.rb +12 -0
  669. data/lib/datadog/tracing/runtime/metrics.rb +17 -0
  670. data/lib/datadog/tracing/sampling/all_sampler.rb +23 -0
  671. data/lib/datadog/tracing/sampling/ext.rb +56 -0
  672. data/lib/datadog/tracing/sampling/matcher.rb +66 -0
  673. data/lib/datadog/tracing/sampling/priority_sampler.rb +163 -0
  674. data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +94 -0
  675. data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +63 -0
  676. data/lib/datadog/tracing/sampling/rate_limiter.rb +186 -0
  677. data/lib/datadog/tracing/sampling/rate_sampler.rb +70 -0
  678. data/lib/datadog/tracing/sampling/rule.rb +74 -0
  679. data/lib/datadog/tracing/sampling/rule_sampler.rb +130 -0
  680. data/lib/datadog/tracing/sampling/sampler.rb +42 -0
  681. data/lib/datadog/tracing/sampling/span/ext.rb +25 -0
  682. data/lib/datadog/tracing/sampling/span/matcher.rb +89 -0
  683. data/lib/datadog/tracing/sampling/span/rule.rb +82 -0
  684. data/lib/datadog/tracing/sampling/span/rule_parser.rb +104 -0
  685. data/lib/datadog/tracing/sampling/span/sampler.rb +75 -0
  686. data/lib/datadog/tracing/span.rb +214 -0
  687. data/lib/datadog/tracing/span_operation.rb +518 -0
  688. data/lib/datadog/tracing/sync_writer.rb +67 -0
  689. data/lib/datadog/tracing/trace_digest.rb +144 -0
  690. data/lib/datadog/tracing/trace_operation.rb +474 -0
  691. data/lib/datadog/tracing/trace_segment.rb +217 -0
  692. data/lib/datadog/tracing/tracer.rb +531 -0
  693. data/lib/datadog/tracing/utils.rb +81 -0
  694. data/lib/datadog/tracing/workers/trace_writer.rb +193 -0
  695. data/lib/datadog/tracing/workers.rb +123 -0
  696. data/lib/datadog/tracing/writer.rb +185 -0
  697. data/lib/datadog/tracing.rb +140 -0
  698. data/lib/ddtrace/auto_instrument.rb +13 -4
  699. data/lib/ddtrace/auto_instrument_base.rb +0 -1
  700. data/lib/ddtrace/profiling/preload.rb +2 -4
  701. data/lib/ddtrace/transport/ext.rb +39 -0
  702. data/lib/ddtrace/transport/http/adapters/net.rb +4 -4
  703. data/lib/ddtrace/transport/http/adapters/registry.rb +0 -1
  704. data/lib/ddtrace/transport/http/adapters/test.rb +1 -2
  705. data/lib/ddtrace/transport/http/adapters/unix_socket.rb +3 -4
  706. data/lib/ddtrace/transport/http/api/endpoint.rb +0 -1
  707. data/lib/ddtrace/transport/http/api/fallbacks.rb +0 -1
  708. data/lib/ddtrace/transport/http/api/instance.rb +0 -1
  709. data/lib/ddtrace/transport/http/api/map.rb +1 -2
  710. data/lib/ddtrace/transport/http/api/spec.rb +0 -1
  711. data/lib/ddtrace/transport/http/api.rb +7 -15
  712. data/lib/ddtrace/transport/http/builder.rb +6 -7
  713. data/lib/ddtrace/transport/http/client.rb +4 -4
  714. data/lib/ddtrace/transport/http/env.rb +0 -1
  715. data/lib/ddtrace/transport/http/response.rb +35 -6
  716. data/lib/ddtrace/transport/http/statistics.rb +1 -2
  717. data/lib/ddtrace/transport/http/traces.rb +6 -5
  718. data/lib/ddtrace/transport/http.rb +37 -33
  719. data/lib/ddtrace/transport/io/client.rb +5 -4
  720. data/lib/ddtrace/transport/io/response.rb +1 -2
  721. data/lib/ddtrace/transport/io/traces.rb +4 -7
  722. data/lib/ddtrace/transport/io.rb +4 -5
  723. data/lib/ddtrace/transport/parcel.rb +1 -3
  724. data/lib/ddtrace/transport/request.rb +0 -1
  725. data/lib/ddtrace/transport/response.rb +0 -1
  726. data/lib/ddtrace/transport/serializable_trace.rb +122 -0
  727. data/lib/ddtrace/transport/statistics.rb +5 -5
  728. data/lib/ddtrace/transport/trace_formatter.rb +196 -0
  729. data/lib/ddtrace/transport/traces.rb +20 -10
  730. data/lib/ddtrace/version.rb +14 -14
  731. data/lib/ddtrace.rb +9 -52
  732. metadata +703 -497
  733. data/.editorconfig +0 -22
  734. data/.gitignore +0 -67
  735. data/.yardopts +0 -5
  736. data/CONTRIBUTING.md +0 -81
  737. data/ddtrace.gemspec +0 -56
  738. data/docs/DevelopmentGuide.md +0 -259
  739. data/docs/GettingStarted.md +0 -2626
  740. data/docs/ProfilingDevelopment.md +0 -107
  741. data/lib/datadog/ci/context_flush.rb +0 -29
  742. data/lib/datadog/contrib.rb +0 -71
  743. data/lib/ddtrace/analytics.rb +0 -39
  744. data/lib/ddtrace/buffer.rb +0 -340
  745. data/lib/ddtrace/chunker.rb +0 -35
  746. data/lib/ddtrace/configuration/agent_settings_resolver.rb +0 -309
  747. data/lib/ddtrace/configuration/base.rb +0 -82
  748. data/lib/ddtrace/configuration/components.rb +0 -292
  749. data/lib/ddtrace/configuration/dependency_resolver.rb +0 -25
  750. data/lib/ddtrace/configuration/option.rb +0 -65
  751. data/lib/ddtrace/configuration/option_definition.rb +0 -122
  752. data/lib/ddtrace/configuration/option_definition_set.rb +0 -19
  753. data/lib/ddtrace/configuration/option_set.rb +0 -7
  754. data/lib/ddtrace/configuration/options.rb +0 -112
  755. data/lib/ddtrace/configuration/pin_setup.rb +0 -32
  756. data/lib/ddtrace/configuration/settings.rb +0 -413
  757. data/lib/ddtrace/configuration.rb +0 -195
  758. data/lib/ddtrace/context.rb +0 -334
  759. data/lib/ddtrace/context_flush.rb +0 -82
  760. data/lib/ddtrace/context_provider.rb +0 -62
  761. data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +0 -31
  762. data/lib/ddtrace/contrib/action_cable/event.rb +0 -67
  763. data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +0 -50
  764. data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +0 -56
  765. data/lib/ddtrace/contrib/action_cable/events/transmit.rb +0 -51
  766. data/lib/ddtrace/contrib/action_cable/events.rb +0 -34
  767. data/lib/ddtrace/contrib/action_cable/ext.rb +0 -27
  768. data/lib/ddtrace/contrib/action_cable/instrumentation.rb +0 -78
  769. data/lib/ddtrace/contrib/action_cable/integration.rb +0 -46
  770. data/lib/ddtrace/contrib/action_cable/patcher.rb +0 -29
  771. data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +0 -32
  772. data/lib/ddtrace/contrib/action_mailer/event.rb +0 -50
  773. data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +0 -54
  774. data/lib/ddtrace/contrib/action_mailer/events/process.rb +0 -41
  775. data/lib/ddtrace/contrib/action_mailer/events.rb +0 -31
  776. data/lib/ddtrace/contrib/action_mailer/ext.rb +0 -32
  777. data/lib/ddtrace/contrib/action_mailer/integration.rb +0 -45
  778. data/lib/ddtrace/contrib/action_mailer/patcher.rb +0 -27
  779. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +0 -157
  780. data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +0 -26
  781. data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +0 -33
  782. data/lib/ddtrace/contrib/action_pack/ext.rb +0 -20
  783. data/lib/ddtrace/contrib/action_pack/integration.rb +0 -46
  784. data/lib/ddtrace/contrib/action_pack/patcher.rb +0 -24
  785. data/lib/ddtrace/contrib/action_pack/utils.rb +0 -37
  786. data/lib/ddtrace/contrib/action_view/configuration/settings.rb +0 -32
  787. data/lib/ddtrace/contrib/action_view/event.rb +0 -36
  788. data/lib/ddtrace/contrib/action_view/events/render_partial.rb +0 -47
  789. data/lib/ddtrace/contrib/action_view/events/render_template.rb +0 -50
  790. data/lib/ddtrace/contrib/action_view/events.rb +0 -31
  791. data/lib/ddtrace/contrib/action_view/ext.rb +0 -21
  792. data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +0 -75
  793. data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +0 -168
  794. data/lib/ddtrace/contrib/action_view/integration.rb +0 -53
  795. data/lib/ddtrace/contrib/action_view/patcher.rb +0 -48
  796. data/lib/ddtrace/contrib/action_view/utils.rb +0 -33
  797. data/lib/ddtrace/contrib/active_job/configuration/settings.rb +0 -33
  798. data/lib/ddtrace/contrib/active_job/event.rb +0 -54
  799. data/lib/ddtrace/contrib/active_job/events/discard.rb +0 -46
  800. data/lib/ddtrace/contrib/active_job/events/enqueue.rb +0 -45
  801. data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +0 -45
  802. data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +0 -47
  803. data/lib/ddtrace/contrib/active_job/events/perform.rb +0 -45
  804. data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +0 -46
  805. data/lib/ddtrace/contrib/active_job/events.rb +0 -39
  806. data/lib/ddtrace/contrib/active_job/ext.rb +0 -32
  807. data/lib/ddtrace/contrib/active_job/integration.rb +0 -46
  808. data/lib/ddtrace/contrib/active_job/log_injection.rb +0 -21
  809. data/lib/ddtrace/contrib/active_job/patcher.rb +0 -33
  810. data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +0 -31
  811. data/lib/ddtrace/contrib/active_model_serializers/event.rb +0 -69
  812. data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +0 -33
  813. data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +0 -36
  814. data/lib/ddtrace/contrib/active_model_serializers/events.rb +0 -31
  815. data/lib/ddtrace/contrib/active_model_serializers/ext.rb +0 -21
  816. data/lib/ddtrace/contrib/active_model_serializers/integration.rb +0 -41
  817. data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +0 -30
  818. data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +0 -31
  819. data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +0 -135
  820. data/lib/ddtrace/contrib/active_record/configuration/settings.rb +0 -36
  821. data/lib/ddtrace/contrib/active_record/event.rb +0 -31
  822. data/lib/ddtrace/contrib/active_record/events/instantiation.rb +0 -61
  823. data/lib/ddtrace/contrib/active_record/events/sql.rb +0 -69
  824. data/lib/ddtrace/contrib/active_record/events.rb +0 -31
  825. data/lib/ddtrace/contrib/active_record/ext.rb +0 -25
  826. data/lib/ddtrace/contrib/active_record/integration.rb +0 -54
  827. data/lib/ddtrace/contrib/active_record/patcher.rb +0 -24
  828. data/lib/ddtrace/contrib/active_record/utils.rb +0 -124
  829. data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +0 -259
  830. data/lib/ddtrace/contrib/active_support/cache/patcher.rb +0 -70
  831. data/lib/ddtrace/contrib/active_support/cache/redis.rb +0 -44
  832. data/lib/ddtrace/contrib/active_support/configuration/settings.rb +0 -31
  833. data/lib/ddtrace/contrib/active_support/ext.rb +0 -28
  834. data/lib/ddtrace/contrib/active_support/integration.rb +0 -47
  835. data/lib/ddtrace/contrib/active_support/notifications/event.rb +0 -76
  836. data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +0 -68
  837. data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +0 -164
  838. data/lib/ddtrace/contrib/active_support/patcher.rb +0 -24
  839. data/lib/ddtrace/contrib/analytics.rb +0 -25
  840. data/lib/ddtrace/contrib/auto_instrument.rb +0 -48
  841. data/lib/ddtrace/contrib/aws/configuration/settings.rb +0 -31
  842. data/lib/ddtrace/contrib/aws/ext.rb +0 -24
  843. data/lib/ddtrace/contrib/aws/instrumentation.rb +0 -91
  844. data/lib/ddtrace/contrib/aws/integration.rb +0 -43
  845. data/lib/ddtrace/contrib/aws/parsed_context.rb +0 -57
  846. data/lib/ddtrace/contrib/aws/patcher.rb +0 -54
  847. data/lib/ddtrace/contrib/aws/services.rb +0 -119
  848. data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +0 -21
  849. data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +0 -42
  850. data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +0 -13
  851. data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +0 -24
  852. data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +0 -39
  853. data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +0 -30
  854. data/lib/ddtrace/contrib/configurable.rb +0 -103
  855. data/lib/ddtrace/contrib/configuration/resolver.rb +0 -82
  856. data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +0 -40
  857. data/lib/ddtrace/contrib/configuration/settings.rb +0 -56
  858. data/lib/ddtrace/contrib/dalli/configuration/settings.rb +0 -31
  859. data/lib/ddtrace/contrib/dalli/ext.rb +0 -21
  860. data/lib/ddtrace/contrib/dalli/instrumentation.rb +0 -55
  861. data/lib/ddtrace/contrib/dalli/integration.rb +0 -39
  862. data/lib/ddtrace/contrib/dalli/patcher.rb +0 -26
  863. data/lib/ddtrace/contrib/dalli/quantize.rb +0 -23
  864. data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +0 -33
  865. data/lib/ddtrace/contrib/delayed_job/ext.rb +0 -24
  866. data/lib/ddtrace/contrib/delayed_job/integration.rb +0 -39
  867. data/lib/ddtrace/contrib/delayed_job/patcher.rb +0 -29
  868. data/lib/ddtrace/contrib/delayed_job/plugin.rb +0 -85
  869. data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +0 -32
  870. data/lib/ddtrace/contrib/elasticsearch/ext.rb +0 -23
  871. data/lib/ddtrace/contrib/elasticsearch/integration.rb +0 -40
  872. data/lib/ddtrace/contrib/elasticsearch/patcher.rb +0 -123
  873. data/lib/ddtrace/contrib/elasticsearch/quantize.rb +0 -84
  874. data/lib/ddtrace/contrib/ethon/configuration/settings.rb +0 -33
  875. data/lib/ddtrace/contrib/ethon/easy_patch.rb +0 -152
  876. data/lib/ddtrace/contrib/ethon/ext.rb +0 -20
  877. data/lib/ddtrace/contrib/ethon/integration.rb +0 -44
  878. data/lib/ddtrace/contrib/ethon/multi_patch.rb +0 -85
  879. data/lib/ddtrace/contrib/ethon/patcher.rb +0 -27
  880. data/lib/ddtrace/contrib/excon/configuration/settings.rb +0 -34
  881. data/lib/ddtrace/contrib/excon/ext.rb +0 -18
  882. data/lib/ddtrace/contrib/excon/integration.rb +0 -44
  883. data/lib/ddtrace/contrib/excon/middleware.rb +0 -164
  884. data/lib/ddtrace/contrib/excon/patcher.rb +0 -28
  885. data/lib/ddtrace/contrib/extensions.rb +0 -169
  886. data/lib/ddtrace/contrib/faraday/configuration/settings.rb +0 -39
  887. data/lib/ddtrace/contrib/faraday/connection.rb +0 -19
  888. data/lib/ddtrace/contrib/faraday/ext.rb +0 -18
  889. data/lib/ddtrace/contrib/faraday/integration.rb +0 -44
  890. data/lib/ddtrace/contrib/faraday/middleware.rb +0 -86
  891. data/lib/ddtrace/contrib/faraday/patcher.rb +0 -54
  892. data/lib/ddtrace/contrib/faraday/rack_builder.rb +0 -19
  893. data/lib/ddtrace/contrib/grape/configuration/settings.rb +0 -39
  894. data/lib/ddtrace/contrib/grape/endpoint.rb +0 -246
  895. data/lib/ddtrace/contrib/grape/ext.rb +0 -24
  896. data/lib/ddtrace/contrib/grape/instrumentation.rb +0 -34
  897. data/lib/ddtrace/contrib/grape/integration.rb +0 -40
  898. data/lib/ddtrace/contrib/grape/patcher.rb +0 -32
  899. data/lib/ddtrace/contrib/graphql/configuration/settings.rb +0 -33
  900. data/lib/ddtrace/contrib/graphql/ext.rb +0 -17
  901. data/lib/ddtrace/contrib/graphql/integration.rb +0 -40
  902. data/lib/ddtrace/contrib/graphql/patcher.rb +0 -61
  903. data/lib/ddtrace/contrib/grpc/configuration/settings.rb +0 -32
  904. data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +0 -59
  905. data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +0 -80
  906. data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +0 -79
  907. data/lib/ddtrace/contrib/grpc/ext.rb +0 -19
  908. data/lib/ddtrace/contrib/grpc/integration.rb +0 -39
  909. data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +0 -50
  910. data/lib/ddtrace/contrib/grpc/patcher.rb +0 -34
  911. data/lib/ddtrace/contrib/http/circuit_breaker.rb +0 -38
  912. data/lib/ddtrace/contrib/http/configuration/settings.rb +0 -33
  913. data/lib/ddtrace/contrib/http/ext.rb +0 -18
  914. data/lib/ddtrace/contrib/http/instrumentation.rb +0 -180
  915. data/lib/ddtrace/contrib/http/integration.rb +0 -46
  916. data/lib/ddtrace/contrib/http/patcher.rb +0 -27
  917. data/lib/ddtrace/contrib/http_annotation_helper.rb +0 -11
  918. data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +0 -33
  919. data/lib/ddtrace/contrib/httpclient/ext.rb +0 -18
  920. data/lib/ddtrace/contrib/httpclient/instrumentation.rb +0 -148
  921. data/lib/ddtrace/contrib/httpclient/integration.rb +0 -44
  922. data/lib/ddtrace/contrib/httpclient/patcher.rb +0 -39
  923. data/lib/ddtrace/contrib/httprb/configuration/settings.rb +0 -33
  924. data/lib/ddtrace/contrib/httprb/ext.rb +0 -18
  925. data/lib/ddtrace/contrib/httprb/instrumentation.rb +0 -158
  926. data/lib/ddtrace/contrib/httprb/integration.rb +0 -44
  927. data/lib/ddtrace/contrib/httprb/patcher.rb +0 -39
  928. data/lib/ddtrace/contrib/integration.rb +0 -17
  929. data/lib/ddtrace/contrib/kafka/configuration/settings.rb +0 -31
  930. data/lib/ddtrace/contrib/kafka/consumer_event.rb +0 -15
  931. data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +0 -15
  932. data/lib/ddtrace/contrib/kafka/event.rb +0 -52
  933. data/lib/ddtrace/contrib/kafka/events/connection/request.rb +0 -35
  934. data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +0 -42
  935. data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +0 -40
  936. data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +0 -40
  937. data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +0 -30
  938. data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +0 -30
  939. data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +0 -30
  940. data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +0 -33
  941. data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +0 -36
  942. data/lib/ddtrace/contrib/kafka/events.rb +0 -45
  943. data/lib/ddtrace/contrib/kafka/ext.rb +0 -42
  944. data/lib/ddtrace/contrib/kafka/integration.rb +0 -40
  945. data/lib/ddtrace/contrib/kafka/patcher.rb +0 -27
  946. data/lib/ddtrace/contrib/lograge/configuration/settings.rb +0 -19
  947. data/lib/ddtrace/contrib/lograge/ext.rb +0 -11
  948. data/lib/ddtrace/contrib/lograge/instrumentation.rb +0 -39
  949. data/lib/ddtrace/contrib/lograge/integration.rb +0 -46
  950. data/lib/ddtrace/contrib/lograge/patcher.rb +0 -26
  951. data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +0 -34
  952. data/lib/ddtrace/contrib/mongodb/ext.rb +0 -24
  953. data/lib/ddtrace/contrib/mongodb/instrumentation.rb +0 -70
  954. data/lib/ddtrace/contrib/mongodb/integration.rb +0 -44
  955. data/lib/ddtrace/contrib/mongodb/parsers.rb +0 -69
  956. data/lib/ddtrace/contrib/mongodb/patcher.rb +0 -32
  957. data/lib/ddtrace/contrib/mongodb/subscribers.rb +0 -112
  958. data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +0 -31
  959. data/lib/ddtrace/contrib/mysql2/ext.rb +0 -19
  960. data/lib/ddtrace/contrib/mysql2/instrumentation.rb +0 -65
  961. data/lib/ddtrace/contrib/mysql2/integration.rb +0 -39
  962. data/lib/ddtrace/contrib/mysql2/patcher.rb +0 -28
  963. data/lib/ddtrace/contrib/patchable.rb +0 -71
  964. data/lib/ddtrace/contrib/patcher.rb +0 -66
  965. data/lib/ddtrace/contrib/presto/configuration/settings.rb +0 -31
  966. data/lib/ddtrace/contrib/presto/ext.rb +0 -29
  967. data/lib/ddtrace/contrib/presto/instrumentation.rb +0 -111
  968. data/lib/ddtrace/contrib/presto/integration.rb +0 -39
  969. data/lib/ddtrace/contrib/presto/patcher.rb +0 -34
  970. data/lib/ddtrace/contrib/qless/configuration/settings.rb +0 -36
  971. data/lib/ddtrace/contrib/qless/ext.rb +0 -21
  972. data/lib/ddtrace/contrib/qless/integration.rb +0 -39
  973. data/lib/ddtrace/contrib/qless/patcher.rb +0 -35
  974. data/lib/ddtrace/contrib/qless/qless_job.rb +0 -74
  975. data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +0 -34
  976. data/lib/ddtrace/contrib/que/configuration/settings.rb +0 -44
  977. data/lib/ddtrace/contrib/que/ext.rb +0 -31
  978. data/lib/ddtrace/contrib/que/integration.rb +0 -43
  979. data/lib/ddtrace/contrib/que/patcher.rb +0 -25
  980. data/lib/ddtrace/contrib/que/tracer.rb +0 -58
  981. data/lib/ddtrace/contrib/racecar/configuration/settings.rb +0 -31
  982. data/lib/ddtrace/contrib/racecar/event.rb +0 -77
  983. data/lib/ddtrace/contrib/racecar/events/batch.rb +0 -28
  984. data/lib/ddtrace/contrib/racecar/events/consume.rb +0 -28
  985. data/lib/ddtrace/contrib/racecar/events/message.rb +0 -28
  986. data/lib/ddtrace/contrib/racecar/events.rb +0 -33
  987. data/lib/ddtrace/contrib/racecar/ext.rb +0 -26
  988. data/lib/ddtrace/contrib/racecar/integration.rb +0 -40
  989. data/lib/ddtrace/contrib/racecar/patcher.rb +0 -27
  990. data/lib/ddtrace/contrib/rack/configuration/settings.rb +0 -47
  991. data/lib/ddtrace/contrib/rack/ext.rb +0 -22
  992. data/lib/ddtrace/contrib/rack/integration.rb +0 -46
  993. data/lib/ddtrace/contrib/rack/middlewares.rb +0 -288
  994. data/lib/ddtrace/contrib/rack/patcher.rb +0 -106
  995. data/lib/ddtrace/contrib/rack/request_queue.rb +0 -45
  996. data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +0 -10
  997. data/lib/ddtrace/contrib/rails/configuration/settings.rb +0 -101
  998. data/lib/ddtrace/contrib/rails/ext.rb +0 -18
  999. data/lib/ddtrace/contrib/rails/framework.rb +0 -172
  1000. data/lib/ddtrace/contrib/rails/integration.rb +0 -45
  1001. data/lib/ddtrace/contrib/rails/log_injection.rb +0 -42
  1002. data/lib/ddtrace/contrib/rails/middlewares.rb +0 -44
  1003. data/lib/ddtrace/contrib/rails/patcher.rb +0 -119
  1004. data/lib/ddtrace/contrib/rails/railtie.rb +0 -18
  1005. data/lib/ddtrace/contrib/rails/utils.rb +0 -25
  1006. data/lib/ddtrace/contrib/rake/configuration/settings.rb +0 -32
  1007. data/lib/ddtrace/contrib/rake/ext.rb +0 -22
  1008. data/lib/ddtrace/contrib/rake/instrumentation.rb +0 -91
  1009. data/lib/ddtrace/contrib/rake/integration.rb +0 -39
  1010. data/lib/ddtrace/contrib/rake/patcher.rb +0 -31
  1011. data/lib/ddtrace/contrib/redis/configuration/resolver.rb +0 -46
  1012. data/lib/ddtrace/contrib/redis/configuration/settings.rb +0 -36
  1013. data/lib/ddtrace/contrib/redis/ext.rb +0 -23
  1014. data/lib/ddtrace/contrib/redis/instrumentation.rb +0 -90
  1015. data/lib/ddtrace/contrib/redis/integration.rb +0 -43
  1016. data/lib/ddtrace/contrib/redis/patcher.rb +0 -33
  1017. data/lib/ddtrace/contrib/redis/quantize.rb +0 -76
  1018. data/lib/ddtrace/contrib/redis/tags.rb +0 -47
  1019. data/lib/ddtrace/contrib/redis/vendor/resolver.rb +0 -159
  1020. data/lib/ddtrace/contrib/registerable.rb +0 -33
  1021. data/lib/ddtrace/contrib/registry.rb +0 -43
  1022. data/lib/ddtrace/contrib/resque/configuration/settings.rb +0 -49
  1023. data/lib/ddtrace/contrib/resque/ext.rb +0 -18
  1024. data/lib/ddtrace/contrib/resque/integration.rb +0 -44
  1025. data/lib/ddtrace/contrib/resque/patcher.rb +0 -30
  1026. data/lib/ddtrace/contrib/resque/resque_job.rb +0 -104
  1027. data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +0 -32
  1028. data/lib/ddtrace/contrib/rest_client/ext.rb +0 -18
  1029. data/lib/ddtrace/contrib/rest_client/integration.rb +0 -39
  1030. data/lib/ddtrace/contrib/rest_client/patcher.rb +0 -25
  1031. data/lib/ddtrace/contrib/rest_client/request_patch.rb +0 -92
  1032. data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +0 -19
  1033. data/lib/ddtrace/contrib/semantic_logger/ext.rb +0 -11
  1034. data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +0 -43
  1035. data/lib/ddtrace/contrib/semantic_logger/integration.rb +0 -48
  1036. data/lib/ddtrace/contrib/semantic_logger/patcher.rb +0 -26
  1037. data/lib/ddtrace/contrib/sequel/configuration/settings.rb +0 -29
  1038. data/lib/ddtrace/contrib/sequel/database.rb +0 -64
  1039. data/lib/ddtrace/contrib/sequel/dataset.rb +0 -64
  1040. data/lib/ddtrace/contrib/sequel/ext.rb +0 -20
  1041. data/lib/ddtrace/contrib/sequel/integration.rb +0 -39
  1042. data/lib/ddtrace/contrib/sequel/patcher.rb +0 -34
  1043. data/lib/ddtrace/contrib/sequel/utils.rb +0 -75
  1044. data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +0 -32
  1045. data/lib/ddtrace/contrib/shoryuken/ext.rb +0 -22
  1046. data/lib/ddtrace/contrib/shoryuken/integration.rb +0 -40
  1047. data/lib/ddtrace/contrib/shoryuken/patcher.rb +0 -25
  1048. data/lib/ddtrace/contrib/shoryuken/tracer.rb +0 -56
  1049. data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +0 -44
  1050. data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +0 -38
  1051. data/lib/ddtrace/contrib/sidekiq/ext.rb +0 -31
  1052. data/lib/ddtrace/contrib/sidekiq/integration.rb +0 -49
  1053. data/lib/ddtrace/contrib/sidekiq/patcher.rb +0 -68
  1054. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +0 -30
  1055. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +0 -30
  1056. data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +0 -29
  1057. data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +0 -66
  1058. data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -45
  1059. data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +0 -40
  1060. data/lib/ddtrace/contrib/sinatra/env.rb +0 -59
  1061. data/lib/ddtrace/contrib/sinatra/ext.rb +0 -28
  1062. data/lib/ddtrace/contrib/sinatra/headers.rb +0 -30
  1063. data/lib/ddtrace/contrib/sinatra/integration.rb +0 -39
  1064. data/lib/ddtrace/contrib/sinatra/patcher.rb +0 -30
  1065. data/lib/ddtrace/contrib/sinatra/tracer.rb +0 -150
  1066. data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +0 -112
  1067. data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +0 -34
  1068. data/lib/ddtrace/contrib/sneakers/ext.rb +0 -23
  1069. data/lib/ddtrace/contrib/sneakers/integration.rb +0 -42
  1070. data/lib/ddtrace/contrib/sneakers/patcher.rb +0 -25
  1071. data/lib/ddtrace/contrib/sneakers/tracer.rb +0 -54
  1072. data/lib/ddtrace/contrib/status_code_matcher.rb +0 -70
  1073. data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +0 -31
  1074. data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +0 -25
  1075. data/lib/ddtrace/contrib/sucker_punch/ext.rb +0 -22
  1076. data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +0 -89
  1077. data/lib/ddtrace/contrib/sucker_punch/integration.rb +0 -39
  1078. data/lib/ddtrace/contrib/sucker_punch/patcher.rb +0 -44
  1079. data/lib/ddtrace/correlation.rb +0 -40
  1080. data/lib/ddtrace/diagnostics/environment_logger.rb +0 -280
  1081. data/lib/ddtrace/diagnostics/health.rb +0 -34
  1082. data/lib/ddtrace/distributed_tracing/headers/b3.rb +0 -45
  1083. data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +0 -57
  1084. data/lib/ddtrace/distributed_tracing/headers/datadog.rb +0 -43
  1085. data/lib/ddtrace/distributed_tracing/headers/headers.rb +0 -72
  1086. data/lib/ddtrace/distributed_tracing/headers/helpers.rb +0 -44
  1087. data/lib/ddtrace/encoding.rb +0 -72
  1088. data/lib/ddtrace/error.rb +0 -97
  1089. data/lib/ddtrace/event.rb +0 -53
  1090. data/lib/ddtrace/ext/analytics.rb +0 -13
  1091. data/lib/ddtrace/ext/app_types.rb +0 -12
  1092. data/lib/ddtrace/ext/correlation.rb +0 -12
  1093. data/lib/ddtrace/ext/diagnostics.rb +0 -37
  1094. data/lib/ddtrace/ext/distributed.rb +0 -40
  1095. data/lib/ddtrace/ext/environment.rb +0 -24
  1096. data/lib/ddtrace/ext/errors.rb +0 -11
  1097. data/lib/ddtrace/ext/forced_tracing.rb +0 -26
  1098. data/lib/ddtrace/ext/git.rb +0 -32
  1099. data/lib/ddtrace/ext/http.rb +0 -47
  1100. data/lib/ddtrace/ext/integration.rb +0 -9
  1101. data/lib/ddtrace/ext/manual_tracing.rb +0 -10
  1102. data/lib/ddtrace/ext/metrics.rb +0 -16
  1103. data/lib/ddtrace/ext/net.rb +0 -11
  1104. data/lib/ddtrace/ext/priority.rb +0 -19
  1105. data/lib/ddtrace/ext/profiling.rb +0 -53
  1106. data/lib/ddtrace/ext/runtime.rb +0 -25
  1107. data/lib/ddtrace/ext/sampling.rb +0 -17
  1108. data/lib/ddtrace/ext/sql.rb +0 -9
  1109. data/lib/ddtrace/ext/test.rb +0 -9
  1110. data/lib/ddtrace/ext/transport.rb +0 -32
  1111. data/lib/ddtrace/forced_tracing.rb +0 -39
  1112. data/lib/ddtrace/logger.rb +0 -41
  1113. data/lib/ddtrace/metrics.rb +0 -282
  1114. data/lib/ddtrace/opentelemetry/extensions.rb +0 -14
  1115. data/lib/ddtrace/opentelemetry/span.rb +0 -34
  1116. data/lib/ddtrace/opentracer/binary_propagator.rb +0 -25
  1117. data/lib/ddtrace/opentracer/carrier.rb +0 -7
  1118. data/lib/ddtrace/opentracer/distributed_headers.rb +0 -56
  1119. data/lib/ddtrace/opentracer/global_tracer.rb +0 -16
  1120. data/lib/ddtrace/opentracer/propagator.rb +0 -23
  1121. data/lib/ddtrace/opentracer/rack_propagator.rb +0 -61
  1122. data/lib/ddtrace/opentracer/scope.rb +0 -16
  1123. data/lib/ddtrace/opentracer/scope_manager.rb +0 -7
  1124. data/lib/ddtrace/opentracer/span.rb +0 -95
  1125. data/lib/ddtrace/opentracer/span_context.rb +0 -15
  1126. data/lib/ddtrace/opentracer/span_context_factory.rb +0 -24
  1127. data/lib/ddtrace/opentracer/text_map_propagator.rb +0 -76
  1128. data/lib/ddtrace/opentracer/thread_local_scope.rb +0 -32
  1129. data/lib/ddtrace/opentracer/thread_local_scope_manager.rb +0 -41
  1130. data/lib/ddtrace/opentracer/tracer.rb +0 -209
  1131. data/lib/ddtrace/opentracer.rb +0 -22
  1132. data/lib/ddtrace/patcher.rb +0 -69
  1133. data/lib/ddtrace/pin.rb +0 -86
  1134. data/lib/ddtrace/pipeline/span_filter.rb +0 -39
  1135. data/lib/ddtrace/pipeline/span_processor.rb +0 -21
  1136. data/lib/ddtrace/pipeline.rb +0 -47
  1137. data/lib/ddtrace/profiling/backtrace_location.rb +0 -33
  1138. data/lib/ddtrace/profiling/buffer.rb +0 -42
  1139. data/lib/ddtrace/profiling/collectors/stack.rb +0 -297
  1140. data/lib/ddtrace/profiling/encoding/profile.rb +0 -46
  1141. data/lib/ddtrace/profiling/event.rb +0 -14
  1142. data/lib/ddtrace/profiling/events/stack.rb +0 -81
  1143. data/lib/ddtrace/profiling/exporter.rb +0 -24
  1144. data/lib/ddtrace/profiling/ext/forking.rb +0 -98
  1145. data/lib/ddtrace/profiling/flush.rb +0 -44
  1146. data/lib/ddtrace/profiling/native_extension.rb +0 -40
  1147. data/lib/ddtrace/profiling/pprof/builder.rb +0 -126
  1148. data/lib/ddtrace/profiling/pprof/converter.rb +0 -103
  1149. data/lib/ddtrace/profiling/pprof/message_set.rb +0 -15
  1150. data/lib/ddtrace/profiling/pprof/payload.rb +0 -19
  1151. data/lib/ddtrace/profiling/pprof/pprof_pb.rb +0 -82
  1152. data/lib/ddtrace/profiling/pprof/stack_sample.rb +0 -140
  1153. data/lib/ddtrace/profiling/pprof/string_table.rb +0 -11
  1154. data/lib/ddtrace/profiling/pprof/template.rb +0 -119
  1155. data/lib/ddtrace/profiling/profiler.rb +0 -31
  1156. data/lib/ddtrace/profiling/recorder.rb +0 -96
  1157. data/lib/ddtrace/profiling/scheduler.rb +0 -150
  1158. data/lib/ddtrace/profiling/tasks/setup.rb +0 -90
  1159. data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +0 -42
  1160. data/lib/ddtrace/profiling/trace_identifiers/helper.rb +0 -46
  1161. data/lib/ddtrace/profiling/transport/client.rb +0 -15
  1162. data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +0 -94
  1163. data/lib/ddtrace/profiling/transport/http/api/instance.rb +0 -37
  1164. data/lib/ddtrace/profiling/transport/http/api/spec.rb +0 -41
  1165. data/lib/ddtrace/profiling/transport/http/api.rb +0 -44
  1166. data/lib/ddtrace/profiling/transport/http/builder.rb +0 -29
  1167. data/lib/ddtrace/profiling/transport/http/client.rb +0 -34
  1168. data/lib/ddtrace/profiling/transport/http/response.rb +0 -22
  1169. data/lib/ddtrace/profiling/transport/http.rb +0 -111
  1170. data/lib/ddtrace/profiling/transport/io/client.rb +0 -28
  1171. data/lib/ddtrace/profiling/transport/io/response.rb +0 -17
  1172. data/lib/ddtrace/profiling/transport/io.rb +0 -31
  1173. data/lib/ddtrace/profiling/transport/parcel.rb +0 -18
  1174. data/lib/ddtrace/profiling/transport/request.rb +0 -16
  1175. data/lib/ddtrace/profiling/transport/response.rb +0 -9
  1176. data/lib/ddtrace/profiling.rb +0 -149
  1177. data/lib/ddtrace/propagation/grpc_propagator.rb +0 -75
  1178. data/lib/ddtrace/propagation/http_propagator.rb +0 -91
  1179. data/lib/ddtrace/quantization/hash.rb +0 -104
  1180. data/lib/ddtrace/quantization/http.rb +0 -90
  1181. data/lib/ddtrace/runtime/metrics.rb +0 -135
  1182. data/lib/ddtrace/sampler.rb +0 -303
  1183. data/lib/ddtrace/sampling/matcher.rb +0 -58
  1184. data/lib/ddtrace/sampling/rate_limiter.rb +0 -177
  1185. data/lib/ddtrace/sampling/rule.rb +0 -62
  1186. data/lib/ddtrace/sampling/rule_sampler.rb +0 -133
  1187. data/lib/ddtrace/sampling.rb +0 -3
  1188. data/lib/ddtrace/span.rb +0 -445
  1189. data/lib/ddtrace/sync_writer.rb +0 -69
  1190. data/lib/ddtrace/tasks/exec.rb +0 -47
  1191. data/lib/ddtrace/tasks/help.rb +0 -15
  1192. data/lib/ddtrace/tracer.rb +0 -449
  1193. data/lib/ddtrace/utils/compression.rb +0 -28
  1194. data/lib/ddtrace/utils/database.rb +0 -26
  1195. data/lib/ddtrace/utils/forking.rb +0 -53
  1196. data/lib/ddtrace/utils/object_set.rb +0 -40
  1197. data/lib/ddtrace/utils/only_once.rb +0 -41
  1198. data/lib/ddtrace/utils/sequence.rb +0 -18
  1199. data/lib/ddtrace/utils/string_table.rb +0 -46
  1200. data/lib/ddtrace/utils/time.rb +0 -51
  1201. data/lib/ddtrace/utils.rb +0 -80
  1202. data/lib/ddtrace/vendor/active_record/connection_specification.rb +0 -302
  1203. data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +0 -117
  1204. data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +0 -58
  1205. data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +0 -136
  1206. data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +0 -10
  1207. data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +0 -9
  1208. data/lib/ddtrace/vendor/multipart-post/multipart.rb +0 -13
  1209. data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +0 -33
  1210. data/lib/ddtrace/worker.rb +0 -21
  1211. data/lib/ddtrace/workers/async.rb +0 -175
  1212. data/lib/ddtrace/workers/interval_loop.rb +0 -116
  1213. data/lib/ddtrace/workers/polling.rb +0 -56
  1214. data/lib/ddtrace/workers/queue.rb +0 -41
  1215. data/lib/ddtrace/workers/runtime_metrics.rb +0 -65
  1216. data/lib/ddtrace/workers/trace_writer.rb +0 -200
  1217. data/lib/ddtrace/workers.rb +0 -123
  1218. data/lib/ddtrace/writer.rb +0 -200
  1219. /data/lib/{ddtrace → datadog/core}/vendor/multipart-post/LICENSE +0 -0
  1220. /data/lib/{ddtrace → datadog}/profiling/pprof/pprof.proto +0 -0
  1221. /data/lib/{ddtrace/vendor/active_record → datadog/tracing/contrib/active_record/vendor}/MIT-LICENSE +0 -0
  1222. /data/lib/{ddtrace → datadog/tracing}/contrib/redis/vendor/LICENSE +0 -0
@@ -1,2626 +0,0 @@
1
- # Datadog Ruby Trace Client
2
-
3
- `ddtrace` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
4
- databases and microservices so that developers have high visibility into bottlenecks and troublesome requests.
5
-
6
- ## Getting started
7
-
8
- For the general APM documentation, see our [setup documentation][setup docs].
9
-
10
- 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
-
12
- To contribute, check out the [contribution guidelines][contribution docs] and [development guide][development docs].
13
-
14
- [setup docs]: https://docs.datadoghq.com/tracing/
15
- [development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/README.md#development
16
- [visualization docs]: https://docs.datadoghq.com/tracing/visualization/
17
- [contribution docs]: https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md
18
- [development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/docs/DevelopmentGuide.md
19
-
20
- ## Table of Contents
21
-
22
- - [Compatibility](#compatibility)
23
- - [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)
27
- - [Manual instrumentation](#manual-instrumentation)
28
- - [Integration instrumentation](#integration-instrumentation)
29
- - [Action Cable](#action-cable)
30
- - [Action View](#action-view)
31
- - [Action Mailer](#action-mailer)
32
- - [Active Model Serializers](#active-model-serializers)
33
- - [Action Pack](#action-pack)
34
- - [Active Job](#active-job)
35
- - [Active Record](#active-record)
36
- - [Active Support](#active-support)
37
- - [AWS](#aws)
38
- - [Concurrent Ruby](#concurrent-ruby)
39
- - [Cucumber](#cucumber)
40
- - [Dalli](#dalli)
41
- - [DelayedJob](#delayedjob)
42
- - [Elasticsearch](#elasticsearch)
43
- - [Ethon & Typhoeus](#ethon)
44
- - [Excon](#excon)
45
- - [Faraday](#faraday)
46
- - [Grape](#grape)
47
- - [GraphQL](#graphql)
48
- - [gRPC](#grpc)
49
- - [http.rb](#httprb)
50
- - [httpclient](#httpclient)
51
- - [httpx](#httpx)
52
- - [MongoDB](#mongodb)
53
- - [MySQL2](#mysql2)
54
- - [Net/HTTP](#nethttp)
55
- - [Presto](#presto)
56
- - [Qless](#qless)
57
- - [Que](#que)
58
- - [Racecar](#racecar)
59
- - [Rack](#rack)
60
- - [Rails](#rails)
61
- - [Rake](#rake)
62
- - [Redis](#redis)
63
- - [Rest Client](#rest-client)
64
- - [Resque](#resque)
65
- - [RSpec](#rspec)
66
- - [Shoryuken](#shoryuken)
67
- - [Sequel](#sequel)
68
- - [Sidekiq](#sidekiq)
69
- - [Sinatra](#sinatra)
70
- - [Sneakers](#sneakers)
71
- - [Sucker Punch](#sucker-punch)
72
- - [Advanced configuration](#advanced-configuration)
73
- - [Tracer settings](#tracer-settings)
74
- - [Custom logging](#custom-logging)
75
- - [Environment and tags](#environment-and-tags)
76
- - [Environment variables](#environment-variables)
77
- - [Sampling](#sampling)
78
- - [Application-side sampling](#application-side-sampling)
79
- - [Priority sampling](#priority-sampling)
80
- - [Distributed tracing](#distributed-tracing)
81
- - [HTTP request queuing](#http-request-queuing)
82
- - [Processing pipeline](#processing-pipeline)
83
- - [Filtering](#filtering)
84
- - [Processing](#processing)
85
- - [Trace correlation](#trace-correlation)
86
- - [Configuring the transport layer](#configuring-the-transport-layer)
87
- - [Metrics](#metrics)
88
- - [For application runtime](#for-application-runtime)
89
- - [OpenTracing](#opentracing)
90
- - [Profiling](#profiling)
91
- - [Troubleshooting](#troubleshooting)
92
- - [Profiling Resque jobs](#profiling-resque-jobs)
93
- - [Known issues and suggested configurations](#known-issues-and-suggested-configurations)
94
- - [Payload too large](#payload-too-large)
95
- - [Stack level too deep](#stack-level-too-deep)
96
-
97
- ## Compatibility
98
-
99
- **Supported Ruby interpreters**:
100
-
101
- | Type | Documentation | Version | Support type | Gem version support |
102
- | ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
103
- | MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
104
- | | | 2.7 | Full | Latest |
105
- | | | 2.6 | Full | Latest |
106
- | | | 2.5 | Full | Latest |
107
- | | | 2.4 | Full | Latest |
108
- | | | 2.3 | Full | Latest |
109
- | | | 2.2 | Full | Latest |
110
- | | | 2.1 | Full | Latest |
111
- | | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
112
- | | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
113
- | | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
114
- | JRuby | https://www.jruby.org | 9.2 | Full | Latest |
115
-
116
- **Supported web servers**:
117
-
118
- | Type | Documentation | Version | Support type |
119
- | --------- | --------------------------------- | ------------ | ------------ |
120
- | Puma | http://puma.io/ | 2.16+ / 3.6+ | Full |
121
- | Unicorn | https://bogomips.org/unicorn/ | 4.8+ / 5.1+ | Full |
122
- | Passenger | https://www.phusionpassenger.com/ | 5.0+ | Full |
123
-
124
- **Supported tracing frameworks**:
125
-
126
- | Type | Documentation | Version | Gem version support |
127
- | ----------- | ----------------------------------------------- | --------------------- | ------------------- |
128
- | OpenTracing | https://github.com/opentracing/opentracing-ruby | 0.4.1+ (w/ Ruby 2.1+) | >= 0.16.0 |
129
-
130
- *Full* support indicates all tracer features are available.
131
-
132
- *Deprecated* indicates support will transition to *Maintenance* in a future release.
133
-
134
- *Maintenance* indicates only critical bugfixes are backported until EOL.
135
-
136
- *EOL* indicates support is no longer provided.
137
-
138
- ### Apple macOS support
139
-
140
- Use of `ddtrace` on macOS is supported for development, but not for production deployments.
141
-
142
- ### Microsoft Windows support
143
-
144
- Using `ddtrace` on Microsoft Windows is currently unsupported. We'll still accept community contributions and issues,
145
- but will consider them as having low priority.
146
-
147
- ## Installation
148
-
149
- The following steps will help you quickly start tracing your Ruby application.
150
-
151
- ### Configure the Datadog Agent for APM
152
-
153
- 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.
154
-
155
- 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.
156
-
157
- #### Containers
158
-
159
- 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).
160
-
161
- 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:
162
-
163
- 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`.
164
-
165
-
166
- ### Quickstart for Rails applications
167
-
168
- #### Automatic instrumentation
169
-
170
- 1. Add the `ddtrace` gem to your Gemfile:
171
-
172
- ```ruby
173
- source 'https://rubygems.org'
174
- gem 'ddtrace', require: 'ddtrace/auto_instrument'
175
- ```
176
-
177
- 2. Install the gem with `bundle install`
178
-
179
- 3. You can configure, override, or disable any specific integration settings by also adding a Rails manual instrumentation configuration file (next).
180
-
181
- #### Manual instrumentation
182
-
183
- 1. Add the `ddtrace` gem to your Gemfile:
184
-
185
- ```ruby
186
- source 'https://rubygems.org'
187
- gem 'ddtrace'
188
- ```
189
-
190
- 2. Install the gem with `bundle install`
191
- 3. Create a `config/initializers/datadog.rb` file containing:
192
-
193
- ```ruby
194
- Datadog.configure do |c|
195
- # This will activate auto-instrumentation for Rails
196
- c.use :rails
197
- end
198
- ```
199
-
200
- You can also activate additional integrations here (see [Integration instrumentation](#integration-instrumentation))
201
-
202
- ### Quickstart for Ruby applications
203
-
204
- #### Automatic instrumentation
205
-
206
- 1. Install the gem with `gem install ddtrace`
207
- 2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
208
- 3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
209
-
210
- ```ruby
211
- # Example frameworks and libraries
212
- require 'sinatra'
213
- require 'faraday'
214
- require 'redis'
215
-
216
- require 'ddtrace/auto_instrument'
217
- ```
218
-
219
- You can configure, override, or disable any specific integration settings by also adding a Ruby manual configuration block (next).
220
-
221
- #### Manual instrumentation
222
-
223
- 1. Install the gem with `gem install ddtrace`
224
- 2. Add a configuration block to your Ruby application:
225
-
226
- ```ruby
227
- require 'ddtrace'
228
- Datadog.configure do |c|
229
- # Configure the tracer here.
230
- # Activate integrations, change tracer settings, etc...
231
- # By default without additional configuration, nothing will be traced.
232
- end
233
- ```
234
-
235
- 3. Add or activate instrumentation by doing either of the following:
236
- - Activate integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
237
- - Add manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
238
-
239
- ### Quickstart for OpenTracing
240
-
241
- 1. Install the gem with `gem install ddtrace`
242
- 2. To your OpenTracing configuration file, add the following:
243
-
244
- ```ruby
245
- require 'opentracing'
246
- require 'ddtrace'
247
- require 'ddtrace/opentracer'
248
-
249
- # Activate the Datadog tracer for OpenTracing
250
- OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new
251
- ```
252
-
253
- 3. (Optional) Add a configuration block to your Ruby application to configure Datadog with:
254
-
255
- ```ruby
256
- Datadog.configure do |c|
257
- # Configure the Datadog tracer here.
258
- # Activate integrations, change tracer settings, etc...
259
- # By default without additional configuration,
260
- # no additional integrations will be traced, only
261
- # what you have instrumented with OpenTracing.
262
- end
263
- ```
264
-
265
- 4. (Optional) Add or activate additional instrumentation by doing either of the following:
266
- - Activate Datadog integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
267
- - Add Datadog manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
268
-
269
- ### Final steps for installation
270
-
271
- After setting up, your services will appear on the [APM services page](https://app.datadoghq.com/apm/services) within a few minutes. Learn more about [using the APM UI][visualization docs].
272
-
273
- ## Manual Instrumentation
274
-
275
- If you aren't using a supported framework instrumentation, you may want to manually instrument your code.
276
-
277
- To trace any Ruby code, you can use the `Datadog.tracer.trace` method:
278
-
279
- ```ruby
280
- Datadog.tracer.trace(name, options) do |span|
281
- # Wrap this block around the code you want to instrument
282
- # Additionally, you can modify the span here.
283
- # e.g. Change the resource name, set tags, etc...
284
- end
285
- ```
286
-
287
- Where `name` should be a `String` that describes the generic kind of operation being done (e.g. `'web.request'`, or `'request.parse'`)
288
-
289
- And `options` is an optional `Hash` that accepts the following parameters:
290
-
291
- | Key | Type | Description | Default |
292
- | --- | --- | --- | --- |
293
- | `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
294
- | `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. |
295
- | `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
296
- | `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
297
- | `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
298
- | `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
299
- | `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? }` |
300
-
301
- 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.
302
-
303
- Example of manual instrumentation in action:
304
-
305
- ```ruby
306
- get '/posts' do
307
- Datadog.tracer.trace('web.request', service: 'my-blog', resource: 'GET /posts') do |span|
308
- # Trace the activerecord call
309
- Datadog.tracer.trace('posts.fetch') do
310
- @posts = Posts.order(created_at: :desc).limit(10)
311
- end
312
-
313
- # Add some APM tags
314
- span.set_tag('http.method', request.request_method)
315
- span.set_tag('posts.count', @posts.length)
316
-
317
- # Trace the template rendering
318
- Datadog.tracer.trace('template.render') do
319
- erb :index
320
- end
321
- end
322
- end
323
- ```
324
-
325
- ### Asynchronous tracing
326
-
327
- 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.
328
-
329
- To trace these operations, you can trace code asynchronously by calling `Datadog.tracer.trace` without a block:
330
-
331
- ```ruby
332
- # Some instrumentation framework calls this after an event finishes...
333
- def db_query(start, finish, query)
334
- span = Datadog.tracer.trace('database.query')
335
- span.resource = query
336
- span.start_time = start
337
- span.finish(finish)
338
- end
339
- ```
340
-
341
- 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`.
342
-
343
- *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.
344
-
345
- To avoid this scenario when handling start/finish events, you can use `Datadog.tracer.active_span` to get the current active span.
346
-
347
- ```ruby
348
- # e.g. ActiveSupport::Notifications calls this when an event starts
349
- def start(name, id, payload)
350
- # Start a span
351
- Datadog.tracer.trace(name)
352
- end
353
-
354
- # e.g. ActiveSupport::Notifications calls this when an event finishes
355
- def finish(name, id, payload)
356
- # Retrieve current active span (thread-safe)
357
- current_span = Datadog.tracer.active_span
358
- unless current_span.nil?
359
- current_span.resource = payload[:query]
360
- current_span.finish
361
- end
362
- end
363
- ```
364
- ### Enriching traces from nested methods
365
-
366
- You can tag additional information to the current active span from any method. Note however that if the method is called and there is no span currently active `active_span` will be nil.
367
-
368
- ```ruby
369
- # e.g. adding tag to active span
370
-
371
- current_span = Datadog.tracer.active_span
372
- current_span.set_tag('my_tag', 'my_value') unless current_span.nil?
373
- ```
374
-
375
- 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.
376
-
377
- ```ruby
378
- # e.g. adding tag to active root span
379
-
380
- current_root_span = Datadog.tracer.active_root_span
381
- current_root_span.set_tag('my_tag', 'my_value') unless current_root_span.nil?
382
- ```
383
-
384
- ## Integration instrumentation
385
-
386
- Many popular libraries and frameworks are supported out-of-the-box, which can be auto-instrumented. Although they are not activated automatically, they can be easily activated and configured by using the `Datadog.configure` API:
387
-
388
- ```ruby
389
- Datadog.configure do |c|
390
- # Activates and configures an integration
391
- c.use :integration_name, options
392
- end
393
- ```
394
-
395
- `options` is a `Hash` of integration-specific configuration settings.
396
-
397
- For a list of available integrations, and their configuration options, please refer to the following:
398
-
399
- | Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
400
- | ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
401
- | Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
402
- | Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
403
- | Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
404
- | Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
405
- | Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
406
- | Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
407
- | Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
408
- | Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
409
- | AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
410
- | Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
411
- | Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
412
- | Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
413
- | DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
414
- | Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
415
- | Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
416
- | Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
417
- | Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
418
- | Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
419
- | GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
420
- | gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
421
- | http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
422
- | httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
423
- | httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
424
- | Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
425
- | Makara (through Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
426
- | MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
427
- | MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
428
- | 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)* |
429
- | Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
430
- | Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
431
- | Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
432
- | Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
433
- | Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
434
- | Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
435
- | Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
436
- | Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
437
- | Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
438
- | Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
439
- | RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
440
- | Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
441
- | Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
442
- | Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
443
- | Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
444
- | Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
445
- | Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
446
-
447
- ### Action Cable
448
-
449
- The Action Cable integration traces broadcast messages and channel actions.
450
-
451
- You can enable it through `Datadog.configure`:
452
-
453
- ```ruby
454
- require 'ddtrace'
455
-
456
- Datadog.configure do |c|
457
- c.use :action_cable, options
458
- end
459
- ```
460
-
461
- Where `options` is an optional `Hash` that accepts the following parameters:
462
-
463
- | Key | Description | Default |
464
- | --- | ----------- | ------- |
465
- | `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
466
-
467
- ### Action View
468
-
469
- Most of the time, Active Support is set up as part of Rails, but it can be activated separately:
470
-
471
- ```ruby
472
- require 'actionview'
473
- require 'ddtrace'
474
-
475
- Datadog.configure do |c|
476
- c.use :action_view, options
477
- end
478
- ```
479
-
480
- Where `options` is an optional `Hash` that accepts the following parameters:
481
-
482
- | Key | Description | Default |
483
- | ---| --- | --- |
484
- | `service_name` | Service name used for rendering instrumentation. | `action_view` |
485
- | `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/'` |
486
-
487
- ### Action Mailer
488
-
489
- The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
490
-
491
- You can enable it through `Datadog.configure`:
492
-
493
- ```ruby
494
- require 'ddtrace'
495
- Datadog.configure do |c|
496
- c.use :action_mailer, options
497
- end
498
- ```
499
-
500
- Where `options` is an optional `Hash` that accepts the following parameters:
501
-
502
- | Key | Description | Default |
503
- | --- | ----------- | ------- |
504
- | `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
505
- | `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
506
- | `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` |
507
-
508
- ### Active Model Serializers
509
-
510
- The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
511
-
512
- ```ruby
513
- require 'active_model_serializers'
514
- require 'ddtrace'
515
-
516
- Datadog.configure do |c|
517
- c.use :active_model_serializers, options
518
- end
519
-
520
- my_object = MyModel.new(name: 'my object')
521
- ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
522
- ```
523
-
524
- | Key | Description | Default |
525
- | --- | ----------- | ------- |
526
- | `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
527
-
528
- ### Action Pack
529
-
530
- Most of the time, Action Pack is set up as part of Rails, but it can be activated separately:
531
-
532
- ```ruby
533
- require 'actionpack'
534
- require 'ddtrace'
535
-
536
- Datadog.configure do |c|
537
- c.use :action_pack, options
538
- end
539
- ```
540
-
541
- Where `options` is an optional `Hash` that accepts the following parameters:
542
-
543
- | Key | Description | Default |
544
- | ---| --- | --- |
545
- | `service_name` | Service name used for rendering instrumentation. | `action_pack` |
546
-
547
- ### Active Job
548
-
549
- Most of the time, Active Job is set up as part of Rails, but it can be activated separately:
550
-
551
- ```ruby
552
- require 'active_job'
553
- require 'ddtrace'
554
-
555
- Datadog.configure do |c|
556
- c.use :active_job, options
557
- end
558
-
559
- ExampleJob.perform_later
560
- ```
561
-
562
- Where `options` is an optional `Hash` that accepts the following parameters:
563
-
564
- | Key | Description | Default |
565
- | --- | ----------- | ------- |
566
- | `service_name` | Service name used for `active_job` instrumentation | `'active_job'` |
567
- | `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` |
568
-
569
- ### Active Record
570
-
571
- Most of the time, Active Record is set up as part of a web framework (Rails, Sinatra...) however, it can be set up alone:
572
-
573
- ```ruby
574
- require 'tmpdir'
575
- require 'sqlite3'
576
- require 'active_record'
577
- require 'ddtrace'
578
-
579
- Datadog.configure do |c|
580
- c.use :active_record, options
581
- end
582
-
583
- Dir::Tmpname.create(['test', '.sqlite']) do |db|
584
- conn = ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
585
- database: db)
586
- conn.connection.execute('SELECT 42') # traced!
587
- end
588
- ```
589
-
590
- Where `options` is an optional `Hash` that accepts the following parameters:
591
-
592
- | Key | Description | Default |
593
- | ---| --- | --- |
594
- | `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'`) |
595
- | `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
596
-
597
- **Configuring trace settings per database**
598
-
599
- You can configure trace settings per database connection by using the `describes` option:
600
-
601
- ```ruby
602
- # Provide a `:describes` option with a connection key.
603
- # Any of the following keys are acceptable and equivalent to one another.
604
- # If a block is provided, it yields a Settings object that
605
- # accepts any of the configuration options listed above.
606
-
607
- Datadog.configure do |c|
608
- # Symbol matching your database connection in config/database.yml
609
- # Only available if you are using Rails with ActiveRecord.
610
- c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
611
-
612
- # Block configuration pattern.
613
- c.use :active_record, describes: :secondary_database do |second_db|
614
- second_db.service_name = 'secondary-db'
615
- end
616
-
617
- # Connection string with the following connection settings:
618
- # adapter, username, host, port, database
619
- # Other fields are ignored.
620
- c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
621
-
622
- # Hash with following connection settings:
623
- # adapter, username, host, port, database
624
- # Other fields are ignored.
625
- c.use :active_record, describes: {
626
- adapter: 'mysql2',
627
- host: '127.0.0.1',
628
- port: '3306',
629
- database: 'mysql',
630
- username: 'root'
631
- },
632
- service_name: 'secondary-db'
633
-
634
- # If using the `makara` gem, it's possible to match on connection `role`:
635
- c.use :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
636
- c.use :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
637
- end
638
- ```
639
-
640
- You can also create configurations based on partial matching of database connection fields:
641
-
642
- ```ruby
643
- Datadog.configure do |c|
644
- # Matches any connection on host `127.0.0.1`.
645
- c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
646
-
647
- # Matches any `mysql2` connection.
648
- c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
649
-
650
- # Matches any `mysql2` connection to the `reports` database.
651
- #
652
- # In case of multiple matching `describe` configurations, the latest one applies.
653
- # In this case a connection with both adapter `mysql` and database `reports`
654
- # will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
655
- c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
656
- end
657
- ```
658
-
659
- When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
660
-
661
- 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.
662
-
663
- ### Active Support
664
-
665
- Most of the time, Active Support is set up as part of Rails, but it can be activated separately:
666
-
667
- ```ruby
668
- require 'activesupport'
669
- require 'ddtrace'
670
-
671
- Datadog.configure do |c|
672
- c.use :active_support, options
673
- end
674
-
675
- cache = ActiveSupport::Cache::MemoryStore.new
676
- cache.read('city')
677
- ```
678
-
679
- Where `options` is an optional `Hash` that accepts the following parameters:
680
-
681
- | Key | Description | Default |
682
- | ---| --- | --- |
683
- | `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
684
-
685
- ### AWS
686
-
687
- The AWS integration will trace every interaction (e.g. API calls) with AWS services (S3, ElastiCache etc.).
688
-
689
- ```ruby
690
- require 'aws-sdk'
691
- require 'ddtrace'
692
-
693
- Datadog.configure do |c|
694
- c.use :aws, options
695
- end
696
-
697
- # Perform traced call
698
- Aws::S3::Client.new.list_buckets
699
- ```
700
-
701
- Where `options` is an optional `Hash` that accepts the following parameters:
702
-
703
- | Key | Description | Default |
704
- | --- | ----------- | ------- |
705
- | `service_name` | Service name used for `aws` instrumentation | `'aws'` |
706
-
707
- ### Concurrent Ruby
708
-
709
- The Concurrent Ruby integration adds support for context propagation when using `::Concurrent::Future`.
710
- Making sure that code traced within the `Future#execute` will have correct parent set.
711
-
712
- To activate your integration, use the `Datadog.configure` method:
713
-
714
- ```ruby
715
- # Inside Rails initializer or equivalent
716
- Datadog.configure do |c|
717
- # Patches ::Concurrent::Future to use ExecutorService that propagates context
718
- c.use :concurrent_ruby, options
719
- end
720
-
721
- # Pass context into code executed within Concurrent::Future
722
- Datadog.tracer.trace('outer') do
723
- Concurrent::Future.execute { Datadog.tracer.trace('inner') { } }.wait
724
- end
725
- ```
726
-
727
- Where `options` is an optional `Hash` that accepts the following parameters:
728
-
729
- | Key | Description | Default |
730
- | --- | ----------- | ------- |
731
- | `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
732
-
733
- ### Cucumber
734
-
735
- Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
736
-
737
- To activate your integration, use the `Datadog.configure` method:
738
-
739
- ```ruby
740
- require 'cucumber'
741
- require 'ddtrace'
742
-
743
- # Configure default Cucumber integration
744
- Datadog.configure do |c|
745
- c.use :cucumber, options
746
- end
747
-
748
- # Example of how to attach tags from scenario to active span
749
- Around do |scenario, block|
750
- active_span = Datadog.configuration[:cucumber][:tracer].active_span
751
- unless active_span.nil?
752
- scenario.tags.filter { |tag| tag.include? ':' }.each do |tag|
753
- active_span.set_tag(*tag.name.split(':', 2))
754
- end
755
- end
756
- block.call
757
- end
758
- ```
759
-
760
- Where `options` is an optional `Hash` that accepts the following parameters:
761
-
762
- | Key | Description | Default |
763
- | --- | ----------- | ------- |
764
- | `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
765
- | `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
766
- | `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
767
-
768
- ### Dalli
769
-
770
- Dalli integration will trace all calls to your `memcached` server:
771
-
772
- ```ruby
773
- require 'dalli'
774
- require 'ddtrace'
775
-
776
- # Configure default Dalli tracing behavior
777
- Datadog.configure do |c|
778
- c.use :dalli, options
779
- end
780
-
781
- # Configure Dalli tracing behavior for single client
782
- client = Dalli::Client.new('localhost:11211', options)
783
- client.set('abc', 123)
784
- ```
785
-
786
- Where `options` is an optional `Hash` that accepts the following parameters:
787
-
788
- | Key | Description | Default |
789
- | --- | ----------- | ------- |
790
- | `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
791
-
792
- ### DelayedJob
793
-
794
- The DelayedJob integration uses lifecycle hooks to trace the job executions and enqueues.
795
-
796
- You can enable it through `Datadog.configure`:
797
-
798
- ```ruby
799
- require 'ddtrace'
800
-
801
- Datadog.configure do |c|
802
- c.use :delayed_job, options
803
- end
804
- ```
805
-
806
- Where `options` is an optional `Hash` that accepts the following parameters:
807
-
808
- | Key | Description | Default |
809
- | --- | ----------- | ------- |
810
- | `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
811
- | `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
812
- | `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? }` |
813
-
814
- ### Elasticsearch
815
-
816
- The Elasticsearch integration will trace any call to `perform_request` in the `Client` object:
817
-
818
- ```ruby
819
- require 'elasticsearch/transport'
820
- require 'ddtrace'
821
-
822
- Datadog.configure do |c|
823
- c.use :elasticsearch, options
824
- end
825
-
826
- # Perform a query to Elasticsearch
827
- client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
828
- response = client.perform_request 'GET', '_cluster/health'
829
- ```
830
-
831
- Where `options` is an optional `Hash` that accepts the following parameters:
832
-
833
- | Key | Description | Default |
834
- | --- | ----------- | ------- |
835
- | `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. | `{}` |
836
- | `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
837
-
838
- ### Ethon
839
-
840
- The `ethon` integration will trace any HTTP request through `Easy` or `Multi` objects. Note that this integration also supports `Typhoeus` library which is based on `Ethon`.
841
-
842
- ```ruby
843
- require 'ddtrace'
844
-
845
- Datadog.configure do |c|
846
- c.use :ethon, options
847
-
848
- # optionally, specify a different service name for hostnames matching a regex
849
- c.use :ethon, describes: /user-[^.]+\.example\.com/ do |ethon|
850
- ethon.service_name = 'user.example.com'
851
- ethon.split_by_domain = false # Only necessary if split_by_domain is true by default
852
- end
853
- end
854
- ```
855
-
856
- Where `options` is an optional `Hash` that accepts the following parameters:
857
-
858
- | Key | Description | Default |
859
- | --- | ----------- | ------- |
860
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
861
- | `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
862
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
863
-
864
- ### Excon
865
-
866
- The `excon` integration is available through the `ddtrace` middleware:
867
-
868
- ```ruby
869
- require 'excon'
870
- require 'ddtrace'
871
-
872
- # Configure default Excon tracing behavior
873
- Datadog.configure do |c|
874
- c.use :excon, options
875
-
876
- # optionally, specify a different service name for hostnames matching a regex
877
- c.use :excon, describes: /user-[^.]+\.example\.com/ do |excon|
878
- excon.service_name = 'user.example.com'
879
- excon.split_by_domain = false # Only necessary if split_by_domain is true by default
880
- end
881
- end
882
-
883
- connection = Excon.new('https://example.com')
884
- connection.get
885
- ```
886
-
887
- Where `options` is an optional `Hash` that accepts the following parameters:
888
-
889
- | Key | Description | Default |
890
- | --- | ----------- | ------- |
891
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
892
- | `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` |
893
- | `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
894
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
895
-
896
- **Configuring connections to use different settings**
897
-
898
- If you use multiple connections with Excon, you can give each of them different settings by configuring their constructors with middleware:
899
-
900
- ```ruby
901
- # Wrap the Datadog tracing middleware around the default middleware stack
902
- Excon.new(
903
- 'http://example.com',
904
- middlewares: Datadog::Contrib::Excon::Middleware.with(options).around_default_stack
905
- )
906
-
907
- # Insert the middleware into a custom middleware stack.
908
- # NOTE: Trace middleware must be inserted after ResponseParser!
909
- Excon.new(
910
- 'http://example.com',
911
- middlewares: [
912
- Excon::Middleware::ResponseParser,
913
- Datadog::Contrib::Excon::Middleware.with(options),
914
- Excon::Middleware::Idempotent
915
- ]
916
- )
917
- ```
918
-
919
- Where `options` is a Hash that contains any of the parameters listed in the table above.
920
-
921
- ### Faraday
922
-
923
- The `faraday` integration is available through the `ddtrace` middleware:
924
-
925
- ```ruby
926
- require 'faraday'
927
- require 'ddtrace'
928
-
929
- # Configure default Faraday tracing behavior
930
- Datadog.configure do |c|
931
- c.use :faraday, options
932
-
933
- # optionally, specify a different service name for hostnames matching a regex
934
- c.use :faraday, describes: /user-[^.]+\.example\.com/ do |faraday|
935
- faraday.service_name = 'user.example.com'
936
- faraday.split_by_domain = false # Only necessary if split_by_domain is true by default
937
- end
938
- end
939
-
940
- # In case you want to override the global configuration for a certain client instance
941
- connection = Faraday.new('https://example.com') do |builder|
942
- builder.use(:ddtrace, options)
943
- builder.adapter Faraday.default_adapter
944
- end
945
-
946
- connection.get('/foo')
947
- ```
948
-
949
- Where `options` is an optional `Hash` that accepts the following parameters:
950
-
951
- | Key | Description | Default |
952
- | --- | ----------- | ------- |
953
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
954
- | `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` |
955
- | `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
956
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
957
-
958
- ### Grape
959
-
960
- The Grape integration adds the instrumentation to Grape endpoints and filters. This integration can work side by side with other integrations like Rack and Rails.
961
-
962
- To activate your integration, use the `Datadog.configure` method before defining your Grape application:
963
-
964
- ```ruby
965
- # api.rb
966
- require 'grape'
967
- require 'ddtrace'
968
-
969
- Datadog.configure do |c|
970
- c.use :grape, options
971
- end
972
-
973
- # Then define your application
974
- class RackTestingAPI < Grape::API
975
- desc 'main endpoint'
976
- get :success do
977
- 'Hello world!'
978
- end
979
- end
980
- ```
981
-
982
- Where `options` is an optional `Hash` that accepts the following parameters:
983
-
984
- | Key | Description | Default |
985
- | --- | ----------- | ------- |
986
- | `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
987
- | `service_name` | Service name used for `grape` instrumentation | `'grape'` |
988
- | `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` |
989
-
990
- ### GraphQL
991
-
992
- The GraphQL integration activates instrumentation for GraphQL queries.
993
-
994
- To activate your integration, use the `Datadog.configure` method:
995
-
996
- ```ruby
997
- # Inside Rails initializer or equivalent
998
- Datadog.configure do |c|
999
- c.use :graphql, schemas: [YourSchema], options
1000
- end
1001
-
1002
- # Then run a GraphQL query
1003
- YourSchema.execute(query, variables: {}, context: {}, operation_name: nil)
1004
- ```
1005
-
1006
- The `use :graphql` method accepts the following parameters. Additional options can be substituted in for `options`:
1007
-
1008
- | Key | Description | Default |
1009
- | --- | ----------- | ------- |
1010
- | `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
1011
- | `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. | `[]` |
1012
-
1013
- **Manually configuring GraphQL schemas**
1014
-
1015
- If you prefer to individually configure the tracer settings for a schema (e.g. you have multiple schemas with different service names), in the schema definition, you can add the following [using the GraphQL API](http://graphql-ruby.org/queries/tracing.html):
1016
-
1017
- ```ruby
1018
- # Class-based schema
1019
- class YourSchema < GraphQL::Schema
1020
- use(
1021
- GraphQL::Tracing::DataDogTracing,
1022
- service: 'graphql'
1023
- )
1024
- end
1025
- ```
1026
-
1027
- ```ruby
1028
- # .define-style schema
1029
- YourSchema = GraphQL::Schema.define do
1030
- use(
1031
- GraphQL::Tracing::DataDogTracing,
1032
- service: 'graphql'
1033
- )
1034
- end
1035
- ```
1036
-
1037
- Or you can modify an already defined schema:
1038
-
1039
- ```ruby
1040
- # Class-based schema
1041
- YourSchema.use(
1042
- GraphQL::Tracing::DataDogTracing,
1043
- service: 'graphql'
1044
- )
1045
- ```
1046
-
1047
- ```ruby
1048
- # .define-style schema
1049
- YourSchema.define do
1050
- use(
1051
- GraphQL::Tracing::DataDogTracing,
1052
- service: 'graphql'
1053
- )
1054
- end
1055
- ```
1056
-
1057
- Do *NOT* `use :graphql` in `Datadog.configure` if you choose to configure manually, as to avoid double tracing. These two means of configuring GraphQL tracing are considered mutually exclusive.
1058
-
1059
- ### gRPC
1060
-
1061
- The `grpc` integration adds both client and server interceptors, which run as middleware before executing the service's remote procedure call. As gRPC applications are often distributed, the integration shares trace information between client and server.
1062
-
1063
- To setup your integration, use the `Datadog.configure` method like so:
1064
-
1065
- ```ruby
1066
- require 'grpc'
1067
- require 'ddtrace'
1068
-
1069
- Datadog.configure do |c|
1070
- c.use :grpc, options
1071
- end
1072
-
1073
- # Server side
1074
- server = GRPC::RpcServer.new
1075
- server.add_http2_port('localhost:50051', :this_port_is_insecure)
1076
- server.handle(Demo)
1077
- server.run_till_terminated
1078
-
1079
- # Client side
1080
- client = Demo.rpc_stub_class.new('localhost:50051', :this_channel_is_insecure)
1081
- client.my_endpoint(DemoMessage.new(contents: 'hello!'))
1082
- ```
1083
-
1084
- Where `options` is an optional `Hash` that accepts the following parameters:
1085
-
1086
- | Key | Description | Default |
1087
- | --- | ----------- | ------- |
1088
- | `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
1089
- | `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? }` |
1090
-
1091
- **Configuring clients to use different settings**
1092
-
1093
- In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
1094
-
1095
- ```ruby
1096
- configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
1097
- c.service_name = "Alternate"
1098
- end
1099
-
1100
- alternate_client = Demo::Echo::Service.rpc_stub_class.new(
1101
- 'localhost:50052',
1102
- :this_channel_is_insecure,
1103
- :interceptors => [configured_interceptor]
1104
- )
1105
- ```
1106
-
1107
- The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
1108
-
1109
- ### http.rb
1110
-
1111
- The http.rb integration will trace any HTTP call using the Http.rb gem.
1112
-
1113
- ```ruby
1114
- require 'http'
1115
- require 'ddtrace'
1116
- Datadog.configure do |c|
1117
- c.use :httprb, options
1118
- # optionally, specify a different service name for hostnames matching a regex
1119
- c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
1120
- httprb.service_name = 'user.example.com'
1121
- httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
1122
- end
1123
- end
1124
- ```
1125
-
1126
- Where `options` is an optional `Hash` that accepts the following parameters:
1127
-
1128
- | Key | Description | Default |
1129
- | --- | ----------- | ------- |
1130
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1131
- | `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
1132
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1133
-
1134
- ### httpclient
1135
-
1136
- The httpclient integration will trace any HTTP call using the httpclient gem.
1137
-
1138
- ```ruby
1139
- require 'httpclient'
1140
- require 'ddtrace'
1141
- Datadog.configure do |c|
1142
- c.use :httpclient, options
1143
- # optionally, specify a different service name for hostnames matching a regex
1144
- c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
1145
- httpclient.service_name = 'user.example.com'
1146
- httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
1147
- end
1148
- end
1149
- ```
1150
-
1151
- Where `options` is an optional `Hash` that accepts the following parameters:
1152
-
1153
- | Key | Description | Default |
1154
- | --- | ----------- | ------- |
1155
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1156
- | `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
1157
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1158
-
1159
- ### httpx
1160
-
1161
- `httpx` maintains its [own integration with `ddtrace`](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter):
1162
-
1163
- ```ruby
1164
- require "ddtrace"
1165
- require "httpx/adapters/datadog"
1166
-
1167
- Datadog.configure do |c|
1168
- c.use :httpx
1169
-
1170
- # optionally, specify a different service name for hostnames matching a regex
1171
- c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
1172
- http.service_name = 'user.example.com'
1173
- http.split_by_domain = false # Only necessary if split_by_domain is true by default
1174
- end
1175
- end
1176
- ```
1177
-
1178
- ### Kafka
1179
-
1180
- The Kafka integration provides tracing of the `ruby-kafka` gem:
1181
-
1182
- You can enable it through `Datadog.configure`:
1183
-
1184
- ```ruby
1185
- require 'active_support/notifications' # required to enable 'ruby-kafka' instrumentation
1186
- require 'kafka'
1187
- require 'ddtrace'
1188
-
1189
- Datadog.configure do |c|
1190
- c.use :kafka, options
1191
- end
1192
- ```
1193
-
1194
- Where `options` is an optional `Hash` that accepts the following parameters:
1195
-
1196
- | Key | Description | Default |
1197
- | --- | ----------- | ------- |
1198
- | `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
1199
- | `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
1200
-
1201
- ### MongoDB
1202
-
1203
- 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:
1204
-
1205
- ```ruby
1206
- require 'mongo'
1207
- require 'ddtrace'
1208
-
1209
- Datadog.configure do |c|
1210
- c.use :mongo, options
1211
- end
1212
-
1213
- # Create a MongoDB client and use it as usual
1214
- client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
1215
- collection = client[:people]
1216
- collection.insert_one({ name: 'Steve' })
1217
-
1218
- # In case you want to override the global configuration for a certain client instance
1219
- Datadog.configure(client, options)
1220
- ```
1221
-
1222
- Where `options` is an optional `Hash` that accepts the following parameters:
1223
-
1224
- | Key | Description | Default |
1225
- | --- | ----------- | ------- |
1226
- | `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] }` |
1227
- | `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
1228
-
1229
- **Configuring trace settings per connection**
1230
-
1231
- You can configure trace settings per connection by using the `describes` option:
1232
-
1233
- ```ruby
1234
- # Provide a `:describes` option with a connection key.
1235
- # Any of the following keys are acceptable and equivalent to one another.
1236
- # If a block is provided, it yields a Settings object that
1237
- # accepts any of the configuration options listed above.
1238
-
1239
- Datadog.configure do |c|
1240
- # Network connection string
1241
- c.use :mongo, describes: '127.0.0.1:27017', service_name: 'mongo-primary'
1242
-
1243
- # Network connection regular expression
1244
- c.use :mongo, describes: /localhost.*/, service_name: 'mongo-secondary'
1245
- end
1246
-
1247
- client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
1248
- collection = client[:people]
1249
- collection.insert_one({ name: 'Steve' })
1250
- # Traced call will belong to `mongo-primary` service
1251
-
1252
- client = Mongo::Client.new([ 'localhost:27017' ], :database => 'artists')
1253
- collection = client[:people]
1254
- collection.insert_one({ name: 'Steve' })
1255
- # Traced call will belong to `mongo-secondary` service
1256
- ```
1257
-
1258
- When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
1259
-
1260
- ### MySQL2
1261
-
1262
- The MySQL2 integration traces any SQL command sent through `mysql2` gem.
1263
-
1264
- ```ruby
1265
- require 'mysql2'
1266
- require 'ddtrace'
1267
-
1268
- Datadog.configure do |c|
1269
- c.use :mysql2, options
1270
- end
1271
-
1272
- client = Mysql2::Client.new(:host => "localhost", :username => "root")
1273
- client.query("SELECT * FROM users WHERE group='x'")
1274
- ```
1275
-
1276
- Where `options` is an optional `Hash` that accepts the following parameters:
1277
-
1278
- | Key | Description | Default |
1279
- | --- | ----------- | ------- |
1280
- | `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
1281
-
1282
- ### Net/HTTP
1283
-
1284
- The Net/HTTP integration will trace any HTTP call using the standard lib Net::HTTP module.
1285
-
1286
- ```ruby
1287
- require 'net/http'
1288
- require 'ddtrace'
1289
-
1290
- Datadog.configure do |c|
1291
- c.use :http, options
1292
-
1293
- # optionally, specify a different service name for hostnames matching a regex
1294
- c.use :http, describes: /user-[^.]+\.example\.com/ do |http|
1295
- http.service_name = 'user.example.com'
1296
- http.split_by_domain = false # Only necessary if split_by_domain is true by default
1297
- end
1298
- end
1299
-
1300
- Net::HTTP.start('127.0.0.1', 8080) do |http|
1301
- request = Net::HTTP::Get.new '/index'
1302
- response = http.request(request)
1303
- end
1304
-
1305
- content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
1306
- ```
1307
-
1308
- Where `options` is an optional `Hash` that accepts the following parameters:
1309
-
1310
- | Key | Description | Default |
1311
- | --- | ----------- | ------- |
1312
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1313
- | `service_name` | Service name used for `http` instrumentation | `'net/http'` |
1314
- | `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
1315
-
1316
- If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
1317
-
1318
- ```ruby
1319
- client = Net::HTTP.new(host, port)
1320
- Datadog.configure(client, options)
1321
- ```
1322
-
1323
- ### Presto
1324
-
1325
- The Presto integration traces any SQL command sent through `presto-client` gem.
1326
-
1327
- ```ruby
1328
- require 'presto-client'
1329
- require 'ddtrace'
1330
-
1331
- Datadog.configure do |c|
1332
- c.use :presto, options
1333
- end
1334
-
1335
- client = Presto::Client.new(
1336
- server: "localhost:8880",
1337
- ssl: {verify: false},
1338
- catalog: "native",
1339
- schema: "default",
1340
- time_zone: "US/Pacific",
1341
- language: "English",
1342
- http_debug: true,
1343
- )
1344
-
1345
- client.run("select * from system.nodes")
1346
- ```
1347
-
1348
- Where `options` is an optional `Hash` that accepts the following parameters:
1349
-
1350
- | Key | Description | Default |
1351
- | --- | ----------- | ------- |
1352
- | `service_name` | Service name used for `presto` instrumentation | `'presto'` |
1353
-
1354
- ### Qless
1355
-
1356
- The Qless integration uses lifecycle hooks to trace job executions.
1357
-
1358
- To add tracing to a Qless job:
1359
-
1360
- ```ruby
1361
- require 'ddtrace'
1362
-
1363
- Datadog.configure do |c|
1364
- c.use :qless, options
1365
- end
1366
- ```
1367
-
1368
- Where `options` is an optional `Hash` that accepts the following parameters:
1369
-
1370
- | Key | Description | Default |
1371
- | --- | ----------- | ------- |
1372
- | `service_name` | Service name used for `qless` instrumentation | `'qless'` |
1373
- | `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
1374
- | `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
1375
-
1376
- ### Que
1377
-
1378
- The Que integration is a middleware which will trace job executions.
1379
-
1380
- You can enable it through `Datadog.configure`:
1381
-
1382
- ```ruby
1383
- require 'ddtrace'
1384
-
1385
- Datadog.configure do |c|
1386
- c.use :que, options
1387
- end
1388
- ```
1389
-
1390
- Where `options` is an optional `Hash` that accepts the following parameters:
1391
-
1392
- | Key | Description | Default |
1393
- | --- | ----------- | ------- |
1394
- | `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1395
- | `service_name` | Service name used for `que` instrumentation | `'que'` |
1396
- | `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
1397
- | `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
1398
- | `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? }` |
1399
-
1400
- ### Racecar
1401
-
1402
- The Racecar integration provides tracing for Racecar jobs.
1403
-
1404
- You can enable it through `Datadog.configure`:
1405
-
1406
- ```ruby
1407
- require 'ddtrace'
1408
-
1409
- Datadog.configure do |c|
1410
- c.use :racecar, options
1411
- end
1412
- ```
1413
-
1414
- Where `options` is an optional `Hash` that accepts the following parameters:
1415
-
1416
- | Key | Description | Default |
1417
- | --- | ----------- | ------- |
1418
- | `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
1419
-
1420
- ### Rack
1421
-
1422
- The Rack integration provides a middleware that traces all requests before they reach the underlying framework or application. It responds to the Rack minimal interface, providing reasonable values that can be retrieved at the Rack level.
1423
-
1424
- This integration is automatically activated with web frameworks like Rails. If you're using a plain Rack application, enable the integration it to your `config.ru`:
1425
-
1426
- ```ruby
1427
- # config.ru example
1428
- require 'ddtrace'
1429
-
1430
- Datadog.configure do |c|
1431
- c.use :rack, options
1432
- end
1433
-
1434
- use Datadog::Contrib::Rack::TraceMiddleware
1435
-
1436
- app = proc do |env|
1437
- [ 200, {'Content-Type' => 'text/plain'}, ['OK'] ]
1438
- end
1439
-
1440
- run app
1441
- ```
1442
-
1443
- Where `options` is an optional `Hash` that accepts the following parameters:
1444
-
1445
- | Key | Description | Default |
1446
- | --- | ----------- | ------- |
1447
- | `application` | Your Rack application. Required for `middleware_names`. | `nil` |
1448
- | `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` |
1449
- | `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'] }` |
1450
- | `middleware_names` | Enable this if you want to use the last executed middleware class as the resource name for the `rack` span. If enabled alongside the `rails` instrumention, `rails` takes precedence by setting the `rack` resource name to the active `rails` controller when applicable. Requires `application` option to use. | `false` |
1451
- | `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
1452
- | `quantize.query` | Hash containing options for query portion of URL quantization. May include `:show` or `:exclude`. See options below. Option must be nested inside the `quantize` option. | `{}` |
1453
- | `quantize.query.show` | Defines which values should always be shown. Shows no values by default. May be an Array of strings, or `:all` to show all values. Option must be nested inside the `query` option. | `nil` |
1454
- | `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` |
1455
- | `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` |
1456
- | `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` |
1457
- | `service_name` | Service name used for `rack` instrumentation | `'rack'` |
1458
- | `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
1459
-
1460
- **Configuring URL quantization behavior**
1461
-
1462
- ```ruby
1463
- Datadog.configure do |c|
1464
- # Default behavior: all values are quantized, fragment is removed.
1465
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by
1466
- # http://example.com/path?categories[]=1&categories[]=2 --> http://example.com/path?categories[]
1467
-
1468
- # Show values for any query string parameter matching 'category_id' exactly
1469
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by
1470
- c.use :rack, quantize: { query: { show: ['category_id'] } }
1471
-
1472
- # Show all values for all query string parameters
1473
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by=asc
1474
- c.use :rack, quantize: { query: { show: :all } }
1475
-
1476
- # Totally exclude any query string parameter matching 'sort_by' exactly
1477
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id
1478
- c.use :rack, quantize: { query: { exclude: ['sort_by'] } }
1479
-
1480
- # Remove the query string entirely
1481
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path
1482
- c.use :rack, quantize: { query: { exclude: :all } }
1483
-
1484
- # Show URL fragments
1485
- # http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by#featured
1486
- c.use :rack, quantize: { fragment: :show }
1487
- end
1488
- ```
1489
-
1490
- ### Rails
1491
-
1492
- The Rails integration will trace requests, database calls, templates rendering, and cache read/write/delete operations. The integration makes use of the Active Support Instrumentation, listening to the Notification API so that any operation instrumented by the API is traced.
1493
-
1494
- To enable the Rails instrumentation, create an initializer file in your `config/initializers` folder:
1495
-
1496
- ```ruby
1497
- # config/initializers/datadog.rb
1498
- require 'ddtrace'
1499
-
1500
- Datadog.configure do |c|
1501
- c.use :rails, options
1502
- end
1503
- ```
1504
-
1505
- Where `options` is an optional `Hash` that accepts the following parameters:
1506
-
1507
- | Key | Description | Default |
1508
- | --- | ----------- | ------- |
1509
- | `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
1510
- | `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
1511
- | `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
1512
- | `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` |
1513
- | `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` |
1514
- | `job_service` | Service name used when tracing ActiveJob activity. | `<app_name>-active_job` |
1515
- | `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
1516
- | `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
1517
- | `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
1518
- | `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/'` |
1519
- | `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` |
1520
-
1521
- **Supported versions**
1522
-
1523
- | MRI Versions | JRuby Versions | Rails Versions |
1524
- | ------------- | -------------- | -------------- |
1525
- | 2.1 | | 3.0 - 4.2 |
1526
- | 2.2 - 2.3 | | 3.0 - 5.2 |
1527
- | 2.4 | | 4.2.8 - 5.2 |
1528
- | 2.5 | | 4.2.8 - 6.1 |
1529
- | 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
1530
- | 3.0 | | 6.1 |
1531
-
1532
- ### Rake
1533
-
1534
- You can add instrumentation around your Rake tasks by activating the `rake` integration. Each task and its subsequent subtasks will be traced.
1535
-
1536
- To activate Rake task tracing, add the following to your `Rakefile`:
1537
-
1538
- ```ruby
1539
- # At the top of your Rakefile:
1540
- require 'rake'
1541
- require 'ddtrace'
1542
-
1543
- Datadog.configure do |c|
1544
- c.use :rake, options
1545
- end
1546
-
1547
- task :my_task do
1548
- # Do something task work here...
1549
- end
1550
-
1551
- Rake::Task['my_task'].invoke
1552
- ```
1553
-
1554
- Where `options` is an optional `Hash` that accepts the following parameters:
1555
-
1556
- | Key | Description | Default |
1557
- | --- | ----------- | ------- |
1558
- | `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1559
- | `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
1560
- | `service_name` | Service name used for `rake` instrumentation | `'rake'` |
1561
-
1562
- **Configuring task quantization behavior**
1563
-
1564
- ```ruby
1565
- Datadog.configure do |c|
1566
- # Given a task that accepts :one, :two, :three...
1567
- # Invoked with 'foo', 'bar', 'baz'.
1568
-
1569
- # Default behavior: all arguments are quantized.
1570
- # `rake.invoke.args` tag --> ['?']
1571
- # `rake.execute.args` tag --> { one: '?', two: '?', three: '?' }
1572
- c.use :rake
1573
-
1574
- # Show values for any argument matching :two exactly
1575
- # `rake.invoke.args` tag --> ['?']
1576
- # `rake.execute.args` tag --> { one: '?', two: 'bar', three: '?' }
1577
- c.use :rake, quantize: { args: { show: [:two] } }
1578
-
1579
- # Show all values for all arguments.
1580
- # `rake.invoke.args` tag --> ['foo', 'bar', 'baz']
1581
- # `rake.execute.args` tag --> { one: 'foo', two: 'bar', three: 'baz' }
1582
- c.use :rake, quantize: { args: { show: :all } }
1583
-
1584
- # Totally exclude any argument matching :three exactly
1585
- # `rake.invoke.args` tag --> ['?']
1586
- # `rake.execute.args` tag --> { one: '?', two: '?' }
1587
- c.use :rake, quantize: { args: { exclude: [:three] } }
1588
-
1589
- # Remove the arguments entirely
1590
- # `rake.invoke.args` tag --> ['?']
1591
- # `rake.execute.args` tag --> {}
1592
- c.use :rake, quantize: { args: { exclude: :all } }
1593
- end
1594
- ```
1595
-
1596
- ### Redis
1597
-
1598
- The Redis integration will trace simple calls as well as pipelines.
1599
-
1600
- ```ruby
1601
- require 'redis'
1602
- require 'ddtrace'
1603
-
1604
- Datadog.configure do |c|
1605
- c.use :redis, options
1606
- end
1607
-
1608
- # Perform Redis commands
1609
- redis = Redis.new
1610
- redis.set 'foo', 'bar'
1611
- ```
1612
-
1613
- Where `options` is an optional `Hash` that accepts the following parameters:
1614
-
1615
- | Key | Description | Default |
1616
- | --- | ----------- | ------- |
1617
- | `service_name` | Service name used for `redis` instrumentation | `'redis'` |
1618
- | `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
1619
-
1620
- You can also set *per-instance* configuration as it follows:
1621
-
1622
- ```ruby
1623
- require 'redis'
1624
- require 'ddtrace'
1625
-
1626
- Datadog.configure do |c|
1627
- c.use :redis # Enabling integration instrumentation is still required
1628
- end
1629
-
1630
- customer_cache = Redis.new
1631
- invoice_cache = Redis.new
1632
-
1633
- Datadog.configure(customer_cache, service_name: 'customer-cache')
1634
- Datadog.configure(invoice_cache, service_name: 'invoice-cache')
1635
-
1636
- # Traced call will belong to `customer-cache` service
1637
- customer_cache.get(...)
1638
- # Traced call will belong to `invoice-cache` service
1639
- invoice_cache.get(...)
1640
- ```
1641
-
1642
- **Configuring trace settings per connection**
1643
-
1644
- You can configure trace settings per connection by using the `describes` option:
1645
-
1646
- ```ruby
1647
- # Provide a `:describes` option with a connection key.
1648
- # Any of the following keys are acceptable and equivalent to one another.
1649
- # If a block is provided, it yields a Settings object that
1650
- # accepts any of the configuration options listed above.
1651
-
1652
- Datadog.configure do |c|
1653
- # The default configuration for any redis client
1654
- c.use :redis, service_name: 'redis-default'
1655
-
1656
- # The configuration matching a given unix socket.
1657
- c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
1658
-
1659
- # For network connections, only these fields are considered during matching:
1660
- # scheme, host, port, db
1661
- # Other fields are ignored.
1662
-
1663
- # Network connection string
1664
- c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
1665
- c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
1666
- # Network client hash
1667
- c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
1668
- # Only a subset of the connection hash
1669
- c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
1670
- c.use :redis, describes: { host: ENV['SIDEKIQ_CACHE_HOST'] }, service_name: 'redis-sidekiq'
1671
- end
1672
- ```
1673
-
1674
- When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
1675
-
1676
- ### Resque
1677
-
1678
- The Resque integration uses Resque hooks that wraps the `perform` method.
1679
-
1680
- To add tracing to a Resque job:
1681
-
1682
- ```ruby
1683
- require 'resque'
1684
- require 'ddtrace'
1685
-
1686
- Datadog.configure do |c|
1687
- c.use :resque, **options
1688
- end
1689
- ```
1690
-
1691
- Where `options` is an optional `Hash` that accepts the following parameters:
1692
-
1693
- | Key | Description | Default |
1694
- | --- | ----------- | ------- |
1695
- | `service_name` | Service name used for `resque` instrumentation | `'resque'` |
1696
- | `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? }` |
1697
- | `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
1698
-
1699
- ### Rest Client
1700
-
1701
- The `rest-client` integration is available through the `ddtrace` middleware:
1702
-
1703
- ```ruby
1704
- require 'rest_client'
1705
- require 'ddtrace'
1706
-
1707
- Datadog.configure do |c|
1708
- c.use :rest_client, options
1709
- end
1710
- ```
1711
-
1712
- Where `options` is an optional `Hash` that accepts the following parameters:
1713
-
1714
- | Key | Description | Default |
1715
- | --- | ----------- | ------- |
1716
- | `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
1717
- | `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
1718
-
1719
- ### RSpec
1720
-
1721
- RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
1722
-
1723
- To activate your integration, use the `Datadog.configure` method:
1724
-
1725
- ```ruby
1726
- require 'rspec'
1727
- require 'ddtrace'
1728
-
1729
- # Configure default RSpec integration
1730
- Datadog.configure do |c|
1731
- c.use :rspec, options
1732
- end
1733
- ```
1734
-
1735
- Where `options` is an optional `Hash` that accepts the following parameters:
1736
-
1737
- | Key | Description | Default |
1738
- | --- | ----------- | ------- |
1739
- | `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1740
- | `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
1741
- | `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
1742
-
1743
- ### Sequel
1744
-
1745
- The Sequel integration traces queries made to your database.
1746
-
1747
- ```ruby
1748
- require 'sequel'
1749
- require 'ddtrace'
1750
-
1751
- # Connect to database
1752
- database = Sequel.sqlite
1753
-
1754
- # Create a table
1755
- database.create_table :articles do
1756
- primary_key :id
1757
- String :name
1758
- end
1759
-
1760
- Datadog.configure do |c|
1761
- c.use :sequel, options
1762
- end
1763
-
1764
- # Perform a query
1765
- articles = database[:articles]
1766
- articles.all
1767
- ```
1768
-
1769
- Where `options` is an optional `Hash` that accepts the following parameters:
1770
-
1771
- | Key | Description | Default |
1772
- | --- | ----------- | ------- |
1773
- | `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
1774
-
1775
- **Configuring databases to use different settings**
1776
-
1777
- If you use multiple databases with Sequel, you can give each of them different settings by configuring their respective `Sequel::Database` objects:
1778
-
1779
- ```ruby
1780
- sqlite_database = Sequel.sqlite
1781
- postgres_database = Sequel.connect('postgres://user:password@host:port/database_name')
1782
-
1783
- # Configure each database with different service names
1784
- Datadog.configure(sqlite_database, service_name: 'my-sqlite-db')
1785
- Datadog.configure(postgres_database, service_name: 'my-postgres-db')
1786
- ```
1787
-
1788
- ### Shoryuken
1789
-
1790
- The Shoryuken integration is a server-side middleware which will trace job executions.
1791
-
1792
- You can enable it through `Datadog.configure`:
1793
-
1794
- ```ruby
1795
- require 'ddtrace'
1796
-
1797
- Datadog.configure do |c|
1798
- c.use :shoryuken, options
1799
- end
1800
- ```
1801
-
1802
- Where `options` is an optional `Hash` that accepts the following parameters:
1803
-
1804
- | Key | Description | Default |
1805
- | --- | ----------- | ------- |
1806
- | `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
1807
- | `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
1808
- | `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? }` |
1809
-
1810
- ### Sidekiq
1811
-
1812
- The Sidekiq integration is a client-side & server-side middleware which will trace job queuing and executions respectively.
1813
-
1814
- You can enable it through `Datadog.configure`:
1815
-
1816
- ```ruby
1817
- require 'ddtrace'
1818
-
1819
- Datadog.configure do |c|
1820
- c.use :sidekiq, options
1821
- end
1822
- ```
1823
-
1824
- Where `options` is an optional `Hash` that accepts the following parameters:
1825
-
1826
- | Key | Description | Default |
1827
- | --- | ----------- | ------- |
1828
- | `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
1829
- | `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
1830
- | `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
1831
- | `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? }` |
1832
-
1833
- ### Sinatra
1834
-
1835
- The Sinatra integration traces requests and template rendering.
1836
-
1837
- To start using the tracing client, make sure you import `ddtrace` and `use :sinatra` after either `sinatra` or `sinatra/base`, and before you define your application/routes:
1838
-
1839
- #### Classic application
1840
-
1841
- ```ruby
1842
- require 'sinatra'
1843
- require 'ddtrace'
1844
-
1845
- Datadog.configure do |c|
1846
- c.use :sinatra, options
1847
- end
1848
-
1849
- get '/' do
1850
- 'Hello world!'
1851
- end
1852
- ```
1853
-
1854
- #### Modular application
1855
-
1856
- ```ruby
1857
- require 'sinatra/base'
1858
- require 'ddtrace'
1859
-
1860
- Datadog.configure do |c|
1861
- c.use :sinatra, options
1862
- end
1863
-
1864
- class NestedApp < Sinatra::Base
1865
- register Datadog::Contrib::Sinatra::Tracer
1866
-
1867
- get '/nested' do
1868
- 'Hello from nested app!'
1869
- end
1870
- end
1871
-
1872
- class App < Sinatra::Base
1873
- register Datadog::Contrib::Sinatra::Tracer
1874
-
1875
- use NestedApp
1876
-
1877
- get '/' do
1878
- 'Hello world!'
1879
- end
1880
- end
1881
- ```
1882
-
1883
- Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
1884
-
1885
- #### Instrumentation options
1886
-
1887
- `options` is an optional `Hash` that accepts the following parameters:
1888
-
1889
- | Key | Description | Default |
1890
- | --- | ----------- | ------- |
1891
- | `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` |
1892
- | `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'] }` |
1893
- | `resource_script_names` | Prepend resource names with script name | `false` |
1894
- | `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
1895
-
1896
- ### Sneakers
1897
-
1898
- The Sneakers integration is a server-side middleware which will trace job executions.
1899
-
1900
- You can enable it through `Datadog.configure`:
1901
-
1902
- ```ruby
1903
- require 'ddtrace'
1904
-
1905
- Datadog.configure do |c|
1906
- c.use :sneakers, options
1907
- end
1908
- ```
1909
-
1910
- Where `options` is an optional `Hash` that accepts the following parameters:
1911
-
1912
- | Key | Description | Default |
1913
- | --- | ----------- | ------- |
1914
- | `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
1915
- | `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
1916
- | `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
1917
- | `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? }` |
1918
-
1919
- ### Sucker Punch
1920
-
1921
- The `sucker_punch` integration traces all scheduled jobs:
1922
-
1923
- ```ruby
1924
- require 'ddtrace'
1925
-
1926
- Datadog.configure do |c|
1927
- c.use :sucker_punch, options
1928
- end
1929
-
1930
- # Execution of this job is traced
1931
- LogJob.perform_async('login')
1932
- ```
1933
-
1934
- Where `options` is an optional `Hash` that accepts the following parameters:
1935
-
1936
- | Key | Description | Default |
1937
- | --- | ----------- | ------- |
1938
- | `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
1939
-
1940
- ## Advanced configuration
1941
-
1942
- ### Tracer settings
1943
-
1944
- To change the default behavior of the Datadog tracer, you can provide custom options inside the `Datadog.configure` block as in:
1945
-
1946
- ```ruby
1947
- # config/initializers/datadog-tracer.rb
1948
-
1949
- Datadog.configure do |c|
1950
- c.tracer.enabled = true
1951
- c.tracer.hostname = 'my-agent'
1952
- c.tracer.port = 8126
1953
-
1954
- # Ensure all traces are ingested by Datadog
1955
- c.sampling.default_rate = 1.0 # Recommended
1956
- c.sampling.rate_limit = 200
1957
- # or provide a custom implementation (overrides c.sampling settings)
1958
- c.tracer.sampler = Datadog::AllSampler.new
1959
-
1960
- # Breaks down very large traces into smaller batches
1961
- c.tracer.partial_flush.enabled = false
1962
-
1963
- # You can specify your own tracer
1964
- c.tracer.instance = Datadog::Tracer.new
1965
-
1966
- # To enable debug mode
1967
- c.diagnostics.debug = true
1968
- end
1969
- ```
1970
-
1971
- Available options are:
1972
-
1973
- - `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`.
1974
- - `hostname`: set the hostname of the trace agent.
1975
- - `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
1976
- - `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
1977
- - `port`: set the port the trace agent is listening on.
1978
- - `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.
1979
- - `sampling.rate_limit`: maximum number of traces per second to sample. Defaults to 100 per second.
1980
- - `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
1981
- - `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
1982
- - `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
1983
- - `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 }`.
1984
-
1985
- #### Custom logging
1986
-
1987
- By default, all logs are processed by the default Ruby logger. When using Rails, you should see the messages in your application log file.
1988
-
1989
- Datadog client log messages are marked with `[ddtrace]` so you should be able to isolate them from other messages.
1990
-
1991
- Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the `log` setting.
1992
-
1993
- ```ruby
1994
- f = File.new("my-custom.log", "w+") # Log messages should go there
1995
- Datadog.configure do |c|
1996
- c.logger = Logger.new(f) # Overriding the default logger
1997
- c.logger.level = ::Logger::INFO
1998
- end
1999
-
2000
- Datadog.logger.info { "this is typically called by tracing code" }
2001
- ```
2002
-
2003
- ### Environment and tags
2004
-
2005
- 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.
2006
-
2007
- You can configure the application to automatically tag your traces and metrics, using the following environment variables:
2008
-
2009
- - `DD_ENV`: Your application environment (e.g. `production`, `staging`, etc.)
2010
- - `DD_SERVICE`: Your application's default service name (e.g. `billing-api`)
2011
- - `DD_VERSION`: Your application version (e.g. `2.5`, `202003181415`, `1.3-alpha`, etc.)
2012
- - `DD_TAGS`: Custom tags in value pairs separated by `,` (e.g. `layer:api,team:intake`)
2013
- - If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are set, it will override any respective `env`/`service`/`version` tag defined in `DD_TAGS`.
2014
- - If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are NOT set, tags defined in `DD_TAGS` will be used to populate `env`/`service`/`version` respectively.
2015
-
2016
- These values can also be overridden at the tracer level:
2017
-
2018
- ```ruby
2019
- Datadog.configure do |c|
2020
- c.service = 'billing-api'
2021
- c.env = 'test'
2022
- c.tags = { 'team' => 'qa' }
2023
- c.version = '1.3-alpha'
2024
- end
2025
- ```
2026
-
2027
- This enables you to set this value on a per application basis, so you can have for example several applications reporting for different environments on the same host.
2028
-
2029
- Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
2030
-
2031
- ### Environment variables
2032
-
2033
- Other Environment Variables:
2034
-
2035
- - `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`.
2036
- - `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.
2037
- - `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.
2038
- - `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`.
2039
-
2040
- ### Sampling
2041
-
2042
- 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/).
2043
-
2044
- We recommend setting the environment variable `DD_TRACE_SAMPLE_RATE=1.0` in all new applications using `ddtrace`.
2045
-
2046
- 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/).
2047
-
2048
- #### Application-side sampling
2049
-
2050
- While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
2051
-
2052
- This will **reduce visibility and is not recommended**. See [DD_TRACE_SAMPLE_RATE](#environment-variables) for the recommended sampling approach.
2053
-
2054
- `Datadog::RateSampler` samples a ratio of the traces. For example:
2055
-
2056
- ```ruby
2057
- # Sample rate is between 0 (nothing sampled) to 1 (everything sampled).
2058
- sampler = Datadog::RateSampler.new(0.5) # sample 50% of the traces
2059
-
2060
- Datadog.configure do |c|
2061
- c.tracer.sampler = sampler
2062
- end
2063
- ```
2064
-
2065
- #### Priority sampling
2066
-
2067
- 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.
2068
-
2069
- The sampler can set the priority to the following values:
2070
-
2071
- - `Datadog::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
2072
- - `Datadog::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
2073
-
2074
- 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.
2075
-
2076
- 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:
2077
-
2078
- - `Datadog::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
2079
- - `Datadog::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
2080
-
2081
- 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.
2082
-
2083
- If you change the priority, we recommend you do it as soon as possible - when the root span has just been created.
2084
-
2085
- ```ruby
2086
- # First, grab the active span
2087
- span = Datadog.tracer.active_span
2088
-
2089
- # Indicate to reject the trace
2090
- span.context.sampling_priority = Datadog::Ext::Priority::USER_REJECT
2091
-
2092
- # Indicate to keep the trace
2093
- span.context.sampling_priority = Datadog::Ext::Priority::USER_KEEP
2094
- ```
2095
-
2096
- ### Distributed Tracing
2097
-
2098
- Distributed tracing allows traces to be propagated across multiple instrumented applications so that a request can be presented as a single trace, rather than a separate trace per service.
2099
-
2100
- To trace requests across application boundaries, the following must be propagated between each application:
2101
-
2102
- | Property | Type | Description |
2103
- | --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
2104
- | **Trace ID** | Integer | ID of the trace. This value should be the same across all requests that belong to the same trace. |
2105
- | **Parent Span ID** | Integer | ID of the span in the service originating the request. This value will always be different for each request within a trace. |
2106
- | **Sampling Priority** | Integer | Sampling priority level for the trace. This value should be the same across all requests that belong to the same trace. |
2107
-
2108
- Such propagation can be visualized as:
2109
-
2110
- ```
2111
- Service A:
2112
- Trace ID: 100000000000000001
2113
- Parent ID: 0
2114
- Span ID: 100000000000000123
2115
- Priority: 1
2116
-
2117
- |
2118
- | Service B Request:
2119
- | Metadata:
2120
- | Trace ID: 100000000000000001
2121
- | Parent ID: 100000000000000123
2122
- | Priority: 1
2123
- |
2124
- V
2125
-
2126
- Service B:
2127
- Trace ID: 100000000000000001
2128
- Parent ID: 100000000000000123
2129
- Span ID: 100000000000000456
2130
- Priority: 1
2131
-
2132
- |
2133
- | Service C Request:
2134
- | Metadata:
2135
- | Trace ID: 100000000000000001
2136
- | Parent ID: 100000000000000456
2137
- | Priority: 1
2138
- |
2139
- V
2140
-
2141
- Service C:
2142
- Trace ID: 100000000000000001
2143
- Parent ID: 100000000000000456
2144
- Span ID: 100000000000000789
2145
- Priority: 1
2146
- ```
2147
-
2148
- **Via HTTP**
2149
-
2150
- For HTTP requests between instrumented applications, this trace metadata is propagated by use of HTTP Request headers:
2151
-
2152
- | Property | Type | HTTP Header name |
2153
- | --------------------- | ------- | ----------------------------- |
2154
- | **Trace ID** | Integer | `x-datadog-trace-id` |
2155
- | **Parent Span ID** | Integer | `x-datadog-parent-id` |
2156
- | **Sampling Priority** | Integer | `x-datadog-sampling-priority` |
2157
-
2158
- Such that:
2159
-
2160
- ```
2161
- Service A:
2162
- Trace ID: 100000000000000001
2163
- Parent ID: 0
2164
- Span ID: 100000000000000123
2165
- Priority: 1
2166
-
2167
- |
2168
- | Service B HTTP Request:
2169
- | Headers:
2170
- | x-datadog-trace-id: 100000000000000001
2171
- | x-datadog-parent-id: 100000000000000123
2172
- | x-datadog-sampling-priority: 1
2173
- |
2174
- V
2175
-
2176
- Service B:
2177
- Trace ID: 100000000000000001
2178
- Parent ID: 100000000000000123
2179
- Span ID: 100000000000000456
2180
- Priority: 1
2181
-
2182
- |
2183
- | Service C HTTP Request:
2184
- | Headers:
2185
- | x-datadog-trace-id: 100000000000000001
2186
- | x-datadog-parent-id: 100000000000000456
2187
- | x-datadog-sampling-priority: 1
2188
- |
2189
- V
2190
-
2191
- Service C:
2192
- Trace ID: 100000000000000001
2193
- Parent ID: 100000000000000456
2194
- Span ID: 100000000000000789
2195
- Priority: 1
2196
- ```
2197
-
2198
- **Activating distributed tracing for integrations**
2199
-
2200
- 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.
2201
-
2202
- - If your application receives requests from services with distributed tracing activated, you must activate distributed tracing on the integrations that handle these requests (e.g. Rails)
2203
- - If your application send requests to services with distributed tracing activated, you must activate distributed tracing on the integrations that send these requests (e.g. Faraday)
2204
- - If your application both sends and receives requests implementing distributed tracing, it must activate all integrations that handle these requests.
2205
-
2206
- For more details on how to activate distributed tracing for integrations, see their documentation:
2207
-
2208
- - [Excon](#excon)
2209
- - [Faraday](#faraday)
2210
- - [Rest Client](#rest-client)
2211
- - [Net/HTTP](#nethttp)
2212
- - [Rack](#rack)
2213
- - [Rails](#rails)
2214
- - [Sinatra](#sinatra)
2215
- - [http.rb](#httprb)
2216
- - [httpclient](#httpclient)
2217
- - [httpx](#httpx)
2218
-
2219
- **Using the HTTP propagator**
2220
-
2221
- To make the process of propagating this metadata easier, you can use the `Datadog::HTTPPropagator` module.
2222
-
2223
- On the client:
2224
-
2225
- ```ruby
2226
- Datadog.tracer.trace('web.call') do |span|
2227
- # Inject span context into headers (`env` must be a Hash)
2228
- Datadog::HTTPPropagator.inject!(span.context, env)
2229
- end
2230
- ```
2231
-
2232
- On the server:
2233
-
2234
- ```ruby
2235
- Datadog.tracer.trace('web.work') do |span|
2236
- # Build a context from headers (`env` must be a Hash)
2237
- context = HTTPPropagator.extract(request.env)
2238
- Datadog.tracer.provider.context = context if context.trace_id
2239
- end
2240
- ```
2241
-
2242
- ### HTTP request queuing
2243
-
2244
- Traces that originate from HTTP requests can be configured to include the time spent in a frontend web server or load balancer queue before the request reaches the Ruby application.
2245
-
2246
- This feature is disabled by default. To activate it, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
2247
-
2248
- ```
2249
- # /etc/nginx/conf.d/ruby_service.conf
2250
- server {
2251
- listen 8080;
2252
-
2253
- location / {
2254
- proxy_set_header X-Request-Start "t=${msec}";
2255
- proxy_pass http://web:3000;
2256
- }
2257
- }
2258
- ```
2259
-
2260
- Then you must enable the request queuing feature, by setting `request_queuing: true`, in the integration handling the request. For Rack-based applications, see the [documentation](#rack) for details.
2261
-
2262
- ### Processing Pipeline
2263
-
2264
- 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.
2265
-
2266
- Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
2267
-
2268
- For example:
2269
-
2270
- ```ruby
2271
- lambda_processor = ->(trace) do
2272
- # Processing logic...
2273
- trace
2274
- end
2275
-
2276
- class MyCustomProcessor
2277
- def call(trace)
2278
- # Processing logic...
2279
- trace
2280
- end
2281
- end
2282
- custom_processor = MyFancyProcessor.new
2283
- ```
2284
-
2285
- `#call` blocks of processors *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
2286
-
2287
- These processors must then be added to the pipeline via `Datadog::Pipeline.before_flush`:
2288
-
2289
- ```ruby
2290
- Datadog::Pipeline.before_flush(lambda_processor, custom_processor)
2291
- ```
2292
-
2293
- You can also define processors using the short-hand block syntax for `Datadog::Pipeline.before_flush`:
2294
-
2295
- ```ruby
2296
- Datadog::Pipeline.before_flush do |trace|
2297
- trace.delete_if { |span| span.name =~ /forbidden/ }
2298
- end
2299
- ```
2300
-
2301
- #### Filtering
2302
-
2303
- You can use the `Datadog::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
2304
-
2305
- ```ruby
2306
- Datadog::Pipeline.before_flush(
2307
- # Remove spans that match a particular resource
2308
- Datadog::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
2309
- # Remove spans that are trafficked to localhost
2310
- Datadog::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
2311
- )
2312
- ```
2313
-
2314
- #### Processing
2315
-
2316
- You can use the `Datadog::Pipeline::SpanProcessor` processor to modify spans:
2317
-
2318
- ```ruby
2319
- Datadog::Pipeline.before_flush(
2320
- # Strip matching text from the resource field
2321
- Datadog::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
2322
- )
2323
- ```
2324
-
2325
- ### Trace correlation
2326
-
2327
- In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
2328
-
2329
- #### For logging in Rails applications
2330
-
2331
- ##### Automatic
2332
-
2333
- 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`:
2334
-
2335
- ```ruby
2336
- # config/initializers/datadog.rb
2337
- require 'ddtrace'
2338
-
2339
- Datadog.configure do |c|
2340
- c.use :rails, log_injection: true
2341
- end
2342
- ```
2343
-
2344
- ##### Manual (Lograge)
2345
-
2346
- 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.
2347
-
2348
- ```ruby
2349
- config.lograge.custom_options = lambda do |event|
2350
- # Retrieves trace information for current thread
2351
- correlation = Datadog.tracer.active_correlation
2352
-
2353
- {
2354
- # Adds IDs as tags to log output
2355
- :dd => {
2356
- # To preserve precision during JSON serialization, use strings for large numbers
2357
- :trace_id => correlation.trace_id.to_s,
2358
- :span_id => correlation.span_id.to_s,
2359
- :env => correlation.env.to_s,
2360
- :service => correlation.service.to_s,
2361
- :version => correlation.version.to_s
2362
- },
2363
- :ddsource => ["ruby"],
2364
- :params => event.payload[:params].reject { |k| %w(controller action).include? k }
2365
- }
2366
- end
2367
- ```
2368
-
2369
- ##### Manual (ActiveSupport::TaggedLogging)
2370
-
2371
- 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:
2372
-
2373
- ```ruby
2374
- Rails.application.configure do
2375
- config.log_tags = [proc { Datadog.tracer.active_correlation.to_s }]
2376
- end
2377
-
2378
- # Given:
2379
- # DD_ENV = 'production' (The name of the environment your application is running in.)
2380
- # DD_SERVICE = 'billing-api' (Default service name of your application.)
2381
- # DD_VERSION = '2.5.17' (The version of your application.)
2382
-
2383
- # Web requests will produce:
2384
- # [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
2385
- # [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 */*
2386
- # [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"
2387
- # [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)
2388
- ```
2389
-
2390
- #### For logging in Ruby applications
2391
-
2392
- 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.
2393
-
2394
- To properly correlate with Datadog logging, be sure the following is present in the log message, in order as they appear:
2395
-
2396
- - `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.tracer.active_correlation.env`. Omit if no environment is configured.
2397
- - `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog.tracer.active_correlation.service`. Omit if no default service name is configured.
2398
- - `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog.tracer.active_correlation.version`. Omit if no application version is configured.
2399
- - `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.
2400
- - `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.
2401
-
2402
- 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>`.
2403
-
2404
- 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=`.
2405
-
2406
- An example of this in practice:
2407
-
2408
- ```ruby
2409
- require 'ddtrace'
2410
- require 'logger'
2411
-
2412
- ENV['DD_ENV'] = 'production'
2413
- ENV['DD_SERVICE'] = 'billing-api'
2414
- ENV['DD_VERSION'] = '2.5.17'
2415
-
2416
- logger = Logger.new(STDOUT)
2417
- logger.progname = 'my_app'
2418
- logger.formatter = proc do |severity, datetime, progname, msg|
2419
- "[#{datetime}][#{progname}][#{severity}][#{Datadog.tracer.active_correlation}] #{msg}\n"
2420
- end
2421
-
2422
- # When no trace is active
2423
- logger.warn('This is an untraced operation.')
2424
- # [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.
2425
-
2426
- # When a trace is active
2427
- Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.') }
2428
- # [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.
2429
- ```
2430
-
2431
- ### Configuring the transport layer
2432
-
2433
- 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.
2434
-
2435
- However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
2436
-
2437
- Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
2438
-
2439
- #### Using the Net::HTTP adapter
2440
-
2441
- The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default transport adapter.
2442
-
2443
- ```ruby
2444
- Datadog.configure do |c|
2445
- c.tracer.transport_options = proc { |t|
2446
- # Hostname, port, and additional options. :timeout is in seconds.
2447
- t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
2448
- }
2449
- end
2450
- ```
2451
-
2452
- #### Using the Unix socket adapter
2453
-
2454
- The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
2455
-
2456
- To use, first configure your trace agent to listen by Unix socket, then configure the tracer with:
2457
-
2458
- ```ruby
2459
- Datadog.configure do |c|
2460
- c.tracer.transport_options = proc { |t|
2461
- # Provide local path to trace agent Unix socket
2462
- t.adapter :unix, '/tmp/ddagent/trace.sock'
2463
- }
2464
- end
2465
- ```
2466
-
2467
- #### Using the transport test adapter
2468
-
2469
- The `Test` adapter is a no-op transport that can optionally buffer requests. For use in test suites or other non-production environments.
2470
-
2471
- ```ruby
2472
- Datadog.configure do |c|
2473
- c.tracer.transport_options = proc { |t|
2474
- # Set transport to no-op mode. Does not retain traces.
2475
- t.adapter :test
2476
-
2477
- # Alternatively, you can provide a buffer to examine trace output.
2478
- # The buffer must respond to '<<'.
2479
- t.adapter :test, []
2480
- }
2481
- end
2482
- ```
2483
-
2484
- #### Using a custom transport adapter
2485
-
2486
- Custom adapters can be configured with:
2487
-
2488
- ```ruby
2489
- Datadog.configure do |c|
2490
- c.tracer.transport_options = proc { |t|
2491
- # Initialize and pass an instance of the adapter
2492
- custom_adapter = CustomAdapter.new
2493
- t.adapter custom_adapter
2494
- }
2495
- end
2496
- ```
2497
-
2498
- ### Metrics
2499
-
2500
- 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.
2501
-
2502
- To configure your application for metrics collection:
2503
-
2504
- 1. [Configure your Datadog agent for StatsD](https://docs.datadoghq.com/developers/dogstatsd/#setup)
2505
- 2. Add `gem 'dogstatsd-ruby', '~> 5.3'` to your Gemfile
2506
-
2507
- #### For application runtime
2508
-
2509
- If runtime metrics are configured, the trace library will automatically collect and send metrics about the health of your application.
2510
-
2511
- To configure runtime metrics, add the following configuration:
2512
-
2513
- ```ruby
2514
- # config/initializers/datadog.rb
2515
- require 'datadog/statsd'
2516
- require 'ddtrace'
2517
-
2518
- Datadog.configure do |c|
2519
- # To enable runtime metrics collection, set `true`. Defaults to `false`
2520
- # You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
2521
- c.runtime_metrics.enabled = true
2522
-
2523
- # Optionally, you can configure the Statsd instance used for sending runtime metrics.
2524
- # Statsd is automatically configured with default settings if `dogstatsd-ruby` is available.
2525
- # You can configure with host and port of Datadog agent; defaults to 'localhost:8125'.
2526
- c.runtime_metrics.statsd = Datadog::Statsd.new
2527
- end
2528
- ```
2529
-
2530
- See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.
2531
-
2532
- The stats are VM specific and will include:
2533
-
2534
- | Name | Type | Description | Available on |
2535
- | -------------------------- | ------- | -------------------------------------------------------- | ------------ |
2536
- | `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. | CRuby |
2537
- | `runtime.ruby.gc.*` | `gauge` | Garbage collection statistics: collected from `GC.stat`. | All runtimes |
2538
- | `runtime.ruby.thread_count` | `gauge` | Number of threads. | All runtimes |
2539
- | `runtime.ruby.global_constant_state` | `gauge` | Global constant cache generation. | CRuby |
2540
- | `runtime.ruby.global_method_state` | `gauge` | [Global method cache generation.](https://tenderlovemaking.com/2015/12/23/inline-caching-in-mri.html) | [CRuby < 3.0.0](https://docs.ruby-lang.org/en/3.0.0/NEWS_md.html#label-Implementation+improvements) |
2541
-
2542
- In addition, all metrics include the following tags:
2543
-
2544
- | Name | Description |
2545
- | ------------ | ------------------------------------------------------- |
2546
- | `language` | Programming language traced. (e.g. `ruby`) |
2547
- | `service` | List of services this associated with this metric. |
2548
-
2549
- ### OpenTracing
2550
-
2551
- For setting up Datadog with OpenTracing, see out [Quickstart for OpenTracing](#quickstart-for-opentracing) section for details.
2552
-
2553
- **Configuring Datadog tracer settings**
2554
-
2555
- The underlying Datadog tracer can be configured by passing options (which match `Datadog::Tracer`) when configuring the global tracer:
2556
-
2557
- ```ruby
2558
- # Where `options` is a Hash of options provided to Datadog::Tracer
2559
- OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(options)
2560
- ```
2561
-
2562
- It can also be configured by using `Datadog.configure` described in the [Tracer settings](#tracer-settings) section.
2563
-
2564
- **Activating and configuring integrations**
2565
-
2566
- By default, configuring OpenTracing with Datadog will not automatically activate any additional instrumentation provided by Datadog. You will only receive spans and traces from OpenTracing instrumentation you have in your application.
2567
-
2568
- However, additional instrumentation provided by Datadog can be activated alongside OpenTracing using `Datadog.configure`, which can be used to enhance your tracing further. To activate this, see [Integration instrumentation](#integration-instrumentation) for more details.
2569
-
2570
- **Supported serialization formats**
2571
-
2572
- | Type | Supported? | Additional information |
2573
- | ------------------------------ | ---------- | ---------------------- |
2574
- | `OpenTracing::FORMAT_TEXT_MAP` | Yes | |
2575
- | `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. |
2576
- | `OpenTracing::FORMAT_BINARY` | No | |
2577
-
2578
- ### Profiling
2579
-
2580
- *Currently available as BETA feature.*
2581
-
2582
- `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.
2583
-
2584
- **Setup**
2585
-
2586
- To get started with profiling, follow the [Enabling the Ruby Profiler](https://docs.datadoghq.com/tracing/profiler/enabling/ruby/) guide.
2587
-
2588
- #### Troubleshooting
2589
-
2590
- If you run into issues with profiling, please check the [Profiler Troubleshooting Guide](https://docs.datadoghq.com/tracing/profiler/profiler_troubleshooting/?code-lang=ruby).
2591
-
2592
- #### Profiling Resque jobs
2593
-
2594
- 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.
2595
-
2596
- 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.
2597
-
2598
- ## Known issues and suggested configurations
2599
-
2600
- ### Payload too large
2601
-
2602
- 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.
2603
-
2604
- If traces are missing, enable [debug mode](#tracer-settings) to check if messages containing `"Dropping trace. Payload too large"` are logged.
2605
-
2606
- 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.
2607
-
2608
- 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.
2609
-
2610
- ### Stack level too deep
2611
-
2612
- 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.
2613
-
2614
- 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.)
2615
-
2616
- 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.
2617
-
2618
- 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.
2619
-
2620
- As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
2621
-
2622
- * `rack-mini-profiler`: [Net::HTTP stack level too deep errors](https://github.com/MiniProfiler/rack-mini-profiler#nethttp-stack-level-too-deep-errors).
2623
-
2624
- For libraries without a known workaround, consider removing the library using `alias` or `Module#alias_method` or separating libraries into different environments for testing.
2625
-
2626
- For any further questions or to report an occurence of this issue, please [reach out to Datadog support](https://docs.datadoghq.com/help)