datadog 2.24.0 → 2.26.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +93 -23
- data/ext/datadog_profiling_native_extension/http_transport.c +1 -0
- data/ext/libdatadog_extconf_helpers.rb +1 -1
- data/lib/datadog/ai_guard/api_client.rb +82 -0
- data/lib/datadog/ai_guard/component.rb +42 -0
- data/lib/datadog/ai_guard/configuration/ext.rb +17 -0
- data/lib/datadog/ai_guard/configuration/settings.rb +98 -0
- data/lib/datadog/ai_guard/configuration.rb +11 -0
- data/lib/datadog/ai_guard/evaluation/message.rb +25 -0
- data/lib/datadog/ai_guard/evaluation/no_op_result.rb +34 -0
- data/lib/datadog/ai_guard/evaluation/request.rb +81 -0
- data/lib/datadog/ai_guard/evaluation/result.rb +43 -0
- data/lib/datadog/ai_guard/evaluation/tool_call.rb +18 -0
- data/lib/datadog/ai_guard/evaluation.rb +72 -0
- data/lib/datadog/ai_guard/ext.rb +16 -0
- data/lib/datadog/ai_guard.rb +153 -0
- data/lib/datadog/appsec/remote.rb +4 -3
- data/lib/datadog/appsec/security_engine/engine.rb +3 -3
- data/lib/datadog/appsec/security_engine/runner.rb +2 -2
- data/lib/datadog/core/configuration/components.rb +7 -0
- data/lib/datadog/core/configuration/supported_configurations.rb +6 -0
- data/lib/datadog/core/error.rb +6 -6
- data/lib/datadog/core/pin.rb +4 -0
- data/lib/datadog/core/rate_limiter.rb +1 -1
- data/lib/datadog/core/runtime/metrics.rb +11 -1
- data/lib/datadog/core/semaphore.rb +1 -4
- data/lib/datadog/core/telemetry/event/app_started.rb +2 -1
- data/lib/datadog/core/transport/response.rb +3 -1
- data/lib/datadog/core/utils/safe_dup.rb +2 -2
- data/lib/datadog/core/utils/sequence.rb +2 -0
- data/lib/datadog/di/boot.rb +4 -2
- data/lib/datadog/di/contrib/active_record.rb +4 -5
- data/lib/datadog/di/instrumenter.rb +9 -3
- data/lib/datadog/di/logger.rb +2 -2
- data/lib/datadog/di/probe_file_loader/railtie.rb +1 -1
- data/lib/datadog/di/probe_notifier_worker.rb +5 -5
- data/lib/datadog/error_tracking/filters.rb +2 -2
- data/lib/datadog/kit/appsec/events/v2.rb +2 -3
- data/lib/datadog/profiling/collectors/code_provenance.rb +1 -1
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -2
- data/lib/datadog/profiling/collectors/info.rb +3 -3
- data/lib/datadog/profiling/ext/dir_monkey_patches.rb +18 -0
- data/lib/datadog/tracing/contrib/waterdrop.rb +4 -0
- data/lib/datadog/tracing/distributed/baggage.rb +3 -2
- data/lib/datadog/tracing/sampling/priority_sampler.rb +3 -1
- data/lib/datadog/tracing/span.rb +1 -1
- data/lib/datadog/tracing/span_operation.rb +15 -9
- data/lib/datadog/version.rb +1 -1
- data/lib/datadog.rb +1 -0
- metadata +23 -10
|
@@ -5,8 +5,8 @@ module Datadog
|
|
|
5
5
|
module Utils
|
|
6
6
|
# Helper methods for safer dup
|
|
7
7
|
module SafeDup
|
|
8
|
-
#
|
|
9
|
-
def self.frozen_or_dup(v)
|
|
8
|
+
# Steep: https://github.com/soutaro/steep/issues/2001
|
|
9
|
+
def self.frozen_or_dup(v) # steep:ignore MethodBodyTypeMismatch
|
|
10
10
|
# For the case of a String we use the methods +@ and -@.
|
|
11
11
|
# Those methods are only for String objects
|
|
12
12
|
# they are faster and chepaer on the memory side.
|
data/lib/datadog/di/boot.rb
CHANGED
|
@@ -17,7 +17,8 @@ require_relative 'serializer'
|
|
|
17
17
|
require_relative 'transport/http'
|
|
18
18
|
require_relative 'utils'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
# Steep: https://github.com/ruby/rbs/pull/2715
|
|
21
|
+
if %w[1 true yes].include?(Datadog::DATADOG_ENV['DD_DYNAMIC_INSTRUMENTATION_ENABLED']) # steep:ignore ArgumentTypeMismatch
|
|
21
22
|
|
|
22
23
|
# For initial release of Dynamic Instrumentation, activate code tracking
|
|
23
24
|
# only if DI is explicitly requested in the environment.
|
|
@@ -35,7 +36,8 @@ require_relative 'contrib'
|
|
|
35
36
|
|
|
36
37
|
Datadog::DI::Contrib.load_now_or_later
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
# Steep: https://github.com/ruby/rbs/pull/2715
|
|
40
|
+
if %w[1 true yes].include?(Datadog::DATADOG_ENV['DD_DYNAMIC_INSTRUMENTATION_ENABLED']) # steep:ignore ArgumentTypeMismatch
|
|
39
41
|
if Datadog::DATADOG_ENV['DD_DYNAMIC_INSTRUMENTATION_PROBE_FILE']
|
|
40
42
|
require_relative 'probe_file_loader'
|
|
41
43
|
Datadog::DI::ProbeFileLoader.load_now_or_later
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# steep thinks all of the arguments are nil here and does not know what ActiveRecord is.
|
|
4
|
-
# steep:ignore:start
|
|
5
|
-
|
|
6
3
|
Datadog::DI::Serializer.register(
|
|
7
4
|
# This serializer uses a dynamic condition to determine its applicability
|
|
8
5
|
# to a particular value. A simpler case could have been a serializer for
|
|
@@ -28,11 +25,13 @@ Datadog::DI::Serializer.register(
|
|
|
28
25
|
# It should always be an integer.
|
|
29
26
|
# Reduce it by 1 when invoking +serialize_value+ on the contents of +value+.
|
|
30
27
|
# This serializer could also potentially do its own depth limiting.
|
|
28
|
+
#
|
|
29
|
+
# Steep: steep thinks all of the arguments are nil here
|
|
30
|
+
# Looks like it cannot handle kwargs in lambdas
|
|
31
|
+
# @type var depth: Integer
|
|
31
32
|
value_to_serialize = {
|
|
32
33
|
attributes: value.attributes,
|
|
33
34
|
new_record: value.new_record?,
|
|
34
35
|
}
|
|
35
36
|
serializer.serialize_value(value_to_serialize, depth: depth - 1, type: value.class)
|
|
36
37
|
end
|
|
37
|
-
|
|
38
|
-
# steep:ignore:end
|
|
@@ -114,7 +114,9 @@ module Datadog
|
|
|
114
114
|
settings = self.settings
|
|
115
115
|
|
|
116
116
|
mod = Module.new do
|
|
117
|
-
define_method(method_name) do |*args, **kwargs, &target_block| # steep:ignore
|
|
117
|
+
define_method(method_name) do |*args, **kwargs, &target_block| # steep:ignore NoMethod
|
|
118
|
+
# Steep: Unsure why it cannot detect kwargs in this block. Workaround:
|
|
119
|
+
# @type var kwargs: ::Hash[::Symbol, untyped]
|
|
118
120
|
continue = true
|
|
119
121
|
if condition = probe.condition
|
|
120
122
|
begin
|
|
@@ -209,7 +211,8 @@ module Datadog
|
|
|
209
211
|
# that location here.
|
|
210
212
|
[]
|
|
211
213
|
end
|
|
212
|
-
|
|
214
|
+
# Steep: https://github.com/ruby/rbs/pull/2745
|
|
215
|
+
caller_locs = method_frame + caller_locations # steep:ignore ArgumentTypeMismatch
|
|
213
216
|
# TODO capture arguments at exit
|
|
214
217
|
|
|
215
218
|
context = Context.new(locals: nil, target_self: self,
|
|
@@ -305,7 +308,10 @@ module Datadog
|
|
|
305
308
|
|
|
306
309
|
iseq = nil
|
|
307
310
|
if code_tracker
|
|
308
|
-
|
|
311
|
+
# Steep: Complex type narrowing (before calling hook_line,
|
|
312
|
+
# we check that probe.line? is true which itself checks that probe.file is not nil)
|
|
313
|
+
# Annotation do not work here as `file` is a method on probe, not a local variable.
|
|
314
|
+
ret = code_tracker.iseqs_for_path_suffix(probe.file) # steep:ignore ArgumentTypeMismatch
|
|
309
315
|
unless ret
|
|
310
316
|
if permit_untargeted_trace_points
|
|
311
317
|
# Continue withoout targeting the trace point.
|
data/lib/datadog/di/logger.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Datadog
|
|
|
8
8
|
#
|
|
9
9
|
# @api private
|
|
10
10
|
class Logger
|
|
11
|
-
extend Forwardable
|
|
11
|
+
extend Forwardable
|
|
12
12
|
|
|
13
13
|
def initialize(settings, target)
|
|
14
14
|
@settings = settings
|
|
@@ -18,7 +18,7 @@ module Datadog
|
|
|
18
18
|
attr_reader :settings
|
|
19
19
|
attr_reader :target
|
|
20
20
|
|
|
21
|
-
def_delegators :target, :debug
|
|
21
|
+
def_delegators :target, :debug
|
|
22
22
|
|
|
23
23
|
def trace(&block)
|
|
24
24
|
if settings.dynamic_instrumentation.internal.trace_logging
|
|
@@ -6,7 +6,7 @@ module Datadog
|
|
|
6
6
|
# Railtie class initializes dynamic instrumentation contrib code
|
|
7
7
|
# in Rails environments.
|
|
8
8
|
class Railtie < Rails::Railtie
|
|
9
|
-
initializer 'datadog.dynamic_instrumentation.load_probe_file' do |app|
|
|
9
|
+
initializer 'datadog.dynamic_instrumentation.load_probe_file' do |app|
|
|
10
10
|
ProbeFileLoader.load_now
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -249,12 +249,12 @@ module Datadog
|
|
|
249
249
|
@lock.synchronize do
|
|
250
250
|
batch = instance_variable_get("@#{event_type}_queue")
|
|
251
251
|
instance_variable_set("@#{event_type}_queue", [])
|
|
252
|
-
@io_in_progress = batch.any?
|
|
252
|
+
@io_in_progress = batch.any?
|
|
253
253
|
end
|
|
254
|
-
logger.trace { "di: #{self.class.name}: checking #{event_type} queue - #{batch.length} entries" }
|
|
255
|
-
if batch.any?
|
|
254
|
+
logger.trace { "di: #{self.class.name}: checking #{event_type} queue - #{batch.length} entries" }
|
|
255
|
+
if batch.any?
|
|
256
256
|
begin
|
|
257
|
-
logger.trace { "di: sending #{batch.length} #{event_type} event(s) to agent" }
|
|
257
|
+
logger.trace { "di: sending #{batch.length} #{event_type} event(s) to agent" }
|
|
258
258
|
send("do_send_#{event_type}", batch)
|
|
259
259
|
time = Core::Utils::Time.get_time
|
|
260
260
|
@lock.synchronize do
|
|
@@ -268,7 +268,7 @@ module Datadog
|
|
|
268
268
|
# telemetry message would also fail.
|
|
269
269
|
end
|
|
270
270
|
end
|
|
271
|
-
batch.any?
|
|
271
|
+
batch.any?
|
|
272
272
|
rescue ThreadError => exc
|
|
273
273
|
# Normally the queue should only be consumed in this method,
|
|
274
274
|
# however if anyone consumes it elsewhere we don't want to block
|
|
@@ -18,10 +18,10 @@ module Datadog
|
|
|
18
18
|
regex_match = regex.match(file_path)
|
|
19
19
|
return unless regex_match
|
|
20
20
|
|
|
21
|
-
gem_name = regex_match[1]
|
|
21
|
+
gem_name = regex_match[1] #: String
|
|
22
22
|
|
|
23
23
|
begin
|
|
24
|
-
Gem::Specification.find_by_name(gem_name)
|
|
24
|
+
Gem::Specification.find_by_name(gem_name)
|
|
25
25
|
rescue Gem::MissingSpecError
|
|
26
26
|
nil
|
|
27
27
|
end
|
|
@@ -66,8 +66,7 @@ module Datadog
|
|
|
66
66
|
record_event_telemetry_metric(LOGIN_SUCCESS_EVENT)
|
|
67
67
|
::Datadog::AppSec::Instrumentation.gateway.push('appsec.events.user_lifecycle', LOGIN_SUCCESS_EVENT)
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
return Kit::Identity.set_user(trace, span, **user_attributes) if user_attributes.key?(:id) # steep:ignore
|
|
69
|
+
return Kit::Identity.set_user(trace, span, **user_attributes) if user_attributes.key?(:id)
|
|
71
70
|
|
|
72
71
|
# NOTE: This is a fallback for the case when we don't have an ID,
|
|
73
72
|
# but need to trigger WAF.
|
|
@@ -156,7 +155,7 @@ module Datadog
|
|
|
156
155
|
raise ArgumentError, 'missing required user key `:id`' unless user_or_id.key?(:id)
|
|
157
156
|
raise TypeError, 'user key `:id` must be a String' unless user_or_id[:id].is_a?(String)
|
|
158
157
|
|
|
159
|
-
user_or_id.merge(login: login)
|
|
158
|
+
user_or_id.merge(login: login) #: {login: ::String, ?id: ::String?}
|
|
160
159
|
else
|
|
161
160
|
raise TypeError, '`user_or_id` argument must be either String or Hash'
|
|
162
161
|
end
|
|
@@ -161,7 +161,7 @@ module Datadog
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
def to_json(arg = nil)
|
|
164
|
-
# Steep: https://github.com/ruby/rbs/pull/2691
|
|
164
|
+
# Steep: https://github.com/ruby/rbs/pull/2691 (remove after RBS 4.0 release)
|
|
165
165
|
{kind: @kind, name: @name, version: @version, paths: @paths}.to_json(arg) # steep:ignore ArgumentTypeMismatch
|
|
166
166
|
end
|
|
167
167
|
|
|
@@ -77,12 +77,13 @@ module Datadog
|
|
|
77
77
|
Datadog.logger.debug("CpuAndWallTimeWorker thread stopping cleanly")
|
|
78
78
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
79
79
|
@failure_exception = e
|
|
80
|
+
operation_name = self.class._native_failure_exception_during_operation(self).inspect
|
|
80
81
|
Datadog.logger.warn(
|
|
81
82
|
"CpuAndWallTimeWorker thread error. " \
|
|
82
|
-
"Cause: #{e.class.name} #{e.message} Location: #{Array(e.backtrace).first}"
|
|
83
|
+
"Operation: #{operation_name} Cause: #{e.class.name} #{e.message} Location: #{Array(e.backtrace).first}"
|
|
83
84
|
)
|
|
84
85
|
on_failure_proc&.call
|
|
85
|
-
Datadog::Core::Telemetry::Logger.report(e, description: "CpuAndWallTimeWorker thread error")
|
|
86
|
+
Datadog::Core::Telemetry::Logger.report(e, description: "CpuAndWallTimeWorker thread error: #{operation_name}")
|
|
86
87
|
end
|
|
87
88
|
@worker_thread.name = self.class.name # Repeated from above to make sure thread gets named asap
|
|
88
89
|
@worker_thread.thread_variable_set(:fork_safe, true)
|
|
@@ -16,6 +16,7 @@ module Datadog
|
|
|
16
16
|
class Info
|
|
17
17
|
def initialize(settings)
|
|
18
18
|
@profiler_info = nil
|
|
19
|
+
|
|
19
20
|
# Steep: https://github.com/soutaro/steep/issues/363
|
|
20
21
|
@info = { # steep:ignore IncompatibleAssignment
|
|
21
22
|
platform: collect_platform_info,
|
|
@@ -97,7 +98,7 @@ module Datadog
|
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
def collect_profiler_info(settings)
|
|
100
|
-
|
|
101
|
+
@profiler_info ||= begin
|
|
101
102
|
lib_datadog_gem = ::Gem.loaded_specs["libdatadog"]
|
|
102
103
|
|
|
103
104
|
libdatadog_version =
|
|
@@ -109,13 +110,12 @@ module Datadog
|
|
|
109
110
|
"#{Libdatadog::VERSION}-(unknown)"
|
|
110
111
|
end
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
{
|
|
113
114
|
version: Datadog::Core::Environment::Identity.gem_datadog_version,
|
|
114
115
|
libdatadog: libdatadog_version,
|
|
115
116
|
settings: collect_settings_recursively(settings.profiling),
|
|
116
117
|
}.freeze
|
|
117
118
|
end
|
|
118
|
-
@profiler_info
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
# The settings/option model isn't directly serializable because
|
|
@@ -30,6 +30,10 @@ module Datadog
|
|
|
30
30
|
if RUBY_VERSION.start_with?("2.")
|
|
31
31
|
# Monkey patches for Dir.singleton_class (Ruby 2 version). See DirMonkeyPatches above for more details.
|
|
32
32
|
module DirClassMonkeyPatches
|
|
33
|
+
# Steep: Workaround that defines args and block only for Ruby 2.x.
|
|
34
|
+
# @type var args: ::Array[any]
|
|
35
|
+
# @type var block: ^(?) -> any | nil
|
|
36
|
+
|
|
33
37
|
def [](*args, &block)
|
|
34
38
|
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals
|
|
35
39
|
super
|
|
@@ -148,6 +152,11 @@ module Datadog
|
|
|
148
152
|
else
|
|
149
153
|
# Monkey patches for Dir.singleton_class (Ruby 3 version). See DirMonkeyPatches above for more details.
|
|
150
154
|
module DirClassMonkeyPatches
|
|
155
|
+
# Steep: Workaround that defines args, kwargs and block only for Ruby 3.x.
|
|
156
|
+
# @type var args: ::Array[any]
|
|
157
|
+
# @type var kwargs: ::Hash[::Symbol, any]
|
|
158
|
+
# @type var block: ^(?) -> any | nil
|
|
159
|
+
|
|
151
160
|
def [](*args, **kwargs, &block)
|
|
152
161
|
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals
|
|
153
162
|
super
|
|
@@ -263,6 +272,10 @@ module Datadog
|
|
|
263
272
|
if RUBY_VERSION.start_with?("2.")
|
|
264
273
|
# Monkey patches for Dir (Ruby 2 version). See DirMonkeyPatches above for more details.
|
|
265
274
|
module DirInstanceMonkeyPatches
|
|
275
|
+
# Steep: Workaround that defines args and block only for Ruby 2.x.
|
|
276
|
+
# @type var args: ::Array[any]
|
|
277
|
+
# @type var block: ^(?) -> any | nil
|
|
278
|
+
|
|
266
279
|
# See note on methods that yield above.
|
|
267
280
|
def each(*args, &block)
|
|
268
281
|
if block
|
|
@@ -336,6 +349,11 @@ module Datadog
|
|
|
336
349
|
else
|
|
337
350
|
# Monkey patches for Dir (Ruby 3 version). See DirMonkeyPatches above for more details.
|
|
338
351
|
module DirInstanceMonkeyPatches
|
|
352
|
+
# Steep: Workaround that defines args, kwargs and block only for Ruby 3.x.
|
|
353
|
+
# @type var args: ::Array[any]
|
|
354
|
+
# @type var kwargs: ::Hash[::Symbol, any]
|
|
355
|
+
# @type var block: ^(?) -> any | nil
|
|
356
|
+
|
|
339
357
|
# See note on methods that yield above.
|
|
340
358
|
def each(*args, **kwargs, &block)
|
|
341
359
|
if block
|
|
@@ -12,12 +12,16 @@ module Datadog
|
|
|
12
12
|
def self.inject(digest, data)
|
|
13
13
|
raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation
|
|
14
14
|
|
|
15
|
+
# Steep: https://github.com/soutaro/steep/issues/477
|
|
16
|
+
# @type ivar @propagation: WaterDrop::Distributed::Propagation
|
|
15
17
|
@propagation.inject!(digest, data)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def self.extract(data)
|
|
19
21
|
raise 'Please invoke Datadog.configure at least once before calling this method' unless @propagation
|
|
20
22
|
|
|
23
|
+
# Steep: https://github.com/soutaro/steep/issues/477
|
|
24
|
+
# @type ivar @propagation: WaterDrop::Distributed::Propagation
|
|
21
25
|
@propagation.extract(data)
|
|
22
26
|
end
|
|
23
27
|
|
|
@@ -175,8 +175,9 @@ module Datadog
|
|
|
175
175
|
|
|
176
176
|
tags = {}
|
|
177
177
|
|
|
178
|
-
baggage_tag_keys.each do |key, _|
|
|
179
|
-
|
|
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
|
-
|
|
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.
|
data/lib/datadog/tracing/span.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 '#{@
|
|
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
|
-
@
|
|
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
|
data/lib/datadog/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.26.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-
|
|
11
|
+
date: 2026-01-16 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.
|
|
33
|
+
version: '3.5'
|
|
34
34
|
- - ">="
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 3.
|
|
36
|
+
version: 3.5.1
|
|
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.
|
|
43
|
+
version: '3.5'
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 3.
|
|
46
|
+
version: 3.5.1
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: libddwaf
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -64,14 +64,14 @@ dependencies:
|
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 25.0.0.1.0
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version:
|
|
74
|
+
version: 25.0.0.1.0
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
76
|
name: logger
|
|
77
77
|
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.
|
|
1081
|
-
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.
|
|
1093
|
+
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.26.0/CHANGELOG.md
|
|
1094
|
+
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.26.0
|
|
1082
1095
|
post_install_message:
|
|
1083
1096
|
rdoc_options: []
|
|
1084
1097
|
require_paths:
|