datadog 2.24.0 → 2.25.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -2
  3. data/lib/datadog/ai_guard/api_client.rb +82 -0
  4. data/lib/datadog/ai_guard/component.rb +42 -0
  5. data/lib/datadog/ai_guard/configuration/ext.rb +17 -0
  6. data/lib/datadog/ai_guard/configuration/settings.rb +98 -0
  7. data/lib/datadog/ai_guard/configuration.rb +11 -0
  8. data/lib/datadog/ai_guard/evaluation/message.rb +25 -0
  9. data/lib/datadog/ai_guard/evaluation/no_op_result.rb +34 -0
  10. data/lib/datadog/ai_guard/evaluation/request.rb +81 -0
  11. data/lib/datadog/ai_guard/evaluation/result.rb +43 -0
  12. data/lib/datadog/ai_guard/evaluation/tool_call.rb +18 -0
  13. data/lib/datadog/ai_guard/evaluation.rb +72 -0
  14. data/lib/datadog/ai_guard/ext.rb +16 -0
  15. data/lib/datadog/ai_guard.rb +153 -0
  16. data/lib/datadog/appsec/remote.rb +4 -3
  17. data/lib/datadog/appsec/security_engine/engine.rb +3 -3
  18. data/lib/datadog/appsec/security_engine/runner.rb +2 -2
  19. data/lib/datadog/core/configuration/components.rb +6 -0
  20. data/lib/datadog/core/configuration/supported_configurations.rb +6 -0
  21. data/lib/datadog/core/error.rb +6 -6
  22. data/lib/datadog/core/pin.rb +4 -0
  23. data/lib/datadog/core/rate_limiter.rb +1 -1
  24. data/lib/datadog/core/semaphore.rb +1 -4
  25. data/lib/datadog/core/telemetry/event/app_started.rb +2 -1
  26. data/lib/datadog/core/transport/response.rb +3 -1
  27. data/lib/datadog/core/utils/safe_dup.rb +2 -2
  28. data/lib/datadog/core/utils/sequence.rb +2 -0
  29. data/lib/datadog/di/boot.rb +4 -2
  30. data/lib/datadog/di/contrib/active_record.rb +4 -5
  31. data/lib/datadog/di/instrumenter.rb +9 -3
  32. data/lib/datadog/di/logger.rb +2 -2
  33. data/lib/datadog/di/probe_file_loader/railtie.rb +1 -1
  34. data/lib/datadog/di/probe_notifier_worker.rb +5 -5
  35. data/lib/datadog/error_tracking/filters.rb +2 -2
  36. data/lib/datadog/kit/appsec/events/v2.rb +2 -3
  37. data/lib/datadog/profiling/collectors/code_provenance.rb +1 -1
  38. data/lib/datadog/profiling/collectors/info.rb +3 -3
  39. data/lib/datadog/profiling/ext/dir_monkey_patches.rb +18 -0
  40. data/lib/datadog/tracing/contrib/waterdrop.rb +4 -0
  41. data/lib/datadog/tracing/distributed/baggage.rb +3 -2
  42. data/lib/datadog/tracing/sampling/priority_sampler.rb +3 -1
  43. data/lib/datadog/tracing/span.rb +1 -1
  44. data/lib/datadog/tracing/span_operation.rb +15 -9
  45. data/lib/datadog/version.rb +1 -1
  46. data/lib/datadog.rb +1 -0
  47. metadata +21 -8
@@ -175,8 +175,9 @@ module Datadog
175
175
 
176
176
  tags = {}
177
177
 
178
- baggage_tag_keys.each do |key, _| # rubocop:disable Style/HashEachMethods
179
- value = baggage[key]
178
+ baggage_tag_keys.each do |key, _|
179
+ # Steep: https://github.com/soutaro/steep/issues/2031
180
+ value = baggage[key] # steep:ignore ArgumentTypeMismatch
180
181
  next if value.nil? || value.empty?
181
182
 
182
183
  tags["baggage.#{key}"] = value
@@ -60,7 +60,9 @@ module Datadog
60
60
  ensure
61
61
  if trace.sampling_priority && trace.sampling_priority > 0
62
62
  # Don't modify decision if priority was set upstream.
63
- if !distributed_sampling_priority && !trace.has_tag?(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER)
63
+ # Steep: https://github.com/soutaro/steep/issues/1971
64
+ if !distributed_sampling_priority && # steep:ignore FallbackAny
65
+ !trace.has_tag?(Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER)
64
66
  # If no sampling priority being assigned at this point, a custom
65
67
  # sampler implementation is configured: this means the user has
66
68
  # full control over the sampling decision.
@@ -80,7 +80,7 @@ module Datadog
80
80
 
81
81
  @meta = meta || {}
82
82
  @metrics = metrics || {}
83
- @metastruct = metastruct || {}
83
+ @metastruct = metastruct || Metastruct.new
84
84
  @status = status || 0
85
85
 
86
86
  # start_time and end_time track wall clock. In Ruby, wall clock
@@ -164,7 +164,9 @@ module Datadog
164
164
  # block is application code that we don't want to hinder.
165
165
  # * We don't yield during a fatal error, as the application is likely trying to
166
166
  # end its execution (either due to a system error or graceful shutdown).
167
- return_value = yield(self) unless e && !e.is_a?(StandardError)
167
+ # @type var e: Exception?
168
+ # Steep: https://github.com/soutaro/steep/issues/919
169
+ return_value = yield(self) unless e && !e.is_a?(StandardError) # steep:ignore FallbackAny
168
170
  end
169
171
  # rubocop:disable Lint/RescueException
170
172
  # Here we really want to catch *any* exception, not only StandardError,
@@ -214,9 +216,6 @@ module Datadog
214
216
  end
