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
@@ -0,0 +1,241 @@
1
+ require 'uri'
2
+
3
+ require 'ddtrace/ext/transport'
4
+ require 'ddtrace/configuration/settings'
5
+
6
+ module Datadog
7
+ module Configuration
8
+ # This class unifies all the different ways that users can configure how we talk to the agent.
9
+ #
10
+ # It has quite a lot of complexity, but this complexity just reflects the actual complexity we have around our
11
+ # configuration today. E.g., this is just all of the complexity regarding agent settings gathered together in a
12
+ # single place. As we deprecate more and more of the different ways that these things can be configured,
13
+ # this class will reflect that simplification as well.
14
+ #
15
+ # Whenever there is a conflict (different configurations are provided in different orders), it MUST warn the users
16
+ # about it and pick a value based on the following priority: code > environment variable > defaults.
17
+ #
18
+ # rubocop:disable Metrics/ClassLength
19
+ class AgentSettingsResolver
20
+ AgentSettings = \
21
+ Struct.new(
22
+ :ssl,
23
+ :hostname,
24
+ :port,
25
+ :timeout_seconds,
26
+ :deprecated_for_removal_transport_configuration_proc,
27
+ :deprecated_for_removal_transport_configuration_options
28
+ ) do
29
+ def initialize(
30
+ # Hacky required kw args, we can get rid of this when we drop Ruby 2.0
31
+ ssl: raise(ArgumentError, 'missing keyword :ssl'),
32
+ hostname: raise(ArgumentError, 'missing keyword :hostname'),
33
+ port: raise(ArgumentError, 'missing keyword :port'),
34
+ timeout_seconds: raise(ArgumentError, 'missing keyword :timeout_seconds'),
35
+ deprecated_for_removal_transport_configuration_proc: \
36
+ raise(ArgumentError, 'missing keyword :deprecated_for_removal_transport_configuration_proc'),
37
+ deprecated_for_removal_transport_configuration_options: \
38
+ raise(ArgumentError, 'missing keyword :deprecated_for_removal_transport_configuration_options')
39
+ )
40
+ super(ssl, hostname, port, timeout_seconds, deprecated_for_removal_transport_configuration_proc, \
41
+ deprecated_for_removal_transport_configuration_options)
42
+ freeze
43
+ end
44
+ end
45
+
46
+ def self.call(settings, logger: Datadog.logger)
47
+ new(settings, logger: logger).send(:call)
48
+ end
49
+
50
+ private
51
+
52
+ attr_reader \
53
+ :logger,
54
+ :settings
55
+
56
+ def initialize(settings, logger: Datadog.logger)
57
+ @settings = settings
58
+ @logger = logger
59
+ end
60
+
61
+ def call
62
+ AgentSettings.new(
63
+ ssl: ssl?,
64
+ hostname: hostname,
65
+ port: port,
66
+ timeout_seconds: timeout_seconds,
67
+ # NOTE: When provided, the deprecated_for_removal_transport_configuration_proc can override all
68
+ # values above (ssl, hostname, port, timeout), or even make them irrelevant (by using an unix socket or
69
+ # enabling test mode instead).
70
+ # That is the main reason why it is deprecated -- it's an opaque function that may set a bunch of settings
71
+ # that we know nothing of until we actually call it.
72
+ deprecated_for_removal_transport_configuration_proc: deprecated_for_removal_transport_configuration_proc,
73
+ deprecated_for_removal_transport_configuration_options: deprecated_for_removal_transport_configuration_options
74
+ )
75
+ end
76
+
77
+ def hostname
78
+ pick_from(
79
+ configurations_in_priority_order: [
80
+ DetectedConfiguration.new(
81
+ friendly_name: "'c.tracer.hostname'",
82
+ value: settings.tracer.hostname
83
+ ),
84
+ DetectedConfiguration.new(
85
+ friendly_name: "#{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL} environment variable",
86
+ value: parsed_url && parsed_url.hostname
87
+ ),
88
+ DetectedConfiguration.new(
89
+ friendly_name: "#{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_HOST} environment variable",
90
+ value: ENV[Datadog::Ext::Transport::HTTP::ENV_DEFAULT_HOST]
91
+ )
92
+ ],
93
+ or_use_default: Datadog::Ext::Transport::HTTP::DEFAULT_HOST
94
+ )
95
+ end
96
+
97
+ def port
98
+ port_from_env = ENV[Datadog::Ext::Transport::HTTP::ENV_DEFAULT_PORT]
99
+ parsed_port_from_env =
100
+ if port_from_env
101
+ begin
102
+ Integer(port_from_env)
103
+ rescue ArgumentError
104
+ log_warning(
105
+ "Invalid value for #{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_PORT} environment variable " \
106
+ "('#{port_from_env}'). Ignoring this configuration."
107
+ )
108
+ end
109
+ end
110
+
111
+ pick_from(
112
+ configurations_in_priority_order: [
113
+ DetectedConfiguration.new(
114
+ friendly_name: '"c.tracer.port"',
115
+ value: settings.tracer.port
116
+ ),
117
+ DetectedConfiguration.new(
118
+ friendly_name: "#{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL} environment variable",
119
+ value: parsed_url && parsed_url.port
120
+ ),
121
+ DetectedConfiguration.new(
122
+ friendly_name: "#{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_PORT} environment variable",
123
+ value: parsed_port_from_env
124
+ )
125
+ ],
126
+ or_use_default: Datadog::Ext::Transport::HTTP::DEFAULT_PORT
127
+ )
128
+ end
129
+
130
+ def ssl?
131
+ !parsed_url.nil? && parsed_url.scheme == 'https'
132
+ end
133
+
134
+ def timeout_seconds
135
+ Datadog::Ext::Transport::HTTP::DEFAULT_TIMEOUT_SECONDS
136
+ end
137
+
138
+ def deprecated_for_removal_transport_configuration_proc
139
+ settings.tracer.transport_options if settings.tracer.transport_options.is_a?(Proc)
140
+ end
141
+
142
+ def deprecated_for_removal_transport_configuration_options
143
+ options = settings.tracer.transport_options
144
+
145
+ if options.is_a?(Hash) && !options.empty?
146
+ log_warning(
147
+ 'Configuring the tracer via a c.tracer.transport_options hash is deprecated for removal in a future ' \
148
+ "ddtrace version (c.tracer.transport_options contained '#{options.inspect}')."
149
+ )
150
+
151
+ options
152
+ end
153
+ end
154
+
155
+ def parsed_url
156
+ return @parsed_url if defined?(@parsed_url)
157
+
158
+ @parsed_url =
159
+ if unparsed_url_from_env
160
+ parsed = URI.parse(unparsed_url_from_env)
161
+
162
+ if %w[http https].include?(parsed.scheme)
163
+ parsed
164
+ else
165
+ log_warning(
166
+ "Invalid URI scheme '#{parsed.scheme}' for #{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL} " \
167
+ "environment variable ('#{unparsed_url_from_env}'). " \
168
+ "Ignoring the contents of #{Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL}."
169
+ )
170
+
171
+ nil
172
+ end
173
+ end
174
+ end
175
+
176
+ # NOTE: This should only be used AFTER parsing, via `#parsed_url`. The only other use-case where this can be used
177
+ # directly without parsing, is when displaying in warning messages, to show users what it actually contains.
178
+ def unparsed_url_from_env
179
+ @unparsed_url_from_env ||= ENV[Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL]
180
+ end
181
+
182
+ def pick_from(
183
+ # Hacky required kw args, we can get rid of this when we drop Ruby 2.0
184
+ configurations_in_priority_order: raise(ArgumentError, 'missing keyword :configurations'),
185
+ or_use_default: raise(ArgumentError, 'missing keyword :or_use_default')
186
+ )
187
+ detected_configurations_in_priority_order = configurations_in_priority_order.select(&:value?)
188
+
189
+ if detected_configurations_in_priority_order.any?
190
+ warn_if_configuration_mismatch(detected_configurations_in_priority_order)
191
+
192
+ # The configurations are listed in priority, so we only need to look at the first; if there's more than
193
+ # one, we emit a warning above
194
+ detected_configurations_in_priority_order.first.value
195
+ else
196
+ or_use_default
197
+ end
198
+ end
199
+
200
+ def warn_if_configuration_mismatch(detected_configurations_in_priority_order)
201
+ return unless detected_configurations_in_priority_order.map(&:value).uniq.size > 1
202
+
203
+ log_warning(
204
+ 'Configuration mismatch: values differ between ' \
205
+ "#{detected_configurations_in_priority_order
206
+ .map { |config| "#{config.friendly_name} ('#{config.value}')" }.join(' and ')}" \
207
+ ". Using '#{detected_configurations_in_priority_order.first.value}'."
208
+ )
209
+ end
210
+
211
+ def log_warning(message)
212
+ logger.warn(message) if logger
213
+ end
214
+
215
+ DetectedConfiguration = Struct.new(:friendly_name, :value) do
216
+ def initialize(
217
+ # Hacky required kw args, we can get rid of this when we drop Ruby 2.0
218
+ friendly_name: raise(ArgumentError, 'missing keyword :friendly_name'),
219
+ value: raise(ArgumentError, 'missing keyword :value')
220
+ )
221
+ super(friendly_name, value)
222
+ freeze
223
+ end
224
+
225
+ def value?
226
+ !value.nil?
227
+ end
228
+ end
229
+ private_constant :DetectedConfiguration
230
+
231
+ # NOTE: Due to... legacy reasons... Some classes like having an `AgentSettings` instance to fall back to.
232
+ # Because we generate this instance with an empty instance of `Settings`, the resulting `AgentSettings` below
233
+ # represents only settings specified via environment variables + the usual defaults.
234
+ #
235
+ # YOU DO NOT WANT TO USE THE BELOW INSTANCE ON ANY NEWLY WRITTEN CODE, as it ignores any settings specified
236
+ # by users via `Datadog.configure`.
237
+ ENVIRONMENT_AGENT_SETTINGS = call(Settings.new, logger: nil)
238
+ end
239
+ # rubocop:enable Metrics/ClassLength
240
+ end
241
+ end
@@ -1,3 +1,4 @@
1
+ require 'ddtrace/configuration/agent_settings_resolver'
1
2
  require 'ddtrace/diagnostics/health'
2
3
  require 'ddtrace/logger'
3
4
  require 'ddtrace/profiling'
@@ -9,7 +10,6 @@ module Datadog
9
10
  module Configuration
10
11
  # Global components for the trace library.
11
12
  # rubocop:disable Layout/LineLength
12
- # rubocop:disable Metrics/ClassLength
13
13
  class Components
14
14
  class << self
15
15
  def build_health_metrics(settings)
@@ -45,7 +45,7 @@ module Datadog
45
45
  Datadog::Workers::RuntimeMetrics.new(options)
46
46
  end
47
47
 
48
- def build_tracer(settings)
48
+ def build_tracer(settings, agent_settings)
49
49
  # If a custom tracer has been provided, use it instead.
50
50
  # Ignore all other options (they should already be configured.)
51
51
  tracer = settings.tracer.instance
@@ -63,12 +63,12 @@ module Datadog
63
63
  # tracer initialization for now. Just reconfigure using the
64
64
  # existing mutable #configure function. Remove when these components
65
65
  # are extracted.
66
- tracer.configure(build_tracer_options(settings))
66
+ tracer.configure(agent_settings: agent_settings, **build_tracer_options(settings))
67
67
 
68
68
  tracer
69
69
  end
70
70
 
71
- def build_profiler(settings)
71
+ def build_profiler(settings, agent_settings)
72
72
  return unless Datadog::Profiling.supported? && settings.profiling.enabled
