ddtrace 1.12.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +109 -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/base.rb +5 -5
  56. data/lib/datadog/core/configuration/components.rb +6 -1
  57. data/lib/datadog/core/configuration/ext.rb +7 -5
  58. data/lib/datadog/core/configuration/option.rb +269 -19
  59. data/lib/datadog/core/configuration/option_definition.rb +76 -11
  60. data/lib/datadog/core/configuration/options.rb +22 -10
  61. data/lib/datadog/core/configuration/settings.rb +116 -61
  62. data/lib/datadog/core/environment/ext.rb +13 -11
  63. data/lib/datadog/core/environment/yjit.rb +58 -0
  64. data/lib/datadog/core/git/ext.rb +24 -22
  65. data/lib/datadog/core/logging/ext.rb +3 -1
  66. data/lib/datadog/core/metrics/ext.rb +7 -5
  67. data/lib/datadog/core/remote/client/capabilities.rb +5 -0
  68. data/lib/datadog/core/remote/client.rb +3 -0
  69. data/lib/datadog/core/remote/component.rb +25 -34
  70. data/lib/datadog/core/remote/configuration/content.rb +28 -1
  71. data/lib/datadog/core/remote/configuration/repository.rb +3 -1
  72. data/lib/datadog/core/remote/ext.rb +1 -1
  73. data/lib/datadog/core/remote/negotiation.rb +17 -4
  74. data/lib/datadog/core/runtime/ext.rb +22 -12
  75. data/lib/datadog/core/runtime/metrics.rb +43 -0
  76. data/lib/datadog/core/telemetry/client.rb +12 -2
  77. data/lib/datadog/core/telemetry/emitter.rb +4 -2
  78. data/lib/datadog/core/telemetry/event.rb +19 -4
  79. data/lib/datadog/core/telemetry/ext.rb +4 -1
  80. data/lib/datadog/core/telemetry/heartbeat.rb +2 -4
  81. data/lib/datadog/core/telemetry/http/ext.rb +10 -8
  82. data/lib/datadog/core/telemetry/http/transport.rb +1 -0
  83. data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +41 -0
  84. data/lib/datadog/core/telemetry/v2/request.rb +29 -0
  85. data/lib/datadog/core/transport/http/client.rb +1 -1
  86. data/lib/datadog/core/transport/http/config.rb +10 -0
  87. data/lib/datadog/core/utils/duration.rb +52 -0
  88. data/lib/datadog/core/utils/hash.rb +47 -0
  89. data/lib/datadog/core/utils/network.rb +1 -1
  90. data/lib/datadog/core/utils/safe_dup.rb +27 -20
  91. data/lib/datadog/core/utils.rb +1 -1
  92. data/lib/datadog/core/workers/async.rb +2 -2
  93. data/lib/datadog/kit/appsec/events.rb +139 -89
  94. data/lib/datadog/kit/identity.rb +80 -65
  95. data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -0
  96. data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -0
  97. data/lib/datadog/profiling/collectors/thread_context.rb +9 -2
  98. data/lib/datadog/profiling/component.rb +41 -9
  99. data/lib/datadog/profiling/exporter.rb +5 -1
  100. data/lib/datadog/profiling/flush.rb +9 -2
  101. data/lib/datadog/profiling/http_transport.rb +4 -1
  102. data/lib/datadog/profiling/load_native_extension.rb +7 -1
  103. data/lib/datadog/profiling.rb +11 -1
  104. data/lib/datadog/tracing/component.rb +58 -6
  105. data/lib/datadog/tracing/configuration/dynamic/option.rb +71 -0
  106. data/lib/datadog/tracing/configuration/dynamic.rb +64 -0
  107. data/lib/datadog/tracing/configuration/ext.rb +35 -32
  108. data/lib/datadog/tracing/configuration/http.rb +74 -0
  109. data/lib/datadog/tracing/configuration/settings.rb +106 -92
  110. data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +9 -6
  111. data/lib/datadog/tracing/contrib/action_cable/ext.rb +20 -18
  112. data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +9 -6
  113. data/lib/datadog/tracing/contrib/action_mailer/ext.rb +20 -18
  114. data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +8 -6
  115. data/lib/datadog/tracing/contrib/action_pack/ext.rb +10 -8
  116. data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +9 -6
  117. data/lib/datadog/tracing/contrib/action_view/ext.rb +12 -10
  118. data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +13 -7
  119. data/lib/datadog/tracing/contrib/active_job/ext.rb +25 -23
  120. data/lib/datadog/tracing/contrib/active_job/log_injection.rb +1 -1
  121. data/lib/datadog/tracing/contrib/active_job/patcher.rb +1 -1
  122. data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +9 -6
  123. data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +12 -10
  124. data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +9 -7
  125. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +0 -8
  126. data/lib/datadog/tracing/contrib/active_record/ext.rb +17 -15
  127. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +0 -5
  128. data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +9 -7
  129. data/lib/datadog/tracing/contrib/active_support/ext.rb +18 -16
  130. data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +14 -7
  131. data/lib/datadog/tracing/contrib/aws/ext.rb +37 -24
  132. data/lib/datadog/tracing/contrib/aws/instrumentation.rb +9 -5
  133. data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +3 -2
  134. data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +4 -2
  135. data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +14 -7
  136. data/lib/datadog/tracing/contrib/dalli/ext.rb +19 -11
  137. data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +8 -6
  138. data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +13 -7
  139. data/lib/datadog/tracing/contrib/delayed_job/ext.rb +16 -14
  140. data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +14 -7
  141. data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +21 -15
  142. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +8 -5
  143. data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +16 -9
  144. data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +43 -3
  145. data/lib/datadog/tracing/contrib/ethon/ext.rb +19 -11
  146. data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +0 -5
  147. data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +19 -10
  148. data/lib/datadog/tracing/contrib/excon/ext.rb +16 -8
  149. data/lib/datadog/tracing/contrib/excon/middleware.rb +20 -5
  150. data/lib/datadog/tracing/contrib/ext.rb +23 -1
  151. data/lib/datadog/tracing/contrib/extensions.rb +32 -0
  152. data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +20 -10
  153. data/lib/datadog/tracing/contrib/faraday/ext.rb +16 -8
  154. data/lib/datadog/tracing/contrib/faraday/middleware.rb +16 -5
  155. data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +8 -6
  156. data/lib/datadog/tracing/contrib/grape/ext.rb +16 -14
  157. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +8 -6
  158. data/lib/datadog/tracing/contrib/graphql/ext.rb +7 -5
  159. data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +19 -9
  160. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +29 -20
  161. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +21 -20
  162. data/lib/datadog/tracing/contrib/grpc/ext.rb +16 -13
  163. data/lib/datadog/tracing/contrib/grpc/formatting.rb +127 -0
  164. data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +3 -2
  165. data/lib/datadog/tracing/contrib/hanami/ext.rb +10 -8
  166. data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +4 -7
  167. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +33 -11
  168. data/lib/datadog/tracing/contrib/http/ext.rb +16 -9
  169. data/lib/datadog/tracing/contrib/http/instrumentation.rb +17 -5
  170. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +33 -11
  171. data/lib/datadog/tracing/contrib/httpclient/ext.rb +17 -9
  172. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +17 -5
  173. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +33 -11
  174. data/lib/datadog/tracing/contrib/httprb/ext.rb +16 -9
  175. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +17 -5
  176. data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +9 -6
  177. data/lib/datadog/tracing/contrib/kafka/ext.rb +42 -39
  178. data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +3 -2
  179. data/lib/datadog/tracing/contrib/lograge/ext.rb +3 -1
  180. data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -0
  181. data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +14 -7
  182. data/lib/datadog/tracing/contrib/mongodb/ext.rb +20 -16
  183. data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +9 -5
  184. data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +17 -14
  185. data/lib/datadog/tracing/contrib/mysql2/ext.rb +15 -10
  186. data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +9 -5
  187. data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +52 -0
  188. data/lib/datadog/tracing/contrib/opensearch/ext.rb +37 -0
  189. data/lib/datadog/tracing/contrib/opensearch/integration.rb +44 -0
  190. data/lib/datadog/tracing/contrib/opensearch/patcher.rb +128 -0
  191. data/lib/datadog/tracing/contrib/opensearch/quantize.rb +81 -0
  192. data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +17 -14
  193. data/lib/datadog/tracing/contrib/pg/ext.rb +22 -19
  194. data/lib/datadog/tracing/contrib/pg/instrumentation.rb +9 -5
  195. data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +14 -7
  196. data/lib/datadog/tracing/contrib/presto/ext.rb +25 -20
  197. data/lib/datadog/tracing/contrib/presto/instrumentation.rb +9 -5
  198. data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +12 -10
  199. data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +12 -8
  200. data/lib/datadog/tracing/contrib/qless/ext.rb +14 -12
  201. data/lib/datadog/tracing/contrib/que/configuration/settings.rb +21 -12
  202. data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +9 -7
  203. data/lib/datadog/tracing/contrib/racecar/event.rb +0 -5
  204. data/lib/datadog/tracing/contrib/racecar/ext.rb +20 -18
  205. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +16 -12
  206. data/lib/datadog/tracing/contrib/rack/ext.rb +18 -16
  207. data/lib/datadog/tracing/contrib/rack/header_collection.rb +3 -0
  208. data/lib/datadog/tracing/contrib/rack/header_tagging.rb +53 -0
  209. data/lib/datadog/tracing/contrib/rack/middlewares.rb +8 -49
  210. data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +15 -11
  211. data/lib/datadog/tracing/contrib/rails/ext.rb +7 -5
  212. data/lib/datadog/tracing/contrib/rails/log_injection.rb +4 -10
  213. data/lib/datadog/tracing/contrib/rails/patcher.rb +10 -41
  214. data/lib/datadog/tracing/contrib/rails/railtie.rb +3 -3
  215. data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +12 -9
  216. data/lib/datadog/tracing/contrib/rake/ext.rb +14 -12
  217. data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +17 -9
  218. data/lib/datadog/tracing/contrib/redis/ext.rb +22 -15
  219. data/lib/datadog/tracing/contrib/redis/tags.rb +9 -5
  220. data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +13 -7
  221. data/lib/datadog/tracing/contrib/resque/ext.rb +9 -7
  222. data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +16 -9
  223. data/lib/datadog/tracing/contrib/rest_client/ext.rb +15 -8
  224. data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +20 -5
  225. data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +9 -6
  226. data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +3 -2
  227. data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +3 -1
  228. data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +1 -0
  229. data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +9 -6
  230. data/lib/datadog/tracing/contrib/sequel/ext.rb +10 -8
  231. data/lib/datadog/tracing/contrib/sequel/utils.rb +2 -7
  232. data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +14 -8
  233. data/lib/datadog/tracing/contrib/shoryuken/ext.rb +14 -12
  234. data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +18 -11
  235. data/lib/datadog/tracing/contrib/sidekiq/ext.rb +32 -30
  236. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +11 -9
  237. data/lib/datadog/tracing/contrib/sinatra/env.rb +0 -17
  238. data/lib/datadog/tracing/contrib/sinatra/ext.rb +21 -19
  239. data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +3 -14
  240. data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +14 -8
  241. data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
  242. data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
  243. data/lib/datadog/tracing/contrib/span_attribute_schema.rb +74 -10
  244. data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +9 -6
  245. data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +9 -6
  246. data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +15 -13
  247. data/lib/datadog/tracing/contrib/utils/database.rb +5 -3
  248. data/lib/datadog/tracing/correlation.rb +9 -12
  249. data/lib/datadog/tracing/diagnostics/ext.rb +21 -19
  250. data/lib/datadog/tracing/distributed/b3_multi.rb +2 -2
  251. data/lib/datadog/tracing/distributed/b3_single.rb +1 -1
  252. data/lib/datadog/tracing/distributed/trace_context.rb +52 -17
  253. data/lib/datadog/tracing/metadata/ext.rb +9 -6
  254. data/lib/datadog/tracing/remote.rb +78 -0
  255. data/lib/datadog/tracing/sampling/rule_sampler.rb +29 -0
  256. data/lib/datadog/tracing/span_operation.rb +3 -15
  257. data/lib/datadog/tracing/trace_operation.rb +16 -3
  258. data/lib/datadog/tracing/trace_segment.rb +5 -2
  259. data/lib/datadog/tracing/tracer.rb +10 -1
  260. data/lib/ddtrace/transport/ext.rb +15 -9
  261. data/lib/ddtrace/transport/trace_formatter.rb +9 -0
  262. data/lib/ddtrace/version.rb +9 -12
  263. metadata +38 -10
  264. data/lib/datadog/tracing/contrib/sinatra/headers.rb +0 -35
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module Tracing
5
+ module Configuration
6
+ module HTTP
7
+ # Datadog tracing supports capturing HTTP request and response headers as span tags.
8
+ #
9
+ # The provided configuration String for this feature has to be pre-processed to
10
+ # allow for ease of utilization by each HTTP integration.
11
+ #
12
+ # This class process configuration, stores the result, and provides methods to
13
+ # utilize this configuration.
14
+ class HeaderTags
15
+ # @param header_tags [Array<String>] The list of strings from DD_TRACE_HEADER_TAGS.
16
+ def initialize(header_tags)
17
+ @request_headers = {}
18
+ @response_headers = {}
19
+ @header_tags = header_tags
20
+
21
+ @header_tags.each do |header_tag|
22
+ header, tag = header_tag.split(':', 2)
23
+
24
+ next unless header # Empty string guard
25
+
26
+ if tag && !tag.empty?
27
+ # When a custom tag name is provided, use that name for both
28
+ # request and response tags.
29
+ normalized_tag = Tracing::Metadata::Ext::HTTP::Headers.to_tag(tag, allow_nested: true)
30
+ request = response = normalized_tag
31
+ else
32
+ # Otherwise, use our internal pattern of
33
+ # "http.{request|response}.headers.{header}" as tag name.
34
+ request = Tracing::Metadata::Ext::HTTP::RequestHeaders.to_tag(header)
35
+ response = Tracing::Metadata::Ext::HTTP::ResponseHeaders.to_tag(header)
36
+ end
37
+
38
+ @request_headers[header] = request
39
+ @response_headers[header] = response
40
+ end
41
+ end
42
+
43
+ # Receives a case insensitive hash with the request headers and returns
44
+ # a list of tag names and values that can be set in a span.
45
+ def request_tags(headers)
46
+ @request_headers.map do |header_name, span_tag|
47
+ # Case-insensitive search
48
+ header_value = headers[header_name]
49
+
50
+ [span_tag, header_value] if header_value
51
+ end.compact
52
+ end
53
+
54
+ # Receives a case insensitive hash with the response headers and returns
55
+ # a list of tag names and values that can be set in a span.
56
+ def response_tags(headers)
57
+ @response_headers.map do |header_name, span_tag|
58
+ # Case-insensitive search
59
+ header_value = headers[header_name]
60
+
61
+ [span_tag, header_value] if header_value
62
+ end.compact
63
+ end
64
+
65
+ # For easy configuration inspection,
66
+ # print the original configuration setting.
67
+ def to_s
68
+ @header_tags.join(',').to_s
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative '../../tracing/configuration/ext'
2
+ require_relative 'http'
2
3
 
