ddtrace 1.12.1 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +129 -9
  3. data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +97 -14
  4. data/ext/ddtrace_profiling_native_extension/extconf.rb +6 -0
  5. data/ext/ddtrace_profiling_native_extension/http_transport.c +19 -6
  6. data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -1
  7. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +41 -2
  8. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +6 -0
  9. data/ext/ddtrace_profiling_native_extension/stack_recorder.c +6 -10
  10. data/ext/ddtrace_profiling_native_extension/time_helpers.c +40 -4
  11. data/ext/ddtrace_profiling_native_extension/time_helpers.h +14 -0
  12. data/lib/datadog/appsec/component.rb +9 -0
  13. data/lib/datadog/appsec/configuration/settings.rb +104 -195
  14. data/lib/datadog/appsec/configuration.rb +0 -79
  15. data/lib/datadog/appsec/contrib/auto_instrument.rb +2 -4
  16. data/lib/datadog/appsec/contrib/devise/event.rb +57 -0
  17. data/lib/datadog/appsec/contrib/devise/ext.rb +13 -0
  18. data/lib/datadog/appsec/contrib/devise/integration.rb +42 -0
  19. data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +76 -0
  20. data/lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb +52 -0
  21. data/lib/datadog/appsec/contrib/devise/patcher.rb +45 -0
  22. data/lib/datadog/appsec/contrib/devise/resource.rb +35 -0
  23. data/lib/datadog/appsec/contrib/devise/tracking.rb +49 -0
  24. data/lib/datadog/appsec/contrib/rack/ext.rb +2 -1
  25. data/lib/datadog/appsec/contrib/rack/reactive/request.rb +1 -1
  26. data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +1 -1
  27. data/lib/datadog/appsec/contrib/rack/reactive/response.rb +1 -1
  28. data/lib/datadog/appsec/contrib/rack/request_middleware.rb +12 -7
  29. data/lib/datadog/appsec/contrib/rails/ext.rb +3 -2
  30. data/lib/datadog/appsec/contrib/rails/framework.rb +1 -3
  31. data/lib/datadog/appsec/contrib/rails/patcher.rb +8 -8
  32. data/lib/datadog/appsec/contrib/rails/reactive/action.rb +1 -1
  33. data/lib/datadog/appsec/contrib/sinatra/ext.rb +2 -1
  34. data/lib/datadog/appsec/contrib/sinatra/framework.rb +1 -3
  35. data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +1 -1
  36. data/lib/datadog/appsec/event.rb +1 -1
  37. data/lib/datadog/appsec/extensions.rb +1 -130
  38. data/lib/datadog/appsec/monitor/reactive/set_user.rb +1 -1
  39. data/lib/datadog/appsec/processor.rb +1 -1
  40. data/lib/datadog/appsec/rate_limiter.rb +1 -1
  41. data/lib/datadog/appsec/remote.rb +1 -1
  42. data/lib/datadog/appsec.rb +1 -2
  43. data/lib/datadog/ci/configuration/settings.rb +6 -8
  44. data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +7 -5
  45. data/lib/datadog/ci/contrib/cucumber/ext.rb +10 -8
  46. data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +35 -0
  47. data/lib/datadog/ci/contrib/minitest/ext.rb +21 -0
  48. data/lib/datadog/ci/contrib/minitest/integration.rb +49 -0
  49. data/lib/datadog/ci/contrib/minitest/patcher.rb +27 -0
  50. data/lib/datadog/ci/contrib/minitest/test_helper.rb +68 -0
  51. data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +7 -5
  52. data/lib/datadog/ci/contrib/rspec/ext.rb +9 -7
  53. data/lib/datadog/ci.rb +1 -0
  54. data/lib/datadog/core/backport.rb +51 -0
  55. data/lib/datadog/core/configuration/agent_settings_resolver.rb +9 -5
  56. data/lib/datadog/core/configuration/base.rb +5 -5
  57. data/lib/datadog/core/configuration/components.rb +6 -1
  58. data/lib/datadog/core/configuration/ext.rb +7 -5
  59. data/lib/datadog/core/configuration/option.rb +269 -19
  60. data/lib/datadog/core/configuration/option_definition.rb +76 -11
  61. data/lib/datadog/core/configuration/options.rb +22 -10
  62. data/lib/datadog/core/configuration/settings.rb +139 -61
  63. data/lib/datadog/core/environment/execution.rb +55 -0
  64. data/lib/datadog/core/environment/ext.rb +13 -11
  65. data/lib/datadog/core/environment/yjit.rb +58 -0
  66. data/lib/datadog/core/git/ext.rb +24 -22
  67. data/lib/datadog/core/logging/ext.rb +3 -1
  68. data/lib/datadog/core/metrics/ext.rb +7 -5
  69. data/lib/datadog/core/remote/client/capabilities.rb +5 -0
  70. data/lib/datadog/core/remote/client.rb +3 -0
  71. data/lib/datadog/core/remote/component.rb +25 -34
  72. data/lib/datadog/core/remote/configuration/content.rb +28 -1
  73. data/lib/datadog/core/remote/configuration/repository.rb +3 -1
  74. data/lib/datadog/core/remote/ext.rb +1 -1
  75. data/lib/datadog/core/remote/negotiation.rb +17 -4
  76. data/lib/datadog/core/runtime/ext.rb +22 -12
  77. data/lib/datadog/core/runtime/metrics.rb +43 -0
  78. data/lib/datadog/core/telemetry/client.rb +12 -2
  79. data/lib/datadog/core/telemetry/emitter.rb +4 -2
  80. data/lib/datadog/core/telemetry/event.rb +19 -4
  81. data/lib/datadog/core/telemetry/ext.rb +4 -1
  82. data/lib/datadog/core/telemetry/heartbeat.rb +2 -4
  83. data/lib/datadog/core/telemetry/http/ext.rb +10 -8
  84. data/lib/datadog/core/telemetry/http/transport.rb +1 -0
  85. data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +41 -0
  86. data/lib/datadog/core/telemetry/v2/request.rb +29 -0
  87. data/lib/datadog/core/transport/http/client.rb +1 -1
  88. data/lib/datadog/core/transport/http/config.rb +10 -0
  89. data/lib/datadog/core/utils/duration.rb +52 -0
  90. data/lib/datadog/core/utils/hash.rb +47 -0
  91. data/lib/datadog/core/utils/network.rb +1 -1
  92. data/lib/datadog/core/utils/safe_dup.rb +27 -20
  93. data/lib/datadog/core/utils.rb +1 -1
  94. data/lib/datadog/core/workers/async.rb +2 -2
  95. data/lib/datadog/kit/appsec/events.rb +139 -89
  96. data/lib/datadog/kit/identity.rb +80 -65
  97. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -0
  98. data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -0
  99. data/lib/datadog/profiling/collectors/thread_context.rb +9 -2
  100. data/lib/datadog/profiling/component.rb +41 -9
  101. data/lib/datadog/profiling/exporter.rb +5 -1
  102. data/lib/datadog/profiling/flush.rb +9 -2
  103. data/lib/datadog/profiling/http_transport.rb +13 -3
  104. data/lib/datadog/profiling/load_native_extension.rb +7 -1
  105. data/lib/datadog/profiling.rb +11 -1
  106. data/lib/datadog/tracing/component.rb +58 -6
  107. data/lib/datadog/tracing/configuration/dynamic/option.rb +71 -0
  108. data/lib/datadog/tracing/configuration/dynamic.rb +64 -0
  109. data/lib/datadog/tracing/configuration/ext.rb +35 -32
  110. data/lib/datadog/tracing/configuration/http.rb +74 -0
  111. data/lib/datadog/tracing/configuration/settings.rb +106 -92
  112. data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +9 -6
  113. data/lib/datadog/tracing/contrib/action_cable/ext.rb +20 -18
  114. data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +9 -6
  115. data/lib/datadog/tracing/contrib/action_mailer/ext.rb +20 -18
  116. data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +8 -6
  117. data/lib/datadog/tracing/contrib/action_pack/ext.rb +10 -8
  118. data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +9 -6
  119. data/lib/datadog/tracing/contrib/action_view/ext.rb +12 -10
  120. data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +13 -7
  121. data/lib/datadog/tracing/contrib/active_job/ext.rb +25 -23
  122. data/lib/datadog/tracing/contrib/active_job/log_injection.rb +1 -1
  123. data/lib/datadog/tracing/contrib/active_job/patcher.rb +1 -1
  124. data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +9 -6
  125. data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +12 -10
  126. data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +9 -7
  127. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +0 -8
  128. data/lib/datadog/tracing/contrib/active_record/ext.rb +17 -15
  129. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +0 -5
  130. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +9 -7
  131. data/lib/datadog/tracing/contrib/active_support/ext.rb +18 -16
  132. data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +14 -7
  133. data/lib/datadog/tracing/contrib/aws/ext.rb +37 -24
  134. data/lib/datadog/tracing/contrib/aws/instrumentation.rb +9 -5
  135. data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +3 -2
  136. data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +4 -2
  137. data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +14 -7
  138. data/lib/datadog/tracing/contrib/dalli/ext.rb +19 -11
  139. data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +8 -6
  140. data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +13 -7
  141. data/lib/datadog/tracing/contrib/delayed_job/ext.rb +16 -14
  142. data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +14 -7
  143. data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +21 -15
  144. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +8 -5
  145. data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +16 -9
  146. data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +43 -3
  147. data/lib/datadog/tracing/contrib/ethon/ext.rb +19 -11
  148. data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +0 -5
  149. data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +19 -10
  150. data/lib/datadog/tracing/contrib/excon/ext.rb +16 -8
  151. data/lib/datadog/tracing/contrib/excon/middleware.rb +20 -5
  152. data/lib/datadog/tracing/contrib/ext.rb +23 -1
  153. data/lib/datadog/tracing/contrib/extensions.rb +32 -0
  154. data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +20 -10
  155. data/lib/datadog/tracing/contrib/faraday/ext.rb +16 -8
  156. data/lib/datadog/tracing/contrib/faraday/middleware.rb +16 -5
  157. data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +8 -6
  158. data/lib/datadog/tracing/contrib/grape/ext.rb +16 -14
  159. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +8 -6
  160. data/lib/datadog/tracing/contrib/graphql/ext.rb +7 -5
  161. data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +19 -9
  162. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +29 -20
  163. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +21 -20
  164. data/lib/datadog/tracing/contrib/grpc/ext.rb +16 -13
  165. data/lib/datadog/tracing/contrib/grpc/formatting.rb +127 -0
  166. data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +3 -2
  167. data/lib/datadog/tracing/contrib/hanami/ext.rb +10 -8
  168. data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +4 -7
  169. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +33 -11
  170. data/lib/datadog/tracing/contrib/http/ext.rb +16 -9
  171. data/lib/datadog/tracing/contrib/http/instrumentation.rb +22 -7
  172. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +33 -11
  173. data/lib/datadog/tracing/contrib/httpclient/ext.rb +17 -9
  174. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +17 -5
  175. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +33 -11
  176. data/lib/datadog/tracing/contrib/httprb/ext.rb +16 -9
  177. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +17 -5
  178. data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +9 -6
  179. data/lib/datadog/tracing/contrib/kafka/ext.rb +42 -39
  180. data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +3 -2
  181. data/lib/datadog/tracing/contrib/lograge/ext.rb +3 -1
  182. data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -0
  183. data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +14 -7
  184. data/lib/datadog/tracing/contrib/mongodb/ext.rb +20 -16
  185. data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +9 -5
  186. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +17 -14
  187. data/lib/datadog/tracing/contrib/mysql2/ext.rb +15 -10
  188. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +9 -5
  189. data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +52 -0
  190. data/lib/datadog/tracing/contrib/opensearch/ext.rb +37 -0
  191. data/lib/datadog/tracing/contrib/opensearch/integration.rb +44 -0
  192. data/lib/datadog/tracing/contrib/opensearch/patcher.rb +128 -0
  193. data/lib/datadog/tracing/contrib/opensearch/quantize.rb +81 -0
  194. data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +17 -14
  195. data/lib/datadog/tracing/contrib/pg/ext.rb +22 -19
  196. data/lib/datadog/tracing/contrib/pg/instrumentation.rb +9 -5
  197. data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +14 -7
  198. data/lib/datadog/tracing/contrib/presto/ext.rb +25 -20
  199. data/lib/datadog/tracing/contrib/presto/instrumentation.rb +9 -5
  200. data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +12 -10
  201. data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +12 -8
  202. data/lib/datadog/tracing/contrib/qless/ext.rb +14 -12
  203. data/lib/datadog/tracing/contrib/que/configuration/settings.rb +21 -12
  204. data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +9 -7
  205. data/lib/datadog/tracing/contrib/racecar/event.rb +0 -5
  206. data/lib/datadog/tracing/contrib/racecar/ext.rb +20 -18
  207. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +16 -12
  208. data/lib/datadog/tracing/contrib/rack/ext.rb +18 -16
  209. data/lib/datadog/tracing/contrib/rack/header_collection.rb +3 -0
  210. data/lib/datadog/tracing/contrib/rack/header_tagging.rb +53 -0
  211. data/lib/datadog/tracing/contrib/rack/middlewares.rb +8 -49
  212. data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +15 -11
  213. data/lib/datadog/tracing/contrib/rails/ext.rb +7 -5
  214. data/lib/datadog/tracing/contrib/rails/log_injection.rb +7 -10
  215. data/lib/datadog/tracing/contrib/rails/patcher.rb +10 -41
  216. data/lib/datadog/tracing/contrib/rails/railtie.rb +3 -3
  217. data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +12 -9
  218. data/lib/datadog/tracing/contrib/rake/ext.rb +14 -12
  219. data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +17 -9
  220. data/lib/datadog/tracing/contrib/redis/ext.rb +22 -15
  221. data/lib/datadog/tracing/contrib/redis/tags.rb +9 -5
  222. data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +13 -7
  223. data/lib/datadog/tracing/contrib/resque/ext.rb +9 -7
  224. data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +16 -9
  225. data/lib/datadog/tracing/contrib/rest_client/ext.rb +15 -8
  226. data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +20 -5
  227. data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +9 -6
  228. data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +3 -2
  229. data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +3 -1
  230. data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +1 -0
  231. data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +9 -6
  232. data/lib/datadog/tracing/contrib/sequel/ext.rb +10 -8
  233. data/lib/datadog/tracing/contrib/sequel/utils.rb +2 -7
  234. data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +14 -8
  235. data/lib/datadog/tracing/contrib/shoryuken/ext.rb +14 -12
  236. data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +18 -11
  237. data/lib/datadog/tracing/contrib/sidekiq/ext.rb +32 -30
  238. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +11 -9
  239. data/lib/datadog/tracing/contrib/sinatra/env.rb +0 -17
  240. data/lib/datadog/tracing/contrib/sinatra/ext.rb +21 -19
  241. data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +3 -14
  242. data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +14 -8
  243. data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
  244. data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
  245. data/lib/datadog/tracing/contrib/span_attribute_schema.rb +74 -10
  246. data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +9 -6
  247. data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +9 -6
  248. data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +15 -13
  249. data/lib/datadog/tracing/contrib/utils/database.rb +5 -3
  250. data/lib/datadog/tracing/contrib.rb +1 -0
  251. data/lib/datadog/tracing/correlation.rb +9 -12
  252. data/lib/datadog/tracing/diagnostics/ext.rb +21 -19
  253. data/lib/datadog/tracing/distributed/b3_multi.rb +2 -2
  254. data/lib/datadog/tracing/distributed/b3_single.rb +1 -1
  255. data/lib/datadog/tracing/distributed/trace_context.rb +52 -17
  256. data/lib/datadog/tracing/metadata/ext.rb +9 -6
  257. data/lib/datadog/tracing/remote.rb +78 -0
  258. data/lib/datadog/tracing/sampling/rule_sampler.rb +29 -0
  259. data/lib/datadog/tracing/span_operation.rb +3 -15
  260. data/lib/datadog/tracing/trace_operation.rb +16 -3
  261. data/lib/datadog/tracing/trace_segment.rb +5 -2
  262. data/lib/datadog/tracing/tracer.rb +10 -1
  263. data/lib/ddtrace/transport/ext.rb +15 -9
  264. data/lib/ddtrace/transport/trace_formatter.rb +9 -0
  265. data/lib/ddtrace/version.rb +8 -11
  266. metadata +36 -7
  267. data/lib/datadog/tracing/contrib/sinatra/headers.rb +0 -35
@@ -7,7 +7,7 @@ module Datadog
7
7
  # Passing in a `nil` tracer is supported and will disable the following profiling features:
8
8
  # * Code Hotspots panel in the trace viewer, as well as scoping a profile down to a span
9
9
  # * Endpoint aggregation in the profiler UX, including normalization (resource per endpoint call)
10
- def self.build_profiler_component(settings:, agent_settings:, optional_tracer:)
10
+ def self.build_profiler_component(settings:, agent_settings:, optional_tracer:) # rubocop:disable Metrics/MethodLength
11
11
  return unless settings.profiling.enabled
12
12
 
13
13
  # Workaround for weird dependency direction: the Core::Configuration::Components class currently has a
@@ -64,7 +64,11 @@ module Datadog
64
64
 
65
65
  # NOTE: Please update the Initialization section of ProfilingDevelopment.md with any changes to this method
66
66
 
67
+ no_signals_workaround_enabled = false
68
+
67
69
  if enable_new_profiler?(settings)
70
+ no_signals_workaround_enabled = no_signals_workaround_enabled?(settings)
71
+
68
72
  recorder = Datadog::Profiling::StackRecorder.new(
69
73
  cpu_time_enabled: RUBY_PLATFORM.include?('linux'), # Only supported on Linux currently
70
74
  alloc_samples_enabled: false, # Always disabled for now -- work in progress
@@ -76,7 +80,8 @@ module Datadog
76
80
  endpoint_collection_enabled: settings.profiling.advanced.endpoint.collection.enabled,
77
81
  gc_profiling_enabled: enable_gc_profiling?(settings),
78
82
  allocation_counting_enabled: settings.profiling.advanced.allocation_counting_enabled,
79
- no_signals_workaround_enabled: no_signals_workaround_enabled?(settings),
83
+ no_signals_workaround_enabled: no_signals_workaround_enabled,
84
+ timeline_enabled: settings.profiling.advanced.experimental_timeline_enabled,
80
85
  )
81
86
  else
82
87
  load_pprof_support
@@ -85,7 +90,7 @@ module Datadog
85
90
  collector = build_profiler_oldstack_collector(settings, recorder, optional_tracer)
86
91
  end
87
92
 
88
- exporter = build_profiler_exporter(settings, recorder)
93
+ exporter = build_profiler_exporter(settings, recorder, no_signals_workaround_enabled: no_signals_workaround_enabled)
89
94
  transport = build_profiler_transport(settings, agent_settings)
90
95
  scheduler = Profiling::Scheduler.new(exporter: exporter, transport: transport)
91
96
 
@@ -96,11 +101,15 @@ module Datadog
96
101
  Profiling::OldRecorder.new([Profiling::Events::StackSample], settings.profiling.advanced.max_events)
97
102
  end
98
103
 
99
- private_class_method def self.build_profiler_exporter(settings, recorder)
104
+ private_class_method def self.build_profiler_exporter(settings, recorder, no_signals_workaround_enabled:)
100
105
  code_provenance_collector =
101
106
  (Profiling::Collectors::CodeProvenance.new if settings.profiling.advanced.code_provenance_enabled)
102
107
 
103
- Profiling::Exporter.new(pprof_recorder: recorder, code_provenance_collector: code_provenance_collector)
108
+ Profiling::Exporter.new(
109
+ pprof_recorder: recorder,
110
+ code_provenance_collector: code_provenance_collector,
111
+ no_signals_workaround_enabled: no_signals_workaround_enabled,
112
+ )
104
113
  end
105
114
 
106
115
  private_class_method def self.build_profiler_oldstack_collector(settings, old_recorder, tracer)
@@ -198,7 +207,7 @@ module Datadog
198
207
  if Gem.loaded_specs['mysql2'] && incompatible_libmysqlclient_version?(settings)
199
208
  Datadog.logger.warn(
200
209
  'Enabling the profiling "no signals" workaround because an incompatible version of the mysql2 gem is ' \
201
- 'installed. Profiling data will have lower quality.' \
210
+ 'installed. Profiling data will have lower quality. ' \
202
211
  'To fix this, upgrade the libmysqlclient in your OS image to version 8.0.0 or above.'
203
212
  )
204
213
  return true
@@ -214,6 +223,16 @@ module Datadog
214
223
  return true
215
224
  end
216
225
 
226
+ if defined?(::PhusionPassenger)
227
+ Datadog.logger.warn(
228
+ 'Enabling the profiling "no signals" workaround because the passenger web server is in use. ' \
229
+ 'This is needed because passenger is currently incompatible with the normal working mode ' \
230
+ 'of the profiler, as detailed in <https://github.com/DataDog/dd-trace-rb/issues/2976>. ' \
231
+ 'Profiling data will have lower quality.'
232
+ )
233
+ return true
234
+ end
235
+
217
236
  false
218
237
  end
219
238
 
@@ -236,9 +255,22 @@ module Datadog
236
255
  begin
237
256
  require 'mysql2'
238
257
 
239
- return true unless defined?(Mysql2::Client) && Mysql2::Client.respond_to?(:info)
240
-
241
- libmysqlclient_version = Gem::Version.new(Mysql2::Client.info[:version])
258
+ # The mysql2-aurora gem likes to monkey patch itself in replacement of Mysql2::Client, and uses
259
+ # `method_missing` to delegate to the original BUT unfortunately does not implement `respond_to_missing?` and
260
+ # thus our `respond_to?(:info)` below was failing.
261
+ #
262
+ # But on the bright side, the gem does stash a reference to the original Mysql2::Client class in a constant,
263
+ # so if that constant exists, we use that for our probing.
264
+ mysql2_client_class =
265
+ if defined?(Mysql2::Aurora::ORIGINAL_CLIENT_CLASS)
266
+ Mysql2::Aurora::ORIGINAL_CLIENT_CLASS
267
+ elsif defined?(Mysql2::Client)
268
+ Mysql2::Client
269
+ end
270
+
271
+ return true unless mysql2_client_class && mysql2_client_class.respond_to?(:info)
272
+
273
+ libmysqlclient_version = Gem::Version.new(mysql2_client_class.info[:version])
242
274
 
243
275
  compatible = libmysqlclient_version >= Gem::Version.new('8.0.0')
244
276
 
@@ -22,13 +22,15 @@ module Datadog
22
22
  :minimum_duration_seconds,
23
23
  :time_provider,
24
24
  :last_flush_finish_at,
25
- :created_at
25
+ :created_at,
26
+ :no_signals_workaround_enabled
26
27
 
27
28
  public
28
29
 
29
30
  def initialize(
30
31
  pprof_recorder:,
31
32
  code_provenance_collector:,
33
+ no_signals_workaround_enabled:,
32
34
  minimum_duration_seconds: PROFILE_DURATION_THRESHOLD_SECONDS,
33
35
  time_provider: Time
34
36
  )
@@ -38,6 +40,7 @@ module Datadog
38
40
  @time_provider = time_provider
39
41
  @last_flush_finish_at = nil
40
42
  @created_at = time_provider.now.utc
43
+ @no_signals_workaround_enabled = no_signals_workaround_enabled
41
44
  end
42
45
 
43
46
  def flush
@@ -61,6 +64,7 @@ module Datadog
61
64
  code_provenance_file_name: Datadog::Profiling::Ext::Transport::HTTP::CODE_PROVENANCE_FILENAME,
62
65
  code_provenance_data: uncompressed_code_provenance,
63
66
  tags_as_array: Datadog::Profiling::TagBuilder.call(settings: Datadog.configuration).to_a,
67
+ no_signals_workaround_enabled: no_signals_workaround_enabled,
64
68
  )
