datadog 2.46.0 → 2.48.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 +56 -2
- data/LICENSE-3rdparty.csv +1 -0
- data/ext/datadog_profiling_native_extension/collectors_stack.c +143 -86
- data/ext/datadog_profiling_native_extension/collectors_stack.h +9 -1
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +6 -1
- data/ext/datadog_profiling_native_extension/extconf.rb +7 -13
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +3 -3
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +67 -14
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +8 -1
- data/ext/datadog_profiling_native_extension/profiling.c +1 -1
- data/ext/libdatadog_api/extconf.rb +9 -7
- data/ext/libdatadog_api/trace_exporter.c +34 -7
- data/ext/libdatadog_extconf_helpers.rb +2 -2
- data/lib/datadog/ai_guard/component.rb +1 -1
- data/lib/datadog/ai_guard/contrib/rack/request_middleware.rb +1 -9
- data/lib/datadog/ai_guard/contrib/rails/patcher.rb +1 -1
- data/lib/datadog/ai_guard/contrib/ruby_llm/message_adapter.rb +1 -1
- data/lib/datadog/ai_guard/contrib/ruby_llm/redaction_change_set.rb +3 -3
- data/lib/datadog/ai_guard/evaluation/client.rb +3 -3
- data/lib/datadog/ai_guard/evaluation.rb +2 -2
- data/lib/datadog/ai_guard/http_client.rb +3 -2
- data/lib/datadog/ai_guard/redaction.rb +1 -1
- data/lib/datadog/appsec/api_security/endpoint_collection/rails_collector.rb +1 -1
- data/lib/datadog/appsec/assets/waf_rules/README.md +3 -3
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +5366 -1517
- data/lib/datadog/appsec/assets/waf_rules/strict.json +2 -2
- data/lib/datadog/appsec/autoload.rb +1 -1
- data/lib/datadog/appsec/component.rb +1 -1
- data/lib/datadog/appsec/compressed_json.rb +1 -1
- data/lib/datadog/appsec/configuration.rb +3 -3
- data/lib/datadog/appsec/context.rb +1 -1
- data/lib/datadog/appsec/contrib/active_record/instrumentation.rb +11 -1
- data/lib/datadog/appsec/contrib/active_record/patcher.rb +12 -4
- data/lib/datadog/appsec/contrib/aws_lambda/gateway/watcher.rb +2 -2
- data/lib/datadog/appsec/contrib/aws_lambda/waf_addresses.rb +1 -1
- data/lib/datadog/appsec/contrib/devise/configuration.rb +1 -1
- data/lib/datadog/appsec/contrib/devise/patches/signin_tracking_patch.rb +1 -1
- data/lib/datadog/appsec/contrib/devise/patches/signup_tracking_patch.rb +1 -1
- data/lib/datadog/appsec/contrib/devise/tracking_middleware.rb +1 -1
- data/lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb +1 -1
- data/lib/datadog/appsec/contrib/faraday/ssrf_detection_middleware.rb +1 -1
- data/lib/datadog/appsec/contrib/graphql/gateway/multiplex.rb +7 -7
- data/lib/datadog/appsec/contrib/graphql/gateway/watcher.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +3 -3
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +5 -5
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +31 -4
- data/lib/datadog/appsec/contrib/rails/patcher.rb +2 -2
- data/lib/datadog/appsec/contrib/rails/patches/render_to_body_patch.rb +8 -7
- data/lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +17 -5
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/patches/json_patch.rb +8 -7
- data/lib/datadog/appsec/metrics/collector.rb +5 -5
- data/lib/datadog/appsec/metrics/telemetry_exporter.rb +3 -3
- data/lib/datadog/appsec/monitor/gateway/watcher.rb +2 -2
- data/lib/datadog/appsec/processor/rule_loader.rb +1 -1
- data/lib/datadog/appsec/response.rb +1 -1
- data/lib/datadog/appsec/security_engine/engine.rb +8 -7
- data/lib/datadog/appsec/security_engine/runner.rb +2 -2
- data/lib/datadog/appsec/trace_keeper.rb +1 -1
- data/lib/datadog/appsec.rb +1 -1
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +14 -13
- data/lib/datadog/core/configuration/agentless_settings_resolver.rb +2 -2
- data/lib/datadog/core/configuration/components.rb +12 -11
- data/lib/datadog/core/configuration/components_state.rb +8 -1
- data/lib/datadog/core/configuration/settings.rb +5 -2
- data/lib/datadog/core/configuration/supported_configurations.rb +3 -0
- data/lib/datadog/core/configuration.rb +2 -2
- data/lib/datadog/core/crashtracking/component.rb +1 -1
- data/lib/datadog/core/diagnostics/environment_logger.rb +1 -1
- data/lib/datadog/core/environment/cgroup.rb +2 -2
- data/lib/datadog/core/environment/container.rb +3 -3
- data/lib/datadog/core/metrics/client.rb +6 -6
- data/lib/datadog/core/process_discovery.rb +1 -1
- data/lib/datadog/core/remote/client.rb +44 -3
- data/lib/datadog/core/remote/dispatcher.rb +34 -3
- data/lib/datadog/core/remote/tie/tracing.rb +4 -3
- data/lib/datadog/core/remote/transport/http.rb +2 -2
- data/lib/datadog/core/runtime/metrics.rb +14 -14
- data/lib/datadog/core/semaphore.rb +3 -1
- data/lib/datadog/core/telemetry/event/app_started.rb +9 -9
- data/lib/datadog/core/telemetry/logger.rb +1 -1
- data/lib/datadog/core/telemetry/logging.rb +1 -1
- data/lib/datadog/core/telemetry/request.rb +9 -3
- data/lib/datadog/core/telemetry/transport/http.rb +2 -2
- data/lib/datadog/core/telemetry/worker.rb +1 -1
- data/lib/datadog/core/transport/http/adapters/net.rb +1 -1
- data/lib/datadog/core/transport/http/adapters/unix_socket.rb +1 -1
- data/lib/datadog/core/transport/http/builder.rb +1 -1
- data/lib/datadog/core/transport/http.rb +3 -3
- data/lib/datadog/core/utils/at_fork_monkey_patch.rb +2 -2
- data/lib/datadog/core/workers/async.rb +1 -1
- data/lib/datadog/core/workers/runtime_metrics.rb +2 -2
- data/lib/datadog/data_streams/pathway_context.rb +1 -1
- data/lib/datadog/data_streams/processor.rb +48 -27
- data/lib/datadog/data_streams/transport/http.rb +1 -1
- data/lib/datadog/data_streams.rb +16 -0
- data/lib/datadog/di/capture_expression_evaluator.rb +48 -11
- data/lib/datadog/di/component.rb +73 -2
- data/lib/datadog/di/configuration.rb +19 -0
- data/lib/datadog/di/contrib/active_record.rb +1 -1
- data/lib/datadog/di/el/compiler.rb +4 -4
- data/lib/datadog/di/el/evaluator.rb +247 -43
- data/lib/datadog/di/el/expression.rb +36 -6
- data/lib/datadog/di/error.rb +16 -0
- data/lib/datadog/di/guardrails_telemetry/reason.rb +3 -2
- data/lib/datadog/di/instrumenter.rb +39 -10
- data/lib/datadog/di/probe_notification_builder.rb +58 -10
- data/lib/datadog/di/probe_notifier_worker.rb +1 -1
- data/lib/datadog/di/remote.rb +46 -2
- data/lib/datadog/di/serializer.rb +47 -13
- data/lib/datadog/di.rb +27 -0
- data/lib/datadog/error_tracking/component.rb +1 -1
- data/lib/datadog/error_tracking/configuration.rb +1 -1
- data/lib/datadog/kit/appsec/events/v2.rb +6 -6
- data/lib/datadog/kit/appsec/events.rb +1 -1
- data/lib/datadog/kit/enable_core_dumps.rb +1 -1
- data/lib/datadog/kit/identity.rb +1 -1
- data/lib/datadog/open_feature/activation.rb +26 -1
- data/lib/datadog/open_feature/agentless/configuration_source.rb +94 -15
- data/lib/datadog/open_feature/component.rb +22 -2
- data/lib/datadog/open_feature/configuration/agentless_endpoint.rb +6 -0
- data/lib/datadog/open_feature/configuration.rb +10 -4
- data/lib/datadog/open_feature/evaluation_engine.rb +62 -4
- data/lib/datadog/open_feature/exposures/buffer.rb +4 -0
- data/lib/datadog/open_feature/exposures/reporter.rb +17 -4
- data/lib/datadog/open_feature/exposures/worker.rb +37 -6
- data/lib/datadog/open_feature/flag_evaluation/aggregator.rb +5 -5
- data/lib/datadog/open_feature/flag_evaluation/writer.rb +1 -1
- data/lib/datadog/open_feature/hooks/debug_logging_hook.rb +56 -0
- data/lib/datadog/open_feature/hooks/evaluation_telemetry_opt_out_hook.rb +25 -0
- data/lib/datadog/open_feature/hooks/span_enrichment_hook.rb +2 -2
- data/lib/datadog/open_feature/metrics/flag_eval_metrics.rb +1 -1
- data/lib/datadog/open_feature/native_evaluator.rb +1 -1
- data/lib/datadog/open_feature/noop_evaluator.rb +1 -1
- data/lib/datadog/open_feature/provider.rb +69 -12
- data/lib/datadog/open_feature/remote.rb +8 -1
- data/lib/datadog/open_feature/resolution_details.rb +2 -2
- data/lib/datadog/open_feature/transport.rb +6 -6
- data/lib/datadog/opentelemetry/api/context.rb +3 -3
- data/lib/datadog/opentelemetry/logs.rb +5 -5
- data/lib/datadog/opentelemetry/metrics.rb +3 -3
- data/lib/datadog/opentelemetry/sdk/propagator.rb +3 -3
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +2 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +1 -1
- data/lib/datadog/profiling/collectors/code_provenance.rb +3 -3
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +4 -4
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -1
- data/lib/datadog/profiling/collectors/info.rb +37 -6
- data/lib/datadog/profiling/collectors/thread_context.rb +1 -1
- data/lib/datadog/profiling/component.rb +41 -39
- data/lib/datadog/profiling/exporter.rb +4 -6
- data/lib/datadog/profiling/http_transport.rb +3 -3
- data/lib/datadog/profiling/profiler.rb +2 -2
- data/lib/datadog/profiling/scheduler.rb +2 -2
- data/lib/datadog/profiling/tag_builder.rb +1 -1
- data/lib/datadog/symbol_database/extractor.rb +8 -8
- data/lib/datadog/symbol_database/uploader.rb +1 -1
- data/lib/datadog/tracing/buffer.rb +3 -3
- data/lib/datadog/tracing/client_ip.rb +1 -1
- data/lib/datadog/tracing/component.rb +15 -10
- data/lib/datadog/tracing/configuration/dynamic/option.rb +2 -2
- data/lib/datadog/tracing/configuration/ext.rb +2 -0
- data/lib/datadog/tracing/configuration/settings.rb +14 -3
- data/lib/datadog/tracing/context.rb +1 -1
- data/lib/datadog/tracing/context_provider.rb +8 -0
- data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +2 -2
- data/lib/datadog/tracing/contrib/active_job/data_streams.rb +27 -2
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +2 -2
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/utils.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +2 -2
- data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +2 -2
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +1 -1
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +1 -1
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +2 -2
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +3 -3
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +17 -12
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +1 -1
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/excon/middleware.rb +16 -9
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +14 -8
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +4 -4
- data/lib/datadog/tracing/contrib/graphql/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/graphql/unified_trace.rb +3 -3
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +2 -2
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +1 -1
- data/lib/datadog/tracing/contrib/grpc.rb +1 -1
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/hanami/plugin.rb +1 -1
- data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +1 -1
- data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +1 -1
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +21 -6
- data/lib/datadog/tracing/contrib/http.rb +1 -1
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +14 -8
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +14 -8
- data/lib/datadog/tracing/contrib/kafka/instrumentation/consumer.rb +2 -2
- data/lib/datadog/tracing/contrib/kafka/instrumentation/producer.rb +2 -2
- data/lib/datadog/tracing/contrib/karafka/monitor.rb +1 -1
- data/lib/datadog/tracing/contrib/karafka/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/karafka.rb +1 -1
- data/lib/datadog/tracing/contrib/lograge/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/mongodb/parsers.rb +1 -1
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +1 -1
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +3 -3
- data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +2 -2
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +3 -3
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +4 -4
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +4 -4
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +1 -1
- data/lib/datadog/tracing/contrib/que/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +1 -1
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +3 -3
- data/lib/datadog/tracing/contrib/rack/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/rails/framework.rb +7 -7
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +1 -1
- data/lib/datadog/tracing/contrib/rails/runner.rb +4 -4
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/quantize.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/tags.rb +1 -1
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +17 -10
- data/lib/datadog/tracing/contrib/sequel/database.rb +1 -1
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +1 -1
- data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +2 -2
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +2 -2
- data/lib/datadog/tracing/contrib/sidekiq.rb +1 -1
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +1 -1
- data/lib/datadog/tracing/contrib/status_range_env_parser.rb +1 -1
- data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +1 -1
- data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +3 -3
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +102 -0
- data/lib/datadog/tracing/contrib/waterdrop/middleware.rb +2 -2
- data/lib/datadog/tracing/contrib/waterdrop.rb +1 -1
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +1 -1
- data/lib/datadog/tracing/distributed/b3_multi.rb +1 -1
- data/lib/datadog/tracing/distributed/b3_single.rb +1 -1
- data/lib/datadog/tracing/distributed/baggage.rb +3 -3
- data/lib/datadog/tracing/distributed/datadog.rb +3 -3
- data/lib/datadog/tracing/distributed/propagation.rb +7 -7
- data/lib/datadog/tracing/distributed/trace_context.rb +1 -1
- data/lib/datadog/tracing/distributed/trace_state/open_telemetry.rb +1 -1
- data/lib/datadog/tracing/otel_thread_context.rb +3 -3
- data/lib/datadog/tracing/pipeline.rb +1 -1
- data/lib/datadog/tracing/remote.rb +50 -19
- data/lib/datadog/tracing/sampling/priority_sampler.rb +1 -1
- data/lib/datadog/tracing/sampling/rule.rb +1 -1
- data/lib/datadog/tracing/sampling/rule_sampler.rb +1 -1
- data/lib/datadog/tracing/sampling/span/rule_parser.rb +2 -2
- data/lib/datadog/tracing/span_operation.rb +1 -1
- data/lib/datadog/tracing/trace_digest.rb +1 -1
- data/lib/datadog/tracing/trace_operation.rb +6 -6
- data/lib/datadog/tracing/tracer.rb +6 -6
- data/lib/datadog/tracing/transport/http/telemetry.rb +1 -1
- data/lib/datadog/tracing/transport/http.rb +2 -2
- data/lib/datadog/tracing/transport/io.rb +1 -1
- data/lib/datadog/tracing/transport/native.rb +3 -3
- data/lib/datadog/tracing/transport/statistics.rb +2 -2
- data/lib/datadog/tracing/transport/telemetry.rb +3 -1
- data/lib/datadog/tracing/transport/trace_formatter.rb +12 -12
- data/lib/datadog/tracing/transport/traces.rb +1 -1
- data/lib/datadog/tracing/utils.rb +1 -1
- data/lib/datadog/tracing/workers.rb +1 -1
- data/lib/datadog/version.rb +1 -1
- metadata +9 -8
- data/lib/datadog/appsec/utils/hash_coercion.rb +0 -23
|
@@ -20,7 +20,7 @@ module Datadog
|
|
|
20
20
|
block_failure: "false",
|
|
21
21
|
rate_limited: (!context.trace.sampled?).to_s,
|
|
22
22
|
input_truncated: metrics.inputs_truncated.positive?.to_s,
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
)
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -31,14 +31,14 @@ module Datadog
|
|
|
31
31
|
if context.span&.get_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE).nil?
|
|
32
32
|
AppSec.telemetry.inc(
|
|
33
33
|
AppSec::Ext::TELEMETRY_METRICS_NAMESPACE, "api_security.missing_route", 1,
|
|
34
|
-
tags: {framework: web_framework}
|
|
34
|
+
tags: {framework: web_framework},
|
|
35
35
|
)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
metric_name = context.state[:schema_extracted] ? "schema" : "no_schema"
|
|
39
39
|
AppSec.telemetry.inc(
|
|
40
40
|
AppSec::Ext::TELEMETRY_METRICS_NAMESPACE, "api_security.request.#{metric_name}", 1,
|
|
41
|
-
tags: {framework: web_framework}
|
|
41
|
+
tags: {framework: web_framework},
|
|
42
42
|
)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -44,7 +44,7 @@ module Datadog
|
|
|
44
44
|
|
|
45
45
|
if result.match? || result.attributes.any?
|
|
46
46
|
context.events.push(
|
|
47
|
-
AppSec::SecurityEvent.new(result, trace: context.trace, span: context.span)
|
|
47
|
+
AppSec::SecurityEvent.new(result, trace: context.trace, span: context.span),
|
|
48
48
|
)
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -71,7 +71,7 @@ module Datadog
|
|
|
71
71
|
|
|
72
72
|
if result.match? || result.attributes.any?
|
|
73
73
|
context.events.push(
|
|
74
|
-
AppSec::SecurityEvent.new(result, trace: context.trace, span: context.span)
|
|
74
|
+
AppSec::SecurityEvent.new(result, trace: context.trace, span: context.span),
|
|
75
75
|
)
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -17,7 +17,7 @@ module Datadog
|
|
|
17
17
|
Datadog.logger.warn(
|
|
18
18
|
"The :risky Application Security Management ruleset has been deprecated and no longer available." \
|
|
19
19
|
"The `:recommended` ruleset will be used instead." \
|
|
20
|
-
"Please remove the `appsec.ruleset = :risky` setting from your Datadog.configure block."
|
|
20
|
+
"Please remove the `appsec.ruleset = :risky` setting from your Datadog.configure block.",
|
|
21
21
|
)
|
|
22
22
|
JSON.parse(Datadog::AppSec::Assets.waf_rules(:recommended))
|
|
23
23
|
when String
|
|
@@ -32,7 +32,7 @@ module Datadog
|
|
|
32
32
|
obfuscator: {
|
|
33
33
|
key_regex: appsec_settings.obfuscator_key_regex,
|
|
34
34
|
value_regex: appsec_settings.obfuscator_value_regex,
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
diagnostics = load_default_config(telemetry: telemetry)
|
|
@@ -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)
|
|
@@ -131,7 +132,7 @@ module Datadog
|
|
|
131
132
|
waf_version: Datadog::AppSec::WAF::VERSION::BASE_STRING,
|
|
132
133
|
event_rules_version: ruleset_version.to_s,
|
|
133
134
|
success: success.to_s,
|
|
134
|
-
}
|
|
135
|
+
},
|
|
135
136
|
)
|
|
136
137
|
end
|
|
137
138
|
|
|
@@ -141,7 +142,7 @@ module Datadog
|
|
|
141
142
|
# deprecated - ip and user id denylists should be configured via RC
|
|
142
143
|
config["rules_data"] ||= AppSec::Processor::RuleLoader.load_data(
|
|
143
144
|
ip_denylist: @default_ip_denylist,
|
|
144
|
-
user_id_denylist: @default_user_id_denylist
|
|
145
|
+
user_id_denylist: @default_user_id_denylist,
|
|
145
146
|
)
|
|
146
147
|
|
|
147
148
|
# deprecated - ip passlist should be configured via RC
|
|
@@ -162,7 +163,7 @@ module Datadog
|
|
|
162
163
|
if diagnostics["error"]
|
|
163
164
|
telemetry.inc(
|
|
164
165
|
Ext::TELEMETRY_METRICS_NAMESPACE, "waf.config_errors", 1,
|
|
165
|
-
tags: common_tags.merge(scope: "top-level")
|
|
166
|
+
tags: common_tags.merge(scope: "top-level"),
|
|
166
167
|
)
|
|
167
168
|
|
|
168
169
|
telemetry.error(diagnostics["error"])
|
|
@@ -177,7 +178,7 @@ module Datadog
|
|
|
177
178
|
|
|
178
179
|
telemetry.inc(
|
|
179
180
|
Ext::TELEMETRY_METRICS_NAMESPACE, "waf.config_errors", 1,
|
|
180
|
-
tags: common_tags.merge(config_key: config_key, scope: "top-level")
|
|
181
|
+
tags: common_tags.merge(config_key: config_key, scope: "top-level"),
|
|
181
182
|
)
|
|
182
183
|
elsif config_diagnostics["errors"]
|
|
183
184
|
config_diagnostics["errors"].each do |error, config_ids|
|
|
@@ -186,7 +187,7 @@ module Datadog
|
|
|
186
187
|
|
|
187
188
|
telemetry.inc(
|
|
188
189
|
Ext::TELEMETRY_METRICS_NAMESPACE, "waf.config_errors", config_diagnostics["errors"].count,
|
|
189
|
-
tags: common_tags.merge(config_key: config_key, scope: "item")
|
|
190
|
+
tags: common_tags.merge(config_key: config_key, scope: "item"),
|
|
190
191
|
)
|
|
191
192
|
end
|
|
192
193
|
end
|
|
@@ -54,7 +54,7 @@ module Datadog
|
|
|
54
54
|
timeout: result.timeout?,
|
|
55
55
|
duration_ns: result.duration,
|
|
56
56
|
duration_ext_ns: (stop_ns - start_ns),
|
|
57
|
-
input_truncated: result.input_truncated
|
|
57
|
+
input_truncated: result.input_truncated?,
|
|
58
58
|
)
|
|
59
59
|
ensure
|
|
60
60
|
@mutex.unlock
|
|
@@ -89,7 +89,7 @@ module Datadog
|
|
|
89
89
|
attributes: {},
|
|
90
90
|
duration: 0,
|
|
91
91
|
keep: false,
|
|
92
|
-
timeout: false
|
|
92
|
+
timeout: false,
|
|
93
93
|
)
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -20,7 +20,7 @@ module Datadog
|
|
|
20
20
|
if previous_dm.nil? || previous_dm == Tracing::Sampling::Ext::Decision::MANUAL
|
|
21
21
|
trace.set_tag(
|
|
22
22
|
Tracing::Metadata::Ext::Distributed::TAG_DECISION_MAKER,
|
|
23
|
-
Tracing::Sampling::Ext::Decision::ASM
|
|
23
|
+
Tracing::Sampling::Ext::Decision::ASM,
|
|
24
24
|
)
|
|
25
25
|
else
|
|
26
26
|
trace.set_tag(
|
data/lib/datadog/appsec.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Datadog
|
|
|
17
17
|
def rasp_enabled?
|
|
18
18
|
# TODO this should take rasp_enabled flag from the settings in
|
|
19
19
|
# the appsec component rather than reading global configuration.
|
|
20
|
-
enabled? && Datadog.configuration.appsec.rasp_enabled
|
|
20
|
+
!!(enabled? && Datadog.configuration.appsec.rasp_enabled)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def active_context
|
|
@@ -60,16 +60,16 @@ module Datadog
|
|
|
60
60
|
@configured_hostname = pick_from(
|
|
61
61
|
DetectedConfiguration.new(
|
|
62
62
|
friendly_name: "'c.agent.host'",
|
|
63
|
-
value: settings.agent.host
|
|
63
|
+
value: settings.agent.host,
|
|
64
64
|
),
|
|
65
65
|
DetectedConfiguration.new(
|
|
66
66
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} environment variable",
|
|
67
|
-
value: parsed_http_url&.hostname
|
|
67
|
+
value: parsed_http_url&.hostname,
|
|
68
68
|
),
|
|
69
69
|
DetectedConfiguration.new(
|
|
70
70
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_HOST} environment variable",
|
|
71
|
-
value: DATADOG_ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_HOST]
|
|
72
|
-
)
|
|
71
|
+
value: DATADOG_ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_HOST],
|
|
72
|
+
),
|
|
73
73
|
)
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -88,7 +88,7 @@ module Datadog
|
|
|
88
88
|
try_parsing_as_integer(
|
|
89
89
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_PORT} environment variable",
|
|
90
90
|
value: DATADOG_ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_PORT],
|
|
91
|
-
)
|
|
91
|
+
),
|
|
92
92
|
)
|
|
93
93
|
end
|
|
94
94
|
|
|
@@ -103,7 +103,7 @@ module Datadog
|
|
|
103
103
|
DetectedConfiguration.new(
|
|
104
104
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} environment variable",
|
|
105
105
|
value: parsed_url_ssl?,
|
|
106
|
-
)
|
|
106
|
+
),
|
|
107
107
|
)
|
|
108
108
|
end
|
|
109
109
|
|
|
@@ -119,7 +119,7 @@ module Datadog
|
|
|
119
119
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_TIMEOUT_SECONDS} " \
|
|
120
120
|
"environment variable",
|
|
121
121
|
value: DATADOG_ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_TIMEOUT_SECONDS],
|
|
122
|
-
)
|
|
122
|
+
),
|
|
123
123
|
)
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -129,12 +129,12 @@ module Datadog
|
|
|
129
129
|
@configured_uds_path = pick_from(
|
|
130
130
|
DetectedConfiguration.new(
|
|
131
131
|
friendly_name: "'c.agent.uds_path'",
|
|
132
|
-
value: settings.agent.uds_path
|
|
132
|
+
value: settings.agent.uds_path,
|
|
133
133
|
),
|
|
134
134
|
DetectedConfiguration.new(
|
|
135
135
|
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} environment variable",
|
|
136
|
-
value: parsed_url_uds_path
|
|
137
|
-
)
|
|
136
|
+
value: parsed_url_uds_path,
|
|
137
|
+
),
|
|
138
138
|
)
|
|
139
139
|
end
|
|
140
140
|
|
|
@@ -239,7 +239,7 @@ module Datadog
|
|
|
239
239
|
friendly_name: "configuration of hostname/port for http/https use",
|
|
240
240
|
value: "hostname: '#{hostname}', port: '#{port}'",
|
|
241
241
|
),
|
|
242
|
-
]
|
|
242
|
+
],
|
|
243
243
|
)
|
|
244
244
|
end
|
|
245
245
|
|
|
@@ -269,7 +269,7 @@ module Datadog
|
|
|
269
269
|
log_warning(
|
|
270
270
|
"Invalid URI scheme '#{parsed.scheme}' for #{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} " \
|
|
271
271
|
"environment variable ('#{unparsed_url_from_env}'). " \
|
|
272
|
-
"Ignoring the contents of #{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL}."
|
|
272
|
+
"Ignoring the contents of #{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL}.",
|
|
273
273
|
)
|
|
274
274
|
# rubocop:enable Layout/LineLength
|
|
275
275
|
|
|
@@ -297,7 +297,8 @@ module Datadog
|
|
|
297
297
|
"Configuration mismatch: values differ between " \
|
|
298
298
|
"#{detected_configurations_in_priority_order
|
|
299
299
|
.map { |config| "#{config.friendly_name} (#{config.value.inspect})" }.join(" and ")}" \
|
|
300
|
-
". Using #{detected_configurations_in_priority_order.first.value.inspect} and ignoring
|
|
300
|
+
". Using #{detected_configurations_in_priority_order.first.value.inspect} and ignoring " \
|
|
301
|
+
"other configuration.",
|
|
301
302
|
)
|
|
302
303
|
end
|
|
303
304
|
|
|
@@ -48,7 +48,7 @@ module Datadog
|
|
|
48
48
|
host_prefix: host_prefix,
|
|
49
49
|
url_override: url_override,
|
|
50
50
|
url_override_source: url_override_source,
|
|
51
|
-
logger: logger
|
|
51
|
+
logger: logger,
|
|
52
52
|
).send(:call)
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -162,7 +162,7 @@ module Datadog
|
|
|
162
162
|
else
|
|
163
163
|
log_warning(
|
|
164
164
|
"Invalid URI scheme '#{parsed.scheme}' for #{url_override_source}. " \
|
|
165
|
-
"Ignoring the contents of #{url_override_source}."
|
|
165
|
+
"Ignoring the contents of #{url_override_source}.",
|
|
166
166
|
)
|
|
167
167
|
nil
|
|
168
168
|
end
|
|
@@ -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.
|
|
@@ -129,7 +129,7 @@ module Datadog
|
|
|
129
129
|
logger: logger,
|
|
130
130
|
settings: settings,
|
|
131
131
|
agent_settings: agent_settings,
|
|
132
|
-
agent_info: agent_info
|
|
132
|
+
agent_info: agent_info,
|
|
133
133
|
)
|
|
134
134
|
rescue => e
|
|
135
135
|
logger.warn("Failed to initialize Data Streams Monitoring: #{e.class}: #{e.message}")
|
|
@@ -288,12 +288,20 @@ module Datadog
|
|
|
288
288
|
end
|
|
289
289
|
end
|
|
290
290
|
|
|
291
|
+
if dynamic_instrumentation && old_state
|
|
292
|
+
dynamic_instrumentation.record_rc_enablement_signal_paths(old_state.rc_enablement_signal_paths)
|
|
293
|
+
end
|
|
294
|
+
|
|
291
295
|
if remote && old_state&.remote_started?
|
|
292
296
|
# The library was reconfigured and previously it already started
|
|
293
297
|
# the remote component (i.e., it received at least one request
|
|
294
298
|
# through the installed Rack middleware which started the remote).
|
|
295
299
|
# If the new configuration also has remote enabled, start the
|
|
296
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.
|
|
297
305
|
remote.start
|
|
298
306
|
end
|
|
299
307
|
|
|
@@ -405,19 +413,12 @@ module Datadog
|
|
|
405
413
|
# di_implicitly_enabled distinguishes RC-driven start from explicit
|
|
406
414
|
# start (env var or programmatic) so that an explicit
|
|
407
415
|
# `enabled = false` on reconfiguration can take effect.
|
|
408
|
-
|
|
409
|
-
# using_default? — not `!enabled` — because Datadog.configure has
|
|
410
|
-
# already mutated the singleton settings by the time #state runs,
|
|
411
|
-
# so `!enabled` would treat a customer's explicit
|
|
412
|
-
# `enabled = false` as "implicitly enabled" and restart DI.
|
|
413
|
-
# using_default? asks "did the customer ever touch this setting",
|
|
414
|
-
# which is the right question for RC carry-over.
|
|
415
|
-
di_implicit = dynamic_instrumentation&.started? &&
|
|
416
|
-
@settings.dynamic_instrumentation.using_default?(:enabled)
|
|
416
|
+
di_implicit = dynamic_instrumentation&.implicitly_enabled?
|
|
417
417
|
ComponentsState.new(
|
|
418
418
|
telemetry_enabled: telemetry.enabled,
|
|
419
419
|
remote_started: remote&.started?,
|
|
420
420
|
di_implicitly_enabled: di_implicit || false,
|
|
421
|
+
rc_enablement_signal_paths: dynamic_instrumentation&.rc_enablement_signal_paths || [],
|
|
421
422
|
)
|
|
422
423
|
end
|
|
423
424
|
|
|
@@ -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
|
|
@@ -519,7 +519,7 @@ module Datadog
|
|
|
519
519
|
Datadog.logger.warn(
|
|
520
520
|
"The profiling.advanced.preview_gvl_enabled setting has been deprecated for removal and " \
|
|
521
521
|
"no longer does anything. Please remove it from your Datadog.configure block. " \
|
|
522
|
-
"GVL profiling is now controlled by the profiling.advanced.gvl_enabled setting instead."
|
|
522
|
+
"GVL profiling is now controlled by the profiling.advanced.gvl_enabled setting instead.",
|
|
523
523
|
)
|
|
524
524
|
end
|
|
525
525
|
end
|
|
@@ -646,10 +646,13 @@ module Datadog
|
|
|
646
646
|
end
|
|
647
647
|
|
|
648
648
|
# Whether the profiler samples include the class/module name in stack frames, like `Foo::Bar#baz`, or not (`baz`)
|
|
649
|
+
#
|
|
650
|
+
# @default `DD_PROFILING_EXPERIMENTAL_SHOW_CLASSES_ENABLED` environment variable as a boolean, otherwise `true`
|
|
649
651
|
option :experimental_show_classes_enabled do |o|
|
|
650
652
|
o.type :bool
|
|
651
653
|
o.env "DD_PROFILING_EXPERIMENTAL_SHOW_CLASSES_ENABLED"
|
|
652
|
-
|
|
654
|
+
# Keep in sync with latest_show_classes in collectors_thread_context.c
|
|
655
|
+
o.default true
|
|
653
656
|
end
|
|
654
657
|
end
|
|
655
658
|
|
|
@@ -53,6 +53,7 @@ module Datadog
|
|
|
53
53
|
"DD_DISABLE_DATADOG_RAILS",
|
|
54
54
|
"DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS",
|
|
55
55
|
"DD_DYNAMIC_INSTRUMENTATION_ENABLED",
|
|
56
|
+
"DD_DYNAMIC_INSTRUMENTATION_EVALUATION_TIMEOUT_MS",
|
|
56
57
|
"DD_DYNAMIC_INSTRUMENTATION_MAX_TIME_TO_SERIALIZE",
|
|
57
58
|
"DD_DYNAMIC_INSTRUMENTATION_PROBE_FILE",
|
|
58
59
|
"DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS",
|
|
@@ -72,6 +73,7 @@ module Datadog
|
|
|
72
73
|
"DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_POLL_INTERVAL_SECONDS",
|
|
73
74
|
"DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_REQUEST_TIMEOUT_SECONDS",
|
|
74
75
|
"DD_FEATURE_FLAGS_ENABLED",
|
|
76
|
+
"DD_FEATURE_FLAGS_EVALUATION_TELEMETRY_PER_SUBJECT_OPT_OUT_ENABLED",
|
|
75
77
|
"DD_FLAGGING_EVALUATION_COUNTS_ENABLED",
|
|
76
78
|
"DD_GIT_COMMIT_SHA",
|
|
77
79
|
"DD_GIT_REPOSITORY_URL",
|
|
@@ -242,6 +244,7 @@ module Datadog
|
|
|
242
244
|
"DD_TRACE_HTTP_ANALYTICS_ENABLED",
|
|
243
245
|
"DD_TRACE_HTTP_ANALYTICS_SAMPLE_RATE",
|
|
244
246
|
"DD_TRACE_HTTP_CLIENT_ERROR_STATUSES",
|
|
247
|
+
"DD_TRACE_HTTP_CLIENT_RESOURCE_NAME_QUANTIZE",
|
|
245
248
|
"DD_TRACE_HTTP_DISTRIBUTED_TRACING",
|
|
246
249
|
"DD_TRACE_HTTP_ENABLED",
|
|
247
250
|
"DD_TRACE_HTTP_ERROR_STATUS_CODES",
|
|
@@ -90,7 +90,7 @@ module Datadog
|
|
|
90
90
|
replace_components!(configuration, @components)
|
|
91
91
|
else
|
|
92
92
|
build_components(configuration)
|
|
93
|
-
end
|
|
93
|
+
end,
|
|
94
94
|
)
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -240,7 +240,7 @@ module Datadog
|
|
|
240
240
|
logger_without_components.error(
|
|
241
241
|
"Detected deadlock during datadog initialization: #{e.class}: #{e.message}. " \
|
|
242
242
|
"Please report this at https://github.com/datadog/dd-trace-rb/blob/master/CONTRIBUTING.md#found-a-bug" \
|
|
243
|
-
"\n\tSource:\n\t#{Array(e.backtrace).join("\n\t")}"
|
|
243
|
+
"\n\tSource:\n\t#{Array(e.backtrace).join("\n\t")}",
|
|
244
244
|
)
|
|
245
245
|
nil
|
|
246
246
|
end
|
|
@@ -53,7 +53,7 @@ module Datadog
|
|
|
53
53
|
end
|
|
54
54
|
rescue => e
|
|
55
55
|
logger.warn(
|
|
56
|
-
"Failed to collect core environment information: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}"
|
|
56
|
+
"Failed to collect core environment information: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}",
|
|
57
57
|
)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -15,7 +15,7 @@ module Datadog
|
|
|
15
15
|
:hierarchy,
|
|
16
16
|
:controllers,
|
|
17
17
|
:path,
|
|
18
|
-
:inode
|
|
18
|
+
:inode,
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
module_function
|
|
@@ -52,7 +52,7 @@ module Datadog
|
|
|
52
52
|
hierarchy,
|
|
53
53
|
controllers,
|
|
54
54
|
path,
|
|
55
|
-
inode_for(controllers, path)
|
|
55
|
+
inode_for(controllers, path),
|
|
56
56
|
)
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -27,7 +27,7 @@ module Datadog
|
|
|
27
27
|
:platform,
|
|
28
28
|
:task_uid,
|
|
29
29
|
:container_id,
|
|
30
|
-
:inode
|
|
30
|
+
:inode,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
module_function
|
|
@@ -108,7 +108,7 @@ module Datadog
|
|
|
108
108
|
end
|
|
109
109
|
rescue => e
|
|
110
110
|
Datadog.logger.debug(
|
|
111
|
-
"Error while checking cgroup namespace. Cause: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}"
|
|
111
|
+
"Error while checking cgroup namespace. Cause: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}",
|
|
112
112
|
)
|
|
113
113
|
false
|
|
114
114
|
end
|
|
@@ -172,7 +172,7 @@ module Datadog
|
|
|
172
172
|
@entry = Entry.new # Empty entry if no valid cgroup entry is found
|
|
173
173
|
rescue => e
|
|
174
174
|
Datadog.logger.debug(
|
|
175
|
-
"Error while reading container entry. Cause: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}"
|
|
175
|
+
"Error while reading container entry. Cause: #{e.class}: #{e.message} Location: #{Array(e.backtrace).first}",
|
|
176
176
|
)
|
|
177
177
|
@entry = Entry.new unless defined?(@entry)
|
|
178
178
|
@entry
|
|
@@ -101,7 +101,7 @@ module Datadog
|
|
|
101
101
|
statsd.count(stat, value, metric_options(options))
|
|
102
102
|
rescue => e
|
|
103
103
|
logger.error(
|
|
104
|
-
"Failed to send count stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}"
|
|
104
|
+
"Failed to send count stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}",
|
|
105
105
|
)
|
|
106
106
|
telemetry.report(e, description: "Failed to send count stat")
|
|
107
107
|
end
|
|
@@ -115,7 +115,7 @@ module Datadog
|
|
|
115
115
|
statsd.distribution(stat, value, metric_options(options))
|
|
116
116
|
rescue => e
|
|
117
117
|
logger.error(
|
|
118
|
-
"Failed to send distribution stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}"
|
|
118
|
+
"Failed to send distribution stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}",
|
|
119
119
|
)
|
|
120
120
|
telemetry.report(e, description: "Failed to send distribution stat")
|
|
121
121
|
end
|
|
@@ -128,7 +128,7 @@ module Datadog
|
|
|
128
128
|
statsd.increment(stat, metric_options(options))
|
|
129
129
|
rescue => e
|
|
130
130
|
logger.error(
|
|
131
|
-
"Failed to send increment stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}"
|
|
131
|
+
"Failed to send increment stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}",
|
|
132
132
|
)
|
|
133
133
|
telemetry.report(e, description: "Failed to send increment stat")
|
|
134
134
|
end
|
|
@@ -142,7 +142,7 @@ module Datadog
|
|
|
142
142
|
statsd.gauge(stat, value, metric_options(options))
|
|
143
143
|
rescue => e
|
|
144
144
|
logger.error(
|
|
145
|
-
"Failed to send gauge stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}"
|
|
145
|
+
"Failed to send gauge stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}",
|
|
146
146
|
)
|
|
147
147
|
telemetry.report(e, description: "Failed to send gauge stat")
|
|
148
148
|
end
|
|
@@ -162,7 +162,7 @@ module Datadog
|
|
|
162
162
|
rescue => e
|
|
163
163
|
# TODO: Likely to be redundant, since `distribution` handles its own errors.
|
|
164
164
|
logger.error(
|
|
165
|
-
"Failed to send time stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}"
|
|
165
|
+
"Failed to send time stat. Cause: #{e.class}: #{e.message} Source: #{Array(e.backtrace).first}",
|
|
166
166
|
)
|
|
167
167
|
telemetry.report(e, description: "Failed to send time stat")
|
|
168
168
|
end
|
|
@@ -196,7 +196,7 @@ module Datadog
|
|
|
196
196
|
IGNORED_STATSD_ONLY_ONCE.run do
|
|
197
197
|
logger.warn(
|
|
198
198
|
"Ignoring user-supplied statsd instance as currently-installed version of dogstastd-ruby is incompatible. " \
|
|
199
|
-
"To fix this, ensure that you have `gem 'dogstatsd-ruby', '~> 5.3'` on your Gemfile or gems.rb file."
|
|
199
|
+
"To fix this, ensure that you have `gem 'dogstatsd-ruby', '~> 5.3'` on your Gemfile or gems.rb file.",
|
|
200
200
|
)
|
|
201
201
|
end
|
|
202
202
|
end
|
|
@@ -16,6 +16,12 @@ module Datadog
|
|
|
16
16
|
|
|
17
17
|
attr_reader :transport, :repository, :id, :dispatcher, :settings, :logger
|
|
18
18
|
|
|
19
|
+
# Whether the initial reconcile is still pending, to run on the first
|
|
20
|
+
# sync whose response contains targets.
|
|
21
|
+
#
|
|
22
|
+
# @return [Boolean]
|
|
23
|
+
attr_reader :pending_initial_reconcile
|
|
24
|
+
|
|
19
25
|
def initialize(transport, capabilities, settings:, logger:, repository: Configuration::Repository.new)
|
|
20
26
|
@transport = transport
|
|
21
27
|
@settings = settings
|
|
@@ -25,27 +31,52 @@ module Datadog
|
|
|
25
31
|
@id = SecureRandom.uuid
|
|
26
32
|
@capabilities = capabilities
|
|
27
33
|
@dispatcher = Dispatcher.new(@capabilities.receivers)
|
|
34
|
+
@pending_initial_reconcile = true
|
|
28
35
|
end
|
|
29
36
|
|
|
37
|
+
# Polls the agent for remote configuration, applies the response to
|
|
38
|
+
# the repository and dispatches the resulting changes to the receivers.
|
|
39
|
+
#
|
|
40
|
+
# The agent sends an empty response when it holds no targets newer
|
|
41
|
+
# than the targets version the client reported. Until the client
|
|
42
|
+
# applies a response that carries targets, it reports the initial
|
|
43
|
+
# targets version, so an empty response then means the agent has not
|
|
44
|
+
# received targets from the backend. The initial reconcile therefore
|
|
45
|
+
# waits for a response that carries targets.
|
|
46
|
+
#
|
|
47
|
+
# @return [void]
|
|
48
|
+
# @raise [TransportError] when the agent reports an internal error
|
|
49
|
+
# @raise [SyncError] when the response cannot be applied to the repository
|
|
30
50
|
def sync
|
|
31
51
|
# TODO: Skip sync if no capabilities are registered
|
|
32
52
|
response = transport.send_config(payload)
|
|
33
53
|
|
|
34
54
|
if response.ok?
|
|
35
|
-
process_response(response)
|
|
55
|
+
changes = process_response(response)
|
|
56
|
+
if pending_initial_reconcile && !response.empty?
|
|
57
|
+
dispatcher.reconcile(changes, repository)
|
|
58
|
+
@pending_initial_reconcile = false
|
|
59
|
+
end
|
|
36
60
|
elsif response.internal_error?
|
|
37
61
|
raise TransportError, response.to_s
|
|
38
62
|
end
|
|
63
|
+
nil
|
|
39
64
|
end
|
|
40
65
|
|
|
41
66
|
private
|
|
42
67
|
|
|
68
|
+
# Applies an OK response to the repository and returns the resulting
|
|
69
|
+
# change set, which is empty when the response is empty.
|
|
70
|
+
#
|
|
71
|
+
# @param response [Transport::Config::Response] the response returned by the agent
|
|
72
|
+
# @return [Configuration::Repository::ChangeSet] the changes applied by this response
|
|
73
|
+
# @raise [SyncError] when the response cannot be applied to the repository
|
|
43
74
|
def process_response(response)
|
|
44
75
|
# when response is completely empty, do nothing as in: leave as is
|
|
45
76
|
if response.empty?
|
|
46
77
|
logger.debug { "remote: empty response => NOOP" }
|
|
47
78
|
|
|
48
|
-
return
|
|
79
|
+
return Configuration::Repository::ChangeSet.new
|
|
49
80
|
end
|
|
50
81
|
|
|
51
82
|
begin
|
|
@@ -61,7 +92,7 @@ module Datadog
|
|
|
61
92
|
end
|
|
62
93
|
|
|
63
94
|
# To make sure steep does not complain
|
|
64
|
-
return unless paths && targets && contents
|
|
95
|
+
return Configuration::Repository::ChangeSet.new unless paths && targets && contents
|
|
65
96
|
|
|
66
97
|
# TODO: sometimes it can strangely be so that paths.empty?
|
|
67
98
|
# TODO: sometimes it can strangely be so that targets.empty?
|
|
@@ -69,6 +100,14 @@ module Datadog
|
|
|
69
100
|
apply_config(paths, targets, contents)
|
|
70
101
|
end
|
|
71
102
|
|
|
103
|
+
# Applies the response to the repository in a transaction, dispatches the
|
|
104
|
+
# resulting changes to the receivers and returns them.
|
|
105
|
+
#
|
|
106
|
+
# @param paths [Array<Configuration::Path>] ingress paths from the response
|
|
107
|
+
# @param targets [Configuration::TargetMap] targets keyed by path
|
|
108
|
+
# @param contents [Configuration::ContentList] contents from the response
|
|
109
|
+
# @return [Configuration::Repository::ChangeSet] the changes applied by the transaction
|
|
110
|
+
# @raise [SyncError] when a path has no matching target or content
|
|
72
111
|
def apply_config(paths, targets, contents)
|
|
73
112
|
changes = repository.transaction do |current, transaction|
|
|
74
113
|
# paths to be removed: previously applied paths minus ingress paths
|
|
@@ -121,6 +160,8 @@ module Datadog
|
|
|
121
160
|
else
|
|
122
161
|
dispatcher.dispatch(changes, repository)
|
|
123
162
|
end
|
|
163
|
+
|
|
164
|
+
changes
|
|
124
165
|
end
|
|
125
166
|
|
|
126
167
|
def payload # standard:disable Metrics/MethodLength
|