datadog 2.40.0 → 2.42.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 +120 -59
- data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +12 -24
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +110 -61
- data/ext/datadog_profiling_native_extension/collectors_stack.c +13 -5
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +141 -103
- data/ext/datadog_profiling_native_extension/collectors_thread_context.h +7 -3
- data/ext/datadog_profiling_native_extension/datadog_ruby_common.h +0 -10
- data/ext/datadog_profiling_native_extension/extconf.rb +52 -93
- data/ext/datadog_profiling_native_extension/heap_recorder.c +338 -255
- data/ext/datadog_profiling_native_extension/heap_recorder.h +46 -31
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +3 -27
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +526 -443
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +15 -3
- data/ext/datadog_profiling_native_extension/profiling.c +2 -0
- data/ext/datadog_profiling_native_extension/ruby_helpers.c +1 -79
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +0 -7
- data/ext/datadog_profiling_native_extension/stack_recorder.c +93 -61
- data/ext/datadog_profiling_native_extension/stack_recorder.h +12 -4
- data/ext/libdatadog_api/datadog_ruby_common.h +0 -10
- data/ext/libdatadog_api/di.c +10 -0
- data/ext/libdatadog_api/extconf.rb +3 -0
- data/ext/libdatadog_api/init.c +2 -0
- data/ext/libdatadog_api/otel_thread_context.c +232 -0
- data/ext/libdatadog_api/otel_thread_context.h +5 -0
- data/ext/libdatadog_api/trace_exporter.c +409 -71
- data/ext/libdatadog_extconf_helpers.rb +1 -1
- data/lib/datadog/ai_guard/api_client.rb +1 -1
- data/lib/datadog/ai_guard/evaluation/request.rb +8 -8
- data/lib/datadog/ai_guard/evaluation.rb +10 -3
- data/lib/datadog/ai_guard/ext.rb +1 -1
- data/lib/datadog/appsec/actions_handler/serializable_backtrace.rb +21 -42
- data/lib/datadog/appsec/api_security/endpoint_collection/grape_route_serializer.rb +1 -1
- data/lib/datadog/appsec/api_security/endpoint_collection/rails_route_serializer.rb +1 -1
- data/lib/datadog/appsec/api_security/endpoint_collection/sinatra_route_serializer.rb +1 -1
- data/lib/datadog/appsec/assets/blocked.html +1 -108
- data/lib/datadog/appsec/configuration.rb +2 -2
- data/lib/datadog/appsec/context.rb +1 -1
- data/lib/datadog/appsec/contrib/active_record/instrumentation.rb +1 -1
- data/lib/datadog/appsec/contrib/aws_lambda/waf_addresses.rb +2 -2
- data/lib/datadog/appsec/contrib/devise/configuration.rb +1 -1
- data/lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb +2 -2
- data/lib/datadog/appsec/contrib/faraday/ssrf_detection_middleware.rb +2 -2
- data/lib/datadog/appsec/contrib/graphql/gateway/watcher.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/ext.rb +2 -2
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +2 -2
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +2 -2
- data/lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb +2 -2
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +2 -2
- data/lib/datadog/appsec/processor/rule_loader.rb +12 -12
- data/lib/datadog/appsec/response.rb +1 -1
- data/lib/datadog/appsec/route_normalizer/route_pattern.rb +3 -3
- data/lib/datadog/appsec/security_engine/engine.rb +3 -3
- data/lib/datadog/core/configuration/components.rb +3 -2
- data/lib/datadog/core/configuration/option_definition.rb +1 -1
- data/lib/datadog/core/configuration/options.rb +1 -1
- data/lib/datadog/core/crashtracking/component.rb +5 -1
- data/lib/datadog/core/diagnostics/environment_logger.rb +36 -1
- data/lib/datadog/core/metrics/helpers.rb +1 -1
- data/lib/datadog/core/metrics/options.rb +2 -2
- data/lib/datadog/core/process_discovery.rb +1 -1
- data/lib/datadog/core/remote/client.rb +1 -1
- data/lib/datadog/core/remote/configuration/repository.rb +2 -2
- data/lib/datadog/core/telemetry/configuration_value.rb +38 -0
- data/lib/datadog/core/telemetry/event/app_client_configuration_change.rb +3 -1
- data/lib/datadog/core/telemetry/event/app_endpoints_loaded.rb +1 -1
- data/lib/datadog/core/telemetry/event/app_started.rb +5 -24
- data/lib/datadog/core/telemetry/event/generate_metrics.rb +1 -1
- data/lib/datadog/core/telemetry/event/log.rb +2 -2
- data/lib/datadog/core/telemetry/metric.rb +2 -2
- data/lib/datadog/core/telemetry/request.rb +2 -2
- data/lib/datadog/core/transport/http.rb +1 -1
- data/lib/datadog/core/transport/transport.rb +1 -1
- data/lib/datadog/core/utils/at_fork_monkey_patch.rb +127 -43
- data/lib/datadog/data_streams/pathway_context.rb +20 -22
- data/lib/datadog/data_streams/processor.rb +45 -14
- data/lib/datadog/di/el/compiler.rb +23 -0
- data/lib/datadog/di/el/expression.rb +8 -5
- data/lib/datadog/di/instrumenter.rb +46 -5
- data/lib/datadog/di/logger.rb +2 -2
- data/lib/datadog/di/probe.rb +9 -1
- data/lib/datadog/di/probe_builder.rb +5 -4
- data/lib/datadog/di/probe_notification_builder.rb +3 -2
- data/lib/datadog/di/remote.rb +3 -3
- data/lib/datadog/di/serializer.rb +29 -4
- data/lib/datadog/error_tracking/component.rb +1 -1
- data/lib/datadog/kit/appsec/events/v2.rb +2 -2
- data/lib/datadog/open_feature/evaluation_engine.rb +29 -3
- data/lib/datadog/open_feature/exposures/batch_builder.rb +1 -1
- data/lib/datadog/open_feature/exposures/event.rb +15 -8
- data/lib/datadog/open_feature/ext.rb +19 -0
- data/lib/datadog/open_feature/flag_evaluation/aggregator.rb +236 -80
- data/lib/datadog/open_feature/flag_evaluation/writer.rb +179 -68
- data/lib/datadog/open_feature/hooks/flag_eval_evp_hook.rb +24 -21
- data/lib/datadog/open_feature/native_evaluator.rb +33 -6
- data/lib/datadog/open_feature/noop_evaluator.rb +5 -0
- data/lib/datadog/open_feature/provider.rb +11 -2
- data/lib/datadog/opentelemetry/sdk/propagator.rb +1 -1
- data/lib/datadog/opentelemetry/trace.rb +3 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -0
- data/lib/datadog/profiling/collectors/info.rb +1 -1
- data/lib/datadog/profiling/collectors/thread_context.rb +0 -4
- data/lib/datadog/profiling/component.rb +8 -16
- data/lib/datadog/profiling/tasks/exec.rb +1 -1
- data/lib/datadog/symbol_database/extractor.rb +6 -6
- data/lib/datadog/tracing/configuration/dynamic/option.rb +4 -0
- data/lib/datadog/tracing/configuration/dynamic.rb +5 -3
- data/lib/datadog/tracing/contrib/action_cable/events.rb +1 -1
- data/lib/datadog/tracing/contrib/action_mailer/events.rb +1 -1
- data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +2 -2
- data/lib/datadog/tracing/contrib/action_view/events.rb +1 -1
- data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +1 -0
- data/lib/datadog/tracing/contrib/active_record/events.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +2 -2
- data/lib/datadog/tracing/contrib/aws/ext.rb +1 -1
- data/lib/datadog/tracing/contrib/aws/services.rb +1 -1
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +1 -1
- data/lib/datadog/tracing/contrib/ext.rb +3 -3
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +1 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +1 -1
- data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +1 -1
- data/lib/datadog/tracing/contrib/kafka/events.rb +1 -1
- data/lib/datadog/tracing/contrib/karafka/distributed/propagation.rb +1 -1
- data/lib/datadog/tracing/contrib/mongodb/parsers.rb +1 -1
- data/lib/datadog/tracing/contrib/opensearch/ext.rb +1 -1
- data/lib/datadog/tracing/contrib/opensearch/quantize.rb +1 -1
- data/lib/datadog/tracing/contrib/patchable.rb +1 -1
- data/lib/datadog/tracing/contrib/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/que/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/events.rb +1 -1
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +1 -1
- data/lib/datadog/tracing/contrib/rack/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/rack/trace_proxy_middleware.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/quantize.rb +36 -2
- data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +9 -3
- data/lib/datadog/tracing/contrib/sequel/utils.rb +1 -1
- data/lib/datadog/tracing/contrib/sidekiq/distributed/propagation.rb +1 -1
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/utils/quantization/hash_formatter.rb +1 -1
- data/lib/datadog/tracing/contrib/waterdrop/distributed/propagation.rb +1 -1
- data/lib/datadog/tracing/correlation.rb +2 -2
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +2 -2
- data/lib/datadog/tracing/distributed/baggage.rb +1 -3
- data/lib/datadog/tracing/distributed/datadog.rb +3 -3
- data/lib/datadog/tracing/distributed/propagation.rb +3 -0
- data/lib/datadog/tracing/distributed/trace_context.rb +14 -271
- data/lib/datadog/tracing/distributed/trace_state/datadog.rb +233 -0
- data/lib/datadog/tracing/distributed/trace_state/ext.rb +44 -0
- data/lib/datadog/tracing/distributed/trace_state/open_telemetry.rb +156 -0
- data/lib/datadog/tracing/distributed/trace_state.rb +121 -0
- data/lib/datadog/tracing/metadata/tagging.rb +1 -1
- data/lib/datadog/tracing/otel_thread_context.rb +30 -0
- data/lib/datadog/tracing/remote.rb +197 -29
- data/lib/datadog/tracing/sampling/rule_sampler.rb +2 -0
- data/lib/datadog/tracing/span.rb +1 -1
- data/lib/datadog/tracing/span_operation.rb +1 -1
- data/lib/datadog/tracing/trace_digest.rb +22 -4
- data/lib/datadog/tracing/trace_operation.rb +22 -10
- data/lib/datadog/tracing/tracer.rb +5 -5
- data/lib/datadog/tracing/transport/io/traces.rb +1 -1
- data/lib/datadog/tracing/transport/native.rb +78 -54
- data/lib/datadog/tracing/writer.rb +1 -1
- data/lib/datadog/version.rb +1 -1
- metadata +15 -8
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +0 -69
|
@@ -65,6 +65,10 @@ module Datadog
|
|
|
65
65
|
# fork-safety note below.
|
|
66
66
|
@send_mutex = Mutex.new
|
|
67
67
|
|
|
68
|
+
# Serializes concurrent fork-hook lifecycles. Unlike @send_mutex,
|
|
69
|
+
# this is held across the fork through the matching completion hook.
|
|
70
|
+
@fork_mutex = Mutex.new
|
|
71
|
+
|
|
68
72
|
url = agent_settings.url
|
|
69
73
|
tracer_version = tracer_version_string
|
|
70
74
|
language = Core::Environment::Ext::LANG
|
|
@@ -106,8 +110,15 @@ module Datadog
|
|
|
106
110
|
# also tears down and replaces the runtime, so it must not run while
|
|
107
111
|
# a send is still using that runtime.
|
|
108
112
|
#
|
|
109
|
-
# `@
|
|
110
|
-
#
|
|
113
|
+
# `@fork_mutex` serializes concurrent forks for this exporter. The
|
|
114
|
+
# `:before` hook locks it first, then calls `_native_before_fork`,
|
|
115
|
+
# and finally locks `@send_mutex`, which serializes sends and is
|
|
116
|
+
# held across the fork. Sends and #close only acquire @send_mutex,
|
|
117
|
+
# so there is no lock-order inversion.
|
|
118
|
+
#
|
|
119
|
+
# `_native_before_fork` must run before locking `@send_mutex` to
|
|
120
|
+
# pause the runtime before waiting for an in-flight send to drain.
|
|
121
|
+
# The hook first calls
|
|
111
122
|
# `_native_before_fork` to pause the runtime, THEN locks the mutex.
|
|
112
123
|
# This ordering minimizes the serialized section and is safe to run
|
|
113
124
|
# concurrently with an in-flight send: `block_on` (used by
|
|
@@ -136,25 +147,29 @@ module Datadog
|
|
|
136
147
|
# hooks when it goes away (see #close and the finalizer): otherwise
|
|
137
148
|
# the closures keep the exporter -- and its runtime threads -- alive
|
|
138
149
|
# forever, and every later fork runs them against every
|
|
139
|
-
# historically-created exporter. The closures intentionally
|
|
140
|
-
# only
|
|
141
|
-
#
|
|
142
|
-
# #close was not called explicitly.
|
|
150
|
+
# historically-created exporter. The closures intentionally close
|
|
151
|
+
# over only locals (NOT `self`), so the Transport stays GC-eligible and
|
|
152
|
+
# its finalizer can fire even when #close was not called explicitly.
|
|
143
153
|
send_mutex = @send_mutex
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
fork_mutex = @fork_mutex
|
|
155
|
+
before_hook = proc do
|
|
156
|
+
fork_mutex.lock
|
|
157
|
+
|
|
158
|
+
begin
|
|
159
|
+
# Pause the runtime first (safe to run concurrently with an
|
|
160
|
+
# in-flight send), then wait for it to drain by acquiring the
|
|
161
|
+
# mutex. The lock must happen even if `_native_before_fork` raises, so the
|
|
162
|
+
# in-flight send has returned before the fork. Held across the
|
|
163
|
+
# fork; released in :parent/:child.
|
|
164
|
+
exporter._native_before_fork
|
|
165
|
+
rescue => e
|
|
166
|
+
Datadog.logger.warn { "Native transport before-fork preparation failed; traces may not be sent to Datadog: #{e.class}: #{e.message}" }
|
|
167
|
+
ensure
|
|
168
|
+
send_mutex.lock
|
|
169
|
+
end
|
|
155
170
|
end
|
|
156
|
-
parent_hook =
|
|
157
|
-
exporter._native_after_fork_in_parent
|
|
171
|
+
parent_hook = proc do
|
|
172
|
+
exporter._native_after_fork_in_parent if fork_mutex.owned?
|
|
158
173
|
rescue => e
|
|
159
174
|
Datadog.logger.warn { "Native transport after-fork reset failed; traces may not be sent to Datadog: #{e.class}: #{e.message}" }
|
|
160
175
|
ensure
|
|
@@ -164,9 +179,10 @@ module Datadog
|
|
|
164
179
|
# between `_native_before_fork` and the lock). Released even if the
|
|
165
180
|
# native call raised, so a failure can't leave the mutex locked.
|
|
166
181
|
send_mutex.unlock if send_mutex.owned?
|
|
182
|
+
fork_mutex.unlock if fork_mutex.owned?
|
|
167
183
|
end
|
|
168
|
-
child_hook =
|
|
169
|
-
exporter._native_after_fork_in_child
|
|
184
|
+
child_hook = proc do
|
|
185
|
+
exporter._native_after_fork_in_child if fork_mutex.owned?
|
|
170
186
|
rescue => e
|
|
171
187
|
Datadog.logger.warn { "Native transport after-fork reset failed; traces may not be sent to Datadog: #{e.class}: #{e.message}" }
|
|
172
188
|
ensure
|
|
@@ -174,61 +190,70 @@ module Datadog
|
|
|
174
190
|
# lone survivor in the child); the guard only covers `:before`
|
|
175
191
|
# being interrupted mid-lock.
|
|
176
192
|
send_mutex.unlock if send_mutex.owned?
|
|
193
|
+
fork_mutex.unlock if fork_mutex.owned?
|
|
177
194
|
end
|
|
178
195
|
|
|
179
|
-
@fork_hooks =
|
|
196
|
+
@fork_hooks = Core::Utils::AtForkMonkeyPatch.at_fork_blocks(
|
|
197
|
+
before: before_hook,
|
|
198
|
+
parent: parent_hook,
|
|
199
|
+
child: child_hook
|
|
200
|
+
)
|
|
201
|
+
remove_fork_hooks = self.class.send(:fork_hooks_remover, @fork_hooks)
|
|
180
202
|
|
|
181
203
|
# Fallback so a dropped (un-#close'd) transport doesn't leak its
|
|
182
204
|
# global fork hooks (and, through them, the exporter/runtime). The
|
|
183
|
-
#
|
|
205
|
+
# removal proc is built by a class method capturing ONLY the
|
|
184
206
|
# stage->block handles, never `self` -- a finalizer that closed over
|
|
185
207
|
# the object it is attached to would keep that object reachable and
|
|
186
|
-
# never run.
|
|
187
|
-
|
|
208
|
+
# never run. A fork that already copied these callbacks still owns
|
|
209
|
+
# them through its matching completion stage.
|
|
210
|
+
ObjectSpace.define_finalizer(
|
|
211
|
+
self,
|
|
212
|
+
remove_fork_hooks
|
|
213
|
+
)
|
|
188
214
|
end
|
|
189
215
|
|
|
190
216
|
# Deregister this transport's process-global fork hooks and release the
|
|
191
217
|
# native exporter so its runtime can shut down. Idempotent: safe to
|
|
192
218
|
# call multiple times and safe to call after the finalizer has run.
|
|
193
219
|
def close
|
|
194
|
-
fork_hooks = @
|
|
195
|
-
|
|
196
|
-
|
|
220
|
+
fork_hooks = @send_mutex.synchronize do
|
|
221
|
+
hooks = @fork_hooks
|
|
222
|
+
return if hooks.nil?
|
|
223
|
+
|
|
224
|
+
@fork_hooks = nil
|
|
225
|
+
@exporter = nil
|
|
226
|
+
hooks
|
|
227
|
+
end
|
|
197
228
|
|
|
198
229
|
fork_hooks.each do |stage, block|
|
|
199
230
|
Core::Utils::AtForkMonkeyPatch.remove_at_fork(stage, block)
|
|
200
231
|
end
|
|
201
232
|
|
|
202
|
-
# Drop our reference to the exporter so that, once the hooks above no
|
|
203
|
-
# longer pin it, it can be collected and its runtime shut down
|
|
204
|
-
# cleanly in this (parent) process.
|
|
205
|
-
@exporter = nil
|
|
206
|
-
|
|
207
233
|
# The finalizer only exists to deregister the hooks for a transport
|
|
208
234
|
# dropped without #close. We have just done that, so remove it;
|
|
209
|
-
# otherwise its
|
|
210
|
-
#
|
|
211
|
-
# itself collected.
|
|
235
|
+
# otherwise its closed-over hook blocks keep the exporter alive until
|
|
236
|
+
# this transport is itself collected.
|
|
212
237
|
ObjectSpace.undefine_finalizer(self)
|
|
213
238
|
|
|
214
239
|
nil
|
|
215
240
|
end
|
|
216
241
|
|
|
217
|
-
# Builds the
|
|
242
|
+
# Builds the proc that deregisters a transport's fork hooks.
|
|
218
243
|
#
|
|
219
244
|
# Defined as a class method so the proc closes over ONLY the
|
|
220
245
|
# stage->block handles passed in and never over a Transport instance
|
|
221
246
|
# (which would keep the instance reachable and prevent the finalizer
|
|
222
247
|
# from ever running). Removing the hooks unpins the exporter captured
|
|
223
248
|
# by those closures, allowing it (and its runtime) to be freed.
|
|
224
|
-
def self.
|
|
249
|
+
def self.fork_hooks_remover(fork_hooks)
|
|
225
250
|
proc do
|
|
226
251
|
fork_hooks.each do |stage, block|
|
|
227
252
|
Core::Utils::AtForkMonkeyPatch.remove_at_fork(stage, block)
|
|
228
253
|
end
|
|
229
254
|
end
|
|
230
255
|
end
|
|
231
|
-
private_class_method :
|
|
256
|
+
private_class_method :fork_hooks_remover
|
|
232
257
|
|
|
233
258
|
# Send a list of traces to the agent.
|
|
234
259
|
#
|
|
@@ -240,12 +265,6 @@ module Datadog
|
|
|
240
265
|
def send_traces(traces)
|
|
241
266
|
return [] if traces.empty?
|
|
242
267
|
|
|
243
|
-
# A closed transport has released its exporter; there is nothing to
|
|
244
|
-
# send through. Raising here is caught below and surfaced as an
|
|
245
|
-
# InternalErrorResponse, matching the other failure paths.
|
|
246
|
-
exporter = @exporter
|
|
247
|
-
raise "Native transport has been closed" if exporter.nil?
|
|
248
|
-
|
|
249
268
|
# Apply trace-level tags to root spans (same as the HTTP transport)
|
|
250
269
|
traces.each { |trace| TraceFormatter.format!(trace) }
|
|
251
270
|
|
|
@@ -253,9 +272,8 @@ module Datadog
|
|
|
253
272
|
# Each trace segment becomes one inner array (one trace chunk).
|
|
254
273
|
chunks = traces.map(&:spans)
|
|
255
274
|
|
|
256
|
-
#
|
|
257
|
-
#
|
|
258
|
-
# converted and would be dropped. Warn (once) so the loss is visible.
|
|
275
|
+
# Span events and span links are not yet converted and would be
|
|
276
|
+
# dropped. Warn (once) so the loss is visible.
|
|
259
277
|
warn_unsupported_fields!(chunks)
|
|
260
278
|
|
|
261
279
|
# Serialize the native send and hold the mutex across it so a
|
|
@@ -263,7 +281,14 @@ module Datadog
|
|
|
263
281
|
# (and `_native_before_fork` cannot tear down the runtime mid-send).
|
|
264
282
|
# `Mutex#synchronize` releases on exception / `rb_jump_tag` via its
|
|
265
283
|
# ensure, so interrupt propagation stays correct.
|
|
266
|
-
responses = @send_mutex.synchronize
|
|
284
|
+
responses = @send_mutex.synchronize do
|
|
285
|
+
# Resolve the exporter under the same lock used by #close, so
|
|
286
|
+
# close either drains this send or prevents it from starting.
|
|
287
|
+
exporter = @exporter
|
|
288
|
+
raise "Native transport has been closed" if exporter.nil?
|
|
289
|
+
|
|
290
|
+
exporter._native_send_traces(chunks)
|
|
291
|
+
end
|
|
267
292
|
|
|
268
293
|
# Update statistics from the response
|
|
269
294
|
responses.each { |response| update_stats_from_response!(response) }
|
|
@@ -278,10 +303,10 @@ module Datadog
|
|
|
278
303
|
private
|
|
279
304
|
|
|
280
305
|
# Warn, at most once per transport, when a batch contains span fields
|
|
281
|
-
# the native exporter does not yet convert (span events
|
|
282
|
-
#
|
|
283
|
-
#
|
|
284
|
-
#
|
|
306
|
+
# the native exporter does not yet convert (span events and span
|
|
307
|
+
# links). These are silently dropped by the native path; full support
|
|
308
|
+
# is tracked separately. The check is cheap: the fields are already-
|
|
309
|
+
# materialized collections on each Span.
|
|
285
310
|
def warn_unsupported_fields!(chunks)
|
|
286
311
|
return if @unsupported_fields_warned
|
|
287
312
|
|
|
@@ -290,7 +315,6 @@ module Datadog
|
|
|
290
315
|
spans.each do |span|
|
|
291
316
|
unsupported << "span events" if span.events.any?
|
|
292
317
|
unsupported << "span links" if span.links.any?
|
|
293
|
-
unsupported << "meta_struct" unless span.metastruct.to_h.empty?
|
|
294
318
|
end
|
|
295
319
|
end
|
|
296
320
|
return if unsupported.empty?
|
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.42.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Datadog, Inc.
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '3.5'
|
|
33
33
|
- - ">="
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: 3.5.
|
|
35
|
+
version: 3.5.5
|
|
36
36
|
type: :runtime
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '3.5'
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 3.5.
|
|
45
|
+
version: 3.5.5
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
47
|
name: libddwaf
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -63,14 +63,14 @@ dependencies:
|
|
|
63
63
|
requirements:
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version:
|
|
66
|
+
version: 40.0.0.2.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: 40.0.0.2.0
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: logger
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -181,6 +181,8 @@ files:
|
|
|
181
181
|
- ext/libdatadog_api/init.c
|
|
182
182
|
- ext/libdatadog_api/library_config.c
|
|
183
183
|
- ext/libdatadog_api/library_config.h
|
|
184
|
+
- ext/libdatadog_api/otel_thread_context.c
|
|
185
|
+
- ext/libdatadog_api/otel_thread_context.h
|
|
184
186
|
- ext/libdatadog_api/process_discovery.c
|
|
185
187
|
- ext/libdatadog_api/process_discovery.h
|
|
186
188
|
- ext/libdatadog_api/trace_exporter.c
|
|
@@ -432,6 +434,7 @@ files:
|
|
|
432
434
|
- lib/datadog/core/tag_builder.rb
|
|
433
435
|
- lib/datadog/core/tag_normalizer.rb
|
|
434
436
|
- lib/datadog/core/telemetry/component.rb
|
|
437
|
+
- lib/datadog/core/telemetry/configuration_value.rb
|
|
435
438
|
- lib/datadog/core/telemetry/emitter.rb
|
|
436
439
|
- lib/datadog/core/telemetry/event.rb
|
|
437
440
|
- lib/datadog/core/telemetry/event/app_client_configuration_change.rb
|
|
@@ -1095,13 +1098,16 @@ files:
|
|
|
1095
1098
|
- lib/datadog/tracing/distributed/b3_single.rb
|
|
1096
1099
|
- lib/datadog/tracing/distributed/baggage.rb
|
|
1097
1100
|
- lib/datadog/tracing/distributed/datadog.rb
|
|
1098
|
-
- lib/datadog/tracing/distributed/datadog_tags_codec.rb
|
|
1099
1101
|
- lib/datadog/tracing/distributed/fetcher.rb
|
|
1100
1102
|
- lib/datadog/tracing/distributed/helpers.rb
|
|
1101
1103
|
- lib/datadog/tracing/distributed/none.rb
|
|
1102
1104
|
- lib/datadog/tracing/distributed/propagation.rb
|
|
1103
1105
|
- lib/datadog/tracing/distributed/propagation_policy.rb
|
|
1104
1106
|
- lib/datadog/tracing/distributed/trace_context.rb
|
|
1107
|
+
- lib/datadog/tracing/distributed/trace_state.rb
|
|
1108
|
+
- lib/datadog/tracing/distributed/trace_state/datadog.rb
|
|
1109
|
+
- lib/datadog/tracing/distributed/trace_state/ext.rb
|
|
1110
|
+
- lib/datadog/tracing/distributed/trace_state/open_telemetry.rb
|
|
1105
1111
|
- lib/datadog/tracing/event.rb
|
|
1106
1112
|
- lib/datadog/tracing/ext.rb
|
|
1107
1113
|
- lib/datadog/tracing/flush.rb
|
|
@@ -1112,6 +1118,7 @@ files:
|
|
|
1112
1118
|
- lib/datadog/tracing/metadata/metastruct.rb
|
|
1113
1119
|
- lib/datadog/tracing/metadata/metastruct_tagging.rb
|
|
1114
1120
|
- lib/datadog/tracing/metadata/tagging.rb
|
|
1121
|
+
- lib/datadog/tracing/otel_thread_context.rb
|
|
1115
1122
|
- lib/datadog/tracing/pipeline.rb
|
|
1116
1123
|
- lib/datadog/tracing/pipeline/span_filter.rb
|
|
1117
1124
|
- lib/datadog/tracing/pipeline/span_processor.rb
|
|
@@ -1165,8 +1172,8 @@ licenses:
|
|
|
1165
1172
|
- Apache-2.0
|
|
1166
1173
|
metadata:
|
|
1167
1174
|
allowed_push_host: https://rubygems.org
|
|
1168
|
-
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.
|
|
1169
|
-
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.
|
|
1175
|
+
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.42.0/CHANGELOG.md
|
|
1176
|
+
source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.42.0
|
|
1170
1177
|
post_install_message: 'JRuby support in the datadog gem is deprecated. Details: https://dtdg.co/jruby-deprecation'
|
|
1171
1178
|
rdoc_options: []
|
|
1172
1179
|
require_paths:
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Datadog
|
|
4
|
-
module Tracing
|
|
5
|
-
module Distributed
|
|
6
|
-
# Encodes and decodes distributed 'x-datadog-tags' tags for transport
|
|
7
|
-
# to and from external processes.
|
|
8
|
-
module DatadogTagsCodec
|
|
9
|
-
# ASCII characters 32-126, except `,`, `=`, and ` `. At least one character.
|
|
10
|
-
VALID_KEY_CHARS = /\A(?:(?![,= ])[\u0020-\u007E])+\Z/.freeze
|
|
11
|
-
# ASCII characters 32-126, except `,`. At least one character.
|
|
12
|
-
VALID_VALUE_CHARS = /\A(?:(?!,)[\u0020-\u007E])+\Z/.freeze
|
|
13
|
-
|
|
14
|
-
# Serializes a {Hash<String,String>} into a `x-datadog-tags`-compatible
|
|
15
|
-
# String.
|
|
16
|
-
#
|
|
17
|
-
# @param tags [Hash<String,String>] trace tag hash
|
|
18
|
-
# @return [String] serialized tags hash
|
|
19
|
-
# @raise [EncodingError] if tags cannot be serialized to the `x-datadog-tags` format
|
|
20
|
-
def self.encode(tags)
|
|
21
|
-
tags.map do |raw_key, raw_value|
|
|
22
|
-
key = raw_key.to_s
|
|
23
|
-
value = raw_value.to_s
|
|
24
|
-
|
|
25
|
-
raise EncodingError, "Invalid key `#{key}` for value `#{value}`" unless VALID_KEY_CHARS.match?(key)
|
|
26
|
-
raise EncodingError, "Invalid value `#{value}` for key `#{key}`" unless VALID_VALUE_CHARS.match?(value)
|
|
27
|
-
|
|
28
|
-
"#{key}=#{value.strip}"
|
|
29
|
-
end.join(",")
|
|
30
|
-
rescue => e
|
|
31
|
-
raise EncodingError, "Error encoding tags `#{tags}`: `#{e.class}: #{e.message}`"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Deserializes a `x-datadog-tags`-formatted String into a {Hash<String,String>}.
|
|
35
|
-
#
|
|
36
|
-
# @param string [String] tags as serialized by {#encode}
|
|
37
|
-
# @return [Hash<String,String>] decoded input as a hash of strings
|
|
38
|
-
# @raise [DecodingError] if string does not conform to the `x-datadog-tags` format
|
|
39
|
-
def self.decode(string)
|
|
40
|
-
result = (string.split(",").map do |raw_tag|
|
|
41
|
-
raw_tag.split("=", 2).tap do |raw_key, raw_value|
|
|
42
|
-
key = raw_key.to_s
|
|
43
|
-
value = raw_value.to_s
|
|
44
|
-
|
|
45
|
-
raise DecodingError, "Invalid key: #{key}" unless VALID_KEY_CHARS.match?(key)
|
|
46
|
-
raise DecodingError, "Invalid value: #{value}" unless VALID_VALUE_CHARS.match?(value)
|
|
47
|
-
|
|
48
|
-
value.strip!
|
|
49
|
-
end
|
|
50
|
-
end).to_h
|
|
51
|
-
|
|
52
|
-
raise DecodingError, "Invalid empty tags: #{string}" if result.empty? && !string.empty?
|
|
53
|
-
|
|
54
|
-
result
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# An error occurred during distributed tags encoding.
|
|
58
|
-
# See {#message} for more information.
|
|
59
|
-
class EncodingError < StandardError
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# An error occurred during distributed tags decoding.
|
|
63
|
-
# See {#message} for more information.
|
|
64
|
-
class DecodingError < StandardError
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|