3
4
  module Datadog
4
5
  module Tracing
@@ -26,8 +27,8 @@ module Datadog
26
27
  # @default `DD_TRACE_ANALYTICS_ENABLED` environment variable, otherwise `nil`
27
28
  # @return [Boolean,nil]
28
29
  option :enabled do |o|
29
- o.default { env_to_bool(Tracing::Configuration::Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED, nil) }
30
- o.lazy
30
+ o.type :bool, nilable: true
31
+ o.env Tracing::Configuration::Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED
31
32
  end
32
33
  end
33
34
 
@@ -51,23 +52,18 @@ module Datadog
51
52
  # otherwise `['Datadog','b3multi','b3']`.
52
53
  # @return [Array<String>]
53
54
  option :propagation_extract_style do |o|
54
- o.default do
55
- # DEV-2.0: Change default value to `tracecontext, Datadog`.
56
- # Look for all headers by default
57
- env_to_list(
58
- [
59
- Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT,
60
- Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT_OLD
61
- ],
62
- [
63
- Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
64
- Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER,
65
- Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER
66
- ],
67
- comma_separated_only: true
68
- )
69
- end
70
-
55
+ o.type :array
56
+ o.deprecated_env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT_OLD
57
+ o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_EXTRACT
58
+ # DEV-2.0: Change default value to `tracecontext, Datadog`.
59
+ # Look for all headers by default
60
+ o.default(
61
+ [
62
+ Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
63
+ Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER,
64
+ Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER,
65
+ ]
66
+ )
71
67
  o.on_set do |styles|
