ddtrace 1.10.1 → 1.11.0.beta1
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 +70 -1
- data/README.md +8 -9
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +76 -11
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +26 -3
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +3 -0
- data/lib/datadog/appsec/component.rb +40 -6
- data/lib/datadog/appsec/configuration/settings.rb +20 -4
- data/lib/datadog/appsec/configuration.rb +8 -0
- data/lib/datadog/appsec/contrib/auto_instrument.rb +2 -0
- data/lib/datadog/appsec/contrib/configuration/settings.rb +2 -0
- data/lib/datadog/appsec/contrib/integration.rb +2 -0
- data/lib/datadog/appsec/contrib/patcher.rb +2 -0
- data/lib/datadog/appsec/contrib/rack/configuration/settings.rb +2 -0
- data/lib/datadog/appsec/contrib/rack/gateway/request.rb +4 -15
- data/lib/datadog/appsec/contrib/rack/gateway/response.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/patcher.rb +2 -0
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +6 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +17 -3
- data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +2 -0
- data/lib/datadog/appsec/contrib/rails/framework.rb +2 -0
- data/lib/datadog/appsec/contrib/rails/gateway/request.rb +1 -1
- data/lib/datadog/appsec/contrib/rails/request.rb +2 -0
- data/lib/datadog/appsec/contrib/rails/request_middleware.rb +2 -0
- data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +2 -0
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +2 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/route_params.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +2 -0
- data/lib/datadog/appsec/extensions.rb +2 -0
- data/lib/datadog/appsec/instrumentation/gateway/argument.rb +2 -4
- data/lib/datadog/appsec/processor/rule_loader.rb +63 -0
- data/lib/datadog/appsec/processor/rule_merger.rb +146 -0
- data/lib/datadog/appsec/processor.rb +15 -70
- data/lib/datadog/appsec/remote.rb +121 -0
- data/lib/datadog/appsec/utils/http.rb +2 -0
- data/lib/datadog/appsec/utils.rb +2 -0
- data/lib/datadog/appsec.rb +18 -4
- data/lib/datadog/ci/configuration/components.rb +2 -0
- data/lib/datadog/ci/configuration/settings.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +2 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +2 -0
- data/lib/datadog/ci/contrib/rspec/patcher.rb +2 -0
- data/lib/datadog/ci/extensions.rb +2 -0
- data/lib/datadog/ci/flush.rb +2 -0
- data/lib/datadog/ci.rb +2 -0
- data/lib/datadog/core/buffer/cruby.rb +2 -0
- data/lib/datadog/core/buffer/random.rb +2 -0
- data/lib/datadog/core/buffer/thread_safe.rb +2 -0
- data/lib/datadog/core/chunker.rb +2 -0
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +6 -6
- data/lib/datadog/core/configuration/components.rb +11 -14
- data/lib/datadog/core/configuration/dependency_resolver.rb +2 -0
- data/lib/datadog/core/configuration/option.rb +2 -0
- data/lib/datadog/core/configuration/option_definition.rb +2 -0
- data/lib/datadog/core/configuration/option_definition_set.rb +2 -0
- data/lib/datadog/core/configuration/option_set.rb +2 -0
- data/lib/datadog/core/configuration/settings.rb +68 -13
- data/lib/datadog/core/diagnostics/health.rb +2 -0
- data/lib/datadog/core/environment/class_count.rb +2 -0
- data/lib/datadog/core/environment/gc.rb +2 -0
- data/lib/datadog/core/environment/identity.rb +2 -0
- data/lib/datadog/core/environment/socket.rb +2 -0
- data/lib/datadog/core/environment/thread_count.rb +2 -0
- data/lib/datadog/core/environment/variable_helpers.rb +10 -2
- data/lib/datadog/core/environment/vm_cache.rb +2 -0
- data/lib/datadog/core/extensions.rb +2 -0
- data/lib/datadog/core/header_collection.rb +2 -0
- data/lib/datadog/core/metrics/helpers.rb +2 -0
- data/lib/datadog/core/metrics/metric.rb +2 -0
- data/lib/datadog/core/remote/client/capabilities.rb +57 -0
- data/lib/datadog/core/remote/client.rb +146 -0
- data/lib/datadog/core/remote/component.rb +150 -0
- data/lib/datadog/core/remote/configuration/content.rb +82 -0
- data/lib/datadog/core/remote/configuration/digest.rb +62 -0
- data/lib/datadog/core/remote/configuration/path.rb +90 -0
- data/lib/datadog/core/remote/configuration/repository.rb +278 -0
- data/lib/datadog/core/remote/configuration/target.rb +72 -0
- data/lib/datadog/core/remote/configuration.rb +18 -0
- data/lib/datadog/core/remote/dispatcher.rb +59 -0
- data/lib/datadog/core/remote/ext.rb +12 -0
- data/lib/datadog/core/remote/worker.rb +96 -0
- data/lib/datadog/core/remote.rb +24 -0
- data/lib/datadog/core/telemetry/collector.rb +8 -9
- data/lib/datadog/core/telemetry/heartbeat.rb +2 -0
- data/lib/datadog/core/telemetry/http/env.rb +2 -0
- data/lib/datadog/core/telemetry/http/transport.rb +2 -0
- data/lib/datadog/core/telemetry/v1/app_event.rb +2 -0
- data/lib/datadog/core/telemetry/v1/application.rb +7 -1
- data/lib/datadog/core/telemetry/v1/dependency.rb +7 -1
- data/lib/datadog/core/telemetry/v1/host.rb +9 -1
- data/lib/datadog/core/telemetry/v1/integration.rb +7 -1
- data/lib/datadog/core/telemetry/v1/product.rb +9 -1
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +7 -1
- data/lib/datadog/core/transport/config.rb +58 -0
- data/lib/datadog/core/transport/http/api/instance.rb +37 -0
- data/lib/datadog/core/transport/http/api/spec.rb +19 -0
- data/lib/datadog/core/transport/http/api.rb +57 -0
- data/lib/datadog/core/transport/http/builder.rb +217 -0
- data/lib/datadog/core/transport/http/client.rb +45 -0
- data/lib/datadog/core/transport/http/config.rb +268 -0
- data/lib/datadog/core/transport/http/negotiation.rb +144 -0
- data/lib/datadog/core/transport/http.rb +169 -0
- data/lib/datadog/core/transport/negotiation.rb +60 -0
- data/lib/datadog/core/utils/compression.rb +2 -0
- data/lib/datadog/core/utils/hash.rb +32 -0
- data/lib/datadog/core/utils/object_set.rb +2 -0
- data/lib/datadog/core/utils/safe_dup.rb +20 -2
- data/lib/datadog/core/utils/sequence.rb +2 -0
- data/lib/datadog/core/utils/time.rb +2 -0
- data/lib/datadog/core/worker.rb +2 -0
- data/lib/datadog/core/workers/interval_loop.rb +2 -0
- data/lib/datadog/core/workers/queue.rb +2 -0
- data/lib/datadog/core/workers/runtime_metrics.rb +2 -0
- data/lib/datadog/kit.rb +2 -0
- data/lib/datadog/opentracer/binary_propagator.rb +2 -0
- data/lib/datadog/opentracer/carrier.rb +2 -0
- data/lib/datadog/opentracer/global_tracer.rb +2 -0
- data/lib/datadog/opentracer/propagator.rb +2 -0
- data/lib/datadog/opentracer/scope.rb +2 -0
- data/lib/datadog/opentracer/scope_manager.rb +2 -0
- data/lib/datadog/opentracer/span_context.rb +2 -0
- data/lib/datadog/opentracer/span_context_factory.rb +2 -0
- data/lib/datadog/opentracer/thread_local_scope.rb +2 -0
- data/lib/datadog/opentracer.rb +2 -0
- data/lib/datadog/profiling/backtrace_location.rb +2 -0
- data/lib/datadog/profiling/buffer.rb +2 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +19 -3
- data/lib/datadog/profiling/collectors/dynamic_sampling_rate.rb +2 -0
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -1
- data/lib/datadog/profiling/collectors/stack.rb +2 -0
- data/lib/datadog/profiling/collectors/thread_context.rb +2 -2
- data/lib/datadog/profiling/component.rb +103 -29
- data/lib/datadog/profiling/event.rb +2 -0
- data/lib/datadog/profiling/events/stack.rb +2 -0
- data/lib/datadog/profiling/ext.rb +28 -26
- data/lib/datadog/profiling/flush.rb +2 -0
- data/lib/datadog/profiling/native_extension.rb +2 -0
- data/lib/datadog/profiling/pprof/message_set.rb +2 -0
- data/lib/datadog/profiling/pprof/payload.rb +2 -0
- data/lib/datadog/profiling/pprof/string_table.rb +2 -0
- data/lib/datadog/profiling/preload.rb +2 -0
- data/lib/datadog/profiling/scheduler.rb +3 -1
- data/lib/datadog/profiling/stack_recorder.rb +0 -18
- data/lib/datadog/profiling/tag_builder.rb +2 -0
- data/lib/datadog/profiling/tasks/setup.rb +0 -26
- data/lib/datadog/profiling.rb +2 -1
- data/lib/datadog/tracing/analytics.rb +2 -0
- data/lib/datadog/tracing/configuration/ext.rb +7 -0
- data/lib/datadog/tracing/configuration/settings.rb +14 -0
- data/lib/datadog/tracing/context.rb +2 -0
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/action_cable/event.rb +2 -0
- data/lib/datadog/tracing/contrib/action_cable/events.rb +2 -0
- data/lib/datadog/tracing/contrib/action_cable/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/action_mailer/event.rb +2 -0
- data/lib/datadog/tracing/contrib/action_mailer/events.rb +2 -0
- data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +2 -24
- data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +14 -1
- data/lib/datadog/tracing/contrib/action_pack/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/action_view/event.rb +2 -0
- data/lib/datadog/tracing/contrib/action_view/events.rb +2 -0
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/active_job/event.rb +2 -0
- data/lib/datadog/tracing/contrib/active_job/events.rb +2 -0
- data/lib/datadog/tracing/contrib/active_job/log_injection.rb +2 -0
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +2 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +2 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/active_record/event.rb +2 -0
- data/lib/datadog/tracing/contrib/active_record/events.rb +2 -0
- data/lib/datadog/tracing/contrib/active_record/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +2 -0
- data/lib/datadog/tracing/contrib/active_support/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/analytics.rb +2 -0
- data/lib/datadog/tracing/contrib/auto_instrument.rb +2 -0
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +9 -1
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +8 -2
- data/lib/datadog/tracing/contrib/aws/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +2 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/configurable.rb +2 -0
- data/lib/datadog/tracing/contrib/configuration/resolver.rb +2 -0
- data/lib/datadog/tracing/contrib/configuration/resolvers/pattern_resolver.rb +2 -0
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/dalli/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +2 -0
- data/lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb +2 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/excon/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/faraday/connection.rb +2 -0
- data/lib/datadog/tracing/contrib/faraday/rack_builder.rb +2 -0
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/grape/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +2 -0
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/plugin.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +2 -0
- data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +2 -0
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +2 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/http/integration.rb +2 -0
- data/lib/datadog/tracing/contrib/http/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/http_annotation_helper.rb +2 -0
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/integration.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/event.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/events.rb +2 -0
- data/lib/datadog/tracing/contrib/kafka/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/lograge/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/mongodb/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/mongodb/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/mysql2/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/patchable.rb +2 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +2 -0
- data/lib/datadog/tracing/contrib/pg/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +2 -0
- data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/qless/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +2 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/racecar/event.rb +2 -0
- data/lib/datadog/tracing/contrib/racecar/events.rb +2 -0
- data/lib/datadog/tracing/contrib/racecar/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +9 -2
- data/lib/datadog/tracing/contrib/rails/framework.rb +2 -0
- data/lib/datadog/tracing/contrib/rails/middlewares.rb +2 -0
- data/lib/datadog/tracing/contrib/rails/utils.rb +3 -1
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/rake/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +2 -0
- data/lib/datadog/tracing/contrib/registerable.rb +2 -0
- data/lib/datadog/tracing/contrib/registry.rb +2 -0
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/resque/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/resque/resque_job.rb +2 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/rest_client/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +2 -0
- data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +34 -0
- data/lib/datadog/tracing/contrib/roda/ext.rb +18 -0
- data/lib/datadog/tracing/contrib/roda/instrumentation.rb +76 -0
- data/lib/datadog/tracing/contrib/roda/integration.rb +45 -0
- data/lib/datadog/tracing/contrib/roda/patcher.rb +30 -0
- data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +3 -0
- data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +2 -0
- data/lib/datadog/tracing/contrib/sequel/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +12 -3
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +3 -0
- data/lib/datadog/tracing/contrib/sidekiq/distributed/propagation.rb +38 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/redis_info.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_poller.rb +2 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +18 -2
- data/lib/datadog/tracing/contrib/sidekiq/{tracing.rb → utils.rb} +3 -1
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +2 -0
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +2 -0
- data/lib/datadog/tracing/contrib/span_attribute_schema.rb +28 -0
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +2 -0
- data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +2 -0
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +2 -2
- data/lib/datadog/tracing/contrib.rb +3 -0
- data/lib/datadog/tracing/correlation.rb +10 -10
- data/lib/datadog/tracing/diagnostics/health.rb +2 -0
- data/lib/datadog/tracing/distributed/trace_context.rb +22 -15
- data/lib/datadog/tracing/flush.rb +2 -0
- data/lib/datadog/tracing/metadata/analytics.rb +2 -0
- data/lib/datadog/tracing/metadata/errors.rb +2 -0
- data/lib/datadog/tracing/metadata/ext.rb +6 -0
- data/lib/datadog/tracing/metadata.rb +2 -0
- data/lib/datadog/tracing/pipeline/span_filter.rb +2 -0
- data/lib/datadog/tracing/pipeline/span_processor.rb +2 -0
- data/lib/datadog/tracing/propagation/http.rb +2 -0
- data/lib/datadog/tracing/runtime/metrics.rb +2 -0
- data/lib/datadog/tracing/sampling/all_sampler.rb +2 -0
- data/lib/datadog/tracing/sampling/matcher.rb +2 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +2 -0
- data/lib/datadog/tracing/sampling/span/sampler.rb +2 -0
- data/lib/datadog/tracing/sync_writer.rb +2 -0
- data/lib/datadog/tracing/trace_digest.rb +2 -0
- data/lib/datadog/tracing/utils.rb +2 -0
- data/lib/datadog/tracing.rb +2 -0
- data/lib/ddtrace/auto_instrument.rb +2 -0
- data/lib/ddtrace/auto_instrument_base.rb +2 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +12 -0
- data/lib/ddtrace/transport/http/adapters/registry.rb +2 -0
- data/lib/ddtrace/transport/http/api/endpoint.rb +2 -0
- data/lib/ddtrace/transport/http/api/fallbacks.rb +2 -0
- data/lib/ddtrace/transport/http/api/instance.rb +2 -0
- data/lib/ddtrace/transport/http/api/map.rb +2 -0
- data/lib/ddtrace/transport/http/api/spec.rb +2 -0
- data/lib/ddtrace/transport/http/env.rb +2 -0
- data/lib/ddtrace/transport/http/response.rb +2 -0
- data/lib/ddtrace/transport/io/response.rb +2 -0
- data/lib/ddtrace/transport/io/traces.rb +2 -0
- data/lib/ddtrace/transport/io.rb +2 -0
- data/lib/ddtrace/transport/parcel.rb +2 -0
- data/lib/ddtrace/transport/request.rb +3 -1
- data/lib/ddtrace/transport/statistics.rb +2 -0
- data/lib/ddtrace/transport/trace_formatter.rb +2 -0
- data/lib/ddtrace/version.rb +7 -5
- data/lib/ddtrace.rb +2 -0
- metadata +38 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../core/remote/dispatcher'
|
|
4
|
+
require_relative 'processor/rule_merger'
|
|
5
|
+
require_relative 'processor/rule_loader'
|
|
6
|
+
|
|
7
|
+
module Datadog
|
|
8
|
+
module AppSec
|
|
9
|
+
# Remote
|
|
10
|
+
module Remote
|
|
11
|
+
class ReadError < StandardError; end
|
|
12
|
+
class NoRulesError < StandardError; end
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
CAP_ASM_ACTIVATION = 1 << 1 # Remote activation via ASM_FEATURES product
|
|
16
|
+
CAP_ASM_IP_BLOCKING = 1 << 2 # accept IP blocking data from ASM_DATA product
|
|
17
|
+
CAP_ASM_DD_RULES = 1 << 3 # read ASM rules from ASM_DD product
|
|
18
|
+
CAP_ASM_EXCLUSIONS = 1 << 4 # exclusion filters (passlist) via ASM product
|
|
19
|
+
CAP_ASM_REQUEST_BLOCKING = 1 << 5 # can block on request info
|
|
20
|
+
CAP_ASM_RESPONSE_BLOCKING = 1 << 6 # can block on response info
|
|
21
|
+
CAP_ASM_USER_BLOCKING = 1 << 7 # accept user blocking data from ASM_DATA product
|
|
22
|
+
CAP_ASM_CUSTOM_RULES = 1 << 8 # accept custom rules
|
|
23
|
+
CAP_ASM_CUSTOM_BLOCKING_RESPONSE = 1 << 9 # supports custom http code or redirect sa blocking response
|
|
24
|
+
|
|
25
|
+
# TODO: we need to dynamically add CAP_ASM_ACTIVATION once we support it
|
|
26
|
+
ASM_CAPABILITIES = [
|
|
27
|
+
CAP_ASM_IP_BLOCKING,
|
|
28
|
+
CAP_ASM_USER_BLOCKING,
|
|
29
|
+
CAP_ASM_CUSTOM_RULES,
|
|
30
|
+
CAP_ASM_EXCLUSIONS,
|
|
31
|
+
CAP_ASM_REQUEST_BLOCKING,
|
|
32
|
+
CAP_ASM_RESPONSE_BLOCKING,
|
|
33
|
+
CAP_ASM_DD_RULES,
|
|
34
|
+
].freeze
|
|
35
|
+
|
|
36
|
+
ASM_PRODUCTS = [
|
|
37
|
+
'ASM_DD', # Datadog employee issued configuration
|
|
38
|
+
'ASM', # customer issued configuration (rulesets, passlist...)
|
|
39
|
+
'ASM_FEATURES', # capabilities
|
|
40
|
+
'ASM_DATA', # config files (IP addresses or users for blocking)
|
|
41
|
+
].freeze
|
|
42
|
+
|
|
43
|
+
def capabilities
|
|
44
|
+
remote_features_enabled? ? ASM_CAPABILITIES : []
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def products
|
|
48
|
+
remote_features_enabled? ? ASM_PRODUCTS : []
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# rubocop:disable Metrics/MethodLength
|
|
52
|
+
def receivers
|
|
53
|
+
return [] unless remote_features_enabled?
|
|
54
|
+
|
|
55
|
+
matcher = Core::Remote::Dispatcher::Matcher::Product.new(ASM_PRODUCTS)
|
|
56
|
+
receiver = Core::Remote::Dispatcher::Receiver.new(matcher) do |repository, changes|
|
|
57
|
+
changes.each do |change|
|
|
58
|
+
Datadog.logger.debug { "remote config change: '#{change.path}'" }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
rules = []
|
|
62
|
+
data = []
|
|
63
|
+
overrides = []
|
|
64
|
+
exclusions = []
|
|
65
|
+
|
|
66
|
+
asm_data_config_types = ['blocked_ips', 'blocked_users']
|
|
67
|
+
asm_overrides_config_types = ['blocking', 'disabled_rules']
|
|
68
|
+
|
|
69
|
+
repository.contents.each do |content|
|
|
70
|
+
case content.path.product
|
|
71
|
+
when 'ASM_DD'
|
|
72
|
+
rules << parse_content(content)
|
|
73
|
+
when 'ASM_DATA'
|
|
74
|
+
data << parse_content(content) if asm_data_config_types.include?(content.path.config_id)
|
|
75
|
+
when 'ASM'
|
|
76
|
+
overrides << parse_content(content) if asm_overrides_config_types.include?(content.path.config_id)
|
|
77
|
+
exclusions << parse_content(content) if content.path.config_id == 'exclusion_filters'
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if rules.empty?
|
|
82
|
+
settings_rules = AppSec::Processor::RuleLoader.load_rules(ruleset: Datadog.configuration.appsec.ruleset)
|
|
83
|
+
|
|
84
|
+
raise NoRulesError, 'no default rules available' unless settings_rules
|
|
85
|
+
|
|
86
|
+
rules = [settings_rules]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
ruleset = AppSec::Processor::RuleMerger.merge(
|
|
90
|
+
rules: rules,
|
|
91
|
+
data: data,
|
|
92
|
+
overrides: overrides,
|
|
93
|
+
exclusions: exclusions,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
Datadog::AppSec.reconfigure(ruleset: ruleset)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
[receiver]
|
|
100
|
+
end
|
|
101
|
+
# rubocop:enable Metrics/MethodLength
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
def remote_features_enabled?
|
|
106
|
+
Datadog::AppSec.send(:default_setting?, :ruleset)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def parse_content(content)
|
|
110
|
+
data = content.data.read
|
|
111
|
+
|
|
112
|
+
content.data.rewind
|
|
113
|
+
|
|
114
|
+
raise ReadError, 'EOF reached' if data.nil?
|
|
115
|
+
|
|
116
|
+
JSON.parse(data)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
data/lib/datadog/appsec/utils.rb
CHANGED
data/lib/datadog/appsec.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative 'appsec/configuration'
|
|
2
4
|
require_relative 'appsec/extensions'
|
|
3
5
|
|
|
@@ -17,6 +19,22 @@ module Datadog
|
|
|
17
19
|
appsec_component.processor if appsec_component
|
|
18
20
|
end
|
|
19
21
|
|
|
22
|
+
def reconfigure(ruleset:)
|
|
23
|
+
appsec_component = components.appsec
|
|
24
|
+
|
|
25
|
+
return unless appsec_component
|
|
26
|
+
|
|
27
|
+
appsec_component.reconfigure(ruleset: ruleset)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def reconfigure_lock(&block)
|
|
31
|
+
appsec_component = components.appsec
|
|
32
|
+
|
|
33
|
+
return unless appsec_component
|
|
34
|
+
|
|
35
|
+
appsec_component.reconfigure_lock(&block)
|
|
36
|
+
end
|
|
37
|
+
|
|
20
38
|
private
|
|
21
39
|
|
|
22
40
|
def components
|
|
@@ -24,10 +42,6 @@ module Datadog
|
|
|
24
42
|
end
|
|
25
43
|
end
|
|
26
44
|
|
|
27
|
-
def self.writer
|
|
28
|
-
@writer ||= Writer.new
|
|
29
|
-
end
|
|
30
|
-
|
|
31
45
|
# Expose AppSec to global shared objects
|
|
32
46
|
Extensions.activate!
|
|
33
47
|
end
|
data/lib/datadog/ci/flush.rb
CHANGED
data/lib/datadog/ci.rb
CHANGED
data/lib/datadog/core/chunker.rb
CHANGED
|
@@ -66,9 +66,9 @@ module Datadog
|
|
|
66
66
|
|
|
67
67
|
def call
|
|
68
68
|
# A transport_options proc configured for unix domain socket overrides most of the logic on this file
|
|
69
|
-
if transport_options.adapter == Transport::Ext::UnixSocket::ADAPTER
|
|
69
|
+
if transport_options.adapter == Datadog::Transport::Ext::UnixSocket::ADAPTER
|
|
70
70
|
return AgentSettings.new(
|
|
71
|
-
adapter: Transport::Ext::UnixSocket::ADAPTER,
|
|
71
|
+
adapter: Datadog::Transport::Ext::UnixSocket::ADAPTER,
|
|
72
72
|
ssl: false,
|
|
73
73
|
hostname: nil,
|
|
74
74
|
port: nil,
|
|
@@ -98,9 +98,9 @@ module Datadog
|
|
|
98
98
|
# If no agent settings have been provided, we try to connect using a local unix socket.
|
|
99
99
|
# We only do so if the socket is present when `ddtrace` runs.
|
|
100
100
|
if should_use_uds_fallback?
|
|
101
|
-
Transport::Ext::UnixSocket::ADAPTER
|
|
101
|
+
Datadog::Transport::Ext::UnixSocket::ADAPTER
|
|
102
102
|
else
|
|
103
|
-
Transport::Ext::HTTP::ADAPTER
|
|
103
|
+
Datadog::Transport::Ext::HTTP::ADAPTER
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -204,9 +204,9 @@ module Datadog
|
|
|
204
204
|
if configured_hostname.nil? &&
|
|
205
205
|
configured_port.nil? &&
|
|
206
206
|
deprecated_for_removal_transport_configuration_proc.nil? &&
|
|
207
|
-
File.exist?(Transport::Ext::UnixSocket::DEFAULT_PATH)
|
|
207
|
+
File.exist?(Datadog::Transport::Ext::UnixSocket::DEFAULT_PATH)
|
|
208
208
|
|
|
209
|
-
Transport::Ext::UnixSocket::DEFAULT_PATH
|
|
209
|
+
Datadog::Transport::Ext::UnixSocket::DEFAULT_PATH
|
|
210
210
|
end
|
|
211
211
|
end
|
|
212
212
|
|
|
@@ -6,6 +6,7 @@ require_relative '../runtime/metrics'
|
|
|
6
6
|
require_relative '../telemetry/client'
|
|
7
7
|
require_relative '../workers/runtime_metrics'
|
|
8
8
|
|
|
9
|
+
require_relative '../remote/component'
|
|
9
10
|
require_relative '../../tracing/component'
|
|
10
11
|
require_relative '../../profiling/component'
|
|
11
12
|
require_relative '../../appsec/component'
|
|
@@ -17,7 +18,6 @@ module Datadog
|
|
|
17
18
|
class Components
|
|
18
19
|
class << self
|
|
19
20
|
include Datadog::Tracing::Component
|
|
20
|
-
include Datadog::Profiling::Component
|
|
21
21
|
|
|
22
22
|
def build_health_metrics(settings)
|
|
23
23
|
settings = settings.diagnostics.health_metrics
|
|
@@ -60,6 +60,7 @@ module Datadog
|
|
|
60
60
|
attr_reader \
|
|
61
61
|
:health_metrics,
|
|
62
62
|
:logger,
|
|
63
|
+
:remote,
|
|
63
64
|
:profiler,
|
|
64
65
|
:runtime_metrics,
|
|
65
66
|
:telemetry,
|
|
@@ -67,27 +68,20 @@ module Datadog
|
|
|
67
68
|
:appsec
|
|
68
69
|
|
|
69
70
|
def initialize(settings)
|
|
70
|
-
# Logger
|
|
71
71
|
@logger = self.class.build_logger(settings)
|
|
72
72
|
|
|
73
73
|
agent_settings = AgentSettingsResolver.call(settings, logger: @logger)
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
@remote = Remote::Component.build(settings, agent_settings)
|
|
76
76
|
@tracer = self.class.build_tracer(settings, agent_settings)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
@profiler = Datadog::Profiling::Component.build_profiler_component(
|
|
78
|
+
settings: settings,
|
|
79
|
+
agent_settings: agent_settings,
|
|
80
|
+
optional_tracer: @tracer,
|
|
81
|
+
)
|
|
82
82
|
@runtime_metrics = self.class.build_runtime_metrics_worker(settings)
|
|
83
|
-
|
|
84
|
-
# Health metrics
|
|
85
83
|
@health_metrics = self.class.build_health_metrics(settings)
|
|
86
|
-
|
|
87
|
-
# Telemetry
|
|
88
84
|
@telemetry = self.class.build_telemetry(settings)
|
|
89
|
-
|
|
90
|
-
# AppSec
|
|
91
85
|
@appsec = Datadog::AppSec::Component.build_appsec_component(settings)
|
|
92
86
|
end
|
|
93
87
|
|
|
@@ -111,6 +105,9 @@ module Datadog
|
|
|
111
105
|
# If it has another instance to compare to, it will compare
|
|
112
106
|
# and avoid tearing down parts still in use.
|
|
113
107
|
def shutdown!(replacement = nil)
|
|
108
|
+
# Shutdown remote configuration
|
|
109
|
+
remote.shutdown! if remote
|
|
110
|
+
|
|
114
111
|
# Decommission AppSec
|
|
115
112
|
appsec.shutdown! if appsec
|
|
116
113
|
|
|
@@ -5,6 +5,7 @@ require_relative 'ext'
|
|
|
5
5
|
require_relative '../environment/ext'
|
|
6
6
|
require_relative '../runtime/ext'
|
|
7
7
|
require_relative '../telemetry/ext'
|
|
8
|
+
require_relative '../remote/ext'
|
|
8
9
|
require_relative '../../profiling/ext'
|
|
9
10
|
|
|
10
11
|
require_relative '../../tracing/configuration/settings'
|
|
@@ -202,9 +203,10 @@ module Datadog
|
|
|
202
203
|
# @public_api
|
|
203
204
|
settings :advanced do
|
|
204
205
|
# This should never be reduced, as it can cause the resulting profiles to become biased.
|
|
205
|
-
# The
|
|
206
|
+
# The default should be enough for most services, allowing 16 threads to be sampled around 30 times
|
|
206
207
|
# per second for a 60 second period.
|
|
207
|
-
#
|
|
208
|
+
#
|
|
209
|
+
# @deprecated This setting is ignored when CPU Profiling 2.0 is in use.
|
|
208
210
|
option :max_events, default: 32768
|
|
209
211
|
|
|
210
212
|
# Controls the maximum number of frames for each thread sampled. Can be tuned to avoid omitted frames in the
|
|
@@ -235,7 +237,7 @@ module Datadog
|
|
|
235
237
|
# grouping and categorization of stack traces.
|
|
236
238
|
option :code_provenance_enabled, default: true
|
|
237
239
|
|
|
238
|
-
# No longer does anything, and will be removed on dd-trace-rb 2.0.
|
|
240
|
+
# @deprecated No longer does anything, and will be removed on dd-trace-rb 2.0.
|
|
239
241
|
#
|
|
240
242
|
# This was added as a temporary support option in case of issues with the new `Profiling::HttpTransport` class
|
|
241
243
|
# but we're now confident it's working nicely so we've removed the old code path.
|
|
@@ -251,29 +253,44 @@ module Datadog
|
|
|
251
253
|
# Forces enabling the new CPU Profiling 2.0 profiler (see ddtrace release notes for more details).
|
|
252
254
|
#
|
|
253
255
|
# Note that setting this to "false" (or not setting it) will not prevent the new profiler from
|
|
254
|
-
# being automatically used
|
|
255
|
-
# This option will be deprecated for removal once the
|
|
256
|
+
# being automatically used.
|
|
257
|
+
# This option will be deprecated for removal once the legacy profiler is removed.
|
|
258
|
+
#
|
|
259
|
+
# @default `DD_PROFILING_FORCE_ENABLE_NEW` environment variable, otherwise `false`
|
|
256
260
|
option :force_enable_new_profiler do |o|
|
|
257
261
|
o.default { env_to_bool('DD_PROFILING_FORCE_ENABLE_NEW', false) }
|
|
258
262
|
o.lazy
|
|
259
263
|
end
|
|
260
264
|
|
|
265
|
+
# Forces enabling the *legacy* (non-CPU Profiling 2.0 profiler) even when it would otherwise NOT be enabled.
|
|
266
|
+
#
|
|
267
|
+
# Temporarily added to ease migration to the new CPU Profiling 2.0 profiler, and will be removed soon.
|
|
268
|
+
# Do not use unless instructed to by support.
|
|
269
|
+
# This option will be deprecated for removal once the legacy profiler is removed.
|
|
270
|
+
#
|
|
271
|
+
# @default `DD_PROFILING_FORCE_ENABLE_LEGACY` environment variable, otherwise `false`
|
|
272
|
+
option :force_enable_legacy_profiler do |o|
|
|
273
|
+
o.default { env_to_bool('DD_PROFILING_FORCE_ENABLE_LEGACY', false) }
|
|
274
|
+
o.lazy
|
|
275
|
+
end
|
|
276
|
+
|
|
261
277
|
# Forces enabling of profiling of time/resources spent in Garbage Collection.
|
|
262
278
|
#
|
|
263
279
|
# Note that setting this to "false" (or not setting it) will not prevent the feature from being
|
|
264
280
|
# being automatically enabled in the future.
|
|
265
281
|
#
|
|
266
|
-
# This
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
#
|
|
270
|
-
#
|
|
271
|
-
#
|
|
272
|
-
#
|
|
273
|
-
# Furthermore, currently this feature can add a lot of overhead for GC-heavy workloads.
|
|
282
|
+
# This feature defaults to off for two reasons:
|
|
283
|
+
# 1. Currently this feature can add a lot of overhead for GC-heavy workloads.
|
|
284
|
+
# 2. Although this feature is safe on Ruby 2.x, on Ruby 3.x it can break in applications that make use of
|
|
285
|
+
# Ractors due to two Ruby VM bugs:
|
|
286
|
+
# https://bugs.ruby-lang.org/issues/19112 AND https://bugs.ruby-lang.org/issues/18464.
|
|
287
|
+
# If you use Ruby 3.x and your application does not use Ractors (or if your Ruby has been patched), the
|
|
288
|
+
# feature is fully safe to enable and this toggle can be used to do so.
|
|
274
289
|
#
|
|
275
290
|
# We expect the once the above issues are overcome, we'll automatically enable the feature on fixed Ruby
|
|
276
291
|
# versions.
|
|
292
|
+
#
|
|
293
|
+
# @default `DD_PROFILING_FORCE_ENABLE_GC` environment variable, otherwise `false`
|
|
277
294
|
option :force_enable_gc_profiling do |o|
|
|
278
295
|
o.default { env_to_bool('DD_PROFILING_FORCE_ENABLE_GC', false) }
|
|
279
296
|
o.lazy
|
|
@@ -287,11 +304,26 @@ module Datadog
|
|
|
287
304
|
#
|
|
288
305
|
# If you use Ruby 3.x and your application does not use Ractors (or if your Ruby has been patched), the
|
|
289
306
|
# feature is fully safe to enable and this toggle can be used to do so.
|
|
307
|
+
#
|
|
308
|
+
# @default `true` on Ruby 2.x, `false` on Ruby 3.x
|
|
290
309
|
option :allocation_counting_enabled, default: RUBY_VERSION.start_with?('2.')
|
|
310
|
+
|
|
311
|
+
# Can be used to disable checking which version of `libmysqlclient` is being used by the `mysql2` gem.
|
|
312
|
+
#
|
|
313
|
+
# This setting is only used when the `mysql2` gem is installed.
|
|
314
|
+
#
|
|
315
|
+
# @default `DD_PROFILING_SKIP_MYSQL2_CHECK` environment variable, otherwise `false`
|
|
316
|
+
option :skip_mysql2_check do |o|
|
|
317
|
+
o.default { env_to_bool('DD_PROFILING_SKIP_MYSQL2_CHECK', false) }
|
|
318
|
+
o.lazy
|
|
319
|
+
end
|
|
291
320
|
end
|
|
292
321
|
|
|
293
322
|
# @public_api
|
|
294
323
|
settings :upload do
|
|
324
|
+
# Network timeout for reporting profiling data to Datadog.
|
|
325
|
+
#
|
|
326
|
+
# @default `DD_PROFILING_UPLOAD_TIMEOUT` environment variable, otherwise `30.0`
|
|
295
327
|
option :timeout_seconds do |o|
|
|
296
328
|
o.setter { |value| value.nil? ? 30.0 : value.to_f }
|
|
297
329
|
o.default { env_to_float(Profiling::Ext::ENV_UPLOAD_TIMEOUT, 30.0) }
|
|
@@ -445,6 +477,29 @@ module Datadog
|
|
|
445
477
|
end
|
|
446
478
|
end
|
|
447
479
|
|
|
480
|
+
# Remote configuration
|
|
481
|
+
# @public_api
|
|
482
|
+
settings :remote do
|
|
483
|
+
# Enable remote configuration. This allows fetching of remote configuration for live updates.
|
|
484
|
+
#
|
|
485
|
+
# @default `DD_REMOTE_CONFIGURATION_ENABLED` environment variable, otherwise `false`. In a future release,
|
|
486
|
+
# this value will be changed to `true` by default.
|
|
487
|
+
# @return [Boolean]
|
|
488
|
+
option :enabled do |o|
|
|
489
|
+
o.default { env_to_bool(Core::Remote::Ext::ENV_ENABLED, false) }
|
|
490
|
+
o.lazy
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
# Tune remote configuration polling interval.
|
|
494
|
+
#
|
|
495
|
+
# @default `DD_REMOTE_CONFIGURATION_POLL_INTERVAL_SECONDS` environment variable, otherwise `5.0` seconds.
|
|
496
|
+
# @return [Float]
|
|
497
|
+
option :poll_interval_seconds do |o|
|
|
498
|
+
o.default { env_to_float(Core::Remote::Ext::ENV_POLL_INTERVAL_SECONDS, 5.0) }
|
|
499
|
+
o.lazy
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
|
|
448
503
|
# TODO: Tracing should manage its own settings.
|
|
449
504
|
# Keep this extension here for now to keep things working.
|
|
450
505
|
extend Datadog::Tracing::Configuration::Settings
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Datadog
|
|
2
4
|
module Core
|
|
3
5
|
# Namespace for handling application environment
|
|
@@ -14,11 +16,17 @@ module Datadog
|
|
|
14
16
|
# @param [Boolean] default the default value if the keys in `var` are not present in the environment
|
|
15
17
|
# @param [Boolean] deprecation_warning when `var` is a list, record a deprecation log when
|
|
16
18
|
# the first key in `var` is not used.
|
|
17
|
-
# @return [Boolean] if the environment value is the string `true`
|
|
19
|
+
# @return [Boolean] if the environment value is the string `true` or `1`
|
|
18
20
|
# @return [default] if the environment value is not found
|
|
19
21
|
def env_to_bool(var, default = nil, deprecation_warning: true)
|
|
20
22
|
var = decode_array(var, deprecation_warning)
|
|
21
|
-
var && ENV.key?(var)
|
|
23
|
+
if var && ENV.key?(var)
|
|
24
|
+
value = ENV[var].to_s.strip
|
|
25
|
+
value.downcase!
|
|
26
|
+
value == 'true' || value == '1' # rubocop:disable Style/MultipleComparison
|
|
27
|
+
else
|
|
28
|
+
default
|
|
29
|
+
end
|
|
22
30
|
end
|
|
23
31
|
|
|
24
32
|
# Reads an environment variable as an Integer.
|