datadog 2.43.0 → 2.44.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 +44 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +36 -5
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +6 -7
- data/ext/datadog_profiling_native_extension/collectors_stack.c +6 -7
- data/ext/datadog_profiling_native_extension/collectors_stack.h +1 -1
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +65 -31
- data/ext/datadog_profiling_native_extension/collectors_thread_context.h +3 -2
- data/ext/datadog_profiling_native_extension/extconf.rb +4 -2
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +25 -0
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +1 -0
- data/ext/datadog_profiling_native_extension/profiling.c +1 -0
- data/ext/datadog_profiling_native_extension/stack_recorder.c +4 -4
- data/ext/datadog_profiling_native_extension/time_helpers.h +3 -3
- data/ext/libdatadog_api/di.c +8 -3
- data/ext/libdatadog_api/extconf.rb +1 -1
- data/ext/libdatadog_api/feature_flags.c +8 -0
- data/ext/libdatadog_api/init.c +3 -1
- data/ext/libdatadog_api/otel_thread_context.c +38 -17
- data/ext/libdatadog_extconf_helpers.rb +14 -9
- data/lib/datadog/ai_guard/component.rb +17 -8
- data/lib/datadog/ai_guard/configuration/ext.rb +2 -0
- data/lib/datadog/ai_guard/configuration.rb +13 -0
- data/lib/datadog/ai_guard/contrib/ruby_llm/chat_instrumentation.rb +48 -55
- data/lib/datadog/ai_guard/contrib/ruby_llm/integration.rb +1 -1
- data/lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb +76 -0
- data/lib/datadog/ai_guard/contrib/ruby_llm/patcher.rb +1 -0
- data/lib/datadog/ai_guard/contrib/ruby_llm/redaction_change_set.rb +135 -0
- data/lib/datadog/ai_guard/evaluation/client.rb +50 -0
- data/lib/datadog/ai_guard/evaluation/content_part.rb +12 -0
- data/lib/datadog/ai_guard/evaluation/message.rb +25 -7
- data/lib/datadog/ai_guard/evaluation/message_builder.rb +31 -0
- data/lib/datadog/ai_guard/evaluation/no_op_result.rb +6 -6
- data/lib/datadog/ai_guard/evaluation/outcome.rb +24 -0
- data/lib/datadog/ai_guard/evaluation/request.rb +4 -60
- data/lib/datadog/ai_guard/evaluation/response.rb +33 -0
- data/lib/datadog/ai_guard/evaluation/result.rb +11 -18
- data/lib/datadog/ai_guard/evaluation/tool_call.rb +15 -2
- data/lib/datadog/ai_guard/evaluation.rb +25 -11
- data/lib/datadog/ai_guard/ext.rb +1 -0
- data/lib/datadog/ai_guard/{api_client.rb → http_client.rb} +6 -4
- data/lib/datadog/ai_guard/metrics/telemetry.rb +43 -0
- data/lib/datadog/ai_guard/redaction/replacements.rb +97 -0
- data/lib/datadog/ai_guard/redaction/result.rb +29 -0
- data/lib/datadog/ai_guard/redaction.rb +80 -0
- data/lib/datadog/ai_guard.rb +58 -57
- data/lib/datadog/core/configuration/components.rb +9 -1
- data/lib/datadog/core/configuration/settings.rb +5 -2
- data/lib/datadog/core/configuration/supported_configurations.rb +8 -0
- data/lib/datadog/core/remote/client/capabilities.rb +10 -4
- data/lib/datadog/core/remote/component.rb +9 -2
- data/lib/datadog/core/remote/worker.rb +8 -0
- data/lib/datadog/di/instrumenter.rb +1 -1
- data/lib/datadog/di/probe_manager.rb +10 -5
- data/lib/datadog/di/proc_responder.rb +1 -1
- data/lib/datadog/open_feature/agentless/configuration_source.rb +246 -0
- data/lib/datadog/open_feature/agentless/parser.rb +43 -0
- data/lib/datadog/open_feature/agentless/response.rb +19 -0
- data/lib/datadog/open_feature/agentless/transport.rb +103 -0
- data/lib/datadog/open_feature/component.rb +57 -1
- data/lib/datadog/open_feature/configuration/agentless_endpoint.rb +90 -0
- data/lib/datadog/open_feature/configuration/source/resolution.rb +22 -0
- data/lib/datadog/open_feature/configuration/source.rb +43 -0
- data/lib/datadog/open_feature/configuration.rb +118 -0
- data/lib/datadog/open_feature/native_evaluator.rb +1 -14
- data/lib/datadog/open_feature/remote.rb +5 -5
- data/lib/datadog/opentelemetry/signal_configuration.rb +13 -9
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +2 -2
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +5 -7
- data/lib/datadog/symbol_database/extractor.rb +84 -102
- data/lib/datadog/tracing/component.rb +2 -0
- data/lib/datadog/tracing/configuration/ext.rb +1 -0
- data/lib/datadog/tracing/configuration/settings.rb +6 -0
- data/lib/datadog/tracing/context.rb +24 -2
- data/lib/datadog/tracing/context_provider.rb +9 -5
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +32 -5
- data/lib/datadog/tracing/metadata/ext.rb +3 -0
- data/lib/datadog/tracing/otel_thread_context.rb +76 -11
- data/lib/datadog/tracing/tracer.rb +15 -2
- data/lib/datadog/tracing/transport/native.rb +1 -1
- data/lib/datadog/tracing/transport/trace_formatter.rb +13 -3
- data/lib/datadog/tracing/transport/traces.rb +1 -1
- data/lib/datadog/version.rb +1 -1
- metadata +23 -7
- data/lib/datadog/ai_guard/evaluation/content_builder.rb +0 -31
|
@@ -20,9 +20,15 @@ module Datadog
|
|
|
20
20
|
attr_reader \
|
|
21
21
|
:active_trace
|
|
22
22
|
|
|
23
|
+
attr_writer \
|
|
24
|
+
:otel_thread_context
|
|
25
|
+
|
|
23
26
|
def initialize(
|
|
24
|
-
trace: nil
|
|
27
|
+
trace: nil,
|
|
28
|
+
otel_thread_context: nil
|
|
25
29
|
)
|
|
30
|
+
@otel_thread_context = otel_thread_context
|
|
31
|
+
@active_trace = nil
|
|
26
32
|
activate!(trace)
|
|
27
33
|
end
|
|
28
34
|
|
|
@@ -54,14 +60,30 @@ module Datadog
|
|
|
54
60
|
# Creates a copy of the context, when forked.
|
|
55
61
|
def fork_clone
|
|
56
62
|
forked_trace = @active_trace&.fork_clone
|
|
57
|
-
|
|
63
|
+
|
|
64
|
+
self.class.new(
|
|
65
|
+
trace: forked_trace,
|
|
66
|
+
otel_thread_context: @otel_thread_context
|
|
67
|
+
)
|
|
58
68
|
end
|
|
59
69
|
|
|
60
70
|
private
|
|
61
71
|
|
|
62
72
|
def set_active_trace!(trace)
|
|
73
|
+
previous_trace = @active_trace
|
|
74
|
+
|
|
63
75
|
# Don't retain finished traces
|
|
64
76
|
@active_trace = (trace && !trace.finished?) ? trace : nil
|
|
77
|
+
|
|
78
|
+
return @active_trace if previous_trace == @active_trace
|
|
79
|
+
|
|
80
|
+
if @active_trace
|
|
81
|
+
@otel_thread_context&.update_from_trace_op(@active_trace)
|
|
82
|
+
elsif previous_trace
|
|
83
|
+
@otel_thread_context&.clear
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
@active_trace
|
|
65
87
|
end
|
|
66
88
|
end
|
|
67
89
|
end
|
|
@@ -12,12 +12,15 @@ module Datadog
|
|
|
12
12
|
# @see https://ruby-doc.org/core-3.1.2/Thread.html#method-i-5B-5D Thread attributes are fiber-local
|
|
13
13
|
class DefaultContextProvider
|
|
14
14
|
# Initializes the default context provider with a fiber-bound context.
|
|
15
|
-
def initialize
|
|
16
|
-
@
|
|
15
|
+
def initialize(otel_thread_context: nil)
|
|
16
|
+
@otel_thread_context = otel_thread_context
|
|
17
|
+
@context = FiberLocalContext.new(otel_thread_context: otel_thread_context)
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
# Sets the current context.
|
|
20
21
|
def context=(ctx)
|
|
22
|
+
ctx.otel_thread_context = @otel_thread_context if ctx.respond_to?(:otel_thread_context=)
|
|
23
|
+
|
|
21
24
|
@context.local = ctx
|
|
22
25
|
end
|
|
23
26
|
|
|
@@ -48,10 +51,11 @@ module Datadog
|
|
|
48
51
|
class FiberLocalContext
|
|
49
52
|
# To support multiple tracers simultaneously, each {Datadog::Tracing::FiberLocalContext}
|
|
50
53
|
# instance has its own fiber-local variable.
|
|
51
|
-
def initialize
|
|
54
|
+
def initialize(otel_thread_context: nil)
|
|
55
|
+
@otel_thread_context = otel_thread_context
|
|
52
56
|
@key = :"datadog_context_#{FiberLocalContext.next_instance_id}"
|
|
53
57
|
|
|
54
|
-
self.local = Context.new
|
|
58
|
+
self.local = Context.new(otel_thread_context: otel_thread_context)
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
# Override the fiber-local context with a new context.
|
|
@@ -61,7 +65,7 @@ module Datadog
|
|
|
61
65
|
|
|
62
66
|
# Return the fiber-local context.
|
|
63
67
|
def local(storage = Thread.current)
|
|
64
|
-
storage[@key] ||= Context.new
|
|
68
|
+
storage[@key] ||= Context.new(otel_thread_context: @otel_thread_context)
|
|
65
69
|
end
|
|
66
70
|
|
|
67
71
|
# Ensure two instances of {FiberLocalContext} do not conflict.
|
|
@@ -15,6 +15,7 @@ module Datadog
|
|
|
15
15
|
module Endpoint
|
|
16
16
|
KEY_RUN = "datadog_grape_endpoint_run"
|
|
17
17
|
KEY_RENDER = "datadog_grape_endpoint_render"
|
|
18
|
+
FORMAT_SEGMENT = /\(\.:?\w+\)\z/
|
|
18
19
|
|
|
19
20
|
class << self
|
|
20
21
|
def subscribe
|
|
@@ -43,8 +44,8 @@ module Datadog
|
|
|
43
44
|
# collect endpoint details
|
|
44
45
|
endpoint = payload.fetch(:endpoint)
|
|
45
46
|
env = payload.fetch(:env)
|
|
46
|
-
api_view = api_view(endpoint
|
|
47
|
-
request_method = endpoint
|
|
47
|
+
api_view = api_view(endpoint_api(endpoint))
|
|
48
|
+
request_method = endpoint_request_method(endpoint)
|
|
48
49
|
path = endpoint_expand_path(endpoint)
|
|
49
50
|
resource = "#{api_view} #{request_method} #{path}"
|
|
50
51
|
|
|
@@ -65,12 +66,16 @@ module Datadog
|
|
|
65
66
|
span.set_tag(Tracing::Metadata::Ext::TAG_SVC_SRC, Ext::TAG_COMPONENT)
|
|
66
67
|
|
|
67
68
|
if (grape_route = env["grape.routing_args"]) && grape_route[:route_info]
|
|
69
|
+
route_info = grape_route[:route_info]
|
|
70
|
+
# Grape 2.3 through 3.0 return nil from GreedyRoute#path; the
|
|
71
|
+
# path lives at pattern.path in those versions.
|
|
72
|
+
route_path = route_info.path || route_info.pattern&.path
|
|
68
73
|
trace.set_tag(
|
|
69
74
|
Tracing::Metadata::Ext::HTTP::TAG_ROUTE,
|
|
70
75
|
# here we are removing the format from the path:
|
|
71
76
|
# e.g. /path/to/resource(.json) => /path/to/resource
|
|
72
77
|
# e.g. /path/to/resource(.:format) => /path/to/resource
|
|
73
|
-
|
|
78
|
+
route_path&.gsub(FORMAT_SEGMENT, "")
|
|
74
79
|
)
|
|
75
80
|
|
|
76
81
|
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, env["SCRIPT_NAME"])
|
|
@@ -96,8 +101,8 @@ module Datadog
|
|
|
96
101
|
begin
|
|
97
102
|
# collect endpoint details
|
|
98
103
|
endpoint = payload.fetch(:endpoint)
|
|
99
|
-
api_view = api_view(endpoint
|
|
100
|
-
request_method = endpoint
|
|
104
|
+
api_view = api_view(endpoint_api(endpoint))
|
|
105
|
+
request_method = endpoint_request_method(endpoint)
|
|
101
106
|
path = endpoint_expand_path(endpoint)
|
|
102
107
|
|
|
103
108
|
trace.resource = span.resource
|
|
@@ -266,8 +271,25 @@ module Datadog
|
|
|
266
271
|
end
|
|
267
272
|
end
|
|
268
273
|
|
|
274
|
+
# Grape 4 moved three values off the endpoint's public options Hash: the
|
|
275
|
+
# API class became the #api reader (ruby-grape/grape#2778), and the verb
|
|
276
|
+
# and path are read off the route (#2775, #2776). Each reader prefers the
|
|
277
|
+
# options Hash, so Grape 1.x through 3.x resolve as they did before.
|
|
278
|
+
def endpoint_api(endpoint)
|
|
279
|
+
endpoint.options.fetch(:for) { endpoint.api }
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def endpoint_request_method(endpoint)
|
|
283
|
+
request_methods = endpoint.options[:method]
|
|
284
|
+
return request_methods.first if request_methods
|
|
285
|
+
|
|
286
|
+
endpoint.routes.first&.request_method
|
|
287
|
+
end
|
|
288
|
+
|
|
269
289
|
def endpoint_expand_path(endpoint)
|
|
270
290
|
route_path = endpoint.options[:path]
|
|
291
|
+
return endpoint_route_path(endpoint) if route_path.nil? || route_path.empty?
|
|
292
|
+
|
|
271
293
|
namespace = endpoint.routes.first&.namespace || ""
|
|
272
294
|
|
|
273
295
|
path = (namespace.split("/") + route_path)
|
|
@@ -277,6 +299,11 @@ module Datadog
|
|
|
277
299
|
path
|
|
278
300
|
end
|
|
279
301
|
|
|
302
|
+
# A compiled path already carries the namespace, so it is used whole.
|
|
303
|
+
def endpoint_route_path(endpoint)
|
|
304
|
+
endpoint.routes.first&.path&.sub(FORMAT_SEGMENT, "") || "/"
|
|
305
|
+
end
|
|
306
|
+
|
|
280
307
|
def service_name
|
|
281
308
|
datadog_configuration[:service_name]
|
|
282
309
|
end
|
|
@@ -33,6 +33,9 @@ module Datadog
|
|
|
33
33
|
|
|
34
34
|
TAG_APM_ENABLED = "_dd.apm.enabled"
|
|
35
35
|
|
|
36
|
+
# Declares whether the trace chunk was exported over OTLP (`"true"`) or the native protocol (`"false"`)
|
|
37
|
+
TAG_SDK_OTLP_EXPORT = "_dd.sdk.otlp_export"
|
|
38
|
+
|
|
36
39
|
# Set to the global service name when a span's service is overridden
|
|
37
40
|
TAG_BASE_SERVICE = "_dd.base_service"
|
|
38
41
|
|
|
@@ -9,24 +9,89 @@ module Datadog
|
|
|
9
9
|
# https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/profiles/4947-thread-ctx.md
|
|
10
10
|
#
|
|
11
11
|
# Native functions are implemented in ext/libdatadog_api/otel_thread_context.c
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
class OTelThreadContext
|
|
13
|
+
UNKNOWN_LOCAL_ROOT_SPAN_ID = 0
|
|
14
|
+
|
|
15
|
+
def self.build(tracing_settings)
|
|
16
|
+
return unless tracing_settings.otel_thread_context_enabled
|
|
17
|
+
|
|
18
|
+
instance = new
|
|
19
|
+
instance if instance.supported? && instance._native_enable
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize
|
|
23
|
+
@span_before_start = proc do |event_span_op, event_trace_op|
|
|
24
|
+
set(
|
|
25
|
+
trace_id: event_trace_op.id,
|
|
26
|
+
span_id: event_span_op.id,
|
|
27
|
+
local_root_span_id: event_trace_op.send(:root_span).id
|
|
28
|
+
)
|
|
16
29
|
end
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
@span_finished = proc do |_event_span_op, event_trace_op|
|
|
32
|
+
next if event_trace_op.finished?
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
update_from_trace_op(event_trace_op)
|
|
22
35
|
end
|
|
36
|
+
end
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
private_class_method :new
|
|
39
|
+
|
|
40
|
+
def subscribe_to_tracer_events!(events)
|
|
41
|
+
events.span_before_start.subscribe(&@span_before_start)
|
|
42
|
+
events.span_finished.subscribe(&@span_finished)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def set(trace_id:, span_id:, local_root_span_id:)
|
|
46
|
+
# OTel requires trace-id and span-id to be either both set or both unset.
|
|
47
|
+
# Zeroes can be used to indicate that no trace and span are active.
|
|
48
|
+
# https://github.com/open-telemetry/opentelemetry-specification/blob/v1.61.0/oteps/profiles/4947-thread-ctx.md?plain=1#L116C144-L116C189
|
|
49
|
+
return clear if trace_id.zero? || span_id.zero?
|
|
50
|
+
|
|
51
|
+
_native_set(trace_id, span_id, local_root_span_id)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def after_fork
|
|
55
|
+
clear
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def clear
|
|
59
|
+
_native_clear
|
|
60
|
+
rescue => e
|
|
61
|
+
Datadog.logger.debug do
|
|
62
|
+
"Error clearing OTel thread context: #{e.class}: #{e.message}"
|
|
26
63
|
end
|
|
27
64
|
|
|
28
|
-
|
|
29
|
-
|
|
65
|
+
false
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def supported?
|
|
69
|
+
Datadog::Core::LIBDATADOG_API_FAILURE.nil? && _native_supported?
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def update_from_trace_op(trace_op)
|
|
73
|
+
active_span = trace_op.active_span
|
|
74
|
+
|
|
75
|
+
if active_span
|
|
76
|
+
# Internally created active span
|
|
77
|
+
set(
|
|
78
|
+
trace_id: trace_op.id,
|
|
79
|
+
span_id: active_span.id,
|
|
80
|
+
local_root_span_id: trace_op.send(:root_span).id
|
|
81
|
+
)
|
|
82
|
+
elsif trace_op.parent_span_id && trace_op.parent_span_id != 0
|
|
83
|
+
# Active distributed trace context, before first local trace is created
|
|
84
|
+
set(
|
|
85
|
+
trace_id: trace_op.id,
|
|
86
|
+
span_id: trace_op.parent_span_id,
|
|
87
|
+
local_root_span_id: UNKNOWN_LOCAL_ROOT_SPAN_ID
|
|
88
|
+
)
|
|
89
|
+
else
|
|
90
|
+
clear
|
|
91
|
+
end
|
|
92
|
+
rescue => e
|
|
93
|
+
Datadog.logger.debug do
|
|
94
|
+
"Error updating OTel thread context: #{e.class}: #{e.message}"
|
|
30
95
|
end
|
|
31
96
|
end
|
|
32
97
|
end
|
|
@@ -52,10 +52,11 @@ module Datadog
|
|
|
52
52
|
# rubocop:disable Style/KeywordParametersOrder
|
|
53
53
|
# https://github.com/rubocop/rubocop/issues/13933
|
|
54
54
|
trace_flush: Flush::Finished.new,
|
|
55
|
-
context_provider:
|
|
55
|
+
context_provider: nil,
|
|
56
56
|
default_service: Core::Environment::Ext::FALLBACK_SERVICE_NAME,
|
|
57
57
|
enabled: true,
|
|
58
58
|
logger: Datadog.logger,
|
|
59
|
+
otel_thread_context: nil,
|
|
59
60
|
sampler: Sampling::PrioritySampler.new(
|
|
60
61
|
base_sampler: Sampling::AllSampler.new,
|
|
61
62
|
post_sampler: Sampling::RuleSampler.new
|
|
@@ -71,11 +72,16 @@ module Datadog
|
|
|
71
72
|
@default_service = default_service
|
|
72
73
|
@enabled = enabled
|
|
73
74
|
@logger = logger
|
|
74
|
-
@provider = context_provider
|
|
75
75
|
@sampler = sampler
|
|
76
76
|
@span_sampler = span_sampler
|
|
77
77
|
@tags = tags
|
|
78
78
|
@writer = writer
|
|
79
|
+
|
|
80
|
+
@otel_thread_context = otel_thread_context
|
|
81
|
+
|
|
82
|
+
@provider = context_provider || DefaultContextProvider.new(
|
|
83
|
+
otel_thread_context: otel_thread_context
|
|
84
|
+
)
|
|
79
85
|
end
|
|
80
86
|
|
|
81
87
|
# Return a {Datadog::Tracing::SpanOperation span_op} and {Datadog::Tracing::TraceOperation trace_op}
|
|
@@ -341,6 +347,10 @@ module Datadog
|
|
|
341
347
|
# rubocop:enable Lint/UselessMethodDefinition
|
|
342
348
|
end
|
|
343
349
|
|
|
350
|
+
def after_fork
|
|
351
|
+
@otel_thread_context&.after_fork
|
|
352
|
+
end
|
|
353
|
+
|
|
344
354
|
# Shorthand that calls the `shutdown!` method of a registered worker.
|
|
345
355
|
# It's useful to ensure that the Trace Buffer is properly flushed before
|
|
346
356
|
# shutting down the application.
|
|
@@ -352,6 +362,7 @@ module Datadog
|
|
|
352
362
|
#
|
|
353
363
|
# tracer.shutdown!
|
|
354
364
|
def shutdown!
|
|
365
|
+
@otel_thread_context&.clear
|
|
355
366
|
return unless @enabled
|
|
356
367
|
|
|
357
368
|
@writer&.stop
|
|
@@ -445,6 +456,8 @@ module Datadog
|
|
|
445
456
|
reconsider_trace_sampling_on_resource(event_trace_op)
|
|
446
457
|
end
|
|
447
458
|
end
|
|
459
|
+
|
|
460
|
+
@otel_thread_context&.subscribe_to_tracer_events!(events)
|
|
448
461
|
end
|
|
449
462
|
|
|
450
463
|
# Creates a new TraceOperation, with events bounds to this Tracer instance.
|
|
@@ -264,7 +264,7 @@ module Datadog
|
|
|
264
264
|
return [] if traces.empty?
|
|
265
265
|
|
|
266
266
|
# Apply trace-level tags to root spans (same as the HTTP transport)
|
|
267
|
-
traces.each { |trace| TraceFormatter.format!(trace) }
|
|
267
|
+
traces.each { |trace| TraceFormatter.format!(trace, transport: "native") }
|
|
268
268
|
|
|
269
269
|
# Build the Array<Array<Span>> structure expected by the C extension.
|
|
270
270
|
# Each trace segment becomes one inner array (one trace chunk).
|
|
@@ -19,8 +19,8 @@ module Datadog
|
|
|
19
19
|
:first_span,
|
|
20
20
|
:trace
|
|
21
21
|
|
|
22
|
-
def self.format!(trace)
|
|
23
|
-
new(trace).format!
|
|
22
|
+
def self.format!(trace, transport: nil)
|
|
23
|
+
new(trace).format!(transport: transport)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def initialize(trace)
|
|
@@ -32,7 +32,7 @@ module Datadog
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Modifies a trace so suitable for transport
|
|
35
|
-
def format!
|
|
35
|
+
def format!(transport: nil)
|
|
36
36
|
return unless trace
|
|
37
37
|
return trace unless root_span
|
|
38
38
|
|
|
@@ -65,10 +65,13 @@ module Datadog
|
|
|
65
65
|
|
|
66
66
|
if first_span
|
|
67
67
|
tag_process_tags!
|
|
68
|
+
tag_sdk_otlp_export!
|
|
68
69
|
tag_git_repository_url!
|
|
69
70
|
tag_git_commit_sha!
|
|
70
71
|
end
|
|
71
72
|
|
|
73
|
+
root_span.set_tag("_dd.tracing.transport", transport) if transport && !partial?
|
|
74
|
+
|
|
72
75
|
trace
|
|
73
76
|
end
|
|
74
77
|
|
|
@@ -237,6 +240,13 @@ module Datadog
|
|
|
237
240
|
)
|
|
238
241
|
end
|
|
239
242
|
|
|
243
|
+
# TODO: Revisit when OTLP trace export support lands. The OTLP path sets
|
|
244
|
+
# `_dd.sdk.otlp_export: "true"` on the OTLP resource, so this tag must not
|
|
245
|
+
# also be set to "false" on the first span of a chunk exported over OTLP.
|
|
246
|
+
def tag_sdk_otlp_export!
|
|
247
|
+
first_span.set_tag(Tracing::Metadata::Ext::TAG_SDK_OTLP_EXPORT, "false")
|
|
248
|
+
end
|
|
249
|
+
|
|
240
250
|
private
|
|
241
251
|
|
|
242
252
|
def partial?
|
|
@@ -100,7 +100,7 @@ module Datadog
|
|
|
100
100
|
|
|
101
101
|
def encode_trace(encoder, trace, logger:, native_events_supported:)
|
|
102
102
|
# Format the trace for transport
|
|
103
|
-
TraceFormatter.format!(trace)
|
|
103
|
+
TraceFormatter.format!(trace, transport: "ruby")
|
|
104
104
|
|
|
105
105
|
# Make the trace serializable
|
|
106
106
|
serializable_trace = SerializableTrace.new(trace, native_events_supported: native_events_supported)
|
data/lib/datadog/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datadog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.44.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
@@ -63,14 +63,14 @@ dependencies:
|
|
|
63
63
|
requirements:
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version:
|
|
66
|
+
version: 44.0.1.1.0
|
|
67
67
|
type: :runtime
|
|
68
68
|
prerelease: false
|
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
71
|
- - "~>"
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version:
|
|
73
|
+
version: 44.0.1.1.0
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: logger
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -190,7 +190,6 @@ files:
|
|
|
190
190
|
- ext/libdatadog_extconf_helpers.rb
|
|
191
191
|
- lib/datadog.rb
|
|
192
192
|
- lib/datadog/ai_guard.rb
|
|
193
|
-
- lib/datadog/ai_guard/api_client.rb
|
|
194
193
|
- lib/datadog/ai_guard/autoload.rb
|
|
195
194
|
- lib/datadog/ai_guard/component.rb
|
|
196
195
|
- lib/datadog/ai_guard/configuration.rb
|
|
@@ -204,16 +203,26 @@ files:
|
|
|
204
203
|
- lib/datadog/ai_guard/contrib/rails/patcher.rb
|
|
205
204
|
- lib/datadog/ai_guard/contrib/ruby_llm/chat_instrumentation.rb
|
|
206
205
|
- lib/datadog/ai_guard/contrib/ruby_llm/integration.rb
|
|
206
|
+
- lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb
|
|
207
207
|
- lib/datadog/ai_guard/contrib/ruby_llm/patcher.rb
|
|
208
|
+
- lib/datadog/ai_guard/contrib/ruby_llm/redaction_change_set.rb
|
|
208
209
|
- lib/datadog/ai_guard/evaluation.rb
|
|
209
|
-
- lib/datadog/ai_guard/evaluation/
|
|
210
|
+
- lib/datadog/ai_guard/evaluation/client.rb
|
|
210
211
|
- lib/datadog/ai_guard/evaluation/content_part.rb
|
|
211
212
|
- lib/datadog/ai_guard/evaluation/message.rb
|
|
213
|
+
- lib/datadog/ai_guard/evaluation/message_builder.rb
|
|
212
214
|
- lib/datadog/ai_guard/evaluation/no_op_result.rb
|
|
215
|
+
- lib/datadog/ai_guard/evaluation/outcome.rb
|
|
213
216
|
- lib/datadog/ai_guard/evaluation/request.rb
|
|
217
|
+
- lib/datadog/ai_guard/evaluation/response.rb
|
|
214
218
|
- lib/datadog/ai_guard/evaluation/result.rb
|
|
215
219
|
- lib/datadog/ai_guard/evaluation/tool_call.rb
|
|
216
220
|
- lib/datadog/ai_guard/ext.rb
|
|
221
|
+
- lib/datadog/ai_guard/http_client.rb
|
|
222
|
+
- lib/datadog/ai_guard/metrics/telemetry.rb
|
|
223
|
+
- lib/datadog/ai_guard/redaction.rb
|
|
224
|
+
- lib/datadog/ai_guard/redaction/replacements.rb
|
|
225
|
+
- lib/datadog/ai_guard/redaction/result.rb
|
|
217
226
|
- lib/datadog/appsec.rb
|
|
218
227
|
- lib/datadog/appsec/actions_handler.rb
|
|
219
228
|
- lib/datadog/appsec/actions_handler/serializable_backtrace.rb
|
|
@@ -577,8 +586,15 @@ files:
|
|
|
577
586
|
- lib/datadog/kit/identity.rb
|
|
578
587
|
- lib/datadog/kit/tracing/method_tracer.rb
|
|
579
588
|
- lib/datadog/open_feature.rb
|
|
589
|
+
- lib/datadog/open_feature/agentless/configuration_source.rb
|
|
590
|
+
- lib/datadog/open_feature/agentless/parser.rb
|
|
591
|
+
- lib/datadog/open_feature/agentless/response.rb
|
|
592
|
+
- lib/datadog/open_feature/agentless/transport.rb
|
|
580
593
|
- lib/datadog/open_feature/component.rb
|
|
581
594
|
- lib/datadog/open_feature/configuration.rb
|
|
595
|
+
- lib/datadog/open_feature/configuration/agentless_endpoint.rb
|
|
596
|
+
- lib/datadog/open_feature/configuration/source.rb
|
|
597
|
+
- lib/datadog/open_feature/configuration/source/resolution.rb
|
|
582
598
|
- lib/datadog/open_feature/evaluation_engine.rb
|
|
583
599
|
- lib/datadog/open_feature/exposures/batch_builder.rb
|
|
584
600
|
- lib/datadog/open_feature/exposures/buffer.rb
|
|
@@ -1174,8 +1190,8 @@ licenses:
|
|
|
1174
1190
|
- Apache-2.0
|
|
1175
1191
|
metadata:
|
|
1176
1192
|
allowed_push_host: https://rubygems.org
|
|
1177
|
-
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.
|
|
1178
|
-
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.
|
|
1193
|
+
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.44.0/CHANGELOG.md
|
|
1194
|
+
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.44.0
|
|
1179
1195
|
post_install_message: 'JRuby support in the datadog gem is deprecated. Details: https://dtdg.co/jruby-deprecation'
|
|
1180
1196
|
rdoc_options: []
|
|
1181
1197
|
require_paths:
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Datadog
|
|
4
|
-
module AIGuard
|
|
5
|
-
module Evaluation
|
|
6
|
-
# Builder for collecting content parts inside a message block.
|
|
7
|
-
#
|
|
8
|
-
# Used via the block form of {Datadog::AIGuard.message}:
|
|
9
|
-
#
|
|
10
|
-
# Datadog::AIGuard.message(role: :user) do |m|
|
|
11
|
-
# m.text("What's in this image?")
|
|
12
|
-
# m.image_url("https://example.com/img.png")
|
|
13
|
-
# end
|
|
14
|
-
class ContentBuilder
|
|
15
|
-
attr_reader :parts
|
|
16
|
-
|
|
17
|
-
def initialize
|
|
18
|
-
@parts = []
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def text(text)
|
|
22
|
-
@parts << ContentPart::Text.new(text)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def image_url(url)
|
|
26
|
-
@parts << ContentPart::ImageURL.new(url)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|