65
69
  end
66
70
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
4
+
3
5
  module Datadog
4
6
  module Profiling
5
7
  # Represents a collection of events of a specific type being flushed.
@@ -14,7 +16,8 @@ module Datadog
14
16
  :pprof_data, # gzipped pprof bytes
15
17
  :code_provenance_file_name,
16
18
  :code_provenance_data, # gzipped json bytes
17
- :tags_as_array
19
+ :tags_as_array,
20
+ :internal_metadata_json
18
21
 
19
22
  def initialize(
20
23
  start:,
@@ -23,7 +26,8 @@ module Datadog
23
26
  pprof_data:,
24
27
  code_provenance_file_name:,
25
28
  code_provenance_data:,
26
- tags_as_array:
29
+ tags_as_array:,
30
+ no_signals_workaround_enabled:
27
31
  )
28
32
  @start = start
29
33
  @finish = finish
@@ -32,6 +36,9 @@ module Datadog
32
36
  @code_provenance_file_name = code_provenance_file_name
33
37
  @code_provenance_data = code_provenance_data
34
38
  @tags_as_array = tags_as_array
39
+ @internal_metadata_json = JSON.fast_generate(
40
+ no_signals_workaround_enabled: (!!no_signals_workaround_enabled).to_s,
41
+ )
35
42
  end
36
43
  end
37
44
  end
@@ -40,6 +40,7 @@ module Datadog
40
40
  code_provenance_data: flush.code_provenance_data,
41
41
 
42
42
  tags_as_array: flush.tags_as_array,
43
+ internal_metadata_json: flush.internal_metadata_json,
43
44
  )
44
45
 
45
46
  if status == :ok
@@ -47,11 +48,14 @@ module Datadog
47
48
  Datadog.logger.debug('Successfully reported profiling data')
48
49
  true
49
50
  else
50
- Datadog.logger.error("Failed to report profiling data: server returned unexpected HTTP #{result} status code")
51
+ Datadog.logger.error(
52
+ "Failed to report profiling data (#{config_without_api_key}): " \
53
+ "server returned unexpected HTTP #{result} status code"
54
+ )
51
55
  false
52
56
  end
53
57
  else
54
- Datadog.logger.error("Failed to report profiling data: #{result}")
58
+ Datadog.logger.error("Failed to report profiling data (#{config_without_api_key}): #{result}")
55
59
  false
56
60
  end
57
61
  end
@@ -109,7 +113,8 @@ module Datadog
109
113
  pprof_data:,
110
114
  code_provenance_file_name:,
111
115
  code_provenance_data:,
112
- tags_as_array:
116
+ tags_as_array:,
117
+ internal_metadata_json:
113
118
  )
114
119
  self.class._native_do_export(
115
120
  exporter_configuration,
@@ -123,8 +128,13 @@ module Datadog
123
128
  code_provenance_file_name,
124
129
  code_provenance_data,
125
130
  tags_as_array,
131
+ internal_metadata_json,
126
132
  )
127
133
  end
134
+
135
+ def config_without_api_key
136
+ [@exporter_configuration[0..1]].to_h
137
+ end
128
138
  end
129
139
  end
130
140
  end
@@ -9,7 +9,13 @@
9
9
  # All code on this file is on-purpose at the top-level; this makes it so this file is executed only once,
10
10
  # the first time it gets required, to avoid any issues with the native extension being initialized more than once.
11
11
 
12
- require "ddtrace_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
12
+ begin
13
+ require "ddtrace_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
14
+ rescue LoadError => e
15
+ raise LoadError,
16
+ 'Failed to load the profiling loader extension. To fix this, please remove and then reinstall ddtrace ' \
17
+ "(Details: #{e.message})"
18
+ end
13
19
 
14
20
  extension_name = "ddtrace_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
15
21
  full_file_path = "#{__dir__}/../../#{extension_name}.#{RbConfig::CONFIG['DLEXT']}"
@@ -66,6 +66,11 @@ module Datadog
66
66
  nil
67
67
  end
68
68
 
69
+ def self.enabled?
70
+ profiler = Datadog.send(:components).profiler
71
+ !!(profiler.scheduler.running? if profiler)
72
+ end
73
+
69
74
  private_class_method def self.replace_noop_allocation_count
70
75
  def self.allocation_count # rubocop:disable Lint/DuplicateMethods, Lint/NestedMethodDefinition (On purpose!)
71
76
  Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count
@@ -178,6 +183,10 @@ module Datadog
178
183
  end
179
184
  end
180
185
 
186
+ # All requires for the profiler should be directly added here; and everything should be loaded eagerly.
187
+ # (Currently there's a few exceptions for the old profiler, but we should avoid other exceptions.)
188
+ #
189
+ # All of the profiler should be loaded and ready to go when this method returns `true`.
181
190
  private_class_method def self.load_profiling
182
191
  return false unless supported?
183
192
 
@@ -197,7 +206,8 @@ module Datadog
197
206
  require_relative 'profiling/profiler'
198
207
  require_relative 'profiling/native_extension'
199
208
  require_relative 'profiling/trace_identifiers/helper'
200
- # This file is loaded in Profiling::Component#load_pprof_support; see notes there for why
209
+ # This file is no longer eagerly loaded as a workaround for an issue. It only gets loaded dynamically if the old
210
+ # profiler is in use. See Profiling::Component#load_pprof_support for more details.
201
211
  # require_relative 'profiling/pprof/pprof_pb'
202
212
  require_relative 'profiling/tag_builder'
203
213
  require_relative 'profiling/http_transport'
@@ -10,6 +10,17 @@ module Datadog
10
10
  module Tracing
11
11
  # Tracing component
12
12
  module Component
13
+ # Methods that interact with component instance fields.
14
+ module InstanceMethods
15
+ # Hot-swaps with a new sampler.
16
+ # This operation acquires the Components lock to ensure
17
+ # there is no concurrent modification of the sampler.
18
+ def reconfigure_live_sampler
19
+ sampler = self.class.build_sampler(Datadog.configuration)
20
+ Datadog.send(:safely_synchronize) { tracer.sampler.sampler = sampler }
21
+ end
22
+ end
23
+
13
24
  def build_tracer(settings, agent_settings)
14
25
  # If a custom tracer has been provided, use it instead.
15
26
  # Ignore all other options (they should already be configured.)
@@ -27,13 +38,18 @@ module Datadog
27
38
  writer = build_writer(settings, agent_settings)
28
39
  end
29
40
 
30
- subscribe_to_writer_events!(writer, sampler, settings.tracing.test_mode.enabled)
41
+ # The sampler instance is wrapped in a delegator,
42
+ # so dynamic instrumentation can hot-swap it.
43
+ # This prevents full tracer reinitialization on sampling changes.
44
+ sampler_delegator = SamplerDelegatorComponent.new(sampler)
45
+
46
+ subscribe_to_writer_events!(writer, sampler_delegator, settings.tracing.test_mode.enabled)
31
47
 
32
48
  Tracing::Tracer.new(
33
49
  default_service: settings.service,
34
50
  enabled: settings.tracing.enabled,
35
51
  trace_flush: trace_flush,
36
- sampler: sampler,
52
+ sampler: sampler_delegator,
37
53
  span_sampler: build_span_sampler(settings),
38
54
  writer: writer,
39
55
  tags: build_tracer_tags(settings),
@@ -62,6 +78,23 @@ module Datadog
62
78
  else
63
79
  ensure_priority_sampling(sampler, settings)
64
80
  end
81
+ elsif (rules = settings.tracing.sampling.rules)
82
+ post_sampler = Tracing::Sampling::RuleSampler.parse(
83
+ rules,
84
+ settings.tracing.sampling.rate_limit,
85
+ settings.tracing.sampling.default_rate
86
+ )
87
+
88
+ post_sampler ||= # Fallback RuleSampler in case `rules` parsing fails
89
+ Tracing::Sampling::RuleSampler.new(
90
+ rate_limit: settings.tracing.sampling.rate_limit,
91
+ default_sample_rate: settings.tracing.sampling.default_rate
92
+ )
93
+
94
+ Tracing::Sampling::PrioritySampler.new(
95
+ base_sampler: Tracing::Sampling::AllSampler.new,
96
+ post_sampler: post_sampler
97
+ )
65
98
  elsif settings.tracing.priority_sampling == false
66
99
  Tracing::Sampling::RuleSampler.new(
67
100
  rate_limit: settings.tracing.sampling.rate_limit,
@@ -105,13 +138,11 @@ module Datadog
105
138
  Tracing::Writer.new(agent_settings: agent_settings, **settings.tracing.writer_options)
106
139
  end
107
140
 
108
- def subscribe_to_writer_events!(writer, sampler, test_mode)
141
+ def subscribe_to_writer_events!(writer, sampler_delegator, test_mode)
109
142
  return unless writer.respond_to?(:events) # Check if it's a custom, external writer
110
143
 
111
144
  writer.events.after_send.subscribe(&WRITER_RECORD_ENVIRONMENT_INFORMATION_CALLBACK)
112
145
 
113
- return unless sampler.is_a?(Tracing::Sampling::PrioritySampler)
114
-
115
146
  # DEV: We need to ignore priority sampling updates coming from the agent in test mode
116
147
  # because test mode wants to *unconditionally* sample all traces.
117
148
  #
@@ -119,7 +150,7 @@ module Datadog
119
150
  # here to achieve 100% sampling rate.
120
151
  return if test_mode
121
152
 
122
- writer.events.after_send.subscribe(&writer_update_priority_sampler_rates_callback(sampler))
153
+ writer.events.after_send.subscribe(&writer_update_priority_sampler_rates_callback(sampler_delegator))
123
154
  end
124
155
 
125
156
  WRITER_RECORD_ENVIRONMENT_INFORMATION_CALLBACK = lambda do |_, responses|
@@ -143,6 +174,27 @@ module Datadog
143
174
  Tracing::Sampling::Span::Sampler.new(rules || [])
144
175
  end
145
176
 
177
+ # Sampler wrapper component, to allow for hot-swapping
178
+ # the sampler instance used by the tracer.
179
+ # Swapping samplers happens during Dynamic Configuration.
180
+ class SamplerDelegatorComponent
181
+ attr_accessor :sampler
182
+
183
+ def initialize(sampler)
184
+ @sampler = sampler
185
+ end
186
+
187
+ def sample!(trace)
188
+ @sampler.sample!(trace)
189
+ end
190
+
191
+ def update(*args, **kwargs)
192
+ return unless @sampler.respond_to?(:update)
193
+
194
+ @sampler.update(*args, **kwargs)
195
+ end
196
+ end
197
+
146
198
  private
147
199
 
148
200
  def build_tracer_tags(settings)
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module Tracing
5
+ module Configuration
6
+ module Dynamic
7
+ # Maps a remote dynamic configuration to a location configuration option.
8
+ class Option
9
+ attr_reader :name, :env_var
10
+
11
+ # @param name [String] dynamic configuration option name. This must match the remote configuration payload.
12
+ def initialize(name, env_var)
13
+ @name = name
14
+ @env_var = env_var
15
+ end
16
+
17
+ # Reconfigures the provided option, setting its value to `value`.
18
+ #
19
+ # @param value [Object,nil] the new value for this option
20
+ def call(value)
21
+ raise NotImplementedError
22
+ end
23
+ end
24
+
25
+ # A dynamic configuration option that can directly mapped to a `Datadog.configuration`
26
+ # option and changing such option is the only requirement to apply the configuration locally.
27
+ class SimpleOption < Option
28
+ # @param name [String] dynamic configuration option name. This must match the remote configuration payload.
29
+ # @param env_var [String] the canonical environment variable that represents this option.
30
+ # This is used for telemetry reporting.
31
+ # @param setting_key [Symbol] option from `Datadog.configuration.tracing` that will be modified
32
+ #
33
+ # DEV: `Datadog.configuration` cannot be an argument default value because
34
+ # DEV: it is dynamic. Also, it is not yet declared when this method is parsed by Ruby.
35
+ def initialize(name, env_var, setting_key)
36
+ super(name, env_var)
37
+ @setting_key = setting_key
38
+ end
39
+
40
+ # Reconfigures the provided option, setting its value to `value`.
41
+ #
42
+ # @param value [Object,nil] the new value for this option
43
+ def call(value)
44
+ Datadog.logger.debug { "Reconfigured tracer option `#{@setting_key}` with value `#{value}`" }
45
+
46
+ if value.nil?
47
+ # Restore the local configuration value
48
+ configuration_object.unset_option(
49
+ @setting_key,
50
+ precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION
51
+ )
52
+ else
53
+ configuration_object.set_option(
54
+ @setting_key,
55
+ value,
56
+ precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION
57
+ )
58
+ end
59
+ end
60
+
61
+ protected
62
+
63
+ # The base where `setting_key` will apply
64
+ def configuration_object
65
+ Datadog.configuration.tracing
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'dynamic/option'
4
+
5
+ module Datadog
6
+ module Tracing
7
+ module Configuration
8
+ # Tracing Dynamic Configuration,
9
+ # powered by the Remote Configuration platform.
10
+ module Dynamic
11
+ # Dynamic configuration for `DD_LOGS_INJECTION`.
12
+ class LogInjectionEnabled < SimpleOption
13
+ def initialize
14
+ super('log_injection_enabled', 'DD_LOGS_INJECTION', :log_injection)
15
+ end
16
+ end
17
+
18
+ # Dynamic configuration for `DD_TRACE_HEADER_TAGS`.
19
+ class TracingHeaderTags < SimpleOption
20
+ def initialize
21
+ super('tracing_header_tags', 'DD_TRACE_HEADER_TAGS', :header_tags)
22
+ end
23
+
24
+ def call(tracing_header_tags)
25
+ # Modify the remote configuration value that it matches the
26
+ # environment variable it configures.
27
+ if tracing_header_tags
28
+ tracing_header_tags.map! do |hash|
29
+ "#{hash['header']}:#{hash['tag_name']}"
30
+ end
31
+ end
32
+
33
+ super(tracing_header_tags)
34
+ end
35
+ end
36
+
37
+ # Dynamic configuration for `DD_TRACE_SAMPLE_RATE`.
38
+ class TracingSamplingRate < SimpleOption
39
+ def initialize
40
+ super('tracing_sampling_rate', 'DD_TRACE_SAMPLE_RATE', :default_rate)
41
+ end
42
+
43
+ # Ensures sampler is rebuilt and new configuration is applied
44
+ def call(tracing_sampling_rate)
45
+ super
46
+ Datadog.send(:components).reconfigure_live_sampler
47
+ end
48
+
49
+ protected
50
+
51
+ def configuration_object
52
+ Datadog.configuration.tracing.sampling
53
+ end
54
+ end
55
+
56
+ # List of all tracing dynamic configuration options supported.
57
+ OPTIONS = [LogInjectionEnabled, TracingHeaderTags, TracingSamplingRate].map do |option_class|
58
+ option = option_class.new
59
+ [option.name, option.env_var, option]
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,99 +1,102 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Datadog
2
4
  module Tracing
3
5
  module Configuration
4
6
  # Constants for configuration settings
5
7
  # e.g. Env vars, default values, enums, etc...
6
8
  module Ext
7
- ENV_ENABLED = 'DD_TRACE_ENABLED'.freeze
8
- ENV_TRACE_ID_128_BIT_GENERATION_ENABLED = 'DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED'.freeze
9
+ ENV_ENABLED = 'DD_TRACE_ENABLED'
10
+ ENV_HEADER_TAGS = 'DD_TRACE_HEADER_TAGS'
11
+ ENV_TRACE_ID_128_BIT_GENERATION_ENABLED = 'DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED'
9
12
 
10
13
  # @public_api
11
14
  module SpanAttributeSchema
12
- ENV_SPAN_ATTRIBUTE_SCHEMA = 'DD_TRACE_SPAN_ATTRIBUTE_SCHEMA'.freeze
13
- DEFAULT_VERSION = 'v0'.freeze
14
- VERSION_ONE = 'v1'.freeze
15
+ ENV_GLOBAL_DEFAULT_SERVICE_NAME_ENABLED = 'DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED'
16
+ ENV_PEER_SERVICE_MAPPING = 'DD_TRACE_PEER_SERVICE_MAPPING'
15
17
  end
16
18
 
17
19
  # @public_api
18
20
  module Analytics
19
- ENV_TRACE_ANALYTICS_ENABLED = 'DD_TRACE_ANALYTICS_ENABLED'.freeze
21
+ ENV_TRACE_ANALYTICS_ENABLED = 'DD_TRACE_ANALYTICS_ENABLED'
20
22
  end
21
23
 
22
24
  # @public_api
23
25
  module Correlation
24
- ENV_LOGS_INJECTION_ENABLED = 'DD_LOGS_INJECTION'.freeze
25
- ENV_TRACE_ID_128_BIT_LOGGING_ENABLED = 'DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED'.freeze
26
+ ENV_LOGS_INJECTION_ENABLED = 'DD_LOGS_INJECTION'
27
+ ENV_TRACE_ID_128_BIT_LOGGING_ENABLED = 'DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED'
26
28
  end
27
29
 
28
30
  # @public_api
29
31
  module Distributed
30
32
  # Custom Datadog format
31
- PROPAGATION_STYLE_DATADOG = 'Datadog'.freeze
33
+ PROPAGATION_STYLE_DATADOG = 'Datadog'
32
34
 
33
- PROPAGATION_STYLE_B3_MULTI_HEADER = 'b3multi'.freeze
35
+ PROPAGATION_STYLE_B3_MULTI_HEADER = 'b3multi'
34
36
  # @deprecated Use `b3multi` instead.
35
- PROPAGATION_STYLE_B3 = 'B3'.freeze
37
+ PROPAGATION_STYLE_B3 = 'B3'
36
38
 
37
- PROPAGATION_STYLE_B3_SINGLE_HEADER = 'b3'.freeze
39
+ PROPAGATION_STYLE_B3_SINGLE_HEADER = 'b3'
38
40
  # @deprecated Use `b3` instead.
39
- PROPAGATION_STYLE_B3_SINGLE_HEADER_OLD = 'B3 single header'.freeze
41
+ PROPAGATION_STYLE_B3_SINGLE_HEADER_OLD = 'B3 single header'
40
42
 
41
43
  # W3C Trace Context
42
- PROPAGATION_STYLE_TRACE_CONTEXT = 'tracecontext'.freeze
44
+ PROPAGATION_STYLE_TRACE_CONTEXT = 'tracecontext'
43
45
 
44
46
  # Sets both extract and inject propagation style tho the provided value.
45
47
  # Has lower precedence than `DD_TRACE_PROPAGATION_STYLE_INJECT` or
46
48
  # `DD_TRACE_PROPAGATION_STYLE_EXTRACT`.
47
- ENV_PROPAGATION_STYLE = 'DD_TRACE_PROPAGATION_STYLE'.freeze
49
+ ENV_PROPAGATION_STYLE = 'DD_TRACE_PROPAGATION_STYLE'
48
50
 
49
- ENV_PROPAGATION_STYLE_INJECT = 'DD_TRACE_PROPAGATION_STYLE_INJECT'.freeze
51
+ ENV_PROPAGATION_STYLE_INJECT = 'DD_TRACE_PROPAGATION_STYLE_INJECT'
50
52
  # @deprecated Use `DD_TRACE_PROPAGATION_STYLE_INJECT` instead.
51
- ENV_PROPAGATION_STYLE_INJECT_OLD = 'DD_PROPAGATION_STYLE_INJECT'.freeze
53
+ ENV_PROPAGATION_STYLE_INJECT_OLD = 'DD_PROPAGATION_STYLE_INJECT'
52
54
 
53
- ENV_PROPAGATION_STYLE_EXTRACT = 'DD_TRACE_PROPAGATION_STYLE_EXTRACT'.freeze
55
+ ENV_PROPAGATION_STYLE_EXTRACT = 'DD_TRACE_PROPAGATION_STYLE_EXTRACT'
54
56
  # @deprecated Use `DD_TRACE_PROPAGATION_STYLE_EXTRACT` instead.
55
- ENV_PROPAGATION_STYLE_EXTRACT_OLD = 'DD_PROPAGATION_STYLE_EXTRACT'.freeze
57
+ ENV_PROPAGATION_STYLE_EXTRACT_OLD = 'DD_PROPAGATION_STYLE_EXTRACT'
56
58
 
57
59
  # A no-op propagator. Compatible with OpenTelemetry's `none` propagator.
58
60
  # @see https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#get_otel__propagators
59
- PROPAGATION_STYLE_NONE = 'none'.freeze
61
+ PROPAGATION_STYLE_NONE = 'none'
60
62
 
61
- ENV_X_DATADOG_TAGS_MAX_LENGTH = 'DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH'.freeze
63
+ ENV_X_DATADOG_TAGS_MAX_LENGTH = 'DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH'
62
64
  end
63
65
 
64
66
  # @public_api
65
67
  module NET
66
- ENV_REPORT_HOSTNAME = 'DD_TRACE_REPORT_HOSTNAME'.freeze
68
+ ENV_REPORT_HOSTNAME = 'DD_TRACE_REPORT_HOSTNAME'
67
69
  end
68
70
 
69
71
  # @public_api
70
72
  module Sampling
71
- ENV_SAMPLE_RATE = 'DD_TRACE_SAMPLE_RATE'.freeze
72
- ENV_RATE_LIMIT = 'DD_TRACE_RATE_LIMIT'.freeze
73
+ ENV_SAMPLE_RATE = 'DD_TRACE_SAMPLE_RATE'
74
+ ENV_RATE_LIMIT = 'DD_TRACE_RATE_LIMIT'
75
+ ENV_RULES = 'DD_TRACE_SAMPLING_RULES'
73
76
 
74
77
  # @public_api
75
78
  module Span
76
- ENV_SPAN_SAMPLING_RULES = 'DD_SPAN_SAMPLING_RULES'.freeze
77
- ENV_SPAN_SAMPLING_RULES_FILE = 'DD_SPAN_SAMPLING_RULES_FILE'.freeze
79
+ ENV_SPAN_SAMPLING_RULES = 'DD_SPAN_SAMPLING_RULES'
80
+ ENV_SPAN_SAMPLING_RULES_FILE = 'DD_SPAN_SAMPLING_RULES_FILE'
78
81
  end
79
82
  end
80
83
 
81
84
  # @public_api
82
85
  module Test
83
- ENV_MODE_ENABLED = 'DD_TRACE_TEST_MODE_ENABLED'.freeze
86
+ ENV_MODE_ENABLED = 'DD_TRACE_TEST_MODE_ENABLED'
84
87
  end
85
88
 
86
89
  # @public_api
87
90
  module Transport
88
- ENV_DEFAULT_PORT = 'DD_TRACE_AGENT_PORT'.freeze
89
- ENV_DEFAULT_URL = 'DD_TRACE_AGENT_URL'.freeze
91
+ ENV_DEFAULT_PORT = 'DD_TRACE_AGENT_PORT'
92
+ ENV_DEFAULT_URL = 'DD_TRACE_AGENT_URL'
90
93
  end
91
94
 
92
95
  # @public_api
93
96
  module ClientIp
94
- ENV_ENABLED = 'DD_TRACE_CLIENT_IP_ENABLED'.freeze
95
- ENV_DISABLED = 'DD_TRACE_CLIENT_IP_HEADER_DISABLED'.freeze # TODO: deprecated, remove later
96
- ENV_HEADER_NAME = 'DD_TRACE_CLIENT_IP_HEADER'.freeze
97
+ ENV_ENABLED = 'DD_TRACE_CLIENT_IP_ENABLED'
98
+ ENV_DISABLED = 'DD_TRACE_CLIENT_IP_HEADER_DISABLED' # TODO: deprecated, remove later
99
+ ENV_HEADER_NAME = 'DD_TRACE_CLIENT_IP_HEADER'
97
100
  end
98
101
  end
99
102
  end