215
217
 
216
218
  # Mark the span stopped at the current time
217
- #
218
- # steep:ignore:start
219
- # Steep issue fixed in https://github.com/soutaro/steep/pull/1467
220
219
  def stop(stop_time = nil, exception: nil)
221
220
  # A span should not be stopped twice. Note that this is not thread-safe,
222
221
  # stop is called from multiple threads, a given span might be stopped
@@ -239,7 +238,6 @@ module Datadog
239
238
 
240
239
  self
241
240
  end
242
- # steep:ignore:end
243
241
 
244
242
  # Return whether the duration is started or not
245
243
  def started?
@@ -287,10 +285,15 @@ module Datadog
287
285
  end
288
286
 
289
287
  def duration
288
+ # Steep: https://github.com/soutaro/steep/issues/477
289
+ # @type ivar @duration_end: Time
290
+ # @type ivar @duration_start: Time
290
291
  return @duration_end - @duration_start if @duration_start && @duration_end
291
292
 
292
293
  # Steep: https://github.com/soutaro/steep/issues/477
293
- @end_time - @start_time if @start_time && @end_time # steep:ignore NoMethod
294
+ # @type ivar @end_time: Time
295
+ # @type ivar @start_time: Time
296
+ @end_time - @start_time if @start_time && @end_time
294
297
  end
295
298
 
296
299
  def set_error(e)
@@ -317,7 +320,9 @@ module Datadog
317
320
  'exception.stacktrace' => exc.backtrace,
318
321
  }
319
322
 
320
- @span_events << SpanEvent.new('exception', attributes: event_attributes.merge!(attributes)) # steep:ignore
323
+ # Steep: Caused by wrong declaration, should be the same parameters as `merge`
324
+ # https://github.com/ruby/rbs/blob/3d0fb3a7fdde60af7120e875fe3bd7237b5b6a88/core/hash.rbs#L1468
325
+ @span_events << SpanEvent.new('exception', attributes: event_attributes.merge!(attributes)) # steep:ignore ArgumentTypeMismatch
321
326
  end
322
327
 
323
328
  # Return a string representation of the span.
@@ -466,7 +471,7 @@ module Datadog
466
471
  @handler.call(*args)
467
472
  rescue => e
468
473
  logger.debug do
469
- "Error in on_error handler '#{@default}': #{e.class}: #{e} at #{Array(e.backtrace).first}"
474
+ "Error in on_error handler '#{@handler}': #{e.class}: #{e} at #{Array(e.backtrace).first}"
470
475
  end
471
476
  end
472
477
 
@@ -553,7 +558,8 @@ module Datadog
553
558
  return 0 if @start_time.nil?
554
559
 
555
560
  # Steep: https://github.com/soutaro/steep/issues/477
556
- @start_time.to_i * 1000000000 + @start_time.nsec # steep:ignore NoMethod
561
+ # @type ivar @start_time: Time
562
+ @start_time.to_i * 1000000000 + @start_time.nsec
557
563
  end
558
564
 
559
565
  # Used for serialization
@@ -3,7 +3,7 @@
3
3
  module Datadog
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 24
6
+ MINOR = 25
7
7
  PATCH = 0
8
8
  PRE = nil
9
9
  BUILD = nil
data/lib/datadog.rb CHANGED
@@ -6,6 +6,7 @@ require_relative 'datadog/tracing/contrib'
6
6
 
7
7
  # Load other products (must follow tracing)
8
8
  require_relative 'datadog/profiling'
9
+ require_relative 'datadog/ai_guard'
9
10
  require_relative 'datadog/appsec'
10
11
  require_relative 'datadog/di'
11
12
  require_relative 'datadog/data_streams'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.24.0
4
+ version: 2.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-08 00:00:00.000000000 Z
11
+ date: 2026-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -30,20 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.4'
33
+ version: '3.5'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 3.4.2
36
+ version: 3.5.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '3.4'
43
+ version: '3.5'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 3.4.2
46
+ version: 3.5.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: libddwaf
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -182,6 +182,19 @@ files:
182
182
  - ext/libdatadog_api/process_discovery.h
183
183
  - ext/libdatadog_extconf_helpers.rb
184
184
  - lib/datadog.rb
185
+ - lib/datadog/ai_guard.rb
186
+ - lib/datadog/ai_guard/api_client.rb
187
+ - lib/datadog/ai_guard/component.rb
188
+ - lib/datadog/ai_guard/configuration.rb
189
+ - lib/datadog/ai_guard/configuration/ext.rb
190
+ - lib/datadog/ai_guard/configuration/settings.rb
191
+ - lib/datadog/ai_guard/evaluation.rb
192
+ - lib/datadog/ai_guard/evaluation/message.rb
193
+ - lib/datadog/ai_guard/evaluation/no_op_result.rb
194
+ - lib/datadog/ai_guard/evaluation/request.rb
195
+ - lib/datadog/ai_guard/evaluation/result.rb
196
+ - lib/datadog/ai_guard/evaluation/tool_call.rb
197
+ - lib/datadog/ai_guard/ext.rb
185
198
  - lib/datadog/appsec.rb
186
199
  - lib/datadog/appsec/actions_handler.rb
187
200
  - lib/datadog/appsec/actions_handler/serializable_backtrace.rb
@@ -1077,8 +1090,8 @@ licenses:
1077
1090
  - Apache-2.0
1078
1091
  metadata:
1079
1092
  allowed_push_host: https://rubygems.org
1080
- changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.24.0/CHANGELOG.md
1081
- source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.24.0
1093
+ changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.25.0/CHANGELOG.md
1094
+ source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.25.0
1082
1095
  post_install_message:
1083
1096
  rdoc_options: []
1084
1097
  require_paths: