ddtrace 1.14.0 → 1.16.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 +146 -2
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +3 -5
- data/ext/ddtrace_profiling_native_extension/clock_id.h +0 -3
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +0 -22
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +0 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +41 -6
- data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +76 -24
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +1 -1
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +207 -32
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +1 -1
- data/ext/ddtrace_profiling_native_extension/extconf.rb +8 -2
- data/ext/ddtrace_profiling_native_extension/http_transport.c +26 -10
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.c +42 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +6 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -16
- data/ext/ddtrace_profiling_native_extension/pid_controller.c +57 -0
- data/ext/ddtrace_profiling_native_extension/pid_controller.h +45 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +17 -12
- data/ext/ddtrace_profiling_native_extension/profiling.c +0 -2
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +74 -37
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +13 -3
- data/lib/datadog/appsec/assets/waf_rules/processors.json +92 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +698 -75
- data/lib/datadog/appsec/assets/waf_rules/scanners.json +114 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +98 -8
- data/lib/datadog/appsec/assets.rb +8 -0
- data/lib/datadog/appsec/component.rb +9 -2
- data/lib/datadog/appsec/configuration/settings.rb +67 -2
- data/lib/datadog/appsec/contrib/rack/gateway/request.rb +6 -2
- data/lib/datadog/appsec/contrib/rack/gateway/response.rb +46 -0
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +8 -6
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +2 -7
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +2 -5
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +7 -5
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +3 -2
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +34 -10
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +3 -2
- data/lib/datadog/appsec/contrib/rails/patcher.rb +9 -3
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +2 -5
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +6 -4
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +13 -7
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +2 -5
- data/lib/datadog/appsec/event.rb +106 -50
- data/lib/datadog/appsec/monitor/gateway/watcher.rb +3 -3
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +2 -5
- data/lib/datadog/appsec/processor/actions.rb +49 -0
- data/lib/datadog/appsec/processor/rule_merger.rb +22 -2
- data/lib/datadog/appsec/processor.rb +34 -6
- data/lib/datadog/appsec/remote.rb +4 -1
- data/lib/datadog/appsec/response.rb +82 -4
- data/lib/datadog/appsec/sample_rate.rb +21 -0
- data/lib/datadog/appsec.rb +2 -2
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +29 -24
- data/lib/datadog/core/configuration/base.rb +1 -11
- data/lib/datadog/core/configuration/components.rb +7 -2
- data/lib/datadog/core/configuration/ext.rb +21 -0
- data/lib/datadog/core/configuration/option.rb +2 -4
- data/lib/datadog/core/configuration/option_definition.rb +17 -41
- data/lib/datadog/core/configuration/options.rb +5 -5
- data/lib/datadog/core/configuration/settings.rb +47 -45
- data/lib/datadog/core/environment/execution.rb +47 -9
- data/lib/datadog/core/environment/variable_helpers.rb +0 -69
- data/lib/datadog/core/error.rb +1 -0
- data/lib/datadog/core/git/ext.rb +2 -0
- data/lib/datadog/core/remote/client/capabilities.rb +1 -1
- data/lib/datadog/core/remote/component.rb +2 -2
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/transport/config.rb +60 -0
- data/lib/datadog/core/remote/transport/http/api/instance.rb +39 -0
- data/lib/datadog/core/remote/transport/http/api/spec.rb +21 -0
- data/lib/datadog/core/remote/transport/http/api.rb +58 -0
- data/lib/datadog/core/remote/transport/http/builder.rb +219 -0
- data/lib/datadog/core/remote/transport/http/client.rb +48 -0
- data/lib/datadog/core/remote/transport/http/config.rb +280 -0
- data/lib/datadog/core/remote/transport/http/negotiation.rb +146 -0
- data/lib/datadog/core/remote/transport/http.rb +179 -0
- data/lib/datadog/core/{transport → remote/transport}/negotiation.rb +25 -23
- data/lib/datadog/core/remote/worker.rb +3 -1
- data/lib/datadog/core/telemetry/collector.rb +3 -2
- data/lib/datadog/core/telemetry/http/transport.rb +2 -1
- data/lib/datadog/core/transport/ext.rb +47 -0
- data/lib/datadog/core/transport/http/adapters/net.rb +168 -0
- data/lib/datadog/core/transport/http/adapters/registry.rb +29 -0
- data/lib/datadog/core/transport/http/adapters/test.rb +89 -0
- data/lib/datadog/core/transport/http/adapters/unix_socket.rb +83 -0
- data/lib/datadog/core/transport/http/api/endpoint.rb +31 -0
- data/lib/datadog/core/transport/http/api/fallbacks.rb +26 -0
- data/lib/datadog/core/transport/http/api/map.rb +18 -0
- data/lib/datadog/core/transport/http/env.rb +62 -0
- data/lib/datadog/core/transport/http/response.rb +60 -0
- data/lib/datadog/core/transport/parcel.rb +22 -0
- data/lib/datadog/core/transport/request.rb +17 -0
- data/lib/datadog/core/transport/response.rb +64 -0
- data/lib/datadog/core/workers/polling.rb +2 -2
- data/lib/datadog/opentelemetry/api/context.rb +10 -3
- data/lib/datadog/opentelemetry/sdk/propagator.rb +2 -1
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +14 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +68 -0
- data/lib/datadog/opentelemetry/trace.rb +58 -0
- data/lib/datadog/opentelemetry.rb +1 -0
- data/lib/datadog/opentracer.rb +9 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +14 -19
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -1
- data/lib/datadog/profiling/collectors/thread_context.rb +9 -1
- data/lib/datadog/profiling/component.rb +24 -99
- data/lib/datadog/profiling/ext.rb +0 -12
- data/lib/datadog/profiling/flush.rb +0 -3
- data/lib/datadog/profiling/http_transport.rb +6 -3
- data/lib/datadog/profiling/native_extension.rb +0 -21
- data/lib/datadog/profiling/profiler.rb +36 -13
- data/lib/datadog/profiling/scheduler.rb +16 -9
- data/lib/datadog/profiling.rb +8 -81
- data/lib/datadog/tracing/component.rb +10 -4
- data/lib/datadog/tracing/configuration/agent_settings_resolver.rb +13 -0
- data/lib/datadog/tracing/configuration/ext.rb +4 -2
- data/lib/datadog/tracing/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +4 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +106 -197
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +3 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +7 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +14 -14
- data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +3 -10
- data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +2 -1
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +8 -1
- data/lib/datadog/tracing/contrib/concurrent_ruby/promises_future_patch.rb +22 -0
- data/lib/datadog/tracing/contrib/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +6 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +7 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +9 -2
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +5 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +8 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/ext.rb +3 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +21 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +11 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +18 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +0 -4
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +3 -3
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +7 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +13 -3
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +2 -2
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +7 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +1 -1
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/event.rb +5 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +14 -4
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +4 -4
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +3 -38
- data/lib/datadog/tracing/contrib/redis/tags.rb +7 -2
- data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +46 -33
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/sequel/utils.rb +5 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +2 -2
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +6 -0
- data/lib/datadog/tracing/distributed/propagation.rb +13 -33
- data/lib/datadog/tracing/metadata/tagging.rb +3 -3
- data/lib/datadog/tracing/sync_writer.rb +3 -3
- data/lib/datadog/tracing/tracer.rb +2 -0
- data/lib/datadog/{core → tracing}/transport/http/api/instance.rb +1 -1
- data/lib/datadog/{core → tracing}/transport/http/api/spec.rb +1 -1
- data/lib/datadog/tracing/transport/http/api.rb +43 -0
- data/lib/datadog/{core → tracing}/transport/http/builder.rb +13 -68
- data/lib/datadog/tracing/transport/http/client.rb +57 -0
- data/lib/datadog/tracing/transport/http/statistics.rb +47 -0
- data/lib/datadog/tracing/transport/http/traces.rb +152 -0
- data/lib/datadog/tracing/transport/http.rb +124 -0
- data/lib/datadog/tracing/transport/io/client.rb +89 -0
- data/lib/datadog/tracing/transport/io/response.rb +27 -0
- data/lib/datadog/tracing/transport/io/traces.rb +101 -0
- data/lib/datadog/tracing/transport/io.rb +30 -0
- data/lib/datadog/tracing/transport/serializable_trace.rb +126 -0
- data/lib/datadog/tracing/transport/statistics.rb +77 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +209 -0
- data/lib/datadog/tracing/transport/traces.rb +224 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +5 -3
- data/lib/datadog/tracing/workers.rb +3 -2
- data/lib/datadog/tracing/writer.rb +5 -2
- data/lib/ddtrace/transport/ext.rb +17 -15
- data/lib/ddtrace/version.rb +1 -1
- data/lib/ddtrace.rb +1 -1
- metadata +73 -96
- data/lib/datadog/ci/configuration/components.rb +0 -32
- data/lib/datadog/ci/configuration/settings.rb +0 -51
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/cucumber/ext.rb +0 -22
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +0 -94
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +0 -28
- data/lib/datadog/ci/contrib/cucumber/integration.rb +0 -47
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/minitest/ext.rb +0 -21
- data/lib/datadog/ci/contrib/minitest/integration.rb +0 -49
- data/lib/datadog/ci/contrib/minitest/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/test_helper.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/rspec/example.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/ext.rb +0 -21
- data/lib/datadog/ci/contrib/rspec/integration.rb +0 -48
- data/lib/datadog/ci/contrib/rspec/patcher.rb +0 -27
- data/lib/datadog/ci/ext/app_types.rb +0 -9
- data/lib/datadog/ci/ext/environment.rb +0 -575
- data/lib/datadog/ci/ext/settings.rb +0 -10
- data/lib/datadog/ci/ext/test.rb +0 -35
- data/lib/datadog/ci/extensions.rb +0 -19
- data/lib/datadog/ci/flush.rb +0 -38
- data/lib/datadog/ci/test.rb +0 -81
- data/lib/datadog/ci.rb +0 -21
- data/lib/datadog/core/configuration/dependency_resolver.rb +0 -28
- data/lib/datadog/core/configuration/option_definition_set.rb +0 -22
- data/lib/datadog/core/configuration/option_set.rb +0 -10
- data/lib/datadog/core/transport/config.rb +0 -58
- data/lib/datadog/core/transport/http/api.rb +0 -57
- data/lib/datadog/core/transport/http/client.rb +0 -45
- data/lib/datadog/core/transport/http/config.rb +0 -278
- data/lib/datadog/core/transport/http/negotiation.rb +0 -144
- data/lib/datadog/core/transport/http.rb +0 -169
- data/lib/datadog/core/utils/object_set.rb +0 -43
- data/lib/datadog/core/utils/string_table.rb +0 -47
- data/lib/datadog/profiling/backtrace_location.rb +0 -34
- data/lib/datadog/profiling/buffer.rb +0 -43
- data/lib/datadog/profiling/collectors/old_stack.rb +0 -301
- data/lib/datadog/profiling/encoding/profile.rb +0 -41
- data/lib/datadog/profiling/event.rb +0 -15
- data/lib/datadog/profiling/events/stack.rb +0 -82
- data/lib/datadog/profiling/old_recorder.rb +0 -107
- data/lib/datadog/profiling/pprof/builder.rb +0 -125
- data/lib/datadog/profiling/pprof/converter.rb +0 -102
- data/lib/datadog/profiling/pprof/message_set.rb +0 -16
- data/lib/datadog/profiling/pprof/payload.rb +0 -20
- data/lib/datadog/profiling/pprof/pprof.proto +0 -212
- data/lib/datadog/profiling/pprof/pprof_pb.rb +0 -81
- data/lib/datadog/profiling/pprof/stack_sample.rb +0 -139
- data/lib/datadog/profiling/pprof/string_table.rb +0 -12
- data/lib/datadog/profiling/pprof/template.rb +0 -118
- data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +0 -43
- data/lib/datadog/profiling/trace_identifiers/helper.rb +0 -45
- data/lib/ddtrace/transport/http/adapters/net.rb +0 -168
- data/lib/ddtrace/transport/http/adapters/registry.rb +0 -27
- data/lib/ddtrace/transport/http/adapters/test.rb +0 -85
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +0 -77
- data/lib/ddtrace/transport/http/api/endpoint.rb +0 -29
- data/lib/ddtrace/transport/http/api/fallbacks.rb +0 -24
- data/lib/ddtrace/transport/http/api/instance.rb +0 -35
- data/lib/ddtrace/transport/http/api/map.rb +0 -16
- data/lib/ddtrace/transport/http/api/spec.rb +0 -17
- data/lib/ddtrace/transport/http/api.rb +0 -39
- data/lib/ddtrace/transport/http/builder.rb +0 -176
- data/lib/ddtrace/transport/http/client.rb +0 -52
- data/lib/ddtrace/transport/http/env.rb +0 -58
- data/lib/ddtrace/transport/http/response.rb +0 -58
- data/lib/ddtrace/transport/http/statistics.rb +0 -43
- data/lib/ddtrace/transport/http/traces.rb +0 -144
- data/lib/ddtrace/transport/http.rb +0 -117
- data/lib/ddtrace/transport/io/client.rb +0 -85
- data/lib/ddtrace/transport/io/response.rb +0 -25
- data/lib/ddtrace/transport/io/traces.rb +0 -99
- data/lib/ddtrace/transport/io.rb +0 -28
- data/lib/ddtrace/transport/parcel.rb +0 -20
- data/lib/ddtrace/transport/request.rb +0 -15
- data/lib/ddtrace/transport/response.rb +0 -60
- data/lib/ddtrace/transport/serializable_trace.rb +0 -122
- data/lib/ddtrace/transport/statistics.rb +0 -75
- data/lib/ddtrace/transport/trace_formatter.rb +0 -207
- data/lib/ddtrace/transport/traces.rb +0 -216
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'uri'
|
|
2
2
|
|
|
3
3
|
require_relative 'settings'
|
|
4
|
-
require_relative '
|
|
5
|
-
require_relative '
|
|
4
|
+
require_relative 'ext'
|
|
5
|
+
require_relative '../transport/ext'
|
|
6
6
|
|
|
7
7
|
module Datadog
|
|
8
8
|
module Core
|
|
@@ -16,6 +16,7 @@ module Datadog
|
|
|
16
16
|
#
|
|
17
17
|
# Whenever there is a conflict (different configurations are provided in different orders), it MUST warn the users
|
|
18
18
|
# about it and pick a value based on the following priority: code > environment variable > defaults.
|
|
19
|
+
# DEV-2.0: The deprecated_for_removal_transport_configuration_proc should be removed.
|
|
19
20
|
class AgentSettingsResolver
|
|
20
21
|
AgentSettings = \
|
|
21
22
|
Struct.new(
|
|
@@ -66,9 +67,9 @@ module Datadog
|
|
|
66
67
|
|
|
67
68
|
def call
|
|
68
69
|
# A transport_options proc configured for unix domain socket overrides most of the logic on this file
|
|
69
|
-
if transport_options.adapter == Datadog::Transport::Ext::UnixSocket::ADAPTER
|
|
70
|
+
if transport_options.adapter == Datadog::Core::Transport::Ext::UnixSocket::ADAPTER
|
|
70
71
|
return AgentSettings.new(
|
|
71
|
-
adapter: Datadog::Transport::Ext::UnixSocket::ADAPTER,
|
|
72
|
+
adapter: Datadog::Core::Transport::Ext::UnixSocket::ADAPTER,
|
|
72
73
|
ssl: false,
|
|
73
74
|
hostname: nil,
|
|
74
75
|
port: nil,
|
|
@@ -96,9 +97,9 @@ module Datadog
|
|
|
96
97
|
|
|
97
98
|
def adapter
|
|
98
99
|
if should_use_uds?
|
|
99
|
-
Datadog::Transport::Ext::UnixSocket::ADAPTER
|
|
100
|
+
Datadog::Core::Transport::Ext::UnixSocket::ADAPTER
|
|
100
101
|
else
|
|
101
|
-
Datadog::Transport::Ext::HTTP::ADAPTER
|
|
102
|
+
Datadog::Core::Transport::Ext::HTTP::ADAPTER
|
|
102
103
|
end
|
|
103
104
|
end
|
|
104
105
|
|
|
@@ -115,7 +116,7 @@ module Datadog
|
|
|
115
116
|
value: settings.agent.host
|
|
116
117
|
),
|
|
117
118
|
DetectedConfiguration.new(
|
|
118
|
-
friendly_name: "#{Datadog::
|
|
119
|
+
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} environment variable",
|
|
119
120
|
value: parsed_http_url && parsed_http_url.hostname
|
|
120
121
|
),
|
|
121
122
|
DetectedConfiguration.new(
|
|
@@ -138,12 +139,12 @@ module Datadog
|
|
|
138
139
|
value: settings.agent.port,
|
|
139
140
|
),
|
|
140
141
|
DetectedConfiguration.new(
|
|
141
|
-
friendly_name: "#{Datadog::
|
|
142
|
+
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} environment variable",
|
|
142
143
|
value: parsed_http_url && parsed_http_url.port,
|
|
143
144
|
),
|
|
144
145
|
try_parsing_as_integer(
|
|
145
|
-
friendly_name: "#{Datadog::
|
|
146
|
-
value: ENV[Datadog::
|
|
146
|
+
friendly_name: "#{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_PORT} environment variable",
|
|
147
|
+
value: ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_PORT],
|
|
147
148
|
)
|
|
148
149
|
)
|
|
149
150
|
end
|
|
@@ -167,11 +168,11 @@ module Datadog
|
|
|
167
168
|
end
|
|
168
169
|
|
|
169
170
|
def hostname
|
|
170
|
-
configured_hostname || (should_use_uds? ? nil : Datadog::
|
|
171
|
+
configured_hostname || (should_use_uds? ? nil : Datadog::Core::Configuration::Ext::Agent::HTTP::DEFAULT_HOST)
|
|
171
172
|
end
|
|
172
173
|
|
|
173
174
|
def port
|
|
174
|
-
configured_port || (should_use_uds? ? nil : Datadog::
|
|
175
|
+
configured_port || (should_use_uds? ? nil : Datadog::Core::Configuration::Ext::Agent::HTTP::DEFAULT_PORT)
|
|
175
176
|
end
|
|
176
177
|
|
|
177
178
|
# Unix socket path in the file system
|
|
@@ -201,8 +202,12 @@ module Datadog
|
|
|
201
202
|
# In transport_options, we try to invoke the transport_options proc and get its configuration. In case that
|
|
202
203
|
# doesn't work, we include the proc directly in the agent settings result.
|
|
203
204
|
def deprecated_for_removal_transport_configuration_proc
|
|
204
|
-
if
|
|
205
|
-
|
|
205
|
+
transport_options_settings if transport_options_settings.is_a?(Proc) && transport_options.adapter.nil?
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def transport_options_settings
|
|
209
|
+
@transport_options_settings ||= begin
|
|
210
|
+
settings.tracing.transport_options if settings.respond_to?(:tracing) && settings.tracing
|
|
206
211
|
end
|
|
207
212
|
end
|
|
208
213
|
|
|
@@ -215,9 +220,9 @@ module Datadog
|
|
|
215
220
|
if configured_hostname.nil? &&
|
|
216
221
|
configured_port.nil? &&
|
|
217
222
|
deprecated_for_removal_transport_configuration_proc.nil? &&
|
|
218
|
-
File.exist?(Datadog::
|
|
223
|
+
File.exist?(Datadog::Core::Configuration::Ext::Agent::UnixSocket::DEFAULT_PATH)
|
|
219
224
|
|
|
220
|
-
Datadog::
|
|
225
|
+
Datadog::Core::Configuration::Ext::Agent::UnixSocket::DEFAULT_PATH
|
|
221
226
|
end
|
|
222
227
|
end
|
|
223
228
|
|
|
@@ -235,7 +240,7 @@ module Datadog
|
|
|
235
240
|
def parsed_url
|
|
236
241
|
return @parsed_url if defined?(@parsed_url)
|
|
237
242
|
|
|
238
|
-
unparsed_url_from_env = ENV[Datadog::
|
|
243
|
+
unparsed_url_from_env = ENV[Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL]
|
|
239
244
|
|
|
240
245
|
@parsed_url =
|
|
241
246
|
if unparsed_url_from_env
|
|
@@ -246,9 +251,9 @@ module Datadog
|
|
|
246
251
|
else
|
|
247
252
|
# rubocop:disable Layout/LineLength
|
|
248
253
|
log_warning(
|
|
249
|
-
"Invalid URI scheme '#{parsed.scheme}' for #{Datadog::
|
|
254
|
+
"Invalid URI scheme '#{parsed.scheme}' for #{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL} " \
|
|
250
255
|
"environment variable ('#{unparsed_url_from_env}'). " \
|
|
251
|
-
"Ignoring the contents of #{Datadog::
|
|
256
|
+
"Ignoring the contents of #{Datadog::Core::Configuration::Ext::Agent::ENV_DEFAULT_URL}."
|
|
252
257
|
)
|
|
253
258
|
# rubocop:enable Layout/LineLength
|
|
254
259
|
|
|
@@ -328,7 +333,7 @@ module Datadog
|
|
|
328
333
|
def transport_options
|
|
329
334
|
return @transport_options if defined?(@transport_options)
|
|
330
335
|
|
|
331
|
-
transport_options_proc =
|
|
336
|
+
transport_options_proc = transport_options_settings
|
|
332
337
|
|
|
333
338
|
@transport_options = TransportOptions.new
|
|
334
339
|
|
|
@@ -380,14 +385,14 @@ module Datadog
|
|
|
380
385
|
|
|
381
386
|
def adapter(kind_or_custom_adapter, *args, **kwargs)
|
|
382
387
|
case kind_or_custom_adapter
|
|
383
|
-
when Datadog::
|
|
384
|
-
@transport_options.adapter = Datadog::
|
|
388
|
+
when Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
|
|
389
|
+
@transport_options.adapter = Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
|
|
385
390
|
@transport_options.hostname = args[0] || kwargs[:hostname]
|
|
386
391
|
@transport_options.port = args[1] || kwargs[:port]
|
|
387
392
|
@transport_options.timeout_seconds = kwargs[:timeout]
|
|
388
393
|
@transport_options.ssl = kwargs[:ssl]
|
|
389
|
-
when Datadog::
|
|
390
|
-
@transport_options.adapter = Datadog::
|
|
394
|
+
when Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
|
|
395
|
+
@transport_options.adapter = Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
|
|
391
396
|
@transport_options.uds_path = args[0] || kwargs[:uds_path]
|
|
392
397
|
end
|
|
393
398
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require_relative '../environment/variable_helpers'
|
|
2
1
|
require_relative 'options'
|
|
3
2
|
|
|
4
3
|
module Datadog
|
|
@@ -8,8 +7,6 @@ module Datadog
|
|
|
8
7
|
# @public_api
|
|
9
8
|
module Base
|
|
10
9
|
def self.included(base)
|
|
11
|
-
base.extend(Core::Environment::VariableHelpers)
|
|
12
|
-
base.include(Core::Environment::VariableHelpers)
|
|
13
10
|
base.include(Options)
|
|
14
11
|
|
|
15
12
|
base.extend(ClassMethods)
|
|
@@ -57,14 +54,7 @@ module Datadog
|
|
|
57
54
|
end
|
|
58
55
|
|
|
59
56
|
def configure(opts = {})
|
|
60
|
-
|
|
61
|
-
ordering = self.class.options.dependency_order
|
|
62
|
-
sorted_opts = opts.sort_by do |name, _value|
|
|
63
|
-
ordering.index(name) || (ordering.length + 1)
|
|
64
|
-
end.to_h
|
|
65
|
-
|
|
66
|
-
# Apply options in sort order
|
|
67
|
-
sorted_opts.each do |name, value|
|
|
57
|
+
opts.each do |name, value|
|
|
68
58
|
if respond_to?("#{name}=")
|
|
69
59
|
send("#{name}=", value)
|
|
70
60
|
elsif option_defined?(name)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require_relative 'agent_settings_resolver'
|
|
2
|
+
require_relative 'ext'
|
|
2
3
|
require_relative '../diagnostics/environment_logger'
|
|
3
4
|
require_relative '../diagnostics/health'
|
|
4
5
|
require_relative '../logger'
|
|
@@ -54,7 +55,7 @@ module Datadog
|
|
|
54
55
|
|
|
55
56
|
def build_telemetry(settings, agent_settings, logger)
|
|
56
57
|
enabled = settings.telemetry.enabled
|
|
57
|
-
if agent_settings.adapter != Datadog::
|
|
58
|
+
if agent_settings.adapter != Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
|
|
58
59
|
enabled = false
|
|
59
60
|
logger.debug { "Telemetry disabled. Agent network adapter not supported: #{agent_settings.adapter}" }
|
|
60
61
|
end
|
|
@@ -81,10 +82,14 @@ module Datadog
|
|
|
81
82
|
def initialize(settings)
|
|
82
83
|
@logger = self.class.build_logger(settings)
|
|
83
84
|
|
|
85
|
+
# This agent_settings is intended for use within Core. If you require
|
|
86
|
+
# agent_settings within a product outside of core you should extend
|
|
87
|
+
# the Core resolver from within your product/component's namespace.
|
|
84
88
|
agent_settings = AgentSettingsResolver.call(settings, logger: @logger)
|
|
85
89
|
|
|
86
90
|
@remote = Remote::Component.build(settings, agent_settings)
|
|
87
|
-
@tracer = self.class.build_tracer(settings,
|
|
91
|
+
@tracer = self.class.build_tracer(settings, logger: @logger)
|
|
92
|
+
|
|
88
93
|
@profiler = Datadog::Profiling::Component.build_profiler_component(
|
|
89
94
|
settings: settings,
|
|
90
95
|
agent_settings: agent_settings,
|
|
@@ -17,9 +17,30 @@ module Datadog
|
|
|
17
17
|
ENV_DEFAULT_PORT = 'DD_METRIC_AGENT_PORT'
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# DEV-2.0: This module only exists for backwards compatibility with the public API.
|
|
21
|
+
# It should be consolidated into the Agent module below.
|
|
20
22
|
module Transport
|
|
21
23
|
ENV_DEFAULT_HOST = 'DD_AGENT_HOST'
|
|
22
24
|
end
|
|
25
|
+
|
|
26
|
+
module Agent
|
|
27
|
+
# env var has "trace" in it, but it really applies to all products
|
|
28
|
+
ENV_DEFAULT_PORT = 'DD_TRACE_AGENT_PORT'
|
|
29
|
+
ENV_DEFAULT_URL = 'DD_TRACE_AGENT_URL'
|
|
30
|
+
|
|
31
|
+
module HTTP
|
|
32
|
+
ADAPTER = :net_http # DEV: Rename to simply `:http`, as Net::HTTP is an implementation detail.
|
|
33
|
+
DEFAULT_HOST = '127.0.0.1'
|
|
34
|
+
DEFAULT_PORT = 8126
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @public_api
|
|
38
|
+
module UnixSocket
|
|
39
|
+
ADAPTER = :unix
|
|
40
|
+
DEFAULT_PATH = '/var/run/datadog/apm.socket'
|
|
41
|
+
DEFAULT_TIMEOUT_SECONDS = 1
|
|
42
|
+
end
|
|
43
|
+
end
|
|
23
44
|
end
|
|
24
45
|
end
|
|
25
46
|
end
|
|
@@ -113,8 +113,6 @@ module Datadog
|
|
|
113
113
|
def get
|
|
114
114
|
if @is_set
|
|
115
115
|
@value
|
|
116
|
-
elsif definition.delegate_to
|
|
117
|
-
context_eval(&definition.delegate_to)
|
|
118
116
|
else
|
|
119
117
|
set_value_from_env_or_default
|
|
120
118
|
end
|
|
@@ -141,7 +139,7 @@ module Datadog
|
|
|
141
139
|
if definition.default.instance_of?(Proc)
|
|
142
140
|
context_eval(&definition.default)
|
|
143
141
|
else
|
|
144
|
-
definition.
|
|
142
|
+
definition.default_proc || Core::Utils::SafeDup.frozen_or_dup(definition.default)
|
|
145
143
|
end
|
|
146
144
|
end
|
|
147
145
|
|
|
@@ -266,7 +264,7 @@ module Datadog
|
|
|
266
264
|
# when restoring a value from `@value_per_precedence`, and we are only running `definition.setter`
|
|
267
265
|
# on the original value, not on a valud that has already been processed by `definition.setter`.
|
|
268
266
|
@value_per_precedence[precedence] = value
|
|
269
|
-
context_exec(v, old_value, &definition.
|
|
267
|
+
context_exec(v, old_value, &definition.after_set) if definition.after_set
|
|
270
268
|
end
|
|
271
269
|
end
|
|
272
270
|
|
|
@@ -11,18 +11,12 @@ module Datadog
|
|
|
11
11
|
|
|
12
12
|
attr_reader \
|
|
13
13
|
:default,
|
|
14
|
-
|
|
15
|
-
# Since this new option is experimental and we might not need it in the near future, I gave it a name that is
|
|
16
|
-
# clear to the reader that they should not rely on it and that is subject to change.
|
|
17
|
-
# Currently is only use internally.
|
|
18
|
-
:experimental_default_proc,
|
|
14
|
+
:default_proc,
|
|
19
15
|
:env,
|
|
20
16
|
:deprecated_env,
|
|
21
17
|
:env_parser,
|
|
22
|
-
:delegate_to,
|
|
23
|
-
:depends_on,
|
|
24
18
|
:name,
|
|
25
|
-
:
|
|
19
|
+
:after_set,
|
|
26
20
|
:resetter,
|
|
27
21
|
:setter,
|
|
28
22
|
:type,
|
|
@@ -30,14 +24,12 @@ module Datadog
|
|
|
30
24
|
|
|
31
25
|
def initialize(name, meta = {}, &block)
|
|
32
26
|
@default = meta[:default]
|
|
33
|
-
@
|
|
27
|
+
@default_proc = meta[:default_proc]
|
|
34
28
|
@env = meta[:env]
|
|
35
29
|
@deprecated_env = meta[:deprecated_env]
|
|
36
30
|
@env_parser = meta[:env_parser]
|
|
37
|
-
@delegate_to = meta[:delegate_to]
|
|
38
|
-
@depends_on = meta[:depends_on] || []
|
|
39
31
|
@name = name.to_sym
|
|
40
|
-
@
|
|
32
|
+
@after_set = meta[:after_set]
|
|
41
33
|
@resetter = meta[:resetter]
|
|
42
34
|
@setter = meta[:setter] || block || IDENTITY
|
|
43
35
|
@type = meta[:type]
|
|
@@ -62,12 +54,10 @@ module Datadog
|
|
|
62
54
|
@deprecated_env = nil
|
|
63
55
|
@env_parser = nil
|
|
64
56
|
@default = nil
|
|
65
|
-
@
|
|
66
|
-
@delegate_to = nil
|
|
67
|
-
@depends_on = []
|
|
57
|
+
@default_proc = nil
|
|
68
58
|
@helpers = {}
|
|
69
59
|
@name = name.to_sym
|
|
70
|
-
@
|
|
60
|
+
@after_set = nil
|
|
71
61
|
@resetter = nil
|
|
72
62
|
@setter = OptionDefinition::IDENTITY
|
|
73
63
|
@type = nil
|
|
@@ -81,10 +71,6 @@ module Datadog
|
|
|
81
71
|
validate_options!
|
|
82
72
|
end
|
|
83
73
|
|
|
84
|
-
def depends_on(*values)
|
|
85
|
-
@depends_on = values.flatten
|
|
86
|
-
end
|
|
87
|
-
|
|
88
74
|
def env(value)
|
|
89
75
|
@env = value
|
|
90
76
|
end
|
|
@@ -101,12 +87,8 @@ module Datadog
|
|
|
101
87
|
@default = block || value
|
|
102
88
|
end
|
|
103
89
|
|
|
104
|
-
def
|
|
105
|
-
@
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def delegate_to(&block)
|
|
109
|
-
@delegate_to = block
|
|
90
|
+
def default_proc(&block)
|
|
91
|
+
@default_proc = block
|
|
110
92
|
end
|
|
111
93
|
|
|
112
94
|
def helper(name, *_args, &block)
|
|
@@ -123,8 +105,8 @@ module Datadog
|
|
|
123
105
|
end
|
|
124
106
|
end
|
|
125
107
|
|
|
126
|
-
def
|
|
127
|
-
@
|
|
108
|
+
def after_set(&block)
|
|
109
|
+
@after_set = block
|
|
128
110
|
end
|
|
129
111
|
|
|
130
112
|
def resetter(&block)
|
|
@@ -143,24 +125,20 @@ module Datadog
|
|
|
143
125
|
end
|
|
144
126
|
|
|
145
127
|
# For applying options for OptionDefinition
|
|
146
|
-
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
147
128
|
def apply_options!(options = {})
|
|
148
129
|
return if options.nil? || options.empty?
|
|
149
130
|
|
|
150
131
|
default(options[:default]) if options.key?(:default)
|
|
151
|
-
|
|
132
|
+
default_proc(&options[:default_proc]) if options.key?(:default_proc)
|
|
152
133
|
env(options[:env]) if options.key?(:env)
|
|
153
134
|
deprecated_env(options[:deprecated_env]) if options.key?(:deprecated_env)
|
|
154
135
|
env_parser(&options[:env_parser]) if options.key?(:env_parser)
|
|
155
|
-
delegate_to(&options[:delegate_to]) if options.key?(:delegate_to)
|
|
156
|
-
depends_on(*options[:depends_on]) if options.key?(:depends_on)
|
|
157
136
|
lazy(options[:lazy]) if options.key?(:lazy)
|
|
158
|
-
|
|
137
|
+
after_set(&options[:after_set]) if options.key?(:after_set)
|
|
159
138
|
resetter(&options[:resetter]) if options.key?(:resetter)
|
|
160
139
|
setter(&options[:setter]) if options.key?(:setter)
|
|
161
140
|
type(options[:type], **(options[:type_options] || {})) if options.key?(:type)
|
|
162
141
|
end
|
|
163
|
-
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
164
142
|
|
|
165
143
|
def to_definition
|
|
166
144
|
OptionDefinition.new(@name, meta)
|
|
@@ -169,13 +147,11 @@ module Datadog
|
|
|
169
147
|
def meta
|
|
170
148
|
{
|
|
171
149
|
default: @default,
|
|
172
|
-
|
|
150
|
+
default_proc: @default_proc,
|
|
173
151
|
env: @env,
|
|
174
152
|
deprecated_env: @deprecated_env,
|
|
175
153
|
env_parser: @env_parser,
|
|
176
|
-
|
|
177
|
-
depends_on: @depends_on,
|
|
178
|
-
on_set: @on_set,
|
|
154
|
+
after_set: @after_set,
|
|
179
155
|
resetter: @resetter,
|
|
180
156
|
setter: @setter,
|
|
181
157
|
type: @type,
|
|
@@ -186,10 +162,10 @@ module Datadog
|
|
|
186
162
|
private
|
|
187
163
|
|
|
188
164
|
def validate_options!
|
|
189
|
-
if !@default.nil? && @
|
|
165
|
+
if !@default.nil? && @default_proc
|
|
190
166
|
raise InvalidOptionError,
|
|
191
|
-
'Using `default` and `
|
|
192
|
-
'If you want to store a block as the default value use `
|
|
167
|
+
'Using `default` and `default_proc` is not allowed. Please use one or the other.' \
|
|
168
|
+
'If you want to store a block as the default value use `default_proc`'\
|
|
193
169
|
' otherwise use `default`'
|
|
194
170
|
end
|
|
195
171
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
require_relative 'option_definition'
|
|
3
|
-
require_relative 'option_definition_set'
|
|
4
4
|
|
|
5
5
|
module Datadog
|
|
6
6
|
module Core
|
|
@@ -18,7 +18,7 @@ module Datadog
|
|
|
18
18
|
module ClassMethods
|
|
19
19
|
def options
|
|
20
20
|
# Allows for class inheritance of option definitions
|
|
21
|
-
@options ||= superclass <= Options ? superclass.options.dup :
|
|
21
|
+
@options ||= superclass <= Options ? superclass.options.dup : {}
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
protected
|
|
@@ -64,7 +64,7 @@ module Datadog
|
|
|
64
64
|
# @public_api
|
|
65
65
|
module InstanceMethods
|
|
66
66
|
def options
|
|
67
|
-
@options ||=
|
|
67
|
+
@options ||= {}
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def set_option(name, value, precedence: Configuration::Option::Precedence::PROGRAMMATIC)
|
|
@@ -101,7 +101,7 @@ module Datadog
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def reset_options!
|
|
104
|
-
options.
|
|
104
|
+
options.each_value(&:reset)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
private
|
|
@@ -103,13 +103,12 @@ module Datadog
|
|
|
103
103
|
o.env Datadog::Core::Configuration::Ext::Diagnostics::ENV_DEBUG_ENABLED
|
|
104
104
|
o.default false
|
|
105
105
|
o.type :bool
|
|
106
|
-
o.
|
|
106
|
+
o.after_set do |enabled|
|
|
107
107
|
# Enable rich debug print statements.
|
|
108
108
|
# We do not need to unnecessarily load 'pp' unless in debugging mode.
|
|
109
109
|
require 'pp' if enabled
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
|
-
|
|
113
112
|
# Internal {Datadog::Statsd} metrics collection.
|
|
114
113
|
#
|
|
115
114
|
# @public_api
|
|
@@ -177,7 +176,7 @@ module Datadog
|
|
|
177
176
|
#
|
|
178
177
|
# @return Logger::Severity
|
|
179
178
|
option :instance do |o|
|
|
180
|
-
o.
|
|
179
|
+
o.after_set { |value| set_option(:level, value.level) unless value.nil? }
|
|
181
180
|
end
|
|
182
181
|
|
|
183
182
|
# Log level for `Datadog.logger`.
|
|
@@ -208,21 +207,16 @@ module Datadog
|
|
|
208
207
|
|
|
209
208
|
# @public_api
|
|
210
209
|
settings :advanced do
|
|
211
|
-
# @deprecated
|
|
210
|
+
# @deprecated No longer does anything, and will be removed on dd-trace-rb 2.0.
|
|
212
211
|
#
|
|
213
|
-
# This
|
|
214
|
-
#
|
|
215
|
-
# per second for a 60 second period.
|
|
212
|
+
# This was used prior to the GA of the new CPU Profiling 2.0 profiler. The CPU Profiling 2.0 profiler does not
|
|
213
|
+
# use or need this setting and thus it doesn't do anything.
|
|
216
214
|
option :max_events do |o|
|
|
217
|
-
o.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
Datadog.
|
|
221
|
-
|
|
222
|
-
'anything unless you the `force_enable_legacy_profiler` option is in use. ' \
|
|
223
|
-
'Please remove it from your Datadog.configure block.'
|
|
224
|
-
)
|
|
225
|
-
end
|
|
215
|
+
o.after_set do
|
|
216
|
+
Datadog.logger.warn(
|
|
217
|
+
'The profiling.advanced.max_events setting has been deprecated for removal and no ' \
|
|
218
|
+
'longer does anything. Please remove it from your Datadog.configure block.'
|
|
219
|
+
)
|
|
226
220
|
end
|
|
227
221
|
end
|
|
228
222
|
|
|
@@ -261,7 +255,7 @@ module Datadog
|
|
|
261
255
|
# This was added as a temporary support option in case of issues with the new `Profiling::HttpTransport` class
|
|
262
256
|
# but we're now confident it's working nicely so we've removed the old code path.
|
|
263
257
|
option :legacy_transport_enabled do |o|
|
|
264
|
-
o.
|
|
258
|
+
o.after_set do
|
|
265
259
|
Datadog.logger.warn(
|
|
266
260
|
'The profiling.advanced.legacy_transport_enabled setting has been deprecated for removal and no ' \
|
|
267
261
|
'longer does anything. Please remove it from your Datadog.configure block.'
|
|
@@ -274,7 +268,7 @@ module Datadog
|
|
|
274
268
|
# This was used prior to the GA of the new CPU Profiling 2.0 profiler. Using CPU Profiling 2.0 is now the
|
|
275
269
|
# default and this doesn't do anything.
|
|
276
270
|
option :force_enable_new_profiler do |o|
|
|
277
|
-
o.
|
|
271
|
+
o.after_set do
|
|
278
272
|
Datadog.logger.warn(
|
|
279
273
|
'The profiling.advanced.force_enable_new_profiler setting has been deprecated for removal and no ' \
|
|
280
274
|
'longer does anything. Please remove it from your Datadog.configure block.'
|
|
@@ -282,26 +276,16 @@ module Datadog
|
|
|
282
276
|
end
|
|
283
277
|
end
|
|
284
278
|
|
|
285
|
-
# @deprecated
|
|
286
|
-
#
|
|
287
|
-
# Forces enabling the *legacy* non-CPU Profiling 2.0 profiler.
|
|
288
|
-
# Do not use unless instructed to by support.
|
|
279
|
+
# @deprecated No longer does anything, and will be removed on dd-trace-rb 2.0.
|
|
289
280
|
#
|
|
290
|
-
#
|
|
281
|
+
# This was used prior to the GA of the new CPU Profiling 2.0 profiler. Using CPU Profiling 2.0 is now the
|
|
282
|
+
# default and this doesn't do anything.
|
|
291
283
|
option :force_enable_legacy_profiler do |o|
|
|
292
|
-
o.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
Datadog.logger.warn(
|
|
298
|
-
'The profiling.advanced.force_enable_legacy_profiler setting has been deprecated for removal. ' \
|
|
299
|
-
'Do not use unless instructed to by support. ' \
|
|
300
|
-
'If you needed to use it due to incompatibilities with the CPU Profiling 2.0 profiler, consider ' \
|
|
301
|
-
'using the profiling.advanced.no_signals_workaround_enabled setting instead. ' \
|
|
302
|
-
'See <https://dtdg.co/ruby-profiler-troubleshooting> for details.'
|
|
303
|
-
)
|
|
304
|
-
end
|
|
284
|
+
o.after_set do
|
|
285
|
+
Datadog.logger.warn(
|
|
286
|
+
'The profiling.advanced.force_enable_legacy_profiler setting has been deprecated for removal and no ' \
|
|
287
|
+
'longer does anything. Please remove it from your Datadog.configure block.'
|
|
288
|
+
)
|
|
305
289
|
end
|
|
306
290
|
end
|
|
307
291
|
|
|
@@ -330,15 +314,33 @@ module Datadog
|
|
|
330
314
|
|
|
331
315
|
# Can be used to enable/disable the Datadog::Profiling.allocation_count feature.
|
|
332
316
|
#
|
|
333
|
-
# This feature is safe and enabled by default on Ruby 2.x, but
|
|
334
|
-
#
|
|
335
|
-
#
|
|
317
|
+
# This feature is safe and enabled by default on Ruby 2.x, but has a few caveats on Ruby 3.x.
|
|
318
|
+
#
|
|
319
|
+
# Caveat 1 (severe):
|
|
320
|
+
# On Ruby versions 3.0 (all), 3.1.0 to 3.1.3, and 3.2.0 to 3.2.2 this is disabled by default because it
|
|
321
|
+
# can trigger a VM bug that causes a segmentation fault during garbage collection of Ractors
|
|
322
|
+
# (https://bugs.ruby-lang.org/issues/18464). We don't recommend using this feature on such Rubies.
|
|
323
|
+
# This bug is fixed on Ruby versions 3.1.4, 3.2.3 and 3.3.0.
|
|
324
|
+
#
|
|
325
|
+
# Caveat 2 (annoyance):
|
|
326
|
+
# On all known versions of Ruby 3.x, due to https://bugs.ruby-lang.org/issues/19112, when a ractor gets
|
|
327
|
+
# garbage collected, Ruby will disable all active tracepoints, which this feature internally relies on.
|
|
328
|
+
# Thus this feature is only usable if you're not using Ractors.
|
|
336
329
|
#
|
|
337
|
-
#
|
|
338
|
-
#
|
|
330
|
+
# Caveat 3 (severe):
|
|
331
|
+
# Ruby 3.2.0 to 3.2.2 have a bug in the newobj tracepoint (https://bugs.ruby-lang.org/issues/19482,
|
|
332
|
+
# https://github.com/ruby/ruby/pull/7464) so that's an extra reason why it's not safe on those Rubies.
|
|
333
|
+
# This bug is fixed on Ruby versions 3.2.2 and 3.3.0.
|
|
339
334
|
#
|
|
340
|
-
# @default `true` on Ruby 2.x
|
|
341
|
-
option :allocation_counting_enabled
|
|
335
|
+
# @default `true` on Ruby 2.x and 3.1.4+, 3.2.3+ and 3.3.0+; `false` for Ruby 3.0 and unpatched Rubies.
|
|
336
|
+
option :allocation_counting_enabled do |o|
|
|
337
|
+
o.default do
|
|
338
|
+
RUBY_VERSION.start_with?('2.') ||
|
|
339
|
+
(RUBY_VERSION.start_with?('3.1.') && RUBY_VERSION >= '3.1.4') ||
|
|
340
|
+
(RUBY_VERSION.start_with?('3.2.') && RUBY_VERSION >= '3.2.3') ||
|
|
341
|
+
RUBY_VERSION >= '3.3.'
|
|
342
|
+
end
|
|
343
|
+
end
|
|
342
344
|
|
|
343
345
|
# Can be used to disable checking which version of `libmysqlclient` is being used by the `mysql2` gem.
|
|
344
346
|
#
|
|
@@ -527,10 +529,10 @@ module Datadog
|
|
|
527
529
|
# @default `->{ Time.now }`
|
|
528
530
|
# @return [Proc<Time>]
|
|
529
531
|
option :time_now_provider do |o|
|
|
530
|
-
o.
|
|
532
|
+
o.default_proc { ::Time.now }
|
|
531
533
|
o.type :proc
|
|
532
534
|
|
|
533
|
-
o.
|
|
535
|
+
o.after_set do |time_provider|
|
|
534
536
|
Core::Utils::Time.now_provider = time_provider
|
|
535
537
|
end
|
|
536
538
|
|