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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83276ed5293cf8971f19f7a1fb1198e01f5ff8d48d3dd440deff0ef3518939d6
|
|
4
|
+
data.tar.gz: 12d22b6020e8830c91b2f68aed9ce03a2d201eafc4911c0a95171df6480cf754
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d4f7fb37bd10399053c026ff92545c5a1d600447cb94b3b35439fb37008154687c09f1834115afe4ed5cddc55fe84b458db955fcd4dbd0140444ffdaa01f8a9
|
|
7
|
+
data.tar.gz: 39d5ac62e456654550f70989e18dd3b122d3167aefc4a6b55ed5dc2ffd22c8f2b51c2f8261b2e4c009310acc2001be1a8f6ab6b0651850a45cc49cf0319ba6b1
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.11.0.beta1] - 2023-04-14
|
|
6
|
+
|
|
7
|
+
As of ddtrace 1.11.0.beta1, CPU Profiling 2.0 is now GA and enabled by default. For more details, check the release notes.
|
|
8
|
+
|
|
9
|
+
As of ddtrace 1.11.0.beta1, Remote Configuration is now public beta and disabled by default. For more details, check the release notes.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
* Add remote configuration beta, disabled by default ([#2674][], [#2678][], [#2686][], [#2687][], [#2688][], [#2689][], [#2696][], [#2705][], [#2731][], [#2732][], [#2733][], [#2739][], [#2756][], [#2769][], [#2771][], [#2773][], [#2789][])
|
|
14
|
+
* AppSec: Add response headers passing to WAF ([#2701][])
|
|
15
|
+
* Tracing: Distributed tracing for Sidekiq ([#2513][])
|
|
16
|
+
* Tracing: Add Roda integration ([#2368][])
|
|
17
|
+
* Profiling: [PROF-6555] Support disabling endpoint names collection in new profiler ([#2698][])
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
* Core: Allow `1` as true value in environment variables ([#2710][])
|
|
22
|
+
* Profiling: [PROF-7360] Enable CPU Profiling 2.0 by default ([#2702][])
|
|
23
|
+
* Tracing: Improve controller instrumentation and deprecate option `exception_controller` ([#2726][])
|
|
24
|
+
* Tracing: Implement Span Attribute Schema Environment Variable ([#2727][])
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
* Bug: Tracing: Fix w3c propagation special character handling ([#2720][])
|
|
29
|
+
* Performance: Tracing: Use `+@` instead of `dup` for duplicating strings ([#2704][])
|
|
30
|
+
* Profiling: [PROF-7307] Avoid triggering allocation sampling during sampling ([#2690][])
|
|
31
|
+
* Integrations: Tracing: Fix Rails < 3 conditional check in Utils#railtie_supported? ([#2695][])
|
|
32
|
+
* Profiling: [PROF-7409] Do not auto-enable new profiler when rugged gem is detected ([#2741][])
|
|
33
|
+
* Tracing: Fix using SemanticLogger#log(severity, message, progname) ([#2748][]) ([@rqz13][])
|
|
34
|
+
* Profiling: [PROF-6447] Improve detection of mysql2 gem incompatibilities with profiler ([#2770][])
|
|
35
|
+
* AppSec: Remove check for `::Rack::Request.instance_methods.include?(:each_header)` at load time ([#2778][])
|
|
36
|
+
* Tracing: Fix quadratic backtracking on invalid URI ([#2788][])
|
|
37
|
+
|
|
5
38
|
## [1.10.1] - 2023-03-10
|
|
6
39
|
|
|
7
40
|
### Fixed
|
|
@@ -2323,7 +2356,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
|
2323
2356
|
|
|
2324
2357
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
2325
2358
|
|
|
2326
|
-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.
|
|
2359
|
+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.11.0.beta1...master
|
|
2360
|
+
[1.11.0.beta1]: https://github.com/DataDog/dd-trace-rb/compare/v1.10.1...v1.11.0.beta1
|
|
2327
2361
|
[1.10.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.10.0...v1.10.1
|
|
2328
2362
|
[1.10.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.9.0...v1.10.0
|
|
2329
2363
|
[1.9.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.8.0...v1.9.0
|
|
@@ -3261,6 +3295,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
|
3261
3295
|
[#2363]: https://github.com/DataDog/dd-trace-rb/issues/2363
|
|
3262
3296
|
[#2365]: https://github.com/DataDog/dd-trace-rb/issues/2365
|
|
3263
3297
|
[#2367]: https://github.com/DataDog/dd-trace-rb/issues/2367
|
|
3298
|
+
[#2368]: https://github.com/DataDog/dd-trace-rb/issues/2368
|
|
3264
3299
|
[#2378]: https://github.com/DataDog/dd-trace-rb/issues/2378
|
|
3265
3300
|
[#2382]: https://github.com/DataDog/dd-trace-rb/issues/2382
|
|
3266
3301
|
[#2390]: https://github.com/DataDog/dd-trace-rb/issues/2390
|
|
@@ -3293,6 +3328,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
|
3293
3328
|
[#2501]: https://github.com/DataDog/dd-trace-rb/issues/2501
|
|
3294
3329
|
[#2504]: https://github.com/DataDog/dd-trace-rb/issues/2504
|
|
3295
3330
|
[#2512]: https://github.com/DataDog/dd-trace-rb/issues/2512
|
|
3331
|
+
[#2513]: https://github.com/DataDog/dd-trace-rb/issues/2513
|
|
3296
3332
|
[#2522]: https://github.com/DataDog/dd-trace-rb/issues/2522
|
|
3297
3333
|
[#2526]: https://github.com/DataDog/dd-trace-rb/issues/2526
|
|
3298
3334
|
[#2530]: https://github.com/DataDog/dd-trace-rb/issues/2530
|
|
@@ -3334,7 +3370,39 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
|
3334
3370
|
[#2663]: https://github.com/DataDog/dd-trace-rb/issues/2663
|
|
3335
3371
|
[#2665]: https://github.com/DataDog/dd-trace-rb/issues/2665
|
|
3336
3372
|
[#2668]: https://github.com/DataDog/dd-trace-rb/issues/2668
|
|
3373
|
+
[#2674]: https://github.com/DataDog/dd-trace-rb/issues/2674
|
|
3374
|
+
[#2678]: https://github.com/DataDog/dd-trace-rb/issues/2678
|
|
3337
3375
|
[#2679]: https://github.com/DataDog/dd-trace-rb/issues/2679
|
|
3376
|
+
[#2686]: https://github.com/DataDog/dd-trace-rb/issues/2686
|
|
3377
|
+
[#2687]: https://github.com/DataDog/dd-trace-rb/issues/2687
|
|
3378
|
+
[#2688]: https://github.com/DataDog/dd-trace-rb/issues/2688
|
|
3379
|
+
[#2689]: https://github.com/DataDog/dd-trace-rb/issues/2689
|
|
3380
|
+
[#2690]: https://github.com/DataDog/dd-trace-rb/issues/2690
|
|
3381
|
+
[#2695]: https://github.com/DataDog/dd-trace-rb/issues/2695
|
|
3382
|
+
[#2696]: https://github.com/DataDog/dd-trace-rb/issues/2696
|
|
3383
|
+
[#2698]: https://github.com/DataDog/dd-trace-rb/issues/2698
|
|
3384
|
+
[#2701]: https://github.com/DataDog/dd-trace-rb/issues/2701
|
|
3385
|
+
[#2702]: https://github.com/DataDog/dd-trace-rb/issues/2702
|
|
3386
|
+
[#2704]: https://github.com/DataDog/dd-trace-rb/issues/2704
|
|
3387
|
+
[#2705]: https://github.com/DataDog/dd-trace-rb/issues/2705
|
|
3388
|
+
[#2710]: https://github.com/DataDog/dd-trace-rb/issues/2710
|
|
3389
|
+
[#2720]: https://github.com/DataDog/dd-trace-rb/issues/2720
|
|
3390
|
+
[#2726]: https://github.com/DataDog/dd-trace-rb/issues/2726
|
|
3391
|
+
[#2727]: https://github.com/DataDog/dd-trace-rb/issues/2727
|
|
3392
|
+
[#2731]: https://github.com/DataDog/dd-trace-rb/issues/2731
|
|
3393
|
+
[#2732]: https://github.com/DataDog/dd-trace-rb/issues/2732
|
|
3394
|
+
[#2733]: https://github.com/DataDog/dd-trace-rb/issues/2733
|
|
3395
|
+
[#2739]: https://github.com/DataDog/dd-trace-rb/issues/2739
|
|
3396
|
+
[#2741]: https://github.com/DataDog/dd-trace-rb/issues/2741
|
|
3397
|
+
[#2748]: https://github.com/DataDog/dd-trace-rb/issues/2748
|
|
3398
|
+
[#2756]: https://github.com/DataDog/dd-trace-rb/issues/2756
|
|
3399
|
+
[#2769]: https://github.com/DataDog/dd-trace-rb/issues/2769
|
|
3400
|
+
[#2770]: https://github.com/DataDog/dd-trace-rb/issues/2770
|
|
3401
|
+
[#2771]: https://github.com/DataDog/dd-trace-rb/issues/2771
|
|
3402
|
+
[#2773]: https://github.com/DataDog/dd-trace-rb/issues/2773
|
|
3403
|
+
[#2778]: https://github.com/DataDog/dd-trace-rb/issues/2778
|
|
3404
|
+
[#2788]: https://github.com/DataDog/dd-trace-rb/issues/2788
|
|
3405
|
+
[#2789]: https://github.com/DataDog/dd-trace-rb/issues/2789
|
|
3338
3406
|
[@AdrianLC]: https://github.com/AdrianLC
|
|
3339
3407
|
[@Azure7111]: https://github.com/Azure7111
|
|
3340
3408
|
[@BabyGroot]: https://github.com/BabyGroot
|
|
@@ -3456,6 +3524,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
|
3456
3524
|
[@renchap]: https://github.com/renchap
|
|
3457
3525
|
[@ricbartm]: https://github.com/ricbartm
|
|
3458
3526
|
[@roccoblues]: https://github.com/roccoblues
|
|
3527
|
+
[@rqz13]: https://github.com/rqz13
|
|
3459
3528
|
[@saturnflyer]: https://github.com/saturnflyer
|
|
3460
3529
|
[@sco11morgan]: https://github.com/sco11morgan
|
|
3461
3530
|
[@senny]: https://github.com/senny
|
data/README.md
CHANGED
|
@@ -3,27 +3,26 @@
|
|
|
3
3
|
[](https://rubygems.org/gems/ddtrace/)
|
|
4
4
|
[](https://circleci.com/gh/DataDog/dd-trace-rb/tree/master)
|
|
5
5
|
[](https://app.codecov.io/gh/DataDog/dd-trace-rb/branch/master)
|
|
6
|
-
[]
|
|
6
|
+
[][api docs]
|
|
7
7
|
|
|
8
8
|
``ddtrace`` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
|
|
9
|
-
databases and microservices so that developers have great
|
|
9
|
+
databases and microservices so that developers have great visibility into bottlenecks and troublesome requests.
|
|
10
10
|
|
|
11
11
|
## Getting started
|
|
12
12
|
|
|
13
13
|
**If you're upgrading from a 0.x version, check out our [upgrade guide](https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide.md#from-0x-to-10).**
|
|
14
14
|
|
|
15
|
-
For a
|
|
15
|
+
For a product overview, installation, and configuration check out our [documentation][public docs].
|
|
16
16
|
|
|
17
|
-
For
|
|
17
|
+
For the gem API, check out our [API documentation][api docs].
|
|
18
18
|
|
|
19
|
-
For descriptions of terminology used in APM, take a look at the [
|
|
19
|
+
For descriptions of terminology used in APM, take a look at the [APM Terms and Concepts][APM glossary].
|
|
20
20
|
|
|
21
21
|
For contributing, checkout the [contribution guidelines][contribution docs] and [development guide][development docs].
|
|
22
22
|
|
|
23
|
-
[
|
|
24
|
-
[api docs]: https://github.
|
|
25
|
-
[
|
|
26
|
-
[visualization docs]: https://docs.datadoghq.com/tracing/visualization/
|
|
23
|
+
[public docs]: https://docs.datadoghq.com/tracing/setup/ruby/
|
|
24
|
+
[api docs]: https://datadog.github.io/dd-trace-rb/
|
|
25
|
+
[APM glossary]: https://docs.datadoghq.com/tracing/glossary/
|
|
27
26
|
[contribution docs]: https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md
|
|
28
27
|
[development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/docs/DevelopmentGuide.md
|
|
29
28
|
|
|
@@ -77,26 +77,33 @@
|
|
|
77
77
|
|
|
78
78
|
// Contains state for a single CpuAndWallTimeWorker instance
|
|
79
79
|
struct cpu_and_wall_time_worker_state {
|
|
80
|
-
|
|
80
|
+
// These are immutable after initialization
|
|
81
81
|
|
|
82
82
|
bool gc_profiling_enabled;
|
|
83
83
|
bool allocation_counting_enabled;
|
|
84
|
+
bool dynamic_sampling_rate_enabled;
|
|
84
85
|
VALUE self_instance;
|
|
85
86
|
VALUE thread_context_collector_instance;
|
|
86
87
|
VALUE idle_sampling_helper_instance;
|
|
87
88
|
VALUE owner_thread;
|
|
88
89
|
dynamic_sampling_rate_state dynamic_sampling_rate;
|
|
90
|
+
VALUE gc_tracepoint; // Used to get gc start/finish information
|
|
91
|
+
VALUE object_allocation_tracepoint; // Used to get allocation counts and allocation profiling
|
|
92
|
+
|
|
93
|
+
// These are mutable and used to signal things between the worker thread and other threads
|
|
89
94
|
|
|
95
|
+
atomic_bool should_run;
|
|
90
96
|
// When something goes wrong during sampling, we record the Ruby exception here, so that it can be "re-raised" on
|
|
91
97
|
// the CpuAndWallTimeWorker thread
|
|
92
98
|
VALUE failure_exception;
|
|
93
99
|
// Used by `_native_stop` to flag the worker thread to start (see comment on `_native_sampling_loop`)
|
|
94
100
|
VALUE stop_thread;
|
|
95
101
|
|
|
96
|
-
//
|
|
97
|
-
VALUE gc_tracepoint;
|
|
102
|
+
// Others
|
|
98
103
|
|
|
99
|
-
|
|
104
|
+
// Used to detect/avoid nested sampling, e.g. when the object_allocation_tracepoint gets triggered by a memory allocation
|
|
105
|
+
// that happens during another sample.
|
|
106
|
+
bool during_sample;
|
|
100
107
|
|
|
101
108
|
struct stats {
|
|
102
109
|
// How many times we tried to trigger a sample
|
|
@@ -115,6 +122,8 @@ struct cpu_and_wall_time_worker_state {
|
|
|
115
122
|
uint64_t sampling_time_ns_min;
|
|
116
123
|
uint64_t sampling_time_ns_max;
|
|
117
124
|
uint64_t sampling_time_ns_total;
|
|
125
|
+
// How many times we saw allocations being done inside a sample
|
|
126
|
+
unsigned int allocations_during_sample;
|
|
118
127
|
} stats;
|
|
119
128
|
};
|
|
120
129
|
|
|
@@ -125,7 +134,8 @@ static VALUE _native_initialize(
|
|
|
125
134
|
VALUE thread_context_collector_instance,
|
|
126
135
|
VALUE gc_profiling_enabled,
|
|
127
136
|
VALUE idle_sampling_helper_instance,
|
|
128
|
-
VALUE allocation_counting_enabled
|
|
137
|
+
VALUE allocation_counting_enabled,
|
|
138
|
+
VALUE dynamic_sampling_rate_enabled
|
|
129
139
|
);
|
|
130
140
|
static void cpu_and_wall_time_worker_typed_data_mark(void *state_ptr);
|
|
131
141
|
static VALUE _native_sampling_loop(VALUE self, VALUE instance);
|
|
@@ -160,6 +170,7 @@ static void sleep_for(uint64_t time_ns);
|
|
|
160
170
|
static VALUE _native_allocation_count(DDTRACE_UNUSED VALUE self);
|
|
161
171
|
static void on_newobj_event(DDTRACE_UNUSED VALUE tracepoint_data, DDTRACE_UNUSED void *unused);
|
|
162
172
|
static void disable_tracepoints(struct cpu_and_wall_time_worker_state *state);
|
|
173
|
+
static VALUE _native_with_blocked_sigprof(DDTRACE_UNUSED VALUE self);
|
|
163
174
|
|
|
164
175
|
// Note on sampler global state safety:
|
|
165
176
|
//
|
|
@@ -197,7 +208,7 @@ void collectors_cpu_and_wall_time_worker_init(VALUE profiling_module) {
|
|
|
197
208
|
// https://bugs.ruby-lang.org/issues/18007 for a discussion around this.
|
|
198
209
|
rb_define_alloc_func(collectors_cpu_and_wall_time_worker_class, _native_new);
|
|
199
210
|
|
|
200
|
-
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_initialize", _native_initialize,
|
|
211
|
+
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_initialize", _native_initialize, 6);
|
|
201
212
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_sampling_loop", _native_sampling_loop, 1);
|
|
202
213
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_stop", _native_stop, 2);
|
|
203
214
|
rb_define_singleton_method(collectors_cpu_and_wall_time_worker_class, "_native_reset_after_fork", _native_reset_after_fork, 1);
|
|
@@ -212,6 +223,7 @@ void collectors_cpu_and_wall_time_worker_init(VALUE profiling_module) {
|
|
|
212
223
|
rb_define_singleton_method(testing_module, "_native_simulate_handle_sampling_signal", _native_simulate_handle_sampling_signal, 0);
|
|
213
224
|
rb_define_singleton_method(testing_module, "_native_simulate_sample_from_postponed_job", _native_simulate_sample_from_postponed_job, 0);
|
|
214
225
|
rb_define_singleton_method(testing_module, "_native_is_sigprof_blocked_in_current_thread", _native_is_sigprof_blocked_in_current_thread, 0);
|
|
226
|
+
rb_define_singleton_method(testing_module, "_native_with_blocked_sigprof", _native_with_blocked_sigprof, 0);
|
|
215
227
|
}
|
|
216
228
|
|
|
217
229
|
// This structure is used to define a Ruby object that stores a pointer to a struct cpu_and_wall_time_worker_state
|
|
@@ -230,17 +242,22 @@ static const rb_data_type_t cpu_and_wall_time_worker_typed_data = {
|
|
|
230
242
|
static VALUE _native_new(VALUE klass) {
|
|
231
243
|
struct cpu_and_wall_time_worker_state *state = ruby_xcalloc(1, sizeof(struct cpu_and_wall_time_worker_state));
|
|
232
244
|
|
|
233
|
-
atomic_init(&state->should_run, false);
|
|
234
245
|
state->gc_profiling_enabled = false;
|
|
235
246
|
state->allocation_counting_enabled = false;
|
|
247
|
+
state->dynamic_sampling_rate_enabled = true;
|
|
236
248
|
state->thread_context_collector_instance = Qnil;
|
|
237
249
|
state->idle_sampling_helper_instance = Qnil;
|
|
238
250
|
state->owner_thread = Qnil;
|
|
239
251
|
dynamic_sampling_rate_init(&state->dynamic_sampling_rate);
|
|
240
|
-
state->failure_exception = Qnil;
|
|
241
|
-
state->stop_thread = Qnil;
|
|
242
252
|
state->gc_tracepoint = Qnil;
|
|
243
253
|
state->object_allocation_tracepoint = Qnil;
|
|
254
|
+
|
|
255
|
+
atomic_init(&state->should_run, false);
|
|
256
|
+
state->failure_exception = Qnil;
|
|
257
|
+
state->stop_thread = Qnil;
|
|
258
|
+
|
|
259
|
+
state->during_sample = false;
|
|
260
|
+
|
|
244
261
|
reset_stats(state);
|
|
245
262
|
|
|
246
263
|
return state->self_instance = TypedData_Wrap_Struct(klass, &cpu_and_wall_time_worker_typed_data, state);
|
|
@@ -252,16 +269,19 @@ static VALUE _native_initialize(
|
|
|
252
269
|
VALUE thread_context_collector_instance,
|
|
253
270
|
VALUE gc_profiling_enabled,
|
|
254
271
|
VALUE idle_sampling_helper_instance,
|
|
255
|
-
VALUE allocation_counting_enabled
|
|
272
|
+
VALUE allocation_counting_enabled,
|
|
273
|
+
VALUE dynamic_sampling_rate_enabled
|
|
256
274
|
) {
|
|
257
275
|
ENFORCE_BOOLEAN(gc_profiling_enabled);
|
|
258
276
|
ENFORCE_BOOLEAN(allocation_counting_enabled);
|
|
277
|
+
ENFORCE_BOOLEAN(dynamic_sampling_rate_enabled);
|
|
259
278
|
|
|
260
279
|
struct cpu_and_wall_time_worker_state *state;
|
|
261
280
|
TypedData_Get_Struct(self_instance, struct cpu_and_wall_time_worker_state, &cpu_and_wall_time_worker_typed_data, state);
|
|
262
281
|
|
|
263
282
|
state->gc_profiling_enabled = (gc_profiling_enabled == Qtrue);
|
|
264
283
|
state->allocation_counting_enabled = (allocation_counting_enabled == Qtrue);
|
|
284
|
+
state->dynamic_sampling_rate_enabled = (dynamic_sampling_rate_enabled == Qtrue);
|
|
265
285
|
state->thread_context_collector_instance = enforce_thread_context_collector_instance(thread_context_collector_instance);
|
|
266
286
|
state->idle_sampling_helper_instance = idle_sampling_helper_instance;
|
|
267
287
|
state->gc_tracepoint = rb_tracepoint_new(Qnil, RUBY_INTERNAL_EVENT_GC_ENTER | RUBY_INTERNAL_EVENT_GC_EXIT, on_gc_event, NULL /* unused */);
|
|
@@ -460,7 +480,7 @@ static void *run_sampling_trigger_loop(void *state_ptr) {
|
|
|
460
480
|
// `dynamic_sampling_rate_get_sleep` may have changed while the above sleep was ongoing.
|
|
461
481
|
uint64_t extra_sleep =
|
|
462
482
|
dynamic_sampling_rate_get_sleep(&state->dynamic_sampling_rate, monotonic_wall_time_now_ns(DO_NOT_RAISE_ON_FAILURE));
|
|
463
|
-
if (extra_sleep > 0) sleep_for(extra_sleep);
|
|
483
|
+
if (state->dynamic_sampling_rate_enabled && extra_sleep > 0) sleep_for(extra_sleep);
|
|
464
484
|
}
|
|
465
485
|
|
|
466
486
|
return NULL; // Unused
|
|
@@ -485,8 +505,12 @@ static void sample_from_postponed_job(DDTRACE_UNUSED void *_unused) {
|
|
|
485
505
|
return; // We're not on the main Ractor; we currently don't support profiling non-main Ractors
|
|
486
506
|
}
|
|
487
507
|
|
|
508
|
+
state->during_sample = true;
|
|
509
|
+
|
|
488
510
|
// Rescue against any exceptions that happen during sampling
|
|
489
511
|
safely_call(rescued_sample_from_postponed_job, state->self_instance, state->self_instance);
|
|
512
|
+
|
|
513
|
+
state->during_sample = false;
|
|
490
514
|
}
|
|
491
515
|
|
|
492
516
|
static VALUE rescued_sample_from_postponed_job(VALUE self_instance) {
|
|
@@ -672,8 +696,12 @@ static void after_gc_from_postponed_job(DDTRACE_UNUSED void *_unused) {
|
|
|
672
696
|
return; // We're not on the main Ractor; we currently don't support profiling non-main Ractors
|
|
673
697
|
}
|
|
674
698
|
|
|
699
|
+
state->during_sample = true;
|
|
700
|
+
|
|
675
701
|
// Trigger sampling using the Collectors::ThreadState; rescue against any exceptions that happen during sampling
|
|
676
702
|
safely_call(thread_context_collector_sample_after_gc, state->thread_context_collector_instance, state->self_instance);
|
|
703
|
+
|
|
704
|
+
state->during_sample = false;
|
|
677
705
|
}
|
|
678
706
|
|
|
679
707
|
// Equivalent to Ruby begin/rescue call, where we call a C function and jump to the exception handler if an
|
|
@@ -753,6 +781,7 @@ static VALUE _native_stats(DDTRACE_UNUSED VALUE self, VALUE instance) {
|
|
|
753
781
|
ID2SYM(rb_intern("sampling_time_ns_max")), /* => */ pretty_sampling_time_ns_max,
|
|
754
782
|
ID2SYM(rb_intern("sampling_time_ns_total")), /* => */ pretty_sampling_time_ns_total,
|
|
755
783
|
ID2SYM(rb_intern("sampling_time_ns_avg")), /* => */ pretty_sampling_time_ns_avg,
|
|
784
|
+
ID2SYM(rb_intern("allocations_during_sample")), /* => */ UINT2NUM(state->stats.allocations_during_sample),
|
|
756
785
|
};
|
|
757
786
|
for (long unsigned int i = 0; i < VALUE_COUNT(arguments); i += 2) rb_hash_aset(stats_as_hash, arguments[i], arguments[i+1]);
|
|
758
787
|
return stats_as_hash;
|
|
@@ -813,9 +842,45 @@ static void on_newobj_event(DDTRACE_UNUSED VALUE tracepoint_data, DDTRACE_UNUSED
|
|
|
813
842
|
} else {
|
|
814
843
|
allocation_count++;
|
|
815
844
|
}
|
|
845
|
+
|
|
846
|
+
struct cpu_and_wall_time_worker_state *state = active_sampler_instance_state; // Read from global variable, see "sampler global state safety" note above
|
|
847
|
+
|
|
848
|
+
// This should not happen in a normal situation because the tracepoint is always enabled after the instance is set
|
|
849
|
+
// and disabled before it is cleared, but just in case...
|
|
850
|
+
if (state == NULL) return;
|
|
851
|
+
|
|
852
|
+
// In a few cases, we may actually be allocating an object as part of profiler sampling. We don't want to recursively
|
|
853
|
+
// sample, so we just return early
|
|
854
|
+
if (state->during_sample) {
|
|
855
|
+
state->stats.allocations_during_sample++;
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// @ivoanjo: Strictly speaking, this is not needed because Ruby should not call the same tracepoint while a previous
|
|
860
|
+
// invocation is still pending, (e.g. it wouldn't call `on_newobj_event` while it's already running), but I decided
|
|
861
|
+
// to keep this here for consistency -- every call to the thread context (other than the special gc calls which are
|
|
862
|
+
// defined as not being able to allocate) sets this.
|
|
863
|
+
state->during_sample = true;
|
|
864
|
+
|
|
865
|
+
// TODO: Sampling goes here (calling into `thread_context_collector_sample_allocation`)
|
|
866
|
+
|
|
867
|
+
state->during_sample = false;
|
|
816
868
|
}
|
|
817
869
|
|
|
818
870
|
static void disable_tracepoints(struct cpu_and_wall_time_worker_state *state) {
|
|
819
871
|
rb_tracepoint_disable(state->gc_tracepoint);
|
|
820
872
|
rb_tracepoint_disable(state->object_allocation_tracepoint);
|
|
821
873
|
}
|
|
874
|
+
|
|
875
|
+
static VALUE _native_with_blocked_sigprof(DDTRACE_UNUSED VALUE self) {
|
|
876
|
+
block_sigprof_signal_handler_from_running_in_current_thread();
|
|
877
|
+
int exception_state;
|
|
878
|
+
VALUE result = rb_protect(rb_yield, Qundef, &exception_state);
|
|
879
|
+
unblock_sigprof_signal_handler_from_running_in_current_thread();
|
|
880
|
+
|
|
881
|
+
if (exception_state) {
|
|
882
|
+
rb_jump_tag(exception_state);
|
|
883
|
+
} else {
|
|
884
|
+
return result;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
@@ -97,6 +97,8 @@ struct thread_context_collector_state {
|
|
|
97
97
|
unsigned int sample_count;
|
|
98
98
|
// Reusable array to get list of threads
|
|
99
99
|
VALUE thread_list_buffer;
|
|
100
|
+
// Used to omit endpoint names (retrieved from tracer) from collected data
|
|
101
|
+
bool endpoint_collection_enabled;
|
|
100
102
|
|
|
101
103
|
struct stats {
|
|
102
104
|
// Track how many garbage collection samples we've taken.
|
|
@@ -140,7 +142,14 @@ static void thread_context_collector_typed_data_free(void *state_ptr);
|
|
|
140
142
|
static int hash_map_per_thread_context_mark(st_data_t key_thread, st_data_t _value, st_data_t _argument);
|
|
141
143
|
static int hash_map_per_thread_context_free_values(st_data_t _thread, st_data_t value_per_thread_context, st_data_t _argument);
|
|
142
144
|
static VALUE _native_new(VALUE klass);
|
|
143
|
-
static VALUE _native_initialize(
|
|
145
|
+
static VALUE _native_initialize(
|
|
146
|
+
VALUE self,
|
|
147
|
+
VALUE collector_instance,
|
|
148
|
+
VALUE recorder_instance,
|
|
149
|
+
VALUE max_frames,
|
|
150
|
+
VALUE tracer_context_key,
|
|
151
|
+
VALUE endpoint_collection_enabled
|
|
152
|
+
);
|
|
144
153
|
static VALUE _native_sample(VALUE self, VALUE collector_instance, VALUE profiler_overhead_stack_thread);
|
|
145
154
|
static VALUE _native_on_gc_start(VALUE self, VALUE collector_instance);
|
|
146
155
|
static VALUE _native_on_gc_finish(VALUE self, VALUE collector_instance);
|
|
@@ -198,7 +207,7 @@ void collectors_thread_context_init(VALUE profiling_module) {
|
|
|
198
207
|
// https://bugs.ruby-lang.org/issues/18007 for a discussion around this.
|
|
199
208
|
rb_define_alloc_func(collectors_thread_context_class, _native_new);
|
|
200
209
|
|
|
201
|
-
rb_define_singleton_method(collectors_thread_context_class, "_native_initialize", _native_initialize,
|
|
210
|
+
rb_define_singleton_method(collectors_thread_context_class, "_native_initialize", _native_initialize, 5);
|
|
202
211
|
rb_define_singleton_method(collectors_thread_context_class, "_native_inspect", _native_inspect, 1);
|
|
203
212
|
rb_define_singleton_method(collectors_thread_context_class, "_native_reset_after_fork", _native_reset_after_fork, 1);
|
|
204
213
|
rb_define_singleton_method(testing_module, "_native_sample", _native_sample, 2);
|
|
@@ -284,11 +293,21 @@ static VALUE _native_new(VALUE klass) {
|
|
|
284
293
|
state->recorder_instance = Qnil;
|
|
285
294
|
state->tracer_context_key = MISSING_TRACER_CONTEXT_KEY;
|
|
286
295
|
state->thread_list_buffer = rb_ary_new();
|
|
296
|
+
state->endpoint_collection_enabled = true;
|
|
287
297
|
|
|
288
298
|
return TypedData_Wrap_Struct(klass, &thread_context_collector_typed_data, state);
|
|
289
299
|
}
|
|
290
300
|
|
|
291
|
-
static VALUE _native_initialize(
|
|
301
|
+
static VALUE _native_initialize(
|
|
302
|
+
DDTRACE_UNUSED VALUE _self,
|
|
303
|
+
VALUE collector_instance,
|
|
304
|
+
VALUE recorder_instance,
|
|
305
|
+
VALUE max_frames,
|
|
306
|
+
VALUE tracer_context_key,
|
|
307
|
+
VALUE endpoint_collection_enabled
|
|
308
|
+
) {
|
|
309
|
+
ENFORCE_BOOLEAN(endpoint_collection_enabled);
|
|
310
|
+
|
|
292
311
|
struct thread_context_collector_state *state;
|
|
293
312
|
TypedData_Get_Struct(collector_instance, struct thread_context_collector_state, &thread_context_collector_typed_data, state);
|
|
294
313
|
|
|
@@ -299,6 +318,7 @@ static VALUE _native_initialize(DDTRACE_UNUSED VALUE _self, VALUE collector_inst
|
|
|
299
318
|
state->sampling_buffer = sampling_buffer_new(max_frames_requested);
|
|
300
319
|
// hash_map_per_thread_context is already initialized, nothing to do here
|
|
301
320
|
state->recorder_instance = enforce_recorder_instance(recorder_instance);
|
|
321
|
+
state->endpoint_collection_enabled = (endpoint_collection_enabled == Qtrue);
|
|
302
322
|
|
|
303
323
|
if (RTEST(tracer_context_key)) {
|
|
304
324
|
ENFORCE_TYPE(tracer_context_key, T_SYMBOL);
|
|
@@ -732,6 +752,7 @@ static VALUE _native_inspect(DDTRACE_UNUSED VALUE _self, VALUE collector_instanc
|
|
|
732
752
|
rb_str_concat(result, rb_sprintf(" tracer_context_key=%+"PRIsVALUE, tracer_context_key));
|
|
733
753
|
rb_str_concat(result, rb_sprintf(" sample_count=%u", state->sample_count));
|
|
734
754
|
rb_str_concat(result, rb_sprintf(" stats=%"PRIsVALUE, stats_as_ruby_hash(state)));
|
|
755
|
+
rb_str_concat(result, rb_sprintf(" endpoint_collection_enabled=%"PRIsVALUE, state->endpoint_collection_enabled ? Qtrue : Qfalse));
|
|
735
756
|
|
|
736
757
|
return result;
|
|
737
758
|
}
|
|
@@ -911,6 +932,8 @@ static void trace_identifiers_for(struct thread_context_collector_state *state,
|
|
|
911
932
|
|
|
912
933
|
trace_identifiers_result->valid = true;
|
|
913
934
|
|
|
935
|
+
if (!state->endpoint_collection_enabled) return;
|
|
936
|
+
|
|
914
937
|
VALUE root_span_type = rb_ivar_get(root_span, at_type_id /* @type */);
|
|
915
938
|
if (root_span_type == Qnil || !is_type_web(root_span_type)) return;
|
|
916
939
|
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
#pragma GCC diagnostic push
|
|
20
20
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
21
21
|
#pragma GCC diagnostic ignored "-Wattributes"
|
|
22
|
+
#pragma GCC diagnostic ignored "-Wpragmas"
|
|
23
|
+
#pragma GCC diagnostic ignored "-Wexpansion-to-defined"
|
|
22
24
|
#include <vm_core.h>
|
|
23
25
|
#pragma GCC diagnostic pop
|
|
24
26
|
#include <iseq.h>
|
|
@@ -651,6 +653,7 @@ check_method_entry(VALUE obj, int can_be_svar)
|
|
|
651
653
|
if (can_be_svar) {
|
|
652
654
|
return check_method_entry(((struct vm_svar *)obj)->cref_or_me, FALSE);
|
|
653
655
|
}
|
|
656
|
+
// fallthrough
|
|
654
657
|
default:
|
|
655
658
|
#if VM_CHECK_MODE > 0
|
|
656
659
|
rb_bug("check_method_entry: svar should not be there:");
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'processor'
|
|
4
|
+
require_relative 'processor/rule_merger'
|
|
5
|
+
require_relative 'processor/rule_loader'
|
|
4
6
|
|
|
5
7
|
module Datadog
|
|
6
8
|
module AppSec
|
|
@@ -10,14 +12,27 @@ module Datadog
|
|
|
10
12
|
def build_appsec_component(settings)
|
|
11
13
|
return unless settings.respond_to?(:appsec) && settings.appsec.enabled
|
|
12
14
|
|
|
13
|
-
processor = create_processor
|
|
15
|
+
processor = create_processor(settings)
|
|
14
16
|
new(processor: processor)
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
private
|
|
18
20
|
|
|
19
|
-
def create_processor
|
|
20
|
-
|
|
21
|
+
def create_processor(settings)
|
|
22
|
+
rules = AppSec::Processor::RuleLoader.load_rules(ruleset: settings.appsec.ruleset)
|
|
23
|
+
return nil unless rules
|
|
24
|
+
|
|
25
|
+
data = AppSec::Processor::RuleLoader.load_data(
|
|
26
|
+
ip_denylist: settings.appsec.ip_denylist,
|
|
27
|
+
user_id_denylist: settings.appsec.user_id_denylist
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
ruleset = AppSec::Processor::RuleMerger.merge(
|
|
31
|
+
rules: [rules],
|
|
32
|
+
data: data,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
processor = Processor.new(ruleset: ruleset)
|
|
21
36
|
return nil unless processor.ready?
|
|
22
37
|
|
|
23
38
|
processor
|
|
@@ -28,12 +43,31 @@ module Datadog
|
|
|
28
43
|
|
|
29
44
|
def initialize(processor:)
|
|
30
45
|
@processor = processor
|
|
46
|
+
@mutex = Mutex.new
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def reconfigure(ruleset:)
|
|
50
|
+
@mutex.synchronize do
|
|
51
|
+
new = Processor.new(ruleset: ruleset)
|
|
52
|
+
|
|
53
|
+
if new && new.ready?
|
|
54
|
+
old = @processor
|
|
55
|
+
@processor = new
|
|
56
|
+
old.finalize
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def reconfigure_lock(&block)
|
|
62
|
+
@mutex.synchronize(&block)
|
|
31
63
|
end
|
|
32
64
|
|
|
33
65
|
def shutdown!
|
|
34
|
-
|
|
35
|
-
processor.
|
|
36
|
-
|
|
66
|
+
@mutex.synchronize do
|
|
67
|
+
if processor && processor.ready?
|
|
68
|
+
processor.finalize
|
|
69
|
+
@processor = nil
|
|
70
|
+
end
|
|
37
71
|
end
|
|
38
72
|
end
|
|
39
73
|
end
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'set'
|
|
4
|
+
|
|
1
5
|
module Datadog
|
|
2
6
|
module AppSec
|
|
3
7
|
module Configuration
|
|
@@ -87,8 +91,8 @@ module Datadog
|
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
# rubocop:disable Layout/LineLength
|
|
90
|
-
DEFAULT_OBFUSCATOR_KEY_REGEX = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization'
|
|
91
|
-
DEFAULT_OBFUSCATOR_VALUE_REGEX = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\s*=[^;]|"\s*:\s*"[^"]+")|bearer\s+[a-z0-9\._\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\w=-]+\.ey[I-L][\w=-]+(?:\.[\w.+\/=-]+)?|[\-]{5}BEGIN[a-z\s]+PRIVATE\sKEY[\-]{5}[^\-]+[\-]{5}END[a-z\s]+PRIVATE\sKEY|ssh-rsa\s*[a-z0-9\/\.+]{100,}'
|
|
94
|
+
DEFAULT_OBFUSCATOR_KEY_REGEX = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?)key)|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)|bearer|authorization'
|
|
95
|
+
DEFAULT_OBFUSCATOR_VALUE_REGEX = '(?i)(?:p(?:ass)?w(?:or)?d|pass(?:_?phrase)?|secret|(?:api_?|private_?|public_?|access_?|secret_?)key(?:_?id)?|token|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)(?:\s*=[^;]|"\s*:\s*"[^"]+")|bearer\s+[a-z0-9\._\-]+|token:[a-z0-9]{13}|gh[opsu]_[0-9a-zA-Z]{36}|ey[I-L][\w=-]+\.ey[I-L][\w=-]+(?:\.[\w.+\/=-]+)?|[\-]{5}BEGIN[a-z\s]+PRIVATE\sKEY[\-]{5}[^\-]+[\-]{5}END[a-z\s]+PRIVATE\sKEY|ssh-rsa\s*[a-z0-9\/\.+]{100,}'
|
|
92
96
|
# rubocop:enable Layout/LineLength
|
|
93
97
|
|
|
94
98
|
DEFAULTS = {
|
|
@@ -116,9 +120,14 @@ module Datadog
|
|
|
116
120
|
|
|
117
121
|
def initialize
|
|
118
122
|
@integrations = []
|
|
123
|
+
# Stores which options have been configured using Datadog.configure block or ENV variables
|
|
124
|
+
@configured = Set.new
|
|
119
125
|
@options = DEFAULTS.dup.tap do |options|
|
|
120
126
|
ENVS.each do |env, (key, conv)|
|
|
121
|
-
|
|
127
|
+
if ENV[env]
|
|
128
|
+
options[key] = conv.call(ENV[env])
|
|
129
|
+
@configured << key
|
|
130
|
+
end
|
|
122
131
|
end
|
|
123
132
|
end
|
|
124
133
|
end
|
|
@@ -182,7 +191,10 @@ module Datadog
|
|
|
182
191
|
|
|
183
192
|
def merge(dsl)
|
|
184
193
|
dsl.options.each do |k, v|
|
|
185
|
-
|
|
194
|
+
unless v.nil?
|
|
195
|
+
@options[k] = v
|
|
196
|
+
@configured << k
|
|
197
|
+
end
|
|
186
198
|
end
|
|
187
199
|
|
|
188
200
|
return self unless @options[:enabled]
|
|
@@ -206,6 +218,10 @@ module Datadog
|
|
|
206
218
|
|
|
207
219
|
private
|
|
208
220
|
|
|
221
|
+
def default?(option)
|
|
222
|
+
!@configured.include?(option)
|
|
223
|
+
end
|
|
224
|
+
|
|
209
225
|
# Restore to original state, for testing only.
|
|
210
226
|
def reset!
|
|
211
227
|
initialize
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative 'configuration/settings'
|
|
2
4
|
|
|
3
5
|
module Datadog
|
|
@@ -82,6 +84,12 @@ module Datadog
|
|
|
82
84
|
def settings
|
|
83
85
|
@settings ||= Settings.new
|
|
84
86
|
end
|
|
87
|
+
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def default_setting?(setting)
|
|
91
|
+
settings.send(:default?, setting)
|
|
92
|
+
end
|
|
85
93
|
end
|
|
86
94
|
end
|
|
87
95
|
end
|