72
68
  # Modernize B3 options
73
69
  # DEV-2.0: Can be removed with the removal of deprecated B3 constants.
@@ -82,8 +78,6 @@ module Datadog
82
78
  end
83
79
  end
84
80
  end
85
-
86
- o.lazy
87
81
  end
88
82
 
89
83
  # The data propagation styles the tracer will use to inject distributed tracing propagation
@@ -94,18 +88,11 @@ module Datadog
94
88
  # @default `DD_TRACE_PROPAGATION_STYLE_INJECT` environment variable (comma-separated list), otherwise `['Datadog']`.
95
89
  # @return [Array<String>]
96
90
  option :propagation_inject_style do |o|
97
- o.default do
98
- # DEV-2.0: Change default value to `tracecontext, Datadog`.
99
- env_to_list(
100
- [
101
- Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT,
102
- Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT_OLD
103
- ],
104
- [Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG],
105
- comma_separated_only: true # Only inject Datadog headers by default
106
- )
107
- end
108
-
91
+ o.type :array
92
+ o.deprecated_env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT_OLD
93
+ o.env Tracing::Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE_INJECT
94
+ # DEV-2.0: Change default value to `tracecontext, Datadog`.
95
+ o.default [Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG]
109
96
  o.on_set do |styles|
110
97
  # Modernize B3 options
111
98
  # DEV-2.0: Can be removed with the removal of deprecated B3 constants.
@@ -120,8 +107,6 @@ module Datadog
120
107
  end
121
108
  end
122
109
  end
123
-
124
- o.lazy
125
110
  end
126
111
 
127
112
  # An ordered list of what data propagation styles the tracer will use to extract distributed tracing propagation
@@ -133,12 +118,11 @@ module Datadog
133
118
  # @default `DD_TRACE_PROPAGATION_STYLE` environment variable (comma-separated list).
134
119
  # @return [Array<String>]
135
120
  option :propagation_style do |o|
136
- o.default do
137
- env_to_list(Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE, nil, comma_separated_only: true)
138
- end
139
-
121
+ o.type :array
122
+ o.env Configuration::Ext::Distributed::ENV_PROPAGATION_STYLE
123
+ o.default []
140
124
  o.on_set do |styles|
141
- next unless styles
125
+ next if styles.empty?
142
126
 
143
127
  # Modernize B3 options
144
128
  # DEV-2.0: Can be removed with the removal of deprecated B3 constants.
@@ -156,8 +140,6 @@ module Datadog
156
140
  set_option(:propagation_extract_style, styles)
157
141
  set_option(:propagation_inject_style, styles)
158
142
  end
159
-
160
- o.lazy
161
143
  end
162
144
  end
163
145
 
@@ -169,8 +151,27 @@ module Datadog
169
151
  # @default `DD_TRACE_ENABLED` environment variable, otherwise `true`
170
152
  # @return [Boolean]
171
153
  option :enabled do |o|
172
- o.default { env_to_bool(Tracing::Configuration::Ext::ENV_ENABLED, true) }
173
- o.lazy
154
+ o.env Tracing::Configuration::Ext::ENV_ENABLED
155
+ o.default true
156
+ o.type :bool
157
+ end
158
+
159
+ # Comma-separated, case-insensitive list of header names that are reported in incoming and outgoing HTTP requests.
160
+ #
161
+ # Each header in the list can either be:
162
+ # * A header name, which is mapped to the respective tags `http.request.headers.<header name>` and `http.response.headers.<header name>`.
163
+ # * A key value pair, "header name:tag name", which is mapped to the span tag `tag name`.
164
+ #
165
+ # You can mix the two types of header declaration in the same list.
166
+ # Tag names will be normalized based on the [Datadog tag normalization rules](https://docs.datadoghq.com/getting_started/tagging/#defining-tags).
167
+ #
168
+ # @default `DD_TRACE_HEADER_TAGS` environment variable, otherwise an empty set of tags
169
+ # @return [Array<String>]
170
+ option :header_tags do |o|
171
+ o.env Configuration::Ext::ENV_HEADER_TAGS
172
+ o.type :array
173
+ o.default []
174
+ o.setter { |header_tags, _| Configuration::HTTP::HeaderTags.new(header_tags) }
174
175
  end
175
176
 
176
177
  # Enable 128 bit trace id generation.
@@ -178,8 +179,9 @@ module Datadog
178
179
  # @default `DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED` environment variable, otherwise `false`
179
180
  # @return [Boolean]
180
181
  option :trace_id_128_bit_generation_enabled do |o|
181
- o.default { env_to_bool(Tracing::Configuration::Ext::ENV_TRACE_ID_128_BIT_GENERATION_ENABLED, false) }
182
- o.lazy
182
+ o.env Tracing::Configuration::Ext::ENV_TRACE_ID_128_BIT_GENERATION_ENABLED
183
+ o.default false
184
+ o.type :bool
183
185
  end
184
186
 
185
187
  # Enable 128 bit trace id injected for logging.
@@ -189,8 +191,9 @@ module Datadog
189
191
  #
190
192
  # It is not supported by our backend yet. Do not enable it.
191
193
  option :trace_id_128_bit_logging_enabled do |o|
192
- o.default { env_to_bool(Tracing::Configuration::Ext::Correlation::ENV_TRACE_ID_128_BIT_LOGGING_ENABLED, false) }
193
- o.lazy
194
+ o.env Tracing::Configuration::Ext::Correlation::ENV_TRACE_ID_128_BIT_LOGGING_ENABLED
195
+ o.default false
196
+ o.type :bool
194
197
  end
195
198
 
196
199
  # A custom tracer instance.
@@ -211,8 +214,9 @@ module Datadog
211
214
  # @see https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#trace-correlation
212
215
  # @return [Boolean]
213
216
  option :log_injection do |o|
214
- o.default { env_to_bool(Tracing::Configuration::Ext::Correlation::ENV_LOGS_INJECTION_ENABLED, true) }
215
- o.lazy
217
+ o.env Tracing::Configuration::Ext::Correlation::ENV_LOGS_INJECTION_ENABLED
218
+ o.default true
219
+ o.type :bool
216
220
  end
217
221
 
218
222
  # Configures an alternative trace transport behavior, where
@@ -229,7 +233,7 @@ module Datadog
229
233
  #
230
234
  # @default `false`
231
235
  # @return [Boolean]
232
- option :enabled, default: false
236
+ option :enabled, default: false, type: :bool
233
237
 
234
238
  # Minimum number of finished spans required in a single unfinished trace before
235
239
  # the tracer will consider that trace for partial flushing.
@@ -242,7 +246,7 @@ module Datadog
242
246
  #
243
247
  # @default 500
244
248
  # @return [Integer]
245
- option :min_spans_threshold, default: 500
249
+ option :min_spans_threshold, default: 500, type: :int
246
250
  end
247
251
 
248
252
  # Enables {https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/#datadog-intelligent-retention-filter
@@ -252,8 +256,9 @@ module Datadog
252
256
  option :priority_sampling
253
257
 
254
258
  option :report_hostname do |o|
255
- o.default { env_to_bool(Tracing::Configuration::Ext::NET::ENV_REPORT_HOSTNAME, false) }
256
- o.lazy
259
+ o.env Tracing::Configuration::Ext::NET::ENV_REPORT_HOSTNAME
260
+ o.default false
261
+ o.type :bool
257
262
  end
258
263
 
259
264
  # A custom sampler instance.
@@ -273,10 +278,10 @@ module Datadog
273
278
  # for resources not seen recently).
274
279
  #
275
280
  # @default `DD_TRACE_SAMPLE_RATE` environment variable, otherwise `nil`.
276
- # @return [Float,nil]
281
+ # @return [Float, nil]
277
282
  option :default_rate do |o|
278
- o.default { env_to_float(Tracing::Configuration::Ext::Sampling::ENV_SAMPLE_RATE, nil) }
279
- o.lazy
283
+ o.type :float, nilable: true
284
+ o.env Tracing::Configuration::Ext::Sampling::ENV_SAMPLE_RATE
280
285
  end
281
286
 
282
287
  # Rate limit for number of spans per second.
@@ -287,8 +292,25 @@ module Datadog
287
292
  # @default `DD_TRACE_RATE_LIMIT` environment variable, otherwise 100.
288
293
  # @return [Numeric,nil]
289
294
  option :rate_limit do |o|
