ddtrace 0.48.0 → 0.49.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (421) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +209 -2
  3. data/.dockerignore +0 -1
  4. data/.gitignore +2 -1
  5. data/.rubocop.yml +13 -1
  6. data/Appraisals +10 -0
  7. data/CHANGELOG.md +32 -0
  8. data/Rakefile +10 -0
  9. data/benchmarks/profiler_sample_loop.rb +69 -0
  10. data/ddtrace.gemspec +1 -1
  11. data/docker-compose.yml +0 -24
  12. data/docs/GettingStarted.md +1 -1
  13. data/gemfiles/jruby_9.2.0.0_contrib.gemfile +79 -0
  14. data/gemfiles/jruby_9.2.0.0_contrib.gemfile.lock +1518 -0
  15. data/gemfiles/jruby_9.2.0.0_contrib_old.gemfile +35 -0
  16. data/gemfiles/jruby_9.2.0.0_contrib_old.gemfile.lock +157 -0
  17. data/gemfiles/jruby_9.2.0.0_core_old.gemfile +34 -0
  18. data/gemfiles/jruby_9.2.0.0_core_old.gemfile.lock +153 -0
  19. data/gemfiles/jruby_9.2.0.0_cucumber3.gemfile +35 -0
  20. data/gemfiles/jruby_9.2.0.0_cucumber3.gemfile.lock +174 -0
  21. data/gemfiles/jruby_9.2.0.0_cucumber4.gemfile +35 -0
  22. data/gemfiles/jruby_9.2.0.0_cucumber4.gemfile.lock +206 -0
  23. data/gemfiles/jruby_9.2.0.0_cucumber5.gemfile +35 -0
  24. data/gemfiles/jruby_9.2.0.0_cucumber5.gemfile.lock +206 -0
  25. data/gemfiles/jruby_9.2.0.0_rails5_mysql2.gemfile +40 -0
  26. data/gemfiles/jruby_9.2.0.0_rails5_mysql2.gemfile.lock +271 -0
  27. data/gemfiles/jruby_9.2.0.0_rails5_postgres.gemfile +40 -0
  28. data/gemfiles/jruby_9.2.0.0_rails5_postgres.gemfile.lock +271 -0
  29. data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis.gemfile +41 -0
  30. data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis.gemfile.lock +273 -0
  31. data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis_activesupport.gemfile +41 -0
  32. data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis_activesupport.gemfile.lock +273 -0
  33. data/gemfiles/jruby_9.2.0.0_rails5_postgres_sidekiq.gemfile +42 -0
  34. data/gemfiles/jruby_9.2.0.0_rails5_postgres_sidekiq.gemfile.lock +279 -0
  35. data/gemfiles/jruby_9.2.0.0_rails61_mysql2.gemfile +40 -0
  36. data/gemfiles/jruby_9.2.0.0_rails61_mysql2.gemfile.lock +290 -0
  37. data/gemfiles/jruby_9.2.0.0_rails61_postgres.gemfile +40 -0
  38. data/gemfiles/jruby_9.2.0.0_rails61_postgres.gemfile.lock +290 -0
  39. data/gemfiles/jruby_9.2.0.0_rails61_postgres_redis.gemfile +41 -0
  40. data/gemfiles/jruby_9.2.0.0_rails61_postgres_redis.gemfile.lock +292 -0
  41. data/gemfiles/jruby_9.2.0.0_rails61_postgres_sidekiq.gemfile +41 -0
  42. data/gemfiles/jruby_9.2.0.0_rails61_postgres_sidekiq.gemfile.lock +297 -0
  43. data/gemfiles/jruby_9.2.0.0_rails6_mysql2.gemfile +40 -0
  44. data/gemfiles/jruby_9.2.0.0_rails6_mysql2.gemfile.lock +287 -0
  45. data/gemfiles/jruby_9.2.0.0_rails6_postgres.gemfile +40 -0
  46. data/gemfiles/jruby_9.2.0.0_rails6_postgres.gemfile.lock +287 -0
  47. data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis.gemfile +41 -0
  48. data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis.gemfile.lock +289 -0
  49. data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis_activesupport.gemfile +41 -0
  50. data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis_activesupport.gemfile.lock +289 -0
  51. data/gemfiles/jruby_9.2.0.0_rails6_postgres_sidekiq.gemfile +42 -0
  52. data/gemfiles/jruby_9.2.0.0_rails6_postgres_sidekiq.gemfile.lock +295 -0
  53. data/gemfiles/jruby_9.2.0.0_resque2_redis3.gemfile +36 -0
  54. data/gemfiles/jruby_9.2.0.0_resque2_redis3.gemfile.lock +180 -0
  55. data/gemfiles/jruby_9.2.0.0_resque2_redis4.gemfile +36 -0
  56. data/gemfiles/jruby_9.2.0.0_resque2_redis4.gemfile.lock +180 -0
  57. data/gemfiles/jruby_9.2.11.1_contrib.gemfile +79 -0
  58. data/gemfiles/jruby_9.2.11.1_contrib.gemfile.lock +1518 -0
  59. data/gemfiles/jruby_9.2.11.1_contrib_old.gemfile +35 -0
  60. data/gemfiles/jruby_9.2.11.1_contrib_old.gemfile.lock +157 -0
  61. data/gemfiles/jruby_9.2.11.1_core_old.gemfile +34 -0
  62. data/gemfiles/jruby_9.2.11.1_core_old.gemfile.lock +153 -0
  63. data/gemfiles/jruby_9.2.11.1_cucumber3.gemfile +35 -0
  64. data/gemfiles/jruby_9.2.11.1_cucumber3.gemfile.lock +174 -0
  65. data/gemfiles/jruby_9.2.11.1_cucumber4.gemfile +35 -0
  66. data/gemfiles/jruby_9.2.11.1_cucumber4.gemfile.lock +206 -0
  67. data/gemfiles/jruby_9.2.11.1_cucumber5.gemfile +35 -0
  68. data/gemfiles/jruby_9.2.11.1_cucumber5.gemfile.lock +206 -0
  69. data/gemfiles/jruby_9.2.11.1_rails5_mysql2.gemfile +40 -0
  70. data/gemfiles/jruby_9.2.11.1_rails5_mysql2.gemfile.lock +271 -0
  71. data/gemfiles/jruby_9.2.11.1_rails5_postgres.gemfile +40 -0
  72. data/gemfiles/jruby_9.2.11.1_rails5_postgres.gemfile.lock +271 -0
  73. data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis.gemfile +41 -0
  74. data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis.gemfile.lock +273 -0
  75. data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis_activesupport.gemfile +41 -0
  76. data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis_activesupport.gemfile.lock +273 -0
  77. data/gemfiles/jruby_9.2.11.1_rails5_postgres_sidekiq.gemfile +42 -0
  78. data/gemfiles/jruby_9.2.11.1_rails5_postgres_sidekiq.gemfile.lock +279 -0
  79. data/gemfiles/jruby_9.2.11.1_rails61_mysql2.gemfile +40 -0
  80. data/gemfiles/jruby_9.2.11.1_rails61_mysql2.gemfile.lock +290 -0
  81. data/gemfiles/jruby_9.2.11.1_rails61_postgres.gemfile +40 -0
  82. data/gemfiles/jruby_9.2.11.1_rails61_postgres.gemfile.lock +290 -0
  83. data/gemfiles/jruby_9.2.11.1_rails61_postgres_redis.gemfile +41 -0
  84. data/gemfiles/jruby_9.2.11.1_rails61_postgres_redis.gemfile.lock +292 -0
  85. data/gemfiles/jruby_9.2.11.1_rails61_postgres_sidekiq.gemfile +41 -0
  86. data/gemfiles/jruby_9.2.11.1_rails61_postgres_sidekiq.gemfile.lock +297 -0
  87. data/gemfiles/jruby_9.2.11.1_rails6_mysql2.gemfile +40 -0
  88. data/gemfiles/jruby_9.2.11.1_rails6_mysql2.gemfile.lock +287 -0
  89. data/gemfiles/jruby_9.2.11.1_rails6_postgres.gemfile +40 -0
  90. data/gemfiles/jruby_9.2.11.1_rails6_postgres.gemfile.lock +287 -0
  91. data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis.gemfile +41 -0
  92. data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis.gemfile.lock +289 -0
  93. data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis_activesupport.gemfile +41 -0
  94. data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis_activesupport.gemfile.lock +289 -0
  95. data/gemfiles/jruby_9.2.11.1_rails6_postgres_sidekiq.gemfile +42 -0
  96. data/gemfiles/jruby_9.2.11.1_rails6_postgres_sidekiq.gemfile.lock +295 -0
  97. data/gemfiles/jruby_9.2.11.1_resque2_redis3.gemfile +36 -0
  98. data/gemfiles/jruby_9.2.11.1_resque2_redis3.gemfile.lock +180 -0
  99. data/gemfiles/jruby_9.2.11.1_resque2_redis4.gemfile +36 -0
  100. data/gemfiles/jruby_9.2.11.1_resque2_redis4.gemfile.lock +180 -0
  101. data/gemfiles/ruby_2.0.0_contrib_old.gemfile +64 -0
  102. data/gemfiles/ruby_2.0.0_contrib_old.gemfile.lock +290 -0
  103. data/gemfiles/ruby_2.0.0_core_old.gemfile +33 -0
  104. data/gemfiles/ruby_2.0.0_core_old.gemfile.lock +118 -0
  105. data/gemfiles/ruby_2.0.0_rails30_postgres.gemfile +39 -0
  106. data/gemfiles/ruby_2.0.0_rails30_postgres.gemfile.lock +196 -0
  107. data/gemfiles/ruby_2.0.0_rails30_postgres_sidekiq.gemfile +40 -0
  108. data/gemfiles/ruby_2.0.0_rails30_postgres_sidekiq.gemfile.lock +205 -0
  109. data/gemfiles/ruby_2.0.0_rails32_mysql2.gemfile +43 -0
  110. data/gemfiles/ruby_2.0.0_rails32_mysql2.gemfile.lock +217 -0
  111. data/gemfiles/ruby_2.0.0_rails32_postgres.gemfile +39 -0
  112. data/gemfiles/ruby_2.0.0_rails32_postgres.gemfile.lock +204 -0
  113. data/gemfiles/ruby_2.0.0_rails32_postgres_redis.gemfile +41 -0
  114. data/gemfiles/ruby_2.0.0_rails32_postgres_redis.gemfile.lock +223 -0
  115. data/gemfiles/ruby_2.0.0_rails32_postgres_sidekiq.gemfile +40 -0
  116. data/gemfiles/ruby_2.0.0_rails32_postgres_sidekiq.gemfile.lock +213 -0
  117. data/gemfiles/ruby_2.1.10_contrib_old.gemfile +66 -0
  118. data/gemfiles/ruby_2.1.10_contrib_old.gemfile.lock +305 -0
  119. data/gemfiles/ruby_2.1.10_core_old.gemfile +33 -0
  120. data/gemfiles/ruby_2.1.10_core_old.gemfile.lock +118 -0
  121. data/gemfiles/ruby_2.1.10_rails30_postgres.gemfile +39 -0
  122. data/gemfiles/ruby_2.1.10_rails30_postgres.gemfile.lock +196 -0
  123. data/gemfiles/ruby_2.1.10_rails30_postgres_sidekiq.gemfile +40 -0
  124. data/gemfiles/ruby_2.1.10_rails30_postgres_sidekiq.gemfile.lock +205 -0
  125. data/gemfiles/ruby_2.1.10_rails32_mysql2.gemfile +42 -0
  126. data/gemfiles/ruby_2.1.10_rails32_mysql2.gemfile.lock +215 -0
  127. data/gemfiles/ruby_2.1.10_rails32_postgres.gemfile +39 -0
  128. data/gemfiles/ruby_2.1.10_rails32_postgres.gemfile.lock +204 -0
  129. data/gemfiles/ruby_2.1.10_rails32_postgres_redis.gemfile +41 -0
  130. data/gemfiles/ruby_2.1.10_rails32_postgres_redis.gemfile.lock +223 -0
  131. data/gemfiles/ruby_2.1.10_rails32_postgres_sidekiq.gemfile +40 -0
  132. data/gemfiles/ruby_2.1.10_rails32_postgres_sidekiq.gemfile.lock +213 -0
  133. data/gemfiles/ruby_2.1.10_rails4_mysql2.gemfile +38 -0
  134. data/gemfiles/ruby_2.1.10_rails4_mysql2.gemfile.lock +218 -0
  135. data/gemfiles/ruby_2.1.10_rails4_postgres.gemfile +38 -0
  136. data/gemfiles/ruby_2.1.10_rails4_postgres.gemfile.lock +218 -0
  137. data/gemfiles/ruby_2.1.10_rails4_postgres_redis.gemfile +40 -0
  138. data/gemfiles/ruby_2.1.10_rails4_postgres_redis.gemfile.lock +237 -0
  139. data/gemfiles/ruby_2.2.10_contrib.gemfile +73 -0
  140. data/gemfiles/ruby_2.2.10_contrib.gemfile.lock +1450 -0
  141. data/gemfiles/ruby_2.2.10_core_old.gemfile +33 -0
  142. data/gemfiles/ruby_2.2.10_core_old.gemfile.lock +118 -0
  143. data/gemfiles/ruby_2.2.10_rails30_postgres.gemfile +39 -0
  144. data/gemfiles/ruby_2.2.10_rails30_postgres.gemfile.lock +196 -0
  145. data/gemfiles/ruby_2.2.10_rails30_postgres_sidekiq.gemfile +40 -0
  146. data/gemfiles/ruby_2.2.10_rails30_postgres_sidekiq.gemfile.lock +205 -0
  147. data/gemfiles/ruby_2.2.10_rails32_mysql2.gemfile +41 -0
  148. data/gemfiles/ruby_2.2.10_rails32_mysql2.gemfile.lock +212 -0
  149. data/gemfiles/ruby_2.2.10_rails32_postgres.gemfile +39 -0
  150. data/gemfiles/ruby_2.2.10_rails32_postgres.gemfile.lock +204 -0
  151. data/gemfiles/ruby_2.2.10_rails32_postgres_redis.gemfile +41 -0
  152. data/gemfiles/ruby_2.2.10_rails32_postgres_redis.gemfile.lock +223 -0
  153. data/gemfiles/ruby_2.2.10_rails32_postgres_sidekiq.gemfile +40 -0
  154. data/gemfiles/ruby_2.2.10_rails32_postgres_sidekiq.gemfile.lock +213 -0
  155. data/gemfiles/ruby_2.2.10_rails4_mysql2.gemfile +38 -0
  156. data/gemfiles/ruby_2.2.10_rails4_mysql2.gemfile.lock +218 -0
  157. data/gemfiles/ruby_2.2.10_rails4_postgres.gemfile +38 -0
  158. data/gemfiles/ruby_2.2.10_rails4_postgres.gemfile.lock +218 -0
  159. data/gemfiles/ruby_2.2.10_rails4_postgres_redis.gemfile +40 -0
  160. data/gemfiles/ruby_2.2.10_rails4_postgres_redis.gemfile.lock +237 -0
  161. data/gemfiles/ruby_2.2.10_rails4_postgres_sidekiq.gemfile +40 -0
  162. data/gemfiles/ruby_2.2.10_rails4_postgres_sidekiq.gemfile.lock +229 -0
  163. data/gemfiles/ruby_2.2.10_rails5_mysql2.gemfile +38 -0
  164. data/gemfiles/ruby_2.2.10_rails5_mysql2.gemfile.lock +234 -0
  165. data/gemfiles/ruby_2.2.10_rails5_postgres.gemfile +38 -0
  166. data/gemfiles/ruby_2.2.10_rails5_postgres.gemfile.lock +234 -0
  167. data/gemfiles/ruby_2.2.10_rails5_postgres_redis.gemfile +39 -0
  168. data/gemfiles/ruby_2.2.10_rails5_postgres_redis.gemfile.lock +236 -0
  169. data/gemfiles/ruby_2.2.10_rails5_postgres_redis_activesupport.gemfile +39 -0
  170. data/gemfiles/ruby_2.2.10_rails5_postgres_redis_activesupport.gemfile.lock +236 -0
  171. data/gemfiles/ruby_2.2.10_rails5_postgres_sidekiq.gemfile +40 -0
  172. data/gemfiles/ruby_2.2.10_rails5_postgres_sidekiq.gemfile.lock +245 -0
  173. data/gemfiles/ruby_2.3.8_contrib.gemfile +73 -0
  174. data/gemfiles/ruby_2.3.8_contrib.gemfile.lock +1459 -0
  175. data/gemfiles/ruby_2.3.8_contrib_old.gemfile +34 -0
  176. data/gemfiles/ruby_2.3.8_contrib_old.gemfile.lock +127 -0
  177. data/gemfiles/ruby_2.3.8_core_old.gemfile +33 -0
  178. data/gemfiles/ruby_2.3.8_core_old.gemfile.lock +123 -0
  179. data/gemfiles/ruby_2.3.8_cucumber3.gemfile +34 -0
  180. data/gemfiles/ruby_2.3.8_cucumber3.gemfile.lock +144 -0
  181. data/gemfiles/ruby_2.3.8_cucumber4.gemfile +34 -0
  182. data/gemfiles/ruby_2.3.8_cucumber4.gemfile.lock +174 -0
  183. data/gemfiles/ruby_2.3.8_rails30_postgres.gemfile +39 -0
  184. data/gemfiles/ruby_2.3.8_rails30_postgres.gemfile.lock +201 -0
  185. data/gemfiles/ruby_2.3.8_rails30_postgres_sidekiq.gemfile +40 -0
  186. data/gemfiles/ruby_2.3.8_rails30_postgres_sidekiq.gemfile.lock +210 -0
  187. data/gemfiles/ruby_2.3.8_rails32_mysql2.gemfile +41 -0
  188. data/gemfiles/ruby_2.3.8_rails32_mysql2.gemfile.lock +217 -0
  189. data/gemfiles/ruby_2.3.8_rails32_postgres.gemfile +39 -0
  190. data/gemfiles/ruby_2.3.8_rails32_postgres.gemfile.lock +209 -0
  191. data/gemfiles/ruby_2.3.8_rails32_postgres_redis.gemfile +41 -0
  192. data/gemfiles/ruby_2.3.8_rails32_postgres_redis.gemfile.lock +228 -0
  193. data/gemfiles/ruby_2.3.8_rails32_postgres_sidekiq.gemfile +40 -0
  194. data/gemfiles/ruby_2.3.8_rails32_postgres_sidekiq.gemfile.lock +218 -0
  195. data/gemfiles/ruby_2.3.8_rails4_mysql2.gemfile +38 -0
  196. data/gemfiles/ruby_2.3.8_rails4_mysql2.gemfile.lock +223 -0
  197. data/gemfiles/ruby_2.3.8_rails4_postgres.gemfile +38 -0
  198. data/gemfiles/ruby_2.3.8_rails4_postgres.gemfile.lock +223 -0
  199. data/gemfiles/ruby_2.3.8_rails4_postgres_redis.gemfile +40 -0
  200. data/gemfiles/ruby_2.3.8_rails4_postgres_redis.gemfile.lock +242 -0
  201. data/gemfiles/ruby_2.3.8_rails4_postgres_sidekiq.gemfile +40 -0
  202. data/gemfiles/ruby_2.3.8_rails4_postgres_sidekiq.gemfile.lock +234 -0
  203. data/gemfiles/ruby_2.3.8_rails5_mysql2.gemfile +37 -0
  204. data/gemfiles/ruby_2.3.8_rails5_mysql2.gemfile.lock +234 -0
  205. data/gemfiles/ruby_2.3.8_rails5_postgres.gemfile +37 -0
  206. data/gemfiles/ruby_2.3.8_rails5_postgres.gemfile.lock +234 -0
  207. data/gemfiles/ruby_2.3.8_rails5_postgres_redis.gemfile +38 -0
  208. data/gemfiles/ruby_2.3.8_rails5_postgres_redis.gemfile.lock +236 -0
  209. data/gemfiles/ruby_2.3.8_rails5_postgres_redis_activesupport.gemfile +38 -0
  210. data/gemfiles/ruby_2.3.8_rails5_postgres_redis_activesupport.gemfile.lock +236 -0
  211. data/gemfiles/ruby_2.3.8_rails5_postgres_sidekiq.gemfile +39 -0
  212. data/gemfiles/ruby_2.3.8_rails5_postgres_sidekiq.gemfile.lock +245 -0
  213. data/gemfiles/ruby_2.3.8_resque2_redis3.gemfile +35 -0
  214. data/gemfiles/ruby_2.3.8_resque2_redis3.gemfile.lock +150 -0
  215. data/gemfiles/ruby_2.3.8_resque2_redis4.gemfile +35 -0
  216. data/gemfiles/ruby_2.3.8_resque2_redis4.gemfile.lock +150 -0
  217. data/gemfiles/ruby_2.4.6_contrib.gemfile +78 -0
  218. data/gemfiles/ruby_2.4.6_contrib.gemfile.lock +1513 -0
  219. data/gemfiles/ruby_2.4.6_contrib_old.gemfile +38 -0
  220. data/gemfiles/ruby_2.4.6_contrib_old.gemfile.lock +155 -0
  221. data/gemfiles/ruby_2.4.6_core_old.gemfile +37 -0
  222. data/gemfiles/ruby_2.4.6_core_old.gemfile.lock +151 -0
  223. data/gemfiles/ruby_2.4.6_cucumber3.gemfile +38 -0
  224. data/gemfiles/ruby_2.4.6_cucumber3.gemfile.lock +172 -0
  225. data/gemfiles/ruby_2.4.6_cucumber4.gemfile +38 -0
  226. data/gemfiles/ruby_2.4.6_cucumber4.gemfile.lock +202 -0
  227. data/gemfiles/ruby_2.4.6_rails5_mysql2.gemfile +41 -0
  228. data/gemfiles/ruby_2.4.6_rails5_mysql2.gemfile.lock +262 -0
  229. data/gemfiles/ruby_2.4.6_rails5_postgres.gemfile +41 -0
  230. data/gemfiles/ruby_2.4.6_rails5_postgres.gemfile.lock +262 -0
  231. data/gemfiles/ruby_2.4.6_rails5_postgres_redis.gemfile +42 -0
  232. data/gemfiles/ruby_2.4.6_rails5_postgres_redis.gemfile.lock +264 -0
  233. data/gemfiles/ruby_2.4.6_rails5_postgres_redis_activesupport.gemfile +42 -0
  234. data/gemfiles/ruby_2.4.6_rails5_postgres_redis_activesupport.gemfile.lock +264 -0
  235. data/gemfiles/ruby_2.4.6_rails5_postgres_sidekiq.gemfile +43 -0
  236. data/gemfiles/ruby_2.4.6_rails5_postgres_sidekiq.gemfile.lock +273 -0
  237. data/gemfiles/ruby_2.4.6_resque2_redis3.gemfile +39 -0
  238. data/gemfiles/ruby_2.4.6_resque2_redis3.gemfile.lock +178 -0
  239. data/gemfiles/ruby_2.4.6_resque2_redis4.gemfile +39 -0
  240. data/gemfiles/ruby_2.4.6_resque2_redis4.gemfile.lock +178 -0
  241. data/gemfiles/ruby_2.5.6_contrib.gemfile +83 -0
  242. data/gemfiles/ruby_2.5.6_contrib.gemfile.lock +1526 -0
  243. data/gemfiles/ruby_2.5.6_contrib_old.gemfile +39 -0
  244. data/gemfiles/ruby_2.5.6_contrib_old.gemfile.lock +165 -0
  245. data/gemfiles/ruby_2.5.6_core_old.gemfile +38 -0
  246. data/gemfiles/ruby_2.5.6_core_old.gemfile.lock +161 -0
  247. data/gemfiles/ruby_2.5.6_cucumber3.gemfile +39 -0
  248. data/gemfiles/ruby_2.5.6_cucumber3.gemfile.lock +182 -0
  249. data/gemfiles/ruby_2.5.6_cucumber4.gemfile +39 -0
  250. data/gemfiles/ruby_2.5.6_cucumber4.gemfile.lock +214 -0
  251. data/gemfiles/ruby_2.5.6_cucumber5.gemfile +39 -0
  252. data/gemfiles/ruby_2.5.6_cucumber5.gemfile.lock +214 -0
  253. data/gemfiles/ruby_2.5.6_rails5_mysql2.gemfile +44 -0
  254. data/gemfiles/ruby_2.5.6_rails5_mysql2.gemfile.lock +276 -0
  255. data/gemfiles/ruby_2.5.6_rails5_postgres.gemfile +44 -0
  256. data/gemfiles/ruby_2.5.6_rails5_postgres.gemfile.lock +276 -0
  257. data/gemfiles/ruby_2.5.6_rails5_postgres_redis.gemfile +45 -0
  258. data/gemfiles/ruby_2.5.6_rails5_postgres_redis.gemfile.lock +278 -0
  259. data/gemfiles/ruby_2.5.6_rails5_postgres_redis_activesupport.gemfile +45 -0
  260. data/gemfiles/ruby_2.5.6_rails5_postgres_redis_activesupport.gemfile.lock +278 -0
  261. data/gemfiles/ruby_2.5.6_rails5_postgres_sidekiq.gemfile +46 -0
  262. data/gemfiles/ruby_2.5.6_rails5_postgres_sidekiq.gemfile.lock +284 -0
  263. data/gemfiles/ruby_2.5.6_rails61_mysql2.gemfile +44 -0
  264. data/gemfiles/ruby_2.5.6_rails61_mysql2.gemfile.lock +295 -0
  265. data/gemfiles/ruby_2.5.6_rails61_postgres.gemfile +44 -0
  266. data/gemfiles/ruby_2.5.6_rails61_postgres.gemfile.lock +295 -0
  267. data/gemfiles/ruby_2.5.6_rails61_postgres_redis.gemfile +45 -0
  268. data/gemfiles/ruby_2.5.6_rails61_postgres_redis.gemfile.lock +297 -0
  269. data/gemfiles/ruby_2.5.6_rails61_postgres_sidekiq.gemfile +45 -0
  270. data/gemfiles/ruby_2.5.6_rails61_postgres_sidekiq.gemfile.lock +302 -0
  271. data/gemfiles/ruby_2.5.6_rails6_mysql2.gemfile +44 -0
  272. data/gemfiles/ruby_2.5.6_rails6_mysql2.gemfile.lock +292 -0
  273. data/gemfiles/ruby_2.5.6_rails6_postgres.gemfile +44 -0
  274. data/gemfiles/ruby_2.5.6_rails6_postgres.gemfile.lock +292 -0
  275. data/gemfiles/ruby_2.5.6_rails6_postgres_redis.gemfile +45 -0
  276. data/gemfiles/ruby_2.5.6_rails6_postgres_redis.gemfile.lock +294 -0
  277. data/gemfiles/ruby_2.5.6_rails6_postgres_redis_activesupport.gemfile +45 -0
  278. data/gemfiles/ruby_2.5.6_rails6_postgres_redis_activesupport.gemfile.lock +294 -0
  279. data/gemfiles/ruby_2.5.6_rails6_postgres_sidekiq.gemfile +46 -0
  280. data/gemfiles/ruby_2.5.6_rails6_postgres_sidekiq.gemfile.lock +300 -0
  281. data/gemfiles/ruby_2.5.6_resque2_redis3.gemfile +40 -0
  282. data/gemfiles/ruby_2.5.6_resque2_redis3.gemfile.lock +188 -0
  283. data/gemfiles/ruby_2.5.6_resque2_redis4.gemfile +40 -0
  284. data/gemfiles/ruby_2.5.6_resque2_redis4.gemfile.lock +188 -0
  285. data/gemfiles/ruby_2.6.4_contrib.gemfile +79 -0
  286. data/gemfiles/ruby_2.6.4_contrib.gemfile.lock +1524 -0
  287. data/gemfiles/ruby_2.6.4_contrib_old.gemfile +39 -0
  288. data/gemfiles/ruby_2.6.4_contrib_old.gemfile.lock +167 -0
  289. data/gemfiles/ruby_2.6.4_core_old.gemfile +38 -0
  290. data/gemfiles/ruby_2.6.4_core_old.gemfile.lock +163 -0
  291. data/gemfiles/ruby_2.6.4_cucumber3.gemfile +39 -0
  292. data/gemfiles/ruby_2.6.4_cucumber3.gemfile.lock +184 -0
  293. data/gemfiles/ruby_2.6.4_cucumber4.gemfile +39 -0
  294. data/gemfiles/ruby_2.6.4_cucumber4.gemfile.lock +216 -0
  295. data/gemfiles/ruby_2.6.4_cucumber5.gemfile +39 -0
  296. data/gemfiles/ruby_2.6.4_cucumber5.gemfile.lock +216 -0
  297. data/gemfiles/ruby_2.6.4_rails5_mysql2.gemfile +42 -0
  298. data/gemfiles/ruby_2.6.4_rails5_mysql2.gemfile.lock +276 -0
  299. data/gemfiles/ruby_2.6.4_rails5_postgres.gemfile +42 -0
  300. data/gemfiles/ruby_2.6.4_rails5_postgres.gemfile.lock +276 -0
  301. data/gemfiles/ruby_2.6.4_rails5_postgres_redis.gemfile +43 -0
  302. data/gemfiles/ruby_2.6.4_rails5_postgres_redis.gemfile.lock +278 -0
  303. data/gemfiles/ruby_2.6.4_rails5_postgres_redis_activesupport.gemfile +43 -0
  304. data/gemfiles/ruby_2.6.4_rails5_postgres_redis_activesupport.gemfile.lock +278 -0
  305. data/gemfiles/ruby_2.6.4_rails5_postgres_sidekiq.gemfile +44 -0
  306. data/gemfiles/ruby_2.6.4_rails5_postgres_sidekiq.gemfile.lock +284 -0
  307. data/gemfiles/ruby_2.6.4_rails61_mysql2.gemfile +42 -0
  308. data/gemfiles/ruby_2.6.4_rails61_mysql2.gemfile.lock +295 -0
  309. data/gemfiles/ruby_2.6.4_rails61_postgres.gemfile +42 -0
  310. data/gemfiles/ruby_2.6.4_rails61_postgres.gemfile.lock +295 -0
  311. data/gemfiles/ruby_2.6.4_rails61_postgres_redis.gemfile +43 -0
  312. data/gemfiles/ruby_2.6.4_rails61_postgres_redis.gemfile.lock +297 -0
  313. data/gemfiles/ruby_2.6.4_rails61_postgres_sidekiq.gemfile +43 -0
  314. data/gemfiles/ruby_2.6.4_rails61_postgres_sidekiq.gemfile.lock +302 -0
  315. data/gemfiles/ruby_2.6.4_rails6_mysql2.gemfile +42 -0
  316. data/gemfiles/ruby_2.6.4_rails6_mysql2.gemfile.lock +292 -0
  317. data/gemfiles/ruby_2.6.4_rails6_postgres.gemfile +42 -0
  318. data/gemfiles/ruby_2.6.4_rails6_postgres.gemfile.lock +292 -0
  319. data/gemfiles/ruby_2.6.4_rails6_postgres_redis.gemfile +43 -0
  320. data/gemfiles/ruby_2.6.4_rails6_postgres_redis.gemfile.lock +294 -0
  321. data/gemfiles/ruby_2.6.4_rails6_postgres_redis_activesupport.gemfile +43 -0
  322. data/gemfiles/ruby_2.6.4_rails6_postgres_redis_activesupport.gemfile.lock +294 -0
  323. data/gemfiles/ruby_2.6.4_rails6_postgres_sidekiq.gemfile +44 -0
  324. data/gemfiles/ruby_2.6.4_rails6_postgres_sidekiq.gemfile.lock +300 -0
  325. data/gemfiles/ruby_2.6.4_resque2_redis3.gemfile +40 -0
  326. data/gemfiles/ruby_2.6.4_resque2_redis3.gemfile.lock +190 -0
  327. data/gemfiles/ruby_2.6.4_resque2_redis4.gemfile +40 -0
  328. data/gemfiles/ruby_2.6.4_resque2_redis4.gemfile.lock +190 -0
  329. data/gemfiles/ruby_2.7.0_contrib.gemfile +78 -0
  330. data/gemfiles/ruby_2.7.0_contrib.gemfile.lock +1523 -0
  331. data/gemfiles/ruby_2.7.0_contrib_old.gemfile +39 -0
  332. data/gemfiles/ruby_2.7.0_contrib_old.gemfile.lock +167 -0
  333. data/gemfiles/ruby_2.7.0_core_old.gemfile +38 -0
  334. data/gemfiles/ruby_2.7.0_core_old.gemfile.lock +163 -0
  335. data/gemfiles/ruby_2.7.0_cucumber3.gemfile +39 -0
  336. data/gemfiles/ruby_2.7.0_cucumber3.gemfile.lock +184 -0
  337. data/gemfiles/ruby_2.7.0_cucumber4.gemfile +39 -0
  338. data/gemfiles/ruby_2.7.0_cucumber4.gemfile.lock +216 -0
  339. data/gemfiles/ruby_2.7.0_cucumber5.gemfile +39 -0
  340. data/gemfiles/ruby_2.7.0_cucumber5.gemfile.lock +216 -0
  341. data/gemfiles/ruby_2.7.0_rails5_mysql2.gemfile +42 -0
  342. data/gemfiles/ruby_2.7.0_rails5_mysql2.gemfile.lock +276 -0
  343. data/gemfiles/ruby_2.7.0_rails5_postgres.gemfile +42 -0
  344. data/gemfiles/ruby_2.7.0_rails5_postgres.gemfile.lock +276 -0
  345. data/gemfiles/ruby_2.7.0_rails5_postgres_redis.gemfile +44 -0
  346. data/gemfiles/ruby_2.7.0_rails5_postgres_redis.gemfile.lock +295 -0
  347. data/gemfiles/ruby_2.7.0_rails5_postgres_redis_activesupport.gemfile +44 -0
  348. data/gemfiles/ruby_2.7.0_rails5_postgres_redis_activesupport.gemfile.lock +295 -0
  349. data/gemfiles/ruby_2.7.0_rails5_postgres_sidekiq.gemfile +44 -0
  350. data/gemfiles/ruby_2.7.0_rails5_postgres_sidekiq.gemfile.lock +284 -0
  351. data/gemfiles/ruby_2.7.0_rails61_mysql2.gemfile +42 -0
  352. data/gemfiles/ruby_2.7.0_rails61_mysql2.gemfile.lock +295 -0
  353. data/gemfiles/ruby_2.7.0_rails61_postgres.gemfile +42 -0
  354. data/gemfiles/ruby_2.7.0_rails61_postgres.gemfile.lock +295 -0
  355. data/gemfiles/ruby_2.7.0_rails61_postgres_redis.gemfile +43 -0
  356. data/gemfiles/ruby_2.7.0_rails61_postgres_redis.gemfile.lock +297 -0
  357. data/gemfiles/ruby_2.7.0_rails61_postgres_sidekiq.gemfile +43 -0
  358. data/gemfiles/ruby_2.7.0_rails61_postgres_sidekiq.gemfile.lock +302 -0
  359. data/gemfiles/ruby_2.7.0_rails6_mysql2.gemfile +42 -0
  360. data/gemfiles/ruby_2.7.0_rails6_mysql2.gemfile.lock +292 -0
  361. data/gemfiles/ruby_2.7.0_rails6_postgres.gemfile +42 -0
  362. data/gemfiles/ruby_2.7.0_rails6_postgres.gemfile.lock +292 -0
  363. data/gemfiles/ruby_2.7.0_rails6_postgres_redis.gemfile +44 -0
  364. data/gemfiles/ruby_2.7.0_rails6_postgres_redis.gemfile.lock +311 -0
  365. data/gemfiles/ruby_2.7.0_rails6_postgres_redis_activesupport.gemfile +44 -0
  366. data/gemfiles/ruby_2.7.0_rails6_postgres_redis_activesupport.gemfile.lock +311 -0
  367. data/gemfiles/ruby_2.7.0_rails6_postgres_sidekiq.gemfile +44 -0
  368. data/gemfiles/ruby_2.7.0_rails6_postgres_sidekiq.gemfile.lock +300 -0
  369. data/gemfiles/ruby_2.7.0_resque2_redis3.gemfile +40 -0
  370. data/gemfiles/ruby_2.7.0_resque2_redis3.gemfile.lock +190 -0
  371. data/gemfiles/ruby_2.7.0_resque2_redis4.gemfile +40 -0
  372. data/gemfiles/ruby_2.7.0_resque2_redis4.gemfile.lock +190 -0
  373. data/gemfiles/ruby_3.0.0_contrib.gemfile +77 -0
  374. data/gemfiles/ruby_3.0.0_contrib.gemfile.lock +1534 -0
  375. data/gemfiles/ruby_3.0.0_core_old.gemfile +39 -0
  376. data/gemfiles/ruby_3.0.0_core_old.gemfile.lock +165 -0
  377. data/gemfiles/ruby_3.0.0_cucumber3.gemfile +40 -0
  378. data/gemfiles/ruby_3.0.0_cucumber3.gemfile.lock +186 -0
  379. data/gemfiles/ruby_3.0.0_cucumber4.gemfile +40 -0
  380. data/gemfiles/ruby_3.0.0_cucumber4.gemfile.lock +218 -0
  381. data/gemfiles/ruby_3.0.0_cucumber5.gemfile +40 -0
  382. data/gemfiles/ruby_3.0.0_cucumber5.gemfile.lock +218 -0
  383. data/gemfiles/ruby_3.0.0_rails61_mysql2.gemfile +43 -0
  384. data/gemfiles/ruby_3.0.0_rails61_mysql2.gemfile.lock +295 -0
  385. data/gemfiles/ruby_3.0.0_rails61_postgres.gemfile +43 -0
  386. data/gemfiles/ruby_3.0.0_rails61_postgres.gemfile.lock +295 -0
  387. data/gemfiles/ruby_3.0.0_rails61_postgres_redis.gemfile +44 -0
  388. data/gemfiles/ruby_3.0.0_rails61_postgres_redis.gemfile.lock +297 -0
  389. data/gemfiles/ruby_3.0.0_rails61_postgres_sidekiq.gemfile +44 -0
  390. data/gemfiles/ruby_3.0.0_rails61_postgres_sidekiq.gemfile.lock +302 -0
  391. data/gemfiles/ruby_3.0.0_resque2_redis3.gemfile +41 -0
  392. data/gemfiles/ruby_3.0.0_resque2_redis3.gemfile.lock +192 -0
  393. data/gemfiles/ruby_3.0.0_resque2_redis4.gemfile +41 -0
  394. data/gemfiles/ruby_3.0.0_resque2_redis4.gemfile.lock +192 -0
  395. data/lib/ddtrace/configuration/agent_settings_resolver.rb +241 -0
  396. data/lib/ddtrace/configuration/components.rb +22 -29
  397. data/lib/ddtrace/configuration/settings.rb +16 -6
  398. data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +1 -1
  399. data/lib/ddtrace/contrib/action_pack/utils.rb +1 -1
  400. data/lib/ddtrace/contrib/auto_instrument.rb +0 -1
  401. data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +4 -0
  402. data/lib/ddtrace/error.rb +85 -9
  403. data/lib/ddtrace/ext/profiling.rb +1 -0
  404. data/lib/ddtrace/ext/transport.rb +1 -0
  405. data/lib/ddtrace/profiling.rb +73 -22
  406. data/lib/ddtrace/profiling/collectors/stack.rb +12 -6
  407. data/lib/ddtrace/profiling/ext/cpu.rb +0 -2
  408. data/lib/ddtrace/profiling/ext/cthread.rb +54 -31
  409. data/lib/ddtrace/profiling/profiler.rb +2 -0
  410. data/lib/ddtrace/profiling/recorder.rb +8 -0
  411. data/lib/ddtrace/profiling/scheduler.rb +32 -11
  412. data/lib/ddtrace/profiling/transport/http.rb +51 -55
  413. data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +1 -0
  414. data/lib/ddtrace/runtime/container.rb +16 -8
  415. data/lib/ddtrace/tracer.rb +7 -28
  416. data/lib/ddtrace/transport/http.rb +36 -33
  417. data/lib/ddtrace/version.rb +13 -1
  418. data/lib/ddtrace/workers/loop.rb +13 -1
  419. data/lib/ddtrace/workers/trace_writer.rb +2 -5
  420. data/lib/ddtrace/writer.rb +4 -1
  421. metadata +393 -6
@@ -16,6 +16,8 @@ module Datadog
16
16
  end
17
17
 
18
18
  def shutdown!
19
+ Datadog.logger.debug('Shutting down profiler')
20
+
19
21
  collectors.each do |collector|
20
22
  collector.enabled = false
21
23
  collector.stop(true)
@@ -16,6 +16,9 @@ module Datadog
16
16
  event_classes.each do |event_class|
17
17
  @buffers[event_class] = Profiling::Buffer.new(max_size)
18
18
  end
19
+
20
+ # Event classes can only be added ahead of time
21
+ @buffers.freeze
19
22
  end
20
23
 
21
24
  def [](event_class)
@@ -59,6 +62,11 @@ module Datadog
59
62
  )
60
63
  end
61
64
 
65
+ # NOTE: Remember that if the recorder is being accessed by multiple threads, this is an inherently racy operation.
66
+ def empty?
67
+ @buffers.values.all?(&:empty?)
68
+ end
69
+
62
70
  # Error when event of an unknown type is used with the Recorder
63
71
  class UnknownEventError < StandardError
64
72
  attr_reader :event_class
@@ -5,31 +5,36 @@ require 'ddtrace/workers/polling'
5
5
 
6
6
  module Datadog
7
7
  module Profiling
8
- # Periodically (every DEFAULT_INTERVAL seconds) takes data from the `Recorder` and pushes them to all configured
8
+ # Periodically (every DEFAULT_INTERVAL_SECONDS) takes data from the `Recorder` and pushes them to all configured
9
9
  # `Exporter`s. Runs on its own background thread.
