ddtrace 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -1
  3. data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +15 -0
  4. data/lib/datadog/appsec/configuration/settings.rb +7 -1
  5. data/lib/datadog/core/configuration/agent_settings_resolver.rb +9 -5
  6. data/lib/datadog/core/configuration/components.rb +2 -0
  7. data/lib/datadog/core/configuration/settings.rb +25 -2
  8. data/lib/datadog/core/diagnostics/environment_logger.rb +130 -234
  9. data/lib/datadog/core/environment/execution.rb +65 -0
  10. data/lib/datadog/core/telemetry/collector.rb +10 -2
  11. data/lib/datadog/profiling/component.rb +14 -4
  12. data/lib/datadog/profiling/diagnostics/environment_logger.rb +39 -0
  13. data/lib/datadog/profiling/exporter.rb +4 -4
  14. data/lib/datadog/profiling/flush.rb +2 -4
  15. data/lib/datadog/profiling/http_transport.rb +9 -2
  16. data/lib/datadog/profiling.rb +1 -0
  17. data/lib/datadog/tracing/component.rb +2 -1
  18. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +18 -11
  19. data/lib/datadog/tracing/contrib/active_record/utils.rb +1 -1
  20. data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +99 -102
  21. data/lib/datadog/tracing/contrib/http/instrumentation.rb +5 -2
  22. data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -17
  23. data/lib/datadog/tracing/contrib/rails/log_injection.rb +6 -3
  24. data/lib/datadog/tracing/contrib/rails/patcher.rb +1 -1
  25. data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +3 -20
  26. data/lib/datadog/tracing/contrib/utils/quantization/http.rb +9 -9
  27. data/lib/datadog/tracing/contrib.rb +1 -0
  28. data/lib/datadog/tracing/correlation.rb +20 -0
  29. data/lib/datadog/tracing/diagnostics/environment_logger.rb +159 -0
  30. data/lib/datadog/tracing/workers/trace_writer.rb +1 -1
  31. data/lib/ddtrace/version.rb +1 -1
  32. metadata +9 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 845f4614c8e20a84d26d9d14a22b5cddde0e1b27aeb7e093b5addf7a0cbd7490
4
- data.tar.gz: 829de76d1ac7aa04f1eb9a1bd36ef3ff5fec7bfc5657015cea291fe8219ea162
3
+ metadata.gz: ae7238650b45da9d8bf8f5834af2a29153081e798c2c8733c9bffb8768b6c430
4
+ data.tar.gz: b9bc8f36d37b91d18754892bd8dbc92cd515b9e38caf8561e23b665f14ee5e9e
5
5
  SHA512:
6
- metadata.gz: 6a3ed99fb7b1ddf340fa2f343f70d0f2ba456f6f45f62cd6f1a3250b05dafa2f44f18784899bd898d213eab37ca4921b618581b8faf0134c2bed325febb20c30
7
- data.tar.gz: 6ef24c9b3559eb34705a4b43d325d4582bef7279627563641cae3675e26978ce92e5f953c277991866389083e57540622d232b58a44d44e4ede4fb370ff93b68
6
+ metadata.gz: 4b4cdffa9d4ee39e6763be4a87dbdf3e351fd29915d4eaea45dc9c800543c65c8eb21375138422280cfed5715d8f23e95e58190752af6631c14453d39b29b263
7
+ data.tar.gz: fbc970e48e5e5038775368618e672ab7b2405cd6ea9b899136b34e9ae776f26a92436087fb0810ef7d66574c2f694cdea03197cf980b08dc35a9defcf4c3dc74
data/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.14.0] - 2023-08-24
6
+
7
+ ### Added
8
+
9
+ * Cucumber 8.0.0 support, test CI visibility with cucumber versions 6-8 ([#3061][])
10
+ * Tracing: Add `ddsource` to #to_log_format ([#3025][])
11
+ * Core: include peer service configurations in telemetry payload ([#3056][])
12
+ * Tracing: Improve quantization ([#3041][])
13
+
14
+ ### Changed
15
+
16
+ * Profiling: Disable profiler on Ruby 3.3 due to incompatibility ([#3054][])
17
+ * Core: EnvironmentLogger adjustments ([#3020][], [#3057][])
18
+
19
+ ### Fixed
20
+
21
+ * Appsec: Fix ASM setting for automated user events. ([#3070][])
22
+ * Tracing: Fix ActiveRecord adapter name for Rails 7 ([#3051][])
23
+
24
+ ## [1.13.1] - 2023-08-14
25
+
26
+ ### Fixed
27
+
28
+ * Tracing: `net/http` instrumentation excludes query string for `http.url` tag ([#3045][])
29
+ * Tracing: Remove `log_tags` warning when given hash for log injection ([#3022][])
30
+ * Tracing: Fix OpenSearch integration loading ([#3019][])
31
+ * Core: Fix default hostname/port when mixing http and uds configuration ([#3037][])
32
+ * Core: Disable Telemetry and Remote Configuration in development environments ([#3039][])
33
+ * Profiling: Improve `Datadog::Profiling::HttpTransport` error logging ([#3038][])
34
+ * Docs: Document known issues with hanging Resque workers ([#3033][])
35
+
5
36
  ## [1.13.0] - 2023-07-31
6
37
 
7
38
  ### Added
@@ -2503,7 +2534,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
2503
2534
 
2504
2535
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2505
2536
 
2506
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.0...master
2537
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.14.0...master
2538
+ [1.14.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.1...1.14.0
2539
+ [1.13.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.0...1.13.1
2507
2540
  [1.13.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.1...v1.13.0
2508
2541
  [1.12.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.0...v1.12.1
2509
2542
  [1.12.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.11.1...v1.12.0
@@ -3638,6 +3671,22 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3638
3671
  [#3005]: https://github.com/DataDog/dd-trace-rb/issues/3005
3639
3672
  [#3007]: https://github.com/DataDog/dd-trace-rb/issues/3007
3640
3673
  [#3011]: https://github.com/DataDog/dd-trace-rb/issues/3011
3674
+ [#3019]: https://github.com/DataDog/dd-trace-rb/issues/3019
3675
+ [#3020]: https://github.com/DataDog/dd-trace-rb/issues/3020
3676
+ [#3022]: https://github.com/DataDog/dd-trace-rb/issues/3022
3677
+ [#3025]: https://github.com/DataDog/dd-trace-rb/issues/3025
3678
+ [#3033]: https://github.com/DataDog/dd-trace-rb/issues/3033
3679
+ [#3037]: https://github.com/DataDog/dd-trace-rb/issues/3037
3680
+ [#3038]: https://github.com/DataDog/dd-trace-rb/issues/3038
3681
+ [#3039]: https://github.com/DataDog/dd-trace-rb/issues/3039
3682
+ [#3041]: https://github.com/DataDog/dd-trace-rb/issues/3041
3683
+ [#3045]: https://github.com/DataDog/dd-trace-rb/issues/3045
3684
+ [#3051]: https://github.com/DataDog/dd-trace-rb/issues/3051
3685
+ [#3054]: https://github.com/DataDog/dd-trace-rb/issues/3054
3686
+ [#3056]: https://github.com/DataDog/dd-trace-rb/issues/3056
3687
+ [#3057]: https://github.com/DataDog/dd-trace-rb/issues/3057
3688
+ [#3061]: https://github.com/DataDog/dd-trace-rb/issues/3061
3689
+ [#3070]: https://github.com/DataDog/dd-trace-rb/issues/3070
3641
3690
  [@AdrianLC]: https://github.com/AdrianLC
3642
3691
  [@Azure7111]: https://github.com/Azure7111
3643
3692
  [@BabyGroot]: https://github.com/BabyGroot
@@ -87,6 +87,7 @@ module Datadog
87
87
  on_unknown_os? ||
88
88
  on_unsupported_cpu_arch? ||
89
89
  on_unsupported_ruby_version? ||
90
+ on_ruby_3_3? ||
90
91
  expected_to_use_mjit_but_mjit_is_disabled? ||
91
92
  libdatadog_not_available? ||
92
93
  libdatadog_not_usable?
@@ -269,6 +270,20 @@ module Datadog
269
270
  ruby_version_not_supported if RUBY_VERSION.start_with?('2.1.', '2.2.')
270
271
  end
271
272
 
273
+ private_class_method def self.on_ruby_3_3?
274
+ incompatible_with_3_3 = explain_issue(
275
+ 'the profiler in the current version of ddtrace does not yet support',
276
+ 'Ruby version 3.3.',
277
+ '(See https://github.com/datadog/dd-trace-rb/issues/3053 for details).',
278
+ suggested: [
279
+ 'Try upgrading to the latest ddtrace, as this issue may have been',
280
+ 'fixed by now.',
281
+ ] + CONTACT_SUPPORT,
282
+ )
283
+
284
+ incompatible_with_3_3 if RUBY_VERSION.start_with?('3.3.')
285
+ end
286
+
272
287
  # On some Rubies, we require the mjit header to be present. If Ruby was installed without MJIT support, we also skip
273
288
  # building the extension.
274
289
  private_class_method def self.expected_to_use_mjit_but_mjit_is_disabled?
@@ -15,6 +15,10 @@ module Datadog
15
15
  'safe',
16
16
  'extended'
17
17
  ].freeze
18
+ APPSEC_VALID_TRACK_USER_EVENTS_ENABLED_VALUES = [
19
+ '1',
20
+ 'true'
21
+ ].concat(APPSEC_VALID_TRACK_USER_EVENTS_MODE).freeze
18
22
 
19
23
  def self.extended(base)
20
24
  base = base.singleton_class unless base.is_a?(Class)
@@ -100,7 +104,7 @@ module Datadog
100
104
  if env_value == 'disabled'
101
105
  false
102
106
  else
103
- ['1', 'true'].include?(env_value.strip.downcase)
107
+ APPSEC_VALID_TRACK_USER_EVENTS_ENABLED_VALUES.include?(env_value.strip.downcase)
104
108
  end
105
109
  end
106
110
  end
@@ -112,6 +116,8 @@ module Datadog
112
116
  o.setter do |v|
113
117
  if APPSEC_VALID_TRACK_USER_EVENTS_MODE.include?(v)
114
118
  v
119
+ elsif v == 'disabled'
120
+ 'safe'
115
121
  else
116
122
  Datadog.logger.warn(
117
123
  'The appsec.track_user_events.mode value provided is not supported.' \
@@ -95,7 +95,7 @@ module Datadog
95
95
  end
96
96
 
97
97
  def adapter
98
- if should_use_uds? && !mixed_http_and_uds?
98
+ if should_use_uds?
99
99
  Datadog::Transport::Ext::UnixSocket::ADAPTER
100
100
  else
101
101
  Datadog::Transport::Ext::HTTP::ADAPTER
@@ -222,6 +222,10 @@ module Datadog
222
222
  end
223
223
 
224
224
  def should_use_uds?
225
+ can_use_uds? && !mixed_http_and_uds?
226
+ end
227
+
228
+ def can_use_uds?
225
229
  parsed_url && unix_scheme?(parsed_url) ||
226
230
  # If no agent settings have been provided, we try to connect using a local unix socket.
227
231
  # We only do so if the socket is present when `ddtrace` runs.
@@ -272,7 +276,7 @@ module Datadog
272
276
  'Configuration mismatch: values differ between ' \
273
277
  "#{detected_configurations_in_priority_order
274
278
  .map { |config| "#{config.friendly_name} (#{config.value.inspect})" }.join(' and ')}" \
275
- ". Using #{detected_configurations_in_priority_order.first.value.inspect}."
279
+ ". Using #{detected_configurations_in_priority_order.first.value.inspect} and ignoring other configuration."
276
280
  )
277
281
  end
278
282
 
@@ -297,18 +301,18 @@ module Datadog
297
301
  def mixed_http_and_uds?
298
302
  return @mixed_http_and_uds if defined?(@mixed_http_and_uds)
299
303
 
300
- @mixed_http_and_uds = (configured_hostname || configured_port) && should_use_uds?
304
+ @mixed_http_and_uds = (configured_hostname || configured_port) && can_use_uds?
301
305
 
302
306
  if @mixed_http_and_uds
303
307
  warn_if_configuration_mismatch(
304
308
  [
305
309
  DetectedConfiguration.new(
306
310
  friendly_name: 'configuration of hostname/port for http/https use',
307
- value: "hostname: '#{configured_hostname}', port: #{configured_port.inspect}",
311
+ value: "hostname: '#{hostname}', port: '#{port}'",
308
312
  ),
309
313
  DetectedConfiguration.new(
310
314
  friendly_name: 'configuration for unix domain socket',
311
- value: "unix://#{uds_path}",
315
+ value: parsed_url.to_s,
312
316
  ),
313
317
  ]
314
318
  )
@@ -110,6 +110,8 @@ module Datadog
110
110
  else
111
111
  @logger.debug('Profiling is disabled')
112
112
  end
113
+
114
+ Core::Diagnostics::EnvironmentLogger.collect_and_log!
113
115
  end
114
116
 
115
117
  # Shuts down all the components in use.
@@ -2,6 +2,7 @@ require 'logger'
2
2
 
3
3
  require_relative 'base'
4
4
  require_relative 'ext'
5
+ require_relative '../environment/execution'
5
6
  require_relative '../environment/ext'
6
7
  require_relative '../runtime/ext'
7
8
  require_relative '../telemetry/ext'
@@ -559,10 +560,21 @@ module Datadog
559
560
  #
560
561
  # @default `DD_INSTRUMENTATION_TELEMETRY_ENABLED` environment variable, otherwise `true`.
561
562
  # Can be disabled as documented [here](https://docs.datadoghq.com/tracing/configure_data_security/#telemetry-collection).
563
+ # By default, telemetry is disabled in development environments.
562
564
  # @return [Boolean]
563
565
  option :enabled do |o|
564
566
  o.env Core::Telemetry::Ext::ENV_ENABLED
565
- o.default true
567
+ o.default do
568
+ if Datadog::Core::Environment::Execution.development?
569
+ Datadog.logger.debug do
570
+ 'Development environment detected, disabling Telemetry. ' \
571
+ 'You can enable it with DD_INSTRUMENTATION_TELEMETRY_ENABLED=true.'
572
+ end
573
+ false
574
+ else
575
+ true
576
+ end
577
+ end
566
578
  o.type :bool
567
579
  end
568
580
 
@@ -586,10 +598,21 @@ module Datadog
586
598
  # Enable remote configuration. This allows fetching of remote configuration for live updates.
587
599
  #
588
600
  # @default `DD_REMOTE_CONFIGURATION_ENABLED` environment variable, otherwise `true`.
601
+ # By default, remote configuration is disabled in development environments.
589
602
  # @return [Boolean]
590
603
  option :enabled do |o|
591
604
  o.env Core::Remote::Ext::ENV_ENABLED
592
- o.default true
605
+ o.default do
606
+ if Datadog::Core::Environment::Execution.development?
607
+ Datadog.logger.debug do
608
+ 'Development environment detected, disabling Remote Configuration. ' \
609
+ 'You can enable it with DD_REMOTE_CONFIGURATION_ENABLED=true.'
610
+ end
611
+ false
612
+ else
613
+ true
614
+ end
615
+ end
593
616
  o.type :bool
594
617
  end
595
618