290
- o.default { env_to_float(Tracing::Configuration::Ext::Sampling::ENV_RATE_LIMIT, 100) }
291
- o.lazy
295
+ o.type :int, nilable: true
296
+ o.env Tracing::Configuration::Ext::Sampling::ENV_RATE_LIMIT
297
+ o.default 100
298
+ end
299
+
300
+ # Trace sampling rules.
301
+ # These rules control whether a trace is kept or dropped by the tracer.
302
+ #
303
+ # The `rules` format is a String with a JSON array of objects:
304
+ # Each object must have a `sample_rate`, and the `name` and `service` fields
305
+ # are optional. The `sample_rate` value must be between 0.0 and 1.0 (inclusive).
306
+ # `name` and `service` are Strings that allow the `sample_rate` to be applied only
307
+ # to traces matching the `name` and `service`.
308
+ #
309
+ # @default `DD_TRACE_SAMPLING_RULES` environment variable. Otherwise `nil`.
310
+ # @return [String,nil]
311
+ # @public_api
312
+ option :rules do |o|
313
+ o.default { ENV.fetch(Configuration::Ext::Sampling::ENV_RULES, nil) }
292
314
  end
293
315
 
294
316
  # Single span sampling rules.
@@ -303,6 +325,7 @@ module Datadog
303
325
  # @return [String,nil]
304
326
  # @public_api
305
327
  option :span_rules do |o|
328
+ o.type :string, nilable: true
306
329
  o.default do
307
330
  rules = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES]
308
331
  rules_file = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES_FILE]
@@ -330,7 +353,6 @@ module Datadog
330
353
  end
331
354
  end
332
355
  end
333
- o.lazy
334
356
  end
335
357
  end
336
358
 
@@ -344,18 +366,16 @@ module Datadog
344
366
  # @default `DD_TRACE_TEST_MODE_ENABLED` environment variable, otherwise `false`
345
367
  # @return [Boolean]
346
368
  option :enabled do |o|
347
- o.default { env_to_bool(Tracing::Configuration::Ext::Test::ENV_MODE_ENABLED, false) }
348
- o.lazy
369
+ o.type :bool
370
+ o.default false
371
+ o.env Tracing::Configuration::Ext::Test::ENV_MODE_ENABLED
349
372
  end
350
373
 
351
- option :trace_flush do |o|
352
- o.default { nil }
353
- o.lazy
354
- end
374
+ option :trace_flush
355
375
 
356
376
  option :writer_options do |o|
357
- o.default { {} }
358
- o.lazy
377
+ o.type :hash
378
+ o.default({})
359
379
  end
360
380
  end
361
381
 
@@ -366,8 +386,10 @@ module Datadog
366
386
  # @yieldparam [Datadog::Transport::HTTP] t transport to be configured.
367
387
  # @default `nil`
368
388
  # @return [Proc,nil]
369
- option :transport_options, default: nil
370
-
389
+ option :transport_options do |o|
390
+ o.type :proc, nilable: true
391
+ o.default nil
392
+ end
371
393
  # A custom writer instance.
372
394
  # The object must respect the {Datadog::Tracing::Writer} interface.
373
395
  #
@@ -382,8 +404,11 @@ module Datadog
382
404
  # This option is recommended for internal use only.
383
405
  #
384
406
  # @default `{}`
385
- # @return [Hash,nil]
386
- option :writer_options, default: ->(_i) { {} }, lazy: true
407
+ # @return [Hash]
408
+ option :writer_options do |o|
409
+ o.type :hash
410
+ o.default({})
411
+ end
387
412
 
388
413
  # Client IP configuration
389
414
  # @public_api
@@ -398,13 +423,16 @@ module Datadog
398
423
  # @default `DD_TRACE_CLIENT_IP_ENABLED` environment variable, otherwise `false`.
399
424
  # @return [Boolean]
400
425
  option :enabled do |o|
426
+ o.type :bool
401
427
  o.default do
402
428
  disabled = env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_DISABLED)
403
429
 
404
430
  enabled = if disabled.nil?
405
431
  false
406
432
  else
407
- Datadog.logger.warn { "#{Tracing::Configuration::Ext::ClientIp::ENV_DISABLED} environment variable is deprecated, found set to #{disabled}, use #{Tracing::Configuration::Ext::ClientIp::ENV_ENABLED}=#{!disabled}" }
433
+ Datadog::Core.log_deprecation do
434
+ "#{Tracing::Configuration::Ext::ClientIp::ENV_DISABLED} environment variable is deprecated, use #{Tracing::Configuration::Ext::ClientIp::ENV_ENABLED} instead."
435
+ end
408
436
 
409
437
  !disabled
410
438
  end
@@ -412,7 +440,6 @@ module Datadog
412
440
  # ENABLED env var takes precedence over deprecated DISABLED
413
441
  env_to_bool(Tracing::Configuration::Ext::ClientIp::ENV_ENABLED, enabled)
414
442
  end
415
- o.lazy
416
443
  end
417
444
 
418
445
  # An optional name of a custom header to resolve the client IP from.
@@ -420,8 +447,8 @@ module Datadog
420
447
  # @default `DD_TRACE_CLIENT_IP_HEADER` environment variable, otherwise `nil`.
421
448
  # @return [String,nil]
422
449
  option :header_name do |o|
423
- o.default { ENV.fetch(Tracing::Configuration::Ext::ClientIp::ENV_HEADER_NAME, nil) }
424
- o.lazy
450
+ o.type :string, nilable: true
451
+ o.env Tracing::Configuration::Ext::ClientIp::ENV_HEADER_NAME
425
452
  end
426
453
  end
427
454
 
@@ -434,22 +461,9 @@ module Datadog
434
461
  # @default `DD_TRACE_X_DATADOG_TAGS_MAX_LENGTH` environment variable, otherwise `512`
435
462
  # @return [Integer]
436
463
  option :x_datadog_tags_max_length do |o|
437
- o.default { env_to_int(Tracing::Configuration::Ext::Distributed::ENV_X_DATADOG_TAGS_MAX_LENGTH, 512) }
438
- o.lazy
439
- end
440
-
441
- # Schema version for span attributes that enables various features
442
- #
443
- # @default `DD_TRACE_SPAN_ATTRIBUTE_SCHEMA` environment variable, otherwise default `v0` currently
444
- # @return [String]
445
- option :span_attribute_schema do |o|
446
- o.default do
447
- ENV.fetch(
448
- Tracing::Configuration::Ext::SpanAttributeSchema::ENV_SPAN_ATTRIBUTE_SCHEMA,
449
- Tracing::Configuration::Ext::SpanAttributeSchema::DEFAULT_VERSION
450
- )
451
- end
452
- o.lazy
464
+ o.type :int
465
+ o.env Tracing::Configuration::Ext::Distributed::ENV_X_DATADOG_TAGS_MAX_LENGTH
466
+ o.default 512
453
467
  end
454
468
  end
455
469
  end
@@ -12,18 +12,21 @@ module Datadog
12
12
  # @public_api
13
13
  class Settings < Contrib::Configuration::Settings
14
14
  option :enabled do |o|
15
- o.default { env_to_bool(Ext::ENV_ENABLED, true) }
16
- o.lazy
15
+ o.type :bool
16
+ o.env Ext::ENV_ENABLED
17
+ o.default true
17
18
  end
18
19
 
19
20
  option :analytics_enabled do |o|
20
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
21
- o.lazy
21
+ o.type :bool
22
+ o.env Ext::ENV_ANALYTICS_ENABLED
23
+ o.default false
22
24
  end
23
25
 
24
26
  option :analytics_sample_rate do |o|
25
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
26
- o.lazy
27
+ o.type :float
28
+ o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
29
+ o.default 1.0
27
30
  end
28
31
 
29
32
  option :service_name
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Datadog
2
4
  module Tracing
3
5
  module Contrib
@@ -5,24 +7,24 @@ module Datadog
5
7
  # ActionCable integration constants
6
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
7
9
  module Ext
8
- ENV_ENABLED = 'DD_TRACE_ACTION_CABLE_ENABLED'.freeze
9
- ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED'.freeze
10
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE'.freeze
11
- SPAN_ACTION = 'action_cable.action'.freeze
12
- SPAN_BROADCAST = 'action_cable.broadcast'.freeze
13
- SPAN_ON_OPEN = 'action_cable.on_open'.freeze
14
- SPAN_TRANSMIT = 'action_cable.transmit'.freeze
15
- TAG_ACTION = 'action_cable.action'.freeze
16
- TAG_BROADCAST_CODER = 'action_cable.broadcast.coder'.freeze
17
- TAG_CHANNEL = 'action_cable.channel'.freeze
18
- TAG_CHANNEL_CLASS = 'action_cable.channel_class'.freeze
19
- TAG_COMPONENT = 'action_cable'.freeze
20
- TAG_CONNECTION = 'action_cable.connection'.freeze
21
- TAG_OPERATION_ACTION = 'action'.freeze
22
- TAG_OPERATION_BROADCAST = 'broadcast'.freeze
23
- TAG_OPERATION_ON_OPEN = 'on_open'.freeze
24
- TAG_OPERATION_TRANSMIT = 'transmit'.freeze
25
- TAG_TRANSMIT_VIA = 'action_cable.transmit.via'.freeze
10
+ ENV_ENABLED = 'DD_TRACE_ACTION_CABLE_ENABLED'
11
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_CABLE_ANALYTICS_ENABLED'
12
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE'
13
+ SPAN_ACTION = 'action_cable.action'
14
+ SPAN_BROADCAST = 'action_cable.broadcast'
15
+ SPAN_ON_OPEN = 'action_cable.on_open'
16
+ SPAN_TRANSMIT = 'action_cable.transmit'
17
+ TAG_ACTION = 'action_cable.action'
18
+ TAG_BROADCAST_CODER = 'action_cable.broadcast.coder'
19
+ TAG_CHANNEL = 'action_cable.channel'
20
+ TAG_CHANNEL_CLASS = 'action_cable.channel_class'
21
+ TAG_COMPONENT = 'action_cable'
22
+ TAG_CONNECTION = 'action_cable.connection'
23
+ TAG_OPERATION_ACTION = 'action'
24
+ TAG_OPERATION_BROADCAST = 'broadcast'
25
+ TAG_OPERATION_ON_OPEN = 'on_open'
26
+ TAG_OPERATION_TRANSMIT = 'transmit'
27
+ TAG_TRANSMIT_VIA = 'action_cable.transmit.via'
26
28
  end