73
73
 
74
74
  # Load extensions needed to support some of the Profiling features
@@ -78,7 +78,7 @@ module Datadog
78
78
 
79
79
  recorder = build_profiler_recorder(settings)
80
80
  collectors = build_profiler_collectors(settings, recorder)
81
- exporters = build_profiler_exporters(settings)
81
+ exporters = build_profiler_exporters(settings, agent_settings)
82
82
  scheduler = build_profiler_scheduler(settings, recorder, exporters)
83
83
 
84
84
  Datadog::Profiler.new(collectors, scheduler)
@@ -97,13 +97,10 @@ module Datadog
97
97
  settings = settings.tracer
98
98
 
99
99
  {}.tap do |opts|
100
- opts[:hostname] = settings.hostname unless settings.hostname.nil?
101
100
  opts[:min_spans_before_partial_flush] = settings.partial_flush.min_spans_threshold unless settings.partial_flush.min_spans_threshold.nil?
102
101
  opts[:partial_flush] = settings.partial_flush.enabled unless settings.partial_flush.enabled.nil?
103
- opts[:port] = settings.port unless settings.port.nil?
104
102
  opts[:priority_sampling] = settings.priority_sampling unless settings.priority_sampling.nil?
105
103
  opts[:sampler] = settings.sampler unless settings.sampler.nil?
106
- opts[:transport_options] = settings.transport_options
107
104
  opts[:writer] = settings.writer unless settings.writer.nil?
108
105
  opts[:writer_options] = settings.writer_options if settings.writer.nil?
109
106
  end
@@ -126,22 +123,16 @@ module Datadog
126
123
  ]
127
124
  end
128
125
 
129
- def build_profiler_exporters(settings)
130
- if settings.profiling.exporter.instances.is_a?(Array)
131
- settings.profiling.exporter.instances
132
- else
133
- transport = if settings.profiling.exporter.transport
134
- settings.profiling.exporter.transport
135
- else
136
- transport_options = settings.profiling.exporter.transport_options.dup
137
- transport_options[:site] ||= settings.site if settings.site
138
- transport_options[:api_key] ||= settings.api_key if settings.api_key
139
- transport_options[:timeout] ||= settings.profiling.upload.timeout
140
- Datadog::Profiling::Transport::HTTP.default(transport_options)
141
- end
142
-
143
- [Datadog::Profiling::Exporter.new(transport)]
144
- end
126
+ def build_profiler_exporters(settings, agent_settings)
127
+ transport =
128
+ settings.profiling.exporter.transport || Datadog::Profiling::Transport::HTTP.default(
129
+ agent_settings: agent_settings,
130
+ site: settings.site,
131
+ api_key: settings.api_key,
132
+ profiling_upload_timeout_seconds: settings.profiling.upload.timeout_seconds
133
+ )
134
+
135
+ [Datadog::Profiling::Exporter.new(transport)]
145
136
  end
146
137
 
147
138
  def build_profiler_scheduler(settings, recorder, exporters)
@@ -160,11 +151,13 @@ module Datadog
160
151
  # Logger
161
152
  @logger = self.class.build_logger(settings)
162
153
 
154
+ agent_settings = AgentSettingsResolver.call(settings, logger: @logger)
155
+
163
156
  # Tracer
164
- @tracer = self.class.build_tracer(settings)
157
+ @tracer = self.class.build_tracer(settings, agent_settings)
165
158
 
166
159
  # Profiler
167
- @profiler = self.class.build_profiler(settings)
160
+ @profiler = self.class.build_profiler(settings, agent_settings)
168
161
 
169
162
  # Runtime metrics
170
163
  @runtime_metrics = self.class.build_runtime_metrics_worker(settings)
@@ -180,9 +173,9 @@ module Datadog
180
173
  @logger.debug('Profiling started')
181
174
  profiler.start
182
175
  else
183
- # Display a warning for users who expected profiling to autostart
184
- protobuf = Datadog::Profiling.google_protobuf_supported?
185
- logger.warn("Profiling was enabled but is not supported; profiling disabled. (google-protobuf?: #{protobuf})")
176
+ # Display a warning for users who expected profiling to be enabled
177
+ unsupported_reason = Datadog::Profiling.unsupported_reason
178
+ logger.warn("Profiling was requested but is not supported, profiling disabled: #{unsupported_reason}")
186
179
  end
187
180
  else
188
181
  @logger.debug('Profiling is disabled')
@@ -14,9 +14,6 @@ module Datadog
14
14
  class Settings
15
15
  include Base
16
16
 
17
- #
18
- # Configuration options
19
- #
20
17
  settings :analytics do
21
18
  option :enabled do |o|
22
19
  o.default { env_to_bool(Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED, nil) }
@@ -116,9 +113,22 @@ module Datadog
116
113
  end
117
114
 
118
115
  settings :exporter do
119
- option :instances
120
116
  option :transport
121
- option :transport_options, default: ->(_o) { {} }, lazy: true
117
+ option :transport_options do |o|
118
+ o.setter do
119
+ # NOTE: As of April 2021 there may be a few profiler private beta customers with this setting, but since I'm
120
+ # marking this as deprecated before public beta, we can remove this for 1.0 without concern.
121
+ Datadog.logger.warn(
122
+ 'Configuring the profiler c.profiling.exporter.transport_options is no longer needed, as the profiler ' \
123
+ 'will reuse your existing global or tracer configuration. ' \
124
+ 'This setting is deprecated for removal in a future ddtrace version ' \
125
+ '(1.0 or profiling GA, whichever comes first).'
126
+ )
127
+ nil
128
+ end
129
+ o.default { nil }
130
+ o.lazy
131
+ end
122
132
  end
123
133
 
124
134
  option :max_events, default: 32768
@@ -131,7 +141,7 @@ module Datadog
131
141
  end
132
142
 
133
143
  settings :upload do
134
- option :timeout do |o|
144
+ option :timeout_seconds do |o|
135
145
  o.setter { |value| value.nil? ? 30.0 : value.to_f }
136
146
  o.default { env_to_float(Ext::Profiling::ENV_UPLOAD_TIMEOUT, 30.0) }
137
147
  o.lazy
@@ -61,7 +61,7 @@ module Datadog
61
61
  # [christian] in some cases :status is not defined,
62
62
  # rather than firing an error, simply acknowledge we don't know it.
63
63
  status = payload.fetch(:status, '?').to_s
64
- span.status = 1 if status.starts_with?('5')
64
+ span.status = 1 if status.start_with?('5')
65
65
  elsif Utils.exception_is_error?(exception)
66
66
  span.set_error(exception)
67
67
  end
@@ -11,7 +11,7 @@ module Datadog
11
11
  # You can add custom errors via `config.action_dispatch.rescue_responses`
12
12
  status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name)
13
13
  # Only 5XX exceptions are actually errors (e.g. don't flag 404s)
14
- status.to_s.starts_with?('5')
14
+ status.to_s.start_with?('5')
15
15
  else
16
16
  true
17
17
  end
@@ -19,7 +19,6 @@ module Datadog
19
19
  else
20
20
  AutoInstrument.patch_all
21
21
  end
22
- AutoInstrument.patch_all
23
22
  end
24
23
  end
25
24
 
@@ -10,6 +10,7 @@ module Datadog
10
10
  module_function
11
11
 
12
12
  # rubocop:disable Metrics/MethodLength
13
+ # rubocop:disable Metrics/AbcSize
13
14
  def patch!
14
15
  # rubocop:disable Metrics/BlockLength
15
16
  ::SuckerPunch::Job::ClassMethods.class_eval do
@@ -34,6 +35,7 @@ module Datadog
34
35
  rescue => e
35
36
  ::SuckerPunch.__exception_handler.call(e, self, args)
36
37
  end
38
+ ruby2_keywords :__run_perform if respond_to?(:ruby2_keywords, true)
37
39
 
38
40
  alias_method :__perform_async, :perform_async
39
41
  def perform_async(*args)
@@ -46,6 +48,7 @@ module Datadog
46
48
  __perform_async(*args)
47
49
  end
48
50
  end
51
+ ruby2_keywords :perform_async if respond_to?(:ruby2_keywords, true)
49
52
 
50
53
  alias_method :__perform_in, :perform_in
51
54
  def perform_in(interval, *args)
@@ -59,6 +62,7 @@ module Datadog
59
62
  __perform_in(interval, *args)
60
63
  end
61
64
  end
65
+ ruby2_keywords :perform_in if respond_to?(:ruby2_keywords, true)
62
66
 
63
67
  private
64
68