ddtrace 1.13.0 → 1.13.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 845f4614c8e20a84d26d9d14a22b5cddde0e1b27aeb7e093b5addf7a0cbd7490
4
- data.tar.gz: 829de76d1ac7aa04f1eb9a1bd36ef3ff5fec7bfc5657015cea291fe8219ea162
3
+ metadata.gz: 77f5ce82c1888cc91b59b92651e262367f416298b668da0ed48ff06ec6f6fb49
4
+ data.tar.gz: 17857f0840b31f08f505661bf07764c79a507e670ef6d378e8bc2688b6be13eb
5
5
  SHA512:
6
- metadata.gz: 6a3ed99fb7b1ddf340fa2f343f70d0f2ba456f6f45f62cd6f1a3250b05dafa2f44f18784899bd898d213eab37ca4921b618581b8faf0134c2bed325febb20c30
7
- data.tar.gz: 6ef24c9b3559eb34705a4b43d325d4582bef7279627563641cae3675e26978ce92e5f953c277991866389083e57540622d232b58a44d44e4ede4fb370ff93b68
6
+ metadata.gz: cbfce752c4991fe0d71df92527eb3774483dbd4a669d6ff21e3483e2e4dd5caeb0da2a350fb09fd074639c9bdf032dfc166e2e1f60c8493eb98a45e14cf6d523
7
+ data.tar.gz: 83de702f81507366ac6afdc37b26df8e1b2df8e283a195e5e8ed5088871e0b3f7ab3035519c3cebd1f15e09935c54119e6093e3d3da010429468a6ecb4710841
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.13.1] - 2023-08-14
6
+
7
+ ### Fixed
8
+
9
+ * Tracing: `net/http` instrumentation excludes query string for `http.url` tag ([#3045][])
10
+ * Tracing: Remove `log_tags` warning when given hash for log injection ([#3022][])
11
+ * Tracing: Fix OpenSearch integration loading ([#3019][])
12
+ * Core: Fix default hostname/port when mixing http and uds configuration ([#3037][])
13
+ * Core: Disable Telemetry and Remote Configuration in development environments ([#3039][])
14
+ * Profiling: Improve `Datadog::Profiling::HttpTransport` error logging ([#3038][])
15
+ * Docs: Document known issues with hanging Resque workers ([#3033][])
16
+
5
17
  ## [1.13.0] - 2023-07-31
6
18
 
7
19
  ### Added
@@ -2503,7 +2515,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
2503
2515
 
2504
2516
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2505
2517
 
2506
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.0...master
2518
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.1...master
2519
+ [1.13.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.13.0...1.13.1
2507
2520
  [1.13.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.1...v1.13.0
2508
2521
  [1.12.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.12.0...v1.12.1
2509
2522
  [1.12.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.11.1...v1.12.0
@@ -3638,6 +3651,13 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3638
3651
  [#3005]: https://github.com/DataDog/dd-trace-rb/issues/3005
3639
3652
  [#3007]: https://github.com/DataDog/dd-trace-rb/issues/3007
3640
3653
  [#3011]: https://github.com/DataDog/dd-trace-rb/issues/3011
3654
+ [#3019]: https://github.com/DataDog/dd-trace-rb/issues/3019
3655
+ [#3022]: https://github.com/DataDog/dd-trace-rb/issues/3022
3656
+ [#3033]: https://github.com/DataDog/dd-trace-rb/issues/3033
3657
+ [#3037]: https://github.com/DataDog/dd-trace-rb/issues/3037
3658
+ [#3038]: https://github.com/DataDog/dd-trace-rb/issues/3038
3659
+ [#3039]: https://github.com/DataDog/dd-trace-rb/issues/3039
3660
+ [#3045]: https://github.com/DataDog/dd-trace-rb/issues/3045
3641
3661
  [@AdrianLC]: https://github.com/AdrianLC
3642
3662
  [@Azure7111]: https://github.com/Azure7111
3643
3663
  [@BabyGroot]: https://github.com/BabyGroot
@@ -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
  )
@@ -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
 
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datadog
4
+ module Core
5
+ module Environment
6
+ # Provides information about the execution environment on the current process.
7
+ module Execution
8
+ class << self
9
+ # Is this process running in a development environment?
10
+ # This can be used to make decisions about when to enable
11
+ # background systems like worker threads or telemetry.
12
+ def development?
13
+ !!(repl? || test?)
14
+ end
15
+
16
+ private
17
+
18
+ # Is this process running a test?
19
+ def test?
20
+ rspec? || minitest?
21
+ end
22
+
23
+ # Is this process running inside on a Read–eval–print loop?
24
+ # DEV: REPLs always set the program name to the exact REPL name.
25
+ def repl?
26
+ REPL_PROGRAM_NAMES.include?($PROGRAM_NAME)
27
+ end
28
+
29
+ REPL_PROGRAM_NAMES = %w[irb pry].freeze
30
+ private_constant :REPL_PROGRAM_NAMES
31
+
32
+ # RSpec always runs using the `rspec` file https://github.com/rspec/rspec-core/blob/main/exe/rspec
33
+ def rspec?
34
+ $PROGRAM_NAME.end_with?(RSPEC_PROGRAM_NAME)
35
+ end
36
+
37
+ RSPEC_PROGRAM_NAME = '/rspec'
38
+ private_constant :RSPEC_PROGRAM_NAME
39
+
40
+ # Check if Minitest is present and installed to run.
41
+ def minitest?
42
+ # Minitest >= 5
43
+ (defined?(::Minitest) &&
44
+ ::Minitest.class_variable_defined?(:@@installed_at_exit) &&
45
+ ::Minitest.class_variable_get(:@@installed_at_exit)) ||
46
+ # Minitest < 5
47
+ (defined?(::Minitest::Unit) &&
48
+ ::Minitest::Unit.class_variable_defined?(:@@installed_at_exit) &&
49
+ ::Minitest::Unit.class_variable_get(:@@installed_at_exit))
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -48,11 +48,14 @@ module Datadog
48
48
  Datadog.logger.debug('Successfully reported profiling data')
49
49
  true
50
50
  else
51
- 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
+ )
52
55
  false
53
56
  end
54
57
  else
55
- Datadog.logger.error("Failed to report profiling data: #{result}")
58
+ Datadog.logger.error("Failed to report profiling data (#{config_without_api_key}): #{result}")
56
59
  false
57
60
  end
58
61
  end
@@ -128,6 +131,10 @@ module Datadog
128
131
  internal_metadata_json,
129
132
  )
130
133
  end
134
+
135
+ def config_without_api_key
136
+ [@exporter_configuration[0..1]].to_h
137
+ end
131
138
  end
132
139
  end
133
140
  end
@@ -3,6 +3,7 @@ require 'uri'
3
3
  require_relative '../../metadata/ext'
4
4
  require_relative '../analytics'
5
5
  require_relative '../http_annotation_helper'
6
+ require_relative '../utils/quantization/http'
6
7
 
7
8
  module Datadog
8
9
  module Tracing
@@ -79,8 +80,10 @@ module Datadog
79
80
 
80
81
  span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
81
82
  span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)
82
-
83
- span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_URL, request.path)
83
+ span.set_tag(
84
+ Tracing::Metadata::Ext::HTTP::TAG_URL,
85
+ Contrib::Utils::Quantization::HTTP.url(request.path, { query: { exclude: :all } })
86
+ )
84
87
  span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD, request.method)
85
88
 
86
89
  host, port = host_and_port(request)
@@ -8,9 +8,12 @@ module Datadog
8
8
  module_function
9
9
 
10
10
  # Use `app.config.log_tags` to inject propagation tags into the default Rails logger.
11
- def configure_log_tags(app)
12
- app.config.log_tags ||= [] # Can be nil, we initialized it if so
13
- app.config.log_tags << proc { Tracing.log_correlation if Datadog.configuration.tracing.log_injection }
11
+ def configure_log_tags(app_config)
12
+ # When using SemanticLogger, app_config.log_tags could be a Hash and should not be modified here
13
+ return unless app_config.log_tags.nil? || app_config.log_tags.respond_to?(:<<)
14
+
15
+ app_config.log_tags ||= [] # Can be nil, we initialized it if so
16
+ app_config.log_tags << proc { Tracing.log_correlation if Datadog.configuration.tracing.log_injection }
14
17
  rescue StandardError => e
15
18
  Datadog.logger.warn(
16
19
  "Unable to add Datadog Trace context to ActiveSupport::TaggedLogging: #{e.class.name} #{e.message}"
@@ -41,7 +41,7 @@ module Datadog
41
41
  # Sometimes we don't want to activate middleware e.g. OpenTracing, etc.
42
42
  add_middleware(app) if Datadog.configuration.tracing[:rails][:middleware]
43
43
 
44
- Rails::LogInjection.configure_log_tags(app)
44
+ Rails::LogInjection.configure_log_tags(app.config)
45
45
  end
46
46
  end
47
47
 
@@ -58,6 +58,7 @@ require_relative 'contrib/kafka/integration'
58
58
  require_relative 'contrib/lograge/integration'
59
59
  require_relative 'contrib/mongodb/integration'
60
60
  require_relative 'contrib/mysql2/integration'
61
+ require_relative 'contrib/opensearch/integration'
61
62
  require_relative 'contrib/pg/integration'
62
63
  require_relative 'contrib/presto/integration'
63
64
  require_relative 'contrib/qless/integration'
@@ -4,7 +4,7 @@ module DDTrace
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 13
7
- PATCH = 0
7
+ PATCH = 1
8
8
  PRE = nil
9
9
  BUILD = nil
10
10
  # PRE and BUILD above are modified for dev gems during gem build GHA workflow
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-31 00:00:00.000000000 Z
11
+ date: 2023-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -244,6 +244,7 @@ files:
244
244
  - lib/datadog/core/environment/cgroup.rb
245
245
  - lib/datadog/core/environment/class_count.rb
246
246
  - lib/datadog/core/environment/container.rb
247
+ - lib/datadog/core/environment/execution.rb
247
248
  - lib/datadog/core/environment/ext.rb
248
249
  - lib/datadog/core/environment/gc.rb
249
250
  - lib/datadog/core/environment/identity.rb
@@ -892,7 +893,7 @@ licenses:
892
893
  metadata:
893
894
  allowed_push_host: https://rubygems.org
894
895
  changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md
895
- post_install_message:
896
+ post_install_message:
896
897
  rdoc_options: []
897
898
  require_paths:
898
899
  - lib
@@ -910,8 +911,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
910
911
  - !ruby/object:Gem::Version
911
912
  version: 2.0.0
912
913
  requirements: []
913
- rubygems_version: 3.4.15
914
- signing_key:
914
+ rubygems_version: 3.4.10
915
+ signing_key:
915
916
  specification_version: 4
916
917
  summary: Datadog tracing code for your Ruby applications
917
918
  test_files: []