27
29
  end
28
30
  end
@@ -12,18 +12,21 @@ module Datadog
12
12
  # @public_api
13
13
  class Settings < Contrib::Configuration::Settings
14
14
  option :enabled do |o|
15
- o.default { env_to_bool(Ext::ENV_ENABLED, true) }
16
- o.lazy
15
+ o.type :bool
16
+ o.env Ext::ENV_ENABLED
17
+ o.default true
17
18
  end
18
19
 
19
20
  option :analytics_enabled do |o|
20
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, false) }
21
- o.lazy
21
+ o.type :bool
22
+ o.env Ext::ENV_ANALYTICS_ENABLED
23
+ o.default false
22
24
  end
23
25
 
24
26
  option :analytics_sample_rate do |o|
25
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
26
- o.lazy
27
+ o.type :float
28
+ o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
29
+ o.default 1.0
27
30
  end
28
31
 
29
32
  option :service_name
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Datadog
2
4
  module Tracing
3
5
  module Contrib
@@ -5,25 +7,25 @@ module Datadog
5
7
  # ActionMailer integration constants
6
8
  # @public_api Changing resource names, tag names, or environment variables creates breaking changes.
7
9
  module Ext
8
- ENV_ENABLED = 'DD_TRACE_ACTION_MAILER_ENABLED'.freeze
9
- ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_MAILER_ANALYTICS_ENABLED'.freeze
10
- ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_MAILER_ANALYTICS_SAMPLE_RATE'.freeze
11
- SPAN_PROCESS = 'action_mailer.process'.freeze
12
- SPAN_DELIVER = 'action_mailer.deliver'.freeze
13
- TAG_COMPONENT = 'action_mailer'.freeze
14
- TAG_ACTION = 'action_mailer.action'.freeze
15
- TAG_MAILER = 'action_mailer.mailer'.freeze
16
- TAG_MSG_ID = 'action_mailer.message_id'.freeze
17
- TAG_OPERATION_DELIVER = 'deliver'.freeze
18
- TAG_OPERATION_PROCESS = 'process'.freeze
10
+ ENV_ENABLED = 'DD_TRACE_ACTION_MAILER_ENABLED'
11
+ ENV_ANALYTICS_ENABLED = 'DD_TRACE_ACTION_MAILER_ANALYTICS_ENABLED'
12
+ ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_ACTION_MAILER_ANALYTICS_SAMPLE_RATE'
13
+ SPAN_PROCESS = 'action_mailer.process'
14
+ SPAN_DELIVER = 'action_mailer.deliver'
15
+ TAG_COMPONENT = 'action_mailer'
16
+ TAG_ACTION = 'action_mailer.action'
17
+ TAG_MAILER = 'action_mailer.mailer'
18
+ TAG_MSG_ID = 'action_mailer.message_id'
19
+ TAG_OPERATION_DELIVER = 'deliver'
20
+ TAG_OPERATION_PROCESS = 'process'
19
21
 
20
- TAG_SUBJECT = 'action_mailer.subject'.freeze
21
- TAG_TO = 'action_mailer.to'.freeze
22
- TAG_FROM = 'action_mailer.from'.freeze
23
- TAG_BCC = 'action_mailer.bcc'.freeze
24
- TAG_CC = 'action_mailer.cc'.freeze
25
- TAG_DATE = 'action_mailer.date'.freeze
26
- TAG_PERFORM_DELIVERIES = 'action_mailer.perform_deliveries'.freeze
22
+ TAG_SUBJECT = 'action_mailer.subject'
23
+ TAG_TO = 'action_mailer.to'
24
+ TAG_FROM = 'action_mailer.from'
25
+ TAG_BCC = 'action_mailer.bcc'
26
+ TAG_CC = 'action_mailer.cc'
27
+ TAG_DATE = 'action_mailer.date'
28
+ TAG_PERFORM_DELIVERIES = 'action_mailer.perform_deliveries'
27
29
  end
28
30
  end
29
31
  end
@@ -12,18 +12,20 @@ module Datadog
12
12
  # @public_api
13
13
  class Settings < Contrib::Configuration::Settings
14
14
  option :enabled do |o|
15
- o.default { env_to_bool(Ext::ENV_ENABLED, true) }
16
- o.lazy
15
+ o.type :bool
16
+ o.env Ext::ENV_ENABLED
17
+ o.default true
17
18
  end
18
19
 
19
20
  option :analytics_enabled do |o|
20
- o.default { env_to_bool(Ext::ENV_ANALYTICS_ENABLED, nil) }
21
- o.lazy
21
+ o.type :bool, nilable: true
22
+ o.env Ext::ENV_ANALYTICS_ENABLED
22
23
  end
23
24
 
24
25
  option :analytics_sample_rate do |o|
25
- o.default { env_to_float(Ext::ENV_ANALYTICS_SAMPLE_RATE, 1.0) }
26
- o.lazy
26
+ o.type :float
27
+ o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
28
+ o.default 1.0
27
29
  end
28
30
 
29
31
  # DEV-2.0: Breaking changes for removal.