datadog 2.39.0 → 2.47.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 +269 -44
- data/README.md +3 -0
- data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +12 -24
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +256 -193
- data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c +1 -5
- data/ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.c +0 -2
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +19 -20
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.h +5 -1
- data/ext/datadog_profiling_native_extension/collectors_stack.c +267 -171
- data/ext/datadog_profiling_native_extension/collectors_stack.h +17 -3
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +307 -217
- data/ext/datadog_profiling_native_extension/collectors_thread_context.h +10 -5
- data/ext/datadog_profiling_native_extension/crashtracking_runtime_stacks.c +5 -4
- data/ext/datadog_profiling_native_extension/datadog_ruby_common.c +19 -11
- data/ext/datadog_profiling_native_extension/datadog_ruby_common.h +7 -10
- data/ext/datadog_profiling_native_extension/extconf.rb +67 -99
- data/ext/datadog_profiling_native_extension/heap_recorder.c +353 -257
- data/ext/datadog_profiling_native_extension/heap_recorder.h +50 -31
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +3 -27
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +853 -496
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +42 -15
- data/ext/datadog_profiling_native_extension/profiling.c +30 -23
- data/ext/datadog_profiling_native_extension/ruby_helpers.c +4 -80
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +4 -7
- data/ext/datadog_profiling_native_extension/setup_signal_handler.c +0 -2
- data/ext/datadog_profiling_native_extension/stack_recorder.c +116 -89
- data/ext/datadog_profiling_native_extension/stack_recorder.h +12 -5
- data/ext/datadog_profiling_native_extension/time_helpers.c +2 -4
- data/ext/datadog_profiling_native_extension/time_helpers.h +15 -15
- data/ext/libdatadog_api/datadog_ruby_common.c +19 -11
- data/ext/libdatadog_api/datadog_ruby_common.h +7 -10
- data/ext/libdatadog_api/di.c +43 -3
- data/ext/libdatadog_api/extconf.rb +6 -1
- data/ext/libdatadog_api/feature_flags.c +8 -0
- data/ext/libdatadog_api/init.c +9 -1
- data/ext/libdatadog_api/otel_thread_context.c +274 -0
- data/ext/libdatadog_api/otel_thread_context.h +5 -0
- data/ext/libdatadog_api/process_discovery.c +15 -1
- data/ext/libdatadog_api/trace_exporter.c +2078 -0
- data/ext/libdatadog_api/trace_exporter.h +5 -0
- 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 +8 -64
- 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 +36 -14
- data/lib/datadog/ai_guard/ext.rb +4 -1
- data/lib/datadog/ai_guard/{api_client.rb → http_client.rb} +7 -5
- 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/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 +11 -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/devise/patcher.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/rack/patcher.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +6 -3
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +30 -3
- data/lib/datadog/appsec/contrib/rails/patches/render_to_body_patch.rb +8 -7
- data/lib/datadog/appsec/contrib/rails/request_middleware.rb +2 -1
- data/lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb +2 -2
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +15 -3
- data/lib/datadog/appsec/contrib/sinatra/patches/json_patch.rb +8 -7
- data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +2 -1
- 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 +5 -4
- data/lib/datadog/core/configuration/components.rb +50 -19
- data/lib/datadog/core/configuration/components_state.rb +8 -1
- data/lib/datadog/core/configuration/option_definition.rb +1 -1
- data/lib/datadog/core/configuration/options.rb +1 -1
- data/lib/datadog/core/configuration/settings.rb +38 -43
- data/lib/datadog/core/configuration/supported_configurations.rb +18 -2
- data/lib/datadog/core/crashtracking/component.rb +5 -1
- data/lib/datadog/core/diagnostics/environment_logger.rb +36 -1
- data/lib/datadog/core/environment/gc.rb +1 -1
- data/lib/datadog/core/environment/vm_cache.rb +1 -1
- data/lib/datadog/core/environment/yjit.rb +2 -2
- 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 +6 -2
- data/lib/datadog/core/remote/client/capabilities.rb +32 -21
- data/lib/datadog/core/remote/client.rb +45 -4
- data/lib/datadog/core/remote/component.rb +30 -7
- data/lib/datadog/core/remote/configuration/repository.rb +2 -2
- data/lib/datadog/core/remote/dispatcher.rb +47 -6
- data/lib/datadog/core/remote/worker.rb +8 -0
- 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/event/synth_app_client_configuration_change.rb +1 -1
- 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 +170 -18
- data/lib/datadog/core/utils/sequence.rb +3 -6
- data/lib/datadog/core/utils/time.rb +16 -54
- data/lib/datadog/core/workers/runtime_metrics.rb +1 -1
- data/lib/datadog/data_streams/pathway_context.rb +20 -22
- data/lib/datadog/data_streams/processor.rb +45 -14
- data/lib/datadog/di/boot.rb +1 -0
- data/lib/datadog/di/capture_expression_evaluator/result.rb +30 -0
- data/lib/datadog/di/capture_expression_evaluator.rb +39 -9
- data/lib/datadog/di/component.rb +108 -3
- data/lib/datadog/di/configuration.rb +53 -2
- data/lib/datadog/di/context.rb +7 -2
- data/lib/datadog/di/contrib/active_record.rb +8 -2
- data/lib/datadog/di/el/compiler.rb +88 -12
- data/lib/datadog/di/el/evaluator.rb +82 -2
- data/lib/datadog/di/el/expression.rb +13 -2
- data/lib/datadog/di/evaluation_failure.rb +28 -0
- data/lib/datadog/di/guardrails_telemetry/reason.rb +87 -0
- data/lib/datadog/di/guardrails_telemetry.rb +203 -0
- data/lib/datadog/di/instrumenter.rb +106 -15
- data/lib/datadog/di/logger.rb +32 -10
- data/lib/datadog/di/probe.rb +9 -1
- data/lib/datadog/di/probe_builder.rb +7 -6
- data/lib/datadog/di/probe_manager.rb +56 -8
- data/lib/datadog/di/probe_notification_builder.rb +31 -28
- data/lib/datadog/di/probe_notifier_worker.rb +56 -6
- data/lib/datadog/di/proc_responder.rb +1 -1
- data/lib/datadog/di/remote.rb +49 -5
- data/lib/datadog/di/serializer.rb +172 -55
- data/lib/datadog/di/snapshot_event.rb +38 -0
- data/lib/datadog/di/transport/http.rb +13 -3
- data/lib/datadog/di/transport/input.rb +32 -7
- data/lib/datadog/error_tracking/component.rb +1 -1
- data/lib/datadog/kit/appsec/events/v2.rb +2 -2
- data/lib/datadog/open_feature/activation.rb +268 -0
- 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 +85 -13
- 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 +124 -0
- 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/evaluation_telemetry_opt_out_hook.rb +25 -0
- data/lib/datadog/open_feature/hooks/flag_eval_evp_hook.rb +24 -21
- data/lib/datadog/open_feature/native_evaluator.rb +20 -6
- data/lib/datadog/open_feature/noop_evaluator.rb +5 -0
- data/lib/datadog/open_feature/provider.rb +315 -10
- data/lib/datadog/open_feature/remote.rb +5 -5
- data/lib/datadog/open_feature/transport.rb +5 -0
- data/lib/datadog/open_feature.rb +31 -1
- data/lib/datadog/opentelemetry/sdk/propagator.rb +1 -1
- data/lib/datadog/opentelemetry/signal_configuration.rb +13 -9
- data/lib/datadog/opentelemetry/trace.rb +3 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +10 -2
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +5 -7
- data/lib/datadog/profiling/collectors/info.rb +40 -13
- data/lib/datadog/profiling/collectors/thread_context.rb +6 -17
- data/lib/datadog/profiling/component.rb +33 -39
- data/lib/datadog/profiling/exporter.rb +10 -10
- data/lib/datadog/profiling/tasks/exec.rb +1 -1
- data/lib/datadog/profiling.rb +4 -0
- data/lib/datadog/symbol_database/extractor.rb +89 -107
- data/lib/datadog/tracing/component.rb +44 -2
- data/lib/datadog/tracing/configuration/dynamic/option.rb +4 -0
- data/lib/datadog/tracing/configuration/dynamic.rb +5 -3
- data/lib/datadog/tracing/configuration/ext.rb +4 -0
- data/lib/datadog/tracing/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/context.rb +24 -2
- data/lib/datadog/tracing/context_provider.rb +17 -5
- 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/ethon/easy_patch.rb +10 -5
- data/lib/datadog/tracing/contrib/excon/middleware.rb +10 -3
- data/lib/datadog/tracing/contrib/ext.rb +3 -3
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +10 -4
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +32 -5
- 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/hanami/router_tracing.rb +2 -1
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +16 -1
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +8 -2
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +10 -4
- data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +4 -0
- data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +7 -2
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +7 -2
- 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/rest_client/request_patch.rb +10 -3
- data/lib/datadog/tracing/contrib/sequel/database.rb +1 -5
- data/lib/datadog/tracing/contrib/sequel/jdbc_connection_string.rb +140 -0
- data/lib/datadog/tracing/contrib/sequel/utils.rb +50 -63
- 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/utils/quantization/http.rb +108 -3
- 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 +3 -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/propagation_policy.rb +5 -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/ext.rb +3 -0
- data/lib/datadog/tracing/metadata/tagging.rb +1 -1
- data/lib/datadog/tracing/otel_thread_context.rb +97 -0
- data/lib/datadog/tracing/remote.rb +236 -37
- 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/sync_writer.rb +8 -3
- data/lib/datadog/tracing/trace_digest.rb +22 -4
- data/lib/datadog/tracing/trace_operation.rb +22 -10
- data/lib/datadog/tracing/tracer.rb +28 -7
- data/lib/datadog/tracing/transport/http/telemetry.rb +94 -0
- data/lib/datadog/tracing/transport/http/traces.rb +2 -0
- data/lib/datadog/tracing/transport/io/traces.rb +1 -1
- data/lib/datadog/tracing/transport/native/response.rb +71 -0
- data/lib/datadog/tracing/transport/native/telemetry.rb +17 -0
- data/lib/datadog/tracing/transport/native.rb +395 -0
- data/lib/datadog/tracing/transport/span_events_negotiation.rb +41 -0
- data/lib/datadog/tracing/transport/telemetry.rb +62 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +14 -4
- data/lib/datadog/tracing/transport/traces.rb +85 -38
- data/lib/datadog/tracing/writer.rb +17 -4
- data/lib/datadog/version.rb +1 -1
- metadata +51 -13
- data/lib/datadog/ai_guard/evaluation/content_builder.rb +0 -31
- data/lib/datadog/appsec/utils/hash_coercion.rb +0 -23
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +0 -69
|
@@ -26,7 +26,7 @@ module Datadog
|
|
|
26
26
|
limit = Datadog.configuration.appsec.body_parsing_size_limit
|
|
27
27
|
|
|
28
28
|
persistent_data = {
|
|
29
|
-
"server.request.path_params" => gateway_request.route_params
|
|
29
|
+
"server.request.path_params" => gateway_request.route_params,
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
unless limit.zero?
|
|
@@ -66,10 +66,23 @@ module Datadog
|
|
|
66
66
|
gateway.watch("rails.response.body.json") do |stack, container|
|
|
67
67
|
context = container.context
|
|
68
68
|
|
|
69
|
+
body_bytesize = container.data.bytesize
|
|
70
|
+
limit = Datadog.configuration.appsec.body_parsing_size_limit
|
|
71
|
+
|
|
69
72
|
persistent_data = {
|
|
70
|
-
"server.response.body" =>
|
|
73
|
+
"server.response.body.byte_length" => body_bytesize,
|
|
71
74
|
}
|
|
72
|
-
|
|
75
|
+
|
|
76
|
+
if limit > 0 && body_bytesize <= limit
|
|
77
|
+
json = extract_json(container.data)
|
|
78
|
+
persistent_data["server.response.body"] = WAF::JSONString.new(json) if json
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
result = begin
|
|
82
|
+
context.run_waf(persistent_data, {}, Datadog.configuration.appsec.waf_timeout)
|
|
83
|
+
rescue WAF::ConversionError
|
|
84
|
+
next stack.call(container)
|
|
85
|
+
end
|
|
73
86
|
|
|
74
87
|
if result.match?
|
|
75
88
|
context.events.push(
|
|
@@ -85,6 +98,20 @@ module Datadog
|
|
|
85
98
|
stack.call(container)
|
|
86
99
|
end
|
|
87
100
|
end
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def extract_json(body)
|
|
105
|
+
return body unless body.start_with?("/**/")
|
|
106
|
+
return unless body.end_with?(")")
|
|
107
|
+
|
|
108
|
+
# NOTE: Best-effort support for standard Rails JSONP callbacks.
|
|
109
|
+
# Callback expressions with parentheses may prevent extraction
|
|
110
|
+
opening_parenthesis_index = body.b.index("(")
|
|
111
|
+
return unless opening_parenthesis_index
|
|
112
|
+
|
|
113
|
+
body.byteslice(opening_parenthesis_index + 1, body.bytesize - opening_parenthesis_index - 2) #: String
|
|
114
|
+
end
|
|
88
115
|
end
|
|
89
116
|
end
|
|
90
117
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "../../../utils/hash_coercion"
|
|
4
3
|
require_relative "../../../instrumentation/gateway/argument"
|
|
5
4
|
|
|
6
5
|
module Datadog
|
|
@@ -8,8 +7,8 @@ module Datadog
|
|
|
8
7
|
module Contrib
|
|
9
8
|
module Rails
|
|
10
9
|
module Patches
|
|
11
|
-
# A patch
|
|
12
|
-
#
|
|
10
|
+
# A patch for `AbstractController::Rendering#render_to_body` that captures
|
|
11
|
+
# the serialized JSON response body for AppSec inspection
|
|
13
12
|
module RenderToBodyPatch
|
|
14
13
|
def render_to_body(options = {})
|
|
15
14
|
return super unless options.key?(:json)
|
|
@@ -17,13 +16,15 @@ module Datadog
|
|
|
17
16
|
context = request.env[Datadog::AppSec::Ext::CONTEXT_KEY]
|
|
18
17
|
return super unless context
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
# NOTE: Custom renderers can return streaming bodies, which we
|
|
20
|
+
# currently do not inspect
|
|
21
|
+
body = super
|
|
22
|
+
return body unless body.is_a?(String)
|
|
22
23
|
|
|
23
|
-
container = Instrumentation::Gateway::DataContainer.new(
|
|
24
|
+
container = Instrumentation::Gateway::DataContainer.new(body, context: context)
|
|
24
25
|
Instrumentation.gateway.push("rails.response.body.json", container)
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
body
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
@@ -6,7 +6,8 @@ module Datadog
|
|
|
6
6
|
module Rails
|
|
7
7
|
# Rack middleware for AppSec on Rails
|
|
8
8
|
class RequestMiddleware
|
|
9
|
-
|
|
9
|
+
# TODO: opt is never used, it can probably be safely removed
|
|
10
|
+
def initialize(app, opt = {}) # steep:ignore DifferentMethodParameterKind
|
|
10
11
|
@app = app
|
|
11
12
|
end
|
|
12
13
|
|
|
@@ -24,7 +24,7 @@ module Datadog
|
|
|
24
24
|
ephemeral_data = {
|
|
25
25
|
"server.io.net.url" => url,
|
|
26
26
|
"server.io.net.request.method" => method.to_s.upcase,
|
|
27
|
-
"server.io.net.request.headers" => headers
|
|
27
|
+
"server.io.net.request.headers" => headers,
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
is_redirect = context.state[:downstream_redirect_url] == url
|
|
@@ -68,7 +68,7 @@ module Datadog
|
|
|
68
68
|
# @type var ephemeral_data: ::Datadog::AppSec::Context::input_data
|
|
69
69
|
ephemeral_data = {
|
|
70
70
|
"server.io.net.response.status" => response.code.to_s,
|
|
71
|
-
"server.io.net.response.headers" => headers
|
|
71
|
+
"server.io.net.response.headers" => headers,
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
is_redirect = REDIRECT_STATUS_CODES.cover?(response.code.to_i) && headers.key?("location")
|
|
@@ -77,7 +77,7 @@ module Datadog
|
|
|
77
77
|
context = gateway_request.env[AppSec::Ext::CONTEXT_KEY] # : Context
|
|
78
78
|
|
|
79
79
|
persistent_data = {
|
|
80
|
-
"server.request.path_params" => gateway_route_params.params
|
|
80
|
+
"server.request.path_params" => gateway_route_params.params,
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
result = context.run_waf(persistent_data, {}, Datadog.configuration.appsec.waf_timeout)
|
|
@@ -101,10 +101,22 @@ module Datadog
|
|
|
101
101
|
gateway.watch("sinatra.response.body.json") do |stack, container|
|
|
102
102
|
context = container.context # : Context
|
|
103
103
|
|
|
104
|
+
body_bytesize = container.data.bytesize
|
|
105
|
+
limit = Datadog.configuration.appsec.body_parsing_size_limit
|
|
106
|
+
|
|
104
107
|
persistent_data = {
|
|
105
|
-
"server.response.body" =>
|
|
108
|
+
"server.response.body.byte_length" => body_bytesize,
|
|
106
109
|
}
|
|
107
|
-
|
|
110
|
+
|
|
111
|
+
if limit > 0 && body_bytesize <= limit
|
|
112
|
+
persistent_data["server.response.body"] = WAF::JSONString.new(container.data)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
result = begin
|
|
116
|
+
context.run_waf(persistent_data, {}, Datadog.configuration.appsec.waf_timeout)
|
|
117
|
+
rescue WAF::ConversionError
|
|
118
|
+
next stack.call(container)
|
|
119
|
+
end
|
|
108
120
|
|
|
109
121
|
if result.match?
|
|
110
122
|
context.events.push(
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "../../../utils/hash_coercion"
|
|
4
3
|
require_relative "../../../instrumentation/gateway/argument"
|
|
5
4
|
|
|
6
5
|
module Datadog
|
|
@@ -8,20 +7,22 @@ module Datadog
|
|
|
8
7
|
module Contrib
|
|
9
8
|
module Sinatra
|
|
10
9
|
module Patches
|
|
11
|
-
# A patch
|
|
12
|
-
# body
|
|
10
|
+
# A patch for `Sinatra::JSON#json` that captures the serialized
|
|
11
|
+
# response body for AppSec inspection
|
|
13
12
|
module JsonPatch
|
|
14
13
|
def json(object, options = {})
|
|
15
14
|
context = @request.env[Datadog::AppSec::Ext::CONTEXT_KEY] # : Context?
|
|
16
15
|
return super unless context
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
# NOTE: Custom renderers can return streaming bodies, which we
|
|
18
|
+
# currently do not inspect
|
|
19
|
+
body = super
|
|
20
|
+
return body unless body.is_a?(String)
|
|
20
21
|
|
|
21
|
-
container = Instrumentation::Gateway::DataContainer.new(
|
|
22
|
+
container = Instrumentation::Gateway::DataContainer.new(body, context: context)
|
|
22
23
|
Instrumentation.gateway.push("sinatra.response.body.json", container)
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
body
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
end
|
|
@@ -6,7 +6,8 @@ module Datadog
|
|
|
6
6
|
module Sinatra
|
|
7
7
|
# Rack middleware for AppSec on Sinatra
|
|
8
8
|
class RequestMiddleware
|
|
9
|
-
|
|
9
|
+
# TODO: opt is never used, it can probably be safely removed
|
|
10
|
+
def initialize(app, opt = {}) # steep:ignore DifferentMethodParameterKind
|
|
10
11
|
@app = app
|
|
11
12
|
end
|
|
12
13
|
|
|
@@ -59,7 +59,7 @@ module Datadog
|
|
|
59
59
|
{
|
|
60
60
|
"id" => id,
|
|
61
61
|
"type" => "data_with_expiration",
|
|
62
|
-
"data" => denylist.map { |v| {"value" => v.to_s, "expiration" => 2**63} }
|
|
62
|
+
"data" => denylist.map { |v| {"value" => v.to_s, "expiration" => 2**63} },
|
|
63
63
|
}
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -82,12 +82,12 @@ module Datadog
|
|
|
82
82
|
"parameters" => {
|
|
83
83
|
"inputs" => [
|
|
84
84
|
{
|
|
85
|
-
"address" => "http.client_ip"
|
|
86
|
-
}
|
|
85
|
+
"address" => "http.client_ip",
|
|
86
|
+
},
|
|
87
87
|
],
|
|
88
|
-
"list" => pass
|
|
89
|
-
}
|
|
90
|
-
}
|
|
88
|
+
"list" => pass,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
91
|
],
|
|
92
92
|
"id" => SecureRandom.uuid,
|
|
93
93
|
}
|
|
@@ -99,15 +99,15 @@ module Datadog
|
|
|
99
99
|
"parameters" => {
|
|
100
100
|
"inputs" => [
|
|
101
101
|
{
|
|
102
|
-
"address" => "http.client_ip"
|
|
103
|
-
}
|
|
102
|
+
"address" => "http.client_ip",
|
|
103
|
+
},
|
|
104
104
|
],
|
|
105
|
-
"list" => monitor
|
|
106
|
-
}
|
|
107
|
-
}
|
|
105
|
+
"list" => monitor,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
108
|
],
|
|
109
109
|
"id" => SecureRandom.uuid,
|
|
110
|
-
"on_match" => "monitor"
|
|
110
|
+
"on_match" => "monitor",
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
exclusions
|
|
@@ -31,7 +31,7 @@ module Datadog
|
|
|
31
31
|
OPTIONAL_GROUP_SIGILS = [
|
|
32
32
|
GROUP_OPEN_CHAR,
|
|
33
33
|
GROUP_CLOSE_CHAR,
|
|
34
|
-
OPTIONAL_GROUP_SUFFIX_CHAR
|
|
34
|
+
OPTIONAL_GROUP_SUFFIX_CHAR,
|
|
35
35
|
].join
|
|
36
36
|
|
|
37
37
|
NAMED_PARAM_PREFIX_CHAR = ":"
|
|
@@ -41,14 +41,14 @@ module Datadog
|
|
|
41
41
|
NAMED_PARAM_PREFIX_CHAR,
|
|
42
42
|
GLOB_PARAM_PREFIX_CHAR,
|
|
43
43
|
GROUP_OPEN_CHAR,
|
|
44
|
-
GROUP_CLOSE_CHAR
|
|
44
|
+
GROUP_CLOSE_CHAR,
|
|
45
45
|
].join
|
|
46
46
|
|
|
47
47
|
PARAM_NAME_CHARS = [*"a".."z", *"A".."Z", *"0".."9", "_"].join
|
|
48
48
|
|
|
49
49
|
EXCLUDED_PARAM_NAME_TERMINATOR_CHARS = [
|
|
50
50
|
PARAM_NAME_CHARS,
|
|
51
|
-
PATTERN_STRUCTURE_CHARS
|
|
51
|
+
PATTERN_STRUCTURE_CHARS,
|
|
52
52
|
].join
|
|
53
53
|
|
|
54
54
|
MAX_RESOLVE_LENGTH = 8192
|
|
@@ -31,7 +31,7 @@ module Datadog
|
|
|
31
31
|
@waf_builder = WAF::HandleBuilder.new(
|
|
32
32
|
obfuscator: {
|
|
33
33
|
key_regex: appsec_settings.obfuscator_key_regex,
|
|
34
|
-
value_regex: appsec_settings.obfuscator_value_regex
|
|
34
|
+
value_regex: appsec_settings.obfuscator_value_regex,
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
|
|
@@ -71,7 +71,8 @@ module Datadog
|
|
|
71
71
|
if is_ruleset_update &&
|
|
72
72
|
(diagnostics.key?("error") ||
|
|
73
73
|
diagnostics.dig("rules", "error") ||
|
|
74
|
-
diagnostics.dig("processors", "
|
|
74
|
+
diagnostics.dig("processors", "error"))
|
|
75
|
+
@waf_builder.remove_config_at_path(path)
|
|
75
76
|
diagnostics = load_default_config(telemetry: AppSec.telemetry)
|
|
76
77
|
@reconfigured_ruleset_version = diagnostics["ruleset_version"]
|
|
77
78
|
report_configuration_diagnostics(diagnostics, action: "update", telemetry: AppSec.telemetry)
|
|
@@ -130,7 +131,7 @@ module Datadog
|
|
|
130
131
|
tags: {
|
|
131
132
|
waf_version: Datadog::AppSec::WAF::VERSION::BASE_STRING,
|
|
132
133
|
event_rules_version: ruleset_version.to_s,
|
|
133
|
-
success: success.to_s
|
|
134
|
+
success: success.to_s,
|
|
134
135
|
}
|
|
135
136
|
)
|
|
136
137
|
end
|
|
@@ -156,7 +157,7 @@ module Datadog
|
|
|
156
157
|
common_tags = {
|
|
157
158
|
waf_version: Datadog::AppSec::WAF::VERSION::BASE_STRING,
|
|
158
159
|
event_rules_version: diagnostics["ruleset_version"].to_s,
|
|
159
|
-
action: action
|
|
160
|
+
action: action,
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
if diagnostics["error"]
|
|
@@ -21,7 +21,7 @@ require_relative "../../ai_guard/component"
|
|
|
21
21
|
require_relative "../../di/component"
|
|
22
22
|
require_relative "../../symbol_database"
|
|
23
23
|
require_relative "../../symbol_database/component"
|
|
24
|
-
require_relative "../../open_feature/
|
|
24
|
+
require_relative "../../open_feature/activation"
|
|
25
25
|
require_relative "../../error_tracking/component"
|
|
26
26
|
require_relative "../crashtracking/component"
|
|
27
27
|
require_relative "../environment/agent_info"
|
|
@@ -55,7 +55,7 @@ module Datadog
|
|
|
55
55
|
# extension, remote config off, non-MRI). Under the always-build model
|
|
56
56
|
# it is non-nil even when the DI setting defaults to off, so a built
|
|
57
57
|
# SymbolDatabase component is inert until an upload is actually
|
|
58
|
-
# permitted: the component's own gate
|
|
58
|
+
# permitted: the component's own gate, SymbolDatabase::Component#upload_allowed?,
|
|
59
59
|
# only extracts and uploads when DI is truly active or the customer
|
|
60
60
|
# opted in explicitly. This mirrors DI advertising/building a component
|
|
61
61
|
# by default while installing no probes until it is enabled.
|
|
@@ -154,8 +154,7 @@ module Datadog
|
|
|
154
154
|
:ai_guard,
|
|
155
155
|
:agent_info,
|
|
156
156
|
:data_streams,
|
|
157
|
-
:symbol_database
|
|
158
|
-
:open_feature
|
|
157
|
+
:symbol_database
|
|
159
158
|
|
|
160
159
|
def initialize(settings)
|
|
161
160
|
@settings = settings
|
|
@@ -188,8 +187,14 @@ module Datadog
|
|
|
188
187
|
|
|
189
188
|
@telemetry = self.class.build_telemetry(settings, agent_settings, @logger)
|
|
190
189
|
|
|
191
|
-
@remote = Remote::Component.build(
|
|
190
|
+
@remote = Remote::Component.build(
|
|
191
|
+
settings,
|
|
192
|
+
agent_settings,
|
|
193
|
+
logger: @logger,
|
|
194
|
+
telemetry: telemetry,
|
|
195
|
+
)
|
|
192
196
|
@tracer = Datadog::Tracing::Component.build_tracer(settings, agent_settings, logger: @logger)
|
|
197
|
+
Datadog::Tracing::Component.bind_transport_telemetry(@tracer, telemetry)
|
|
193
198
|
@crashtracker = self.class.build_crashtracker(settings, agent_settings, logger: @logger)
|
|
194
199
|
|
|
195
200
|
@profiler, profiler_logger_extra = Datadog::Profiling::Component.build_profiler_component(
|
|
@@ -204,7 +209,13 @@ module Datadog
|
|
|
204
209
|
@health_metrics = self.class.build_health_metrics(settings, @logger, telemetry)
|
|
205
210
|
@appsec = Datadog::AppSec::Component.build_appsec_component(settings, telemetry: telemetry)
|
|
206
211
|
@ai_guard = Datadog::AIGuard::Component.build(settings, logger: @logger, telemetry: telemetry)
|
|
207
|
-
@
|
|
212
|
+
@open_feature_activation = OpenFeature::Activation.new(
|
|
213
|
+
settings,
|
|
214
|
+
agent_settings,
|
|
215
|
+
remote,
|
|
216
|
+
logger: @logger,
|
|
217
|
+
telemetry: telemetry,
|
|
218
|
+
)
|
|
208
219
|
@dynamic_instrumentation = Datadog::DI::Component.build(settings, agent_settings, @logger, telemetry: telemetry)
|
|
209
220
|
# Only build symbol database when enabled, so a disabled component is
|
|
210
221
|
# never constructed.
|
|
@@ -243,11 +254,14 @@ module Datadog
|
|
|
243
254
|
|
|
244
255
|
# Called when a fork is detected
|
|
245
256
|
def after_fork
|
|
257
|
+
tracer.after_fork
|
|
246
258
|
telemetry.after_fork
|
|
247
259
|
remote&.after_fork
|
|
248
260
|
crashtracker&.update_on_fork
|
|
249
261
|
ProcessDiscovery.after_fork
|
|
250
262
|
symbol_database&.after_fork!
|
|
263
|
+
data_streams&.restart_flush_thread
|
|
264
|
+
@open_feature_activation.after_fork
|
|
251
265
|
end
|
|
252
266
|
|
|
253
267
|
# Hot-swaps with a new sampler.
|
|
@@ -262,6 +276,8 @@ module Datadog
|
|
|
262
276
|
def startup!(settings, old_state: nil)
|
|
263
277
|
telemetry.start(old_state&.telemetry_enabled?, components: self)
|
|
264
278
|
|
|
279
|
+
@open_feature_activation.startup!
|
|
280
|
+
|
|
265
281
|
if settings.profiling.enabled
|
|
266
282
|
if profiler
|
|
267
283
|
profiler.start
|
|
@@ -272,12 +288,20 @@ module Datadog
|
|
|
272
288
|
end
|
|
273
289
|
end
|
|
274
290
|
|
|
291
|
+
if dynamic_instrumentation && old_state
|
|
292
|
+
dynamic_instrumentation.record_rc_enablement_signal_paths(old_state.rc_enablement_signal_paths)
|
|
293
|
+
end
|
|
294
|
+
|
|
275
295
|
if remote && old_state&.remote_started?
|
|
276
296
|
# The library was reconfigured and previously it already started
|
|
277
297
|
# the remote component (i.e., it received at least one request
|
|
278
298
|
# through the installed Rack middleware which started the remote).
|
|
279
299
|
# If the new configuration also has remote enabled, start the
|
|
280
300
|
# new remote right away.
|
|
301
|
+
#
|
|
302
|
+
# The DI signal-path restore above must precede this: the
|
|
303
|
+
# replacement client's first sync can dispatch the APM_TRACING
|
|
304
|
+
# merge, whose withdrawal branch reads the recorded paths.
|
|
281
305
|
remote.start
|
|
282
306
|
end
|
|
283
307
|
|
|
@@ -320,8 +344,14 @@ module Datadog
|
|
|
320
344
|
# Shutdown Symbol Database
|
|
321
345
|
symbol_database&.shutdown!
|
|
322
346
|
|
|
323
|
-
|
|
324
|
-
|
|
347
|
+
begin
|
|
348
|
+
@open_feature_activation.shutdown!
|
|
349
|
+
rescue => e
|
|
350
|
+
# Feature Flags is optional and must never interrupt library shutdown.
|
|
351
|
+
description = "Feature Flags delivery failed to shut down"
|
|
352
|
+
logger.error("#{description}: #{e.class}: #{e.message}")
|
|
353
|
+
telemetry.report(e, description: description)
|
|
354
|
+
end
|
|
325
355
|
|
|
326
356
|
# Decommission AppSec
|
|
327
357
|
appsec&.shutdown!
|
|
@@ -352,13 +382,13 @@ module Datadog
|
|
|
352
382
|
# have direct ownership of it.
|
|
353
383
|
old_statsd = [
|
|
354
384
|
runtime_metrics.metrics.statsd,
|
|
355
|
-
health_metrics.statsd
|
|
385
|
+
health_metrics.statsd,
|
|
356
386
|
].compact.uniq
|
|
357
387
|
|
|
358
388
|
new_statsd = if replacement
|
|
359
389
|
[
|
|
360
390
|
replacement.runtime_metrics.metrics.statsd,
|
|
361
|
-
replacement.health_metrics.statsd
|
|
391
|
+
replacement.health_metrics.statsd,
|
|
362
392
|
].compact.uniq
|
|
363
393
|
else
|
|
364
394
|
[]
|
|
@@ -383,21 +413,22 @@ module Datadog
|
|
|
383
413
|
# di_implicitly_enabled distinguishes RC-driven start from explicit
|
|
384
414
|
# start (env var or programmatic) so that an explicit
|
|
385
415
|
# `enabled = false` on reconfiguration can take effect.
|
|
386
|
-
|
|
387
|
-
# using_default? — not `!enabled` — because Datadog.configure has
|
|
388
|
-
# already mutated the singleton settings by the time #state runs,
|
|
389
|
-
# so `!enabled` would treat a customer's explicit
|
|
390
|
-
# `enabled = false` as "implicitly enabled" and restart DI.
|
|
391
|
-
# using_default? asks "did the customer ever touch this setting",
|
|
392
|
-
# which is the right question for RC carry-over.
|
|
393
|
-
di_implicit = dynamic_instrumentation&.started? &&
|
|
394
|
-
@settings.dynamic_instrumentation.using_default?(:enabled)
|
|
416
|
+
di_implicit = dynamic_instrumentation&.implicitly_enabled?
|
|
395
417
|
ComponentsState.new(
|
|
396
418
|
telemetry_enabled: telemetry.enabled,
|
|
397
419
|
remote_started: remote&.started?,
|
|
398
420
|
di_implicitly_enabled: di_implicit || false,
|
|
421
|
+
rc_enablement_signal_paths: dynamic_instrumentation&.rc_enablement_signal_paths || [],
|
|
399
422
|
)
|
|
400
423
|
end
|
|
424
|
+
|
|
425
|
+
def open_feature
|
|
426
|
+
@open_feature_activation.component
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
private
|
|
430
|
+
|
|
431
|
+
attr_reader :open_feature_activation
|
|
401
432
|
end
|
|
402
433
|
end
|
|
403
434
|
end
|
|
@@ -5,10 +5,12 @@ module Datadog
|
|
|
5
5
|
module Configuration
|
|
6
6
|
# Stores the state of component tree when replacing the tree.
|
|
7
7
|
class ComponentsState
|
|
8
|
-
def initialize(telemetry_enabled:, remote_started:, di_implicitly_enabled: false
|
|
8
|
+
def initialize(telemetry_enabled:, remote_started:, di_implicitly_enabled: false,
|
|
9
|
+
rc_enablement_signal_paths: [])
|
|
9
10
|
@telemetry_enabled = !!telemetry_enabled
|
|
10
11
|
@remote_started = !!remote_started
|
|
11
12
|
@di_implicitly_enabled = !!di_implicitly_enabled
|
|
13
|
+
@rc_enablement_signal_paths = rc_enablement_signal_paths || []
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def telemetry_enabled?
|
|
@@ -22,6 +24,11 @@ module Datadog
|
|
|
22
24
|
def di_implicitly_enabled?
|
|
23
25
|
@di_implicitly_enabled
|
|
24
26
|
end
|
|
27
|
+
|
|
28
|
+
# The RC enable-signal carrier paths recorded by the replaced tree's DI component.
|
|
29
|
+
#
|
|
30
|
+
# @return [Array<Core::Remote::Configuration::Path>]
|
|
31
|
+
attr_reader :rc_enablement_signal_paths
|
|
25
32
|
end
|
|
26
33
|
end
|
|
27
34
|
end
|
|
@@ -644,6 +644,13 @@ module Datadog
|
|
|
644
644
|
o.env "DD_PROFILING_EXPERIMENTAL_USE_SYSTEM_DNS"
|
|
645
645
|
o.default true
|
|
646
646
|
end
|
|
647
|
+
|
|
648
|
+
# Whether the profiler samples include the class/module name in stack frames, like `Foo::Bar#baz`, or not (`baz`)
|
|
649
|
+
option :experimental_show_classes_enabled do |o|
|
|
650
|
+
o.type :bool
|
|
651
|
+
o.env "DD_PROFILING_EXPERIMENTAL_SHOW_CLASSES_ENABLED"
|
|
652
|
+
o.default false
|
|
653
|
+
end
|
|
647
654
|
end
|
|
648
655
|
|
|
649
656
|
# @public_api
|
|
@@ -750,12 +757,15 @@ module Datadog
|
|
|
750
757
|
val ||= ""
|
|
751
758
|
# maps OpenTelemetry semantic attributes to Datadog tags
|
|
752
759
|
key = case key.downcase
|
|
753
|
-
when "deployment.environment"
|
|
760
|
+
when "deployment.environment.name"
|
|
761
|
+
result["env"] = val
|
|
762
|
+
nil
|
|
763
|
+
when "deployment.environment" then "env" unless result.key?("env")
|
|
754
764
|
when "service.version" then "version"
|
|
755
765
|
when "service.name" then "service"
|
|
756
766
|
else key
|
|
757
767
|
end
|
|
758
|
-
result[key] = val unless key.empty?
|
|
768
|
+
result[key] = val unless key.nil? || key.empty?
|
|
759
769
|
end
|
|
760
770
|
end
|
|
761
771
|
result
|
|
@@ -792,55 +802,40 @@ module Datadog
|
|
|
792
802
|
end
|
|
793
803
|
end
|
|
794
804
|
|
|
795
|
-
#
|
|
796
|
-
#
|
|
797
|
-
#
|
|
798
|
-
#
|
|
799
|
-
# For [Timecop](https://rubygems.org/gems/timecop), for example, `->{ Time.now_without_mock_time }`
|
|
800
|
-
# allows Datadog features to use the real wall time when time is frozen.
|
|
801
|
-
#
|
|
802
|
-
# @default `->{ Time.now }`
|
|
803
|
-
# @return [Proc<Time>]
|
|
805
|
+
# Deprecated and no longer does anything.
|
|
806
|
+
# This gem already takes care to not be affected by timecop.
|
|
807
|
+
# DEV-3.0: Remove `time_now_provider` option
|
|
804
808
|
option :time_now_provider do |o|
|
|
805
|
-
o.default_proc { ::Time.now }
|
|
809
|
+
o.default_proc { Datadog::Core::Utils::Time.now }
|
|
806
810
|
o.type :proc
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
Core::Utils::Time.now_provider = default
|
|
811
|
+
o.after_set do |_, _, precedence|
|
|
812
|
+
unless precedence == Datadog::Core::Configuration::Option::Precedence::DEFAULT
|
|
813
|
+
unless defined?(Datadog::CI) # the datadog-ci gem needs to work with any datadog gem version and not warn
|
|
814
|
+
Core.log_deprecation(key: :time_now_provider) do
|
|
815
|
+
"The time_now_provider setting has been deprecated for removal " \
|
|
816
|
+
"and no longer does anything. Please remove it from your Datadog.configure block. " \
|
|
817
|
+
"The datadog gem always uses the real non-mocked time, even when the timecop gem monkey-patches Time."
|
|
818
|
+
end
|
|
819
|
+
end
|
|
817
820
|
end
|
|
818
821
|
end
|
|
819
822
|
end
|
|
820
823
|
|
|
821
|
-
#
|
|
822
|
-
# gem
|
|
823
|
-
#
|
|
824
|
-
# It must respect the interface of [Datadog::Core::Utils::Time#get_time] method.
|
|
825
|
-
#
|
|
826
|
-
# For [Timecop](https://rubygems.org/gems/timecop), for example,
|
|
827
|
-
# `->(unit = :float_second) { ::Process.clock_gettime_without_mock(Datadog::Core::Utils::Time::MONOTONIC_CLOCK_ID, unit) }`
|
|
828
|
-
# allows Datadog features to use the real monotonic time when time is frozen with
|
|
829
|
-
# `Timecop.mock_process_clock = true`.
|
|
830
|
-
#
|
|
831
|
-
# @default `->(unit = :float_second) { ::Process.clock_gettime(Core::Utils::Time::MONOTONIC_CLOCK_ID, unit) }`
|
|
832
|
-
# @return [Proc<Numeric>]
|
|
824
|
+
# Deprecated and no longer does anything.
|
|
825
|
+
# This gem already takes care to not be affected by timecop.
|
|
826
|
+
# DEV-3.0: Remove `get_time_provider` option
|
|
833
827
|
option :get_time_provider do |o|
|
|
834
|
-
o.default_proc { |unit = :float_second| ::
|
|
828
|
+
o.default_proc { |unit = :float_second| Datadog::Core::Utils::Time.get_time(unit) }
|
|
835
829
|
o.type :proc
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
830
|
+
o.after_set do |_, _, precedence|
|
|
831
|
+
unless precedence == Datadog::Core::Configuration::Option::Precedence::DEFAULT
|
|
832
|
+
unless defined?(Datadog::CI) # the datadog-ci gem needs to work with any datadog gem version and not warn
|
|
833
|
+
Core.log_deprecation(key: :get_time_provider) do
|
|
834
|
+
"The get_time_provider setting has been deprecated for removal " \
|
|
835
|
+
"and no longer does anything. Please remove it from your Datadog.configure block. " \
|
|
836
|
+
"The datadog gem always uses the real non-mocked time, even when the timecop gem monkey-patches Process.clock_gettime."
|
|
837
|
+
end
|
|
838
|
+
end
|
|
844
839
|
end
|
|
845
840
|
end
|
|
846
841
|
end
|