10
10
  class Scheduler < Worker
11
11
  include Workers::Polling
12
12
 
13
- DEFAULT_INTERVAL = 60
14
- MIN_INTERVAL = 0
13
+ DEFAULT_INTERVAL_SECONDS = 60
14
+ MIN_INTERVAL_SECONDS = 0
15
15
 
16
16
  attr_reader \
17
17
  :exporters,
18
18
  :recorder
19
19
 
20
- def initialize(recorder, exporters, options = {})
20
+ def initialize(
21
+ recorder,
22
+ exporters,
23
+ fork_policy: Workers::Async::Thread::FORK_POLICY_RESTART, # Restart in forks by default
24
+ interval: DEFAULT_INTERVAL_SECONDS,
25
+ enabled: true
26
+ )
21
27
  @recorder = recorder
22
28
  @exporters = [exporters].flatten
23
29
 
24
30
  # Workers::Async::Thread settings
25
- # Restart in forks by default
26
- self.fork_policy = options[:fork_policy] || Workers::Async::Thread::FORK_POLICY_RESTART
31
+ self.fork_policy = fork_policy
27
32
 
28
33
  # Workers::IntervalLoop settings
29
- self.loop_base_interval = options[:interval] || DEFAULT_INTERVAL
34
+ self.loop_base_interval = interval
30
35
 
31
36
  # Workers::Polling settings
32
- self.enabled = options.key?(:enabled) ? options[:enabled] == true : true
37
+ self.enabled = enabled
33
38
  end
34
39
 
35
40
  def start
@@ -51,6 +56,21 @@ module Datadog
51
56
  recorder.flush
52
57
  end
53
58
 
59
+ # Configure Workers::IntervalLoop to not report immediately when scheduler starts
60
+ #
61
+ # When a scheduler gets created (or reset), we don't want it to immediately try to flush; we want it to wait for
62
+ # the loop wait time first. This avoids an issue where the scheduler reported a mostly-empty profile if the
63
+ # application just started but this thread took a bit longer so there's already samples in the recorder.
64
+ def loop_wait_before_first_iteration?
65
+ true
66
+ end
67
+
68
+ def work_pending?
69
+ !recorder.empty?
70
+ end
71
+
72
+ private
73
+
54
74
  def flush_and_wait
55
75
  run_time = Datadog::Utils::Time.measure do
56
76
  flush_events
@@ -58,7 +78,7 @@ module Datadog
58
78
 
59
79
  # Update wait time to try to wake consistently on time.
60
80
  # Don't drop below the minimum interval.
61
- self.loop_wait_time = [loop_base_interval - run_time, MIN_INTERVAL].max
81
+ self.loop_wait_time = [loop_base_interval - run_time, MIN_INTERVAL_SECONDS].max
62
82
  end
63
83
 
64
84
  def flush_events
@@ -71,8 +91,9 @@ module Datadog
71
91
  begin
72
92
  exporter.export(flush)
73
93
  rescue StandardError => e
74
- error_details = "Cause: #{e} Location: #{e.backtrace.first}"
75
- Datadog.logger.error("Unable to export #{flush.event_count} profiling events. #{error_details}")
94
+ Datadog.logger.error(
95
+ "Unable to export #{flush.event_count} profiling events. Cause: #{e} Location: #{e.backtrace.first}"
96
+ )
76
97
  end
77
98
  end
78
99
  end
@@ -13,7 +13,6 @@ require 'ddtrace/transport/http/adapters/unix_socket'
13
13
  module Datadog
14
14
  module Profiling
15
15
  module Transport
16
- # TODO: Consolidate with Dataog::Transport::HTTP
17
16
  # Namespace for HTTP transport components
18
17
  module HTTP
19
18
  module_function
@@ -25,31 +24,32 @@ module Datadog
25
24
 
26
25
  # Builds a new Transport::HTTP::Client with default settings
27
26
  # Pass a block to override any settings.
28
- def default(options = {})
27
+ def default(profiling_upload_timeout_seconds:, agent_settings: nil, site: nil, api_key: nil)
29
28
  new do |transport|
30
29
  transport.headers default_headers
31
30
 
32
31
  # Configure adapter & API
33
- if options[:site] && options[:api_key]
34
- configure_for_agentless(transport, options)
32
+ if site && api_key
33
+ configure_for_agentless(
34
+ transport,
35
+ profiling_upload_timeout_seconds: profiling_upload_timeout_seconds,
36
+ site: site,
37
+ api_key: api_key
38
+ )
35
39
  else
36
- configure_for_agent(transport, options)
40
+ unless agent_settings
41
+ raise(
42
+ ArgumentError,
43
+ "Missing configuration for #{self}.default: All of `agent_settings`, `site` and `api_key` are nil"
44
+ )
45
+ end
46
+
47
+ configure_for_agent(
48
+ transport,
49
+ profiling_upload_timeout_seconds: profiling_upload_timeout_seconds,
50
+ agent_settings: agent_settings
51
+ )
37
52
  end
38
-
39
- # Additional options
40
- unless options.empty?
41
- # Change default API
42
- transport.default_api = options[:api_version] if options.key?(:api_version)
43
-
44
- # Add headers
45
- transport.headers options[:headers] if options.key?(:headers)
46
-
47
- # Execute on_build callback
48
- options[:on_build].call(transport) if options[:on_build].is_a?(Proc)
49
- end
50
-
51
- # Call block to apply any customization, if provided.
52
- yield(transport) if block_given?
53
53
  end
54
54
  end
55
55
 
@@ -66,56 +66,52 @@ module Datadog
66
66
  end
67
67
  end
68
68
 
69
- def default_adapter
69
+ private_class_method def default_adapter
70
70
  :net_http
71
71
  end
72
72
 
73
- def default_hostname
74
- ENV.fetch(Datadog::Ext::Transport::HTTP::ENV_DEFAULT_HOST, Datadog::Ext::Transport::HTTP::DEFAULT_HOST)
75
- end
76
-
77
- def default_port
78
- ENV.fetch(Datadog::Ext::Transport::HTTP::ENV_DEFAULT_PORT, Datadog::Ext::Transport::HTTP::DEFAULT_PORT).to_i
79
- end
80
-
81
- def configure_for_agent(transport, options = {})
73
+ private_class_method def configure_for_agent(transport, profiling_upload_timeout_seconds:, agent_settings:)
82
74
  apis = API.agent_defaults
83
75
 
84
- hostname = options[:hostname] || default_hostname
85
- port = options[:port] || default_port
86
-
87
- adapter_options = {}
88
- adapter_options[:timeout] = options[:timeout] if options.key?(:timeout)
89
- adapter_options[:ssl] = options[:ssl] if options.key?(:ssl)
90
-
91
- transport.adapter default_adapter, hostname, port, adapter_options
92
- transport.api API::V1, apis[API::V1], default: true
76
+ transport.adapter(
77
+ default_adapter,
78
+ agent_settings.hostname,
79
+ agent_settings.port,
80
+ # We explictly use profiling_upload_timeout_seconds instead of agent_settings.timeout because profile
81
+ # uploads are bigger and thus we employ a separate configuration.
82
+ timeout: profiling_upload_timeout_seconds,
83
+ ssl: agent_settings.ssl
84
+ )
85
+ transport.api(API::V1, apis[API::V1], default: true)
86
+
87
+ # NOTE: This proc, when it exists, usually overrides the transport specified above
88
+ if agent_settings.deprecated_for_removal_transport_configuration_proc
89
+ agent_settings.deprecated_for_removal_transport_configuration_proc.call(transport)
90
+ end
93
91
  end
94
92
 
95
- def configure_for_agentless(transport, options = {})
93
+ private_class_method def configure_for_agentless(transport, profiling_upload_timeout_seconds:, site:, api_key:)
96
94
  apis = API.api_defaults
97
95
 
98
- site_uri = URI(format(Datadog::Ext::Profiling::Transport::HTTP::URI_TEMPLATE_DD_API, options[:site]))
99
- hostname = options[:hostname] || site_uri.host
100
- port = options[:port] || site_uri.port
101
-
102
- adapter_options = {}
103
- adapter_options[:timeout] = options[:timeout] if options.key?(:timeout)
104
- adapter_options[:ssl] = options[:ssl] || (site_uri.scheme == 'https'.freeze)
105
-
106
- transport.adapter default_adapter, hostname, port, adapter_options
107
- transport.api API::V1, apis[API::V1], default: true
108
- transport.headers(Datadog::Ext::Transport::HTTP::HEADER_DD_API_KEY => options[:api_key])
96
+ site_uri = URI(format(Datadog::Ext::Profiling::Transport::HTTP::URI_TEMPLATE_DD_API, site))
97
+ hostname = site_uri.host
98
+ port = site_uri.port
99
+
100
+ transport.adapter(
101
+ default_adapter,
102
+ hostname,
103
+ port,
104
+ timeout: profiling_upload_timeout_seconds,
105
+ ssl: site_uri.scheme == 'https'
106
+ )
107
+ transport.api(API::V1, apis[API::V1], default: true)
108
+ transport.headers(Datadog::Ext::Transport::HTTP::HEADER_DD_API_KEY => api_key)
109
109
  end
110
110
 
111
111
  # Add adapters to registry
112
112
  Builder::REGISTRY.set(Datadog::Transport::HTTP::Adapters::Net, :net_http)
113
113
  Builder::REGISTRY.set(Datadog::Transport::HTTP::Adapters::Test, :test)
114
114
  Builder::REGISTRY.set(Datadog::Transport::HTTP::Adapters::UnixSocket, :unix)
115
-
116
- private \
117
- :configure_for_agent,
118
- :configure_for_agentless
119
115
  end
120
116
  end
121
117
  end
@@ -48,6 +48,7 @@ module Datadog
48
48
  "#{FORM_FIELD_TAG_RUNTIME_ENGINE}:#{flush.runtime_engine}",
49
49
  "#{FORM_FIELD_TAG_RUNTIME_PLATFORM}:#{flush.runtime_platform}",
50
50
  "#{FORM_FIELD_TAG_RUNTIME_VERSION}:#{flush.runtime_version}",
51
+ "#{FORM_FIELD_TAG_PID}:#{Process.pid}",
51
52
  "#{FORM_FIELD_TAG_PROFILER_VERSION}:#{flush.profiler_version}",
52
53
  # NOTE: Redundant w/ 'runtime'; may want to remove this later.
53
54
  "#{FORM_FIELD_TAG_LANGUAGE}:#{flush.language}",
@@ -8,9 +8,10 @@ module Datadog
8
8
  UUID_PATTERN = '[0-9a-f]{8}[-_]?[0-9a-f]{4}[-_]?[0-9a-f]{4}[-_]?[0-9a-f]{4}[-_]?[0-9a-f]{12}'.freeze
9
9
  CONTAINER_PATTERN = '[0-9a-f]{64}'.freeze
10
10
 
11
- POD_REGEX = /(pod)?(#{UUID_PATTERN})(?:.slice)?$/.freeze
12
- CONTAINER_REGEX = /(#{UUID_PATTERN}|#{CONTAINER_PATTERN})(?:.scope)?$/.freeze
13
- FARGATE_14_CONTAINER_REGEX = /[0-9a-f]{32}-[0-9]{10}/.freeze
11
+ PLATFORM_REGEX = /(?<platform>.*?)(?:.slice)?$/.freeze
12
+ POD_REGEX = /(?<pod>(pod)?#{UUID_PATTERN})(?:.slice)?$/.freeze
13
+ CONTAINER_REGEX = /(?<container>#{UUID_PATTERN}|#{CONTAINER_PATTERN})(?:.scope)?$/.freeze
14
+ FARGATE_14_CONTAINER_REGEX = /(?<container>[0-9a-f]{32}-[0-9]{10})/.freeze
14
15
 
15
16
  Descriptor = Struct.new(
16
17
  :platform,
@@ -45,16 +46,23 @@ module Datadog
45
46
  parts.shift # Remove leading empty part
46
47
 
47
48
  # Read info from path
48
- platform = parts[0]
49
+ next if parts.empty?
50
+
51
+ platform = parts[0][PLATFORM_REGEX, :platform]
49
52
  container_id, task_uid = nil
50
53
 
51
54
  case parts.length
55
+ when 0..1
56
+ next
52
57
  when 2
53
- container_id = parts[-1][CONTAINER_REGEX] || parts[-1][FARGATE_14_CONTAINER_REGEX]
58
+ container_id = parts[-1][CONTAINER_REGEX, :container] \
59
+ || parts[-1][FARGATE_14_CONTAINER_REGEX, :container]
54
60
  else
55
- platform = parts[0]
56
- container_id = parts[-1][CONTAINER_REGEX]
57
- task_uid = parts[-2][POD_REGEX]
61
+ if (container_id = parts[-1][CONTAINER_REGEX, :container])
62
+ task_uid = parts[-2][POD_REGEX, :pod]
63
+ else
64
+ container_id = parts[-1][FARGATE_14_CONTAINER_REGEX, :container]
65
+ end
58
66
  end
59
67
 
60
68
  # If container ID wasn't found, ignore.
@@ -85,7 +85,7 @@ module Datadog
85
85
  @provider = options.fetch(:context_provider, Datadog::DefaultContextProvider.new)
86
86
  @sampler = options.fetch(:sampler, Datadog::AllSampler.new)
87
87
  @tags = options.fetch(:tags, {})
88
- @writer = options.fetch(:writer, Datadog::Writer.new)
88
+ @writer = options.fetch(:writer) { Datadog::Writer.new }
89
89
 
90
90
  # Instance variables
91
91
  @mutex = Mutex.new
@@ -391,20 +391,14 @@ module Datadog
391
391
 
392
392
  # TODO: Move this kind of configuration building out of the tracer.
393
393
  # Tracer should not have this kind of knowledge of writer.
394
- # rubocop:disable Metrics/PerceivedComplexity
395
- # rubocop:disable Metrics/CyclomaticComplexity
396
- # rubocop:disable Metrics/MethodLength
397
394
  def configure_writer(options = {})
398
- hostname = options.fetch(:hostname, nil)
399
- port = options.fetch(:port, nil)
400
395
  sampler = options.fetch(:sampler, nil)
401
396
  priority_sampling = options.fetch(:priority_sampling, nil)
402
397
  writer = options.fetch(:writer, nil)
403
- transport_options = options.fetch(:transport_options, {}).dup
398
+ agent_settings = options.fetch(:agent_settings, nil)
404
399
 
405
400
  # Compile writer options
406
401
  writer_options = options.fetch(:writer_options, {}).dup
407
- rebuild_writer = !writer_options.empty?
408
402
 
409
403
  # Re-build the sampler and writer if priority sampling is enabled,
410
404
  # but neither are configured. Verify the sampler isn't already a
@@ -417,35 +411,20 @@ module Datadog
417
411
  end
418
412
  elsif priority_sampling != false && !@sampler.is_a?(PrioritySampler)
419
413
  writer_options[:priority_sampler] = activate_priority_sampling!(@sampler)
420
- rebuild_writer = true
421
414
  elsif priority_sampling == false
422
415
  deactivate_priority_sampling!(sampler)
423
- rebuild_writer = true
424
416
  elsif @sampler.is_a?(PrioritySampler)
425
417
  # Make sure to add sampler to options if transport is rebuilt.
426
418
  writer_options[:priority_sampler] = @sampler
427
419
  end
428
420
 
429
- # Apply options to transport
430
- if transport_options.is_a?(Proc)
431
- transport_options = { on_build: transport_options }
432
- rebuild_writer = true
433
- end
434
-
435
- if hostname || port
436
- transport_options[:hostname] = hostname unless hostname.nil?
437
- transport_options[:port] = port unless port.nil?
438
- rebuild_writer = true
439
- end
421
+ writer_options[:agent_settings] = agent_settings if agent_settings
440
422
 
441
- writer_options[:transport_options] = transport_options
423
+ # Make sure old writer is shut down before throwing away.
424
+ # Don't want additional threads running...
425
+ @writer.stop unless writer.nil?
442
426
 
443
- if rebuild_writer || writer
444
- # Make sure old writer is shut down before throwing away.
445
- # Don't want additional threads running...
446
- @writer.stop unless writer.nil?
447
- @writer = writer || Writer.new(writer_options)
448
- end
427
+ @writer = writer || Writer.new(writer_options)
449
428
  end
450
429
 
451
430
  def activate_priority_sampling!(base_sampler = nil)
@@ -25,11 +25,23 @@ module Datadog
25
25
 
26
26
  # Builds a new Transport::HTTP::Client with default settings
27
27
  # Pass a block to override any settings.
28
- def default(options = {})
28
+ def default(agent_settings: Datadog::Configuration::AgentSettingsResolver::ENVIRONMENT_AGENT_SETTINGS, **options)
29
29
  new do |transport|
30
- transport.adapter default_adapter, default_hostname, default_port, timeout: 1
30
+ transport.adapter(
31
+ default_adapter,
32
+ agent_settings.hostname,
33
+ agent_settings.port,
34
+ timeout: agent_settings.timeout_seconds,
35
+ ssl: agent_settings.ssl
36
+ )
31
37
  transport.headers default_headers
32
38
 
39
+ if agent_settings.deprecated_for_removal_transport_configuration_options
40
+ # The deprecated_for_removal_transport_configuration_options take precedence over any options the caller
41
+ # specifies
42
+ options = options.merge(**agent_settings.deprecated_for_removal_transport_configuration_options)
43
+ end
44
+
33
45
  apis = API.defaults
34
46
 
35
47
  transport.api API::V4, apis[API::V4], fallback: API::V3, default: true
@@ -38,29 +50,15 @@ module Datadog
38
50
 
39
51
  # Apply any settings given by options
40
52
  unless options.empty?
41
- # Change hostname/port
42
- if [:hostname, :port, :timeout, :ssl].any? { |key| options.key?(key) }
43
- hostname = options[:hostname] || default_hostname
44
- port = options[:port] || default_port
45
-
46
- adapter_options = { timeout: 1 }
47
- adapter_options[:timeout] = options[:timeout] if options.key?(:timeout)
48
- adapter_options[:ssl] = options[:ssl] if options.key?(:ssl)
49
-
50
- transport.adapter default_adapter, hostname, port, adapter_options
51
- end
52
-
53
- # Change default API
54
53
  transport.default_api = options[:api_version] if options.key?(:api_version)
55
-
56
- # Add headers
57
54
  transport.headers options[:headers] if options.key?(:headers)
55
+ end
58
56
 
59
- # Execute on_build callback
60
- options[:on_build].call(transport) if options[:on_build].is_a?(Proc)
57
+ if agent_settings.deprecated_for_removal_transport_configuration_proc
58
+ agent_settings.deprecated_for_removal_transport_configuration_proc.call(transport)
61
59
  end
62
60
 
63
- # Call block to apply any customization, if provided.
61
+ # Call block to apply any customization, if provided
64
62
  yield(transport) if block_given?
65
63
  end
66
64
  end
@@ -82,26 +80,31 @@ module Datadog
82
80
  :net_http
83
81
  end
84
82
 
85
- def default_hostname
86
- return default_url.hostname if default_url
83
+ def default_hostname(logger: Datadog.logger)
84
+ logger.warn(
85
+ 'Deprecated for removal: Using #default_hostname for configuration is deprecated and will ' \
86
+ 'be removed on a future ddtrace release.'
87
+ )
87
88
 
88
- ENV.fetch(Datadog::Ext::Transport::HTTP::ENV_DEFAULT_HOST, Datadog::Ext::Transport::HTTP::DEFAULT_HOST)
89
+ Datadog::Configuration::AgentSettingsResolver::ENVIRONMENT_AGENT_SETTINGS.hostname
89
90
  end
90
91
 
91
- def default_port
92
- return default_url.port if default_url
92
+ def default_port(logger: Datadog.logger)
93
+ logger.warn(
94
+ 'Deprecated for removal: Using #default_hostname for configuration is deprecated and will ' \
95
+ 'be removed on a future ddtrace release.'
96
+ )
93
97
 
94
- ENV.fetch(Datadog::Ext::Transport::HTTP::ENV_DEFAULT_PORT, Datadog::Ext::Transport::HTTP::DEFAULT_PORT).to_i
98
+ Datadog::Configuration::AgentSettingsResolver::ENVIRONMENT_AGENT_SETTINGS.port
95
99
  end
96
100
 
97
- def default_url
98
- url_env = ENV.fetch(Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL, nil)
101
+ def default_url(logger: Datadog.logger)
102
+ logger.warn(
103
+ 'Deprecated for removal: Using #default_url for configuration is deprecated and will ' \
104
+ 'be removed on a future ddtrace release.'
105
+ )
99
106
 
100
- if url_env
101
- uri_parsed = URI.parse(url_env)
102
-
103
- uri_parsed if %w[http https].include?(uri_parsed.scheme)
104
- end
107
+ nil
105
108
  end
106
109
 
107
110
  # Add adapters to registry