ddtrace 1.10.0 → 1.11.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -2
- data/LICENSE-3rdparty.csv +1 -0
- 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 +41 -7
- 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 +7 -25
- 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/ext/environment.rb +2 -20
- 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 +12 -15
- 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/network.rb +140 -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/vendor/ipaddr.rb +78 -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/appsec/events.rb +1 -1
- 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/client_ip.rb +39 -140
- 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/http/traces.rb +1 -1
- 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/transport/traces.rb +1 -1
- data/lib/ddtrace/version.rb +6 -4
- data/lib/ddtrace.rb +2 -0
- metadata +45 -9
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../../metadata/ext'
|
2
4
|
require_relative '../analytics'
|
5
|
+
require_relative 'distributed/propagation'
|
3
6
|
require_relative 'ext'
|
4
|
-
require_relative '
|
7
|
+
require_relative 'utils'
|
5
8
|
|
6
9
|
module Datadog
|
7
10
|
module Tracing
|
@@ -9,7 +12,7 @@ module Datadog
|
|
9
12
|
module Sidekiq
|
10
13
|
# Tracer is a Sidekiq client-side middleware which traces job enqueues/pushes
|
11
14
|
class ClientTracer
|
12
|
-
include
|
15
|
+
include Utils
|
13
16
|
|
14
17
|
def initialize(options = {})
|
15
18
|
@sidekiq_service = options[:client_service_name] || configuration[:client_service_name]
|
@@ -20,7 +23,9 @@ module Datadog
|
|
20
23
|
def call(worker_class, job, queue, redis_pool)
|
21
24
|
resource = job_resource(job)
|
22
25
|
|
23
|
-
Datadog::Tracing.trace(Ext::SPAN_PUSH, service: @sidekiq_service) do |span|
|
26
|
+
Datadog::Tracing.trace(Ext::SPAN_PUSH, service: @sidekiq_service) do |span, trace_op|
|
27
|
+
propagation.inject!(trace_op, job) if configuration[:distributed_tracing]
|
28
|
+
|
24
29
|
span.resource = resource
|
25
30
|
|
26
31
|
span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_COMPONENT)
|
@@ -50,6 +55,10 @@ module Datadog
|
|
50
55
|
def configuration
|
51
56
|
Datadog.configuration.tracing[:sidekiq]
|
52
57
|
end
|
58
|
+
|
59
|
+
def propagation
|
60
|
+
@propagation ||= Contrib::Sidekiq::Distributed::Propagation.new
|
61
|
+
end
|
53
62
|
end
|
54
63
|
end
|
55
64
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../../../span_operation'
|
2
4
|
require_relative '../../configuration/settings'
|
3
5
|
require_relative '../ext'
|
@@ -34,6 +36,7 @@ module Datadog
|
|
34
36
|
option :client_service_name
|
35
37
|
option :error_handler, default: Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
|
36
38
|
option :quantize, default: {}
|
39
|
+
option :distributed_tracing, default: false
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../distributed/fetcher'
|
4
|
+
require_relative '../../../distributed/propagation'
|
5
|
+
require_relative '../../../distributed/b3_multi'
|
6
|
+
require_relative '../../../distributed/b3_single'
|
7
|
+
require_relative '../../../distributed/datadog'
|
8
|
+
require_relative '../../../distributed/none'
|
9
|
+
require_relative '../../../distributed/trace_context'
|
10
|
+
require_relative '../../../configuration/ext'
|
11
|
+
|
12
|
+
module Datadog
|
13
|
+
module Tracing
|
14
|
+
module Contrib
|
15
|
+
module Sidekiq
|
16
|
+
module Distributed
|
17
|
+
# Extracts and injects propagation through HTTP headers.
|
18
|
+
class Propagation < Tracing::Distributed::Propagation
|
19
|
+
def initialize
|
20
|
+
super(
|
21
|
+
propagation_styles: {
|
22
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_MULTI_HEADER =>
|
23
|
+
Tracing::Distributed::B3Multi.new(fetcher: Tracing::Distributed::Fetcher),
|
24
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER =>
|
25
|
+
Tracing::Distributed::B3Single.new(fetcher: Tracing::Distributed::Fetcher),
|
26
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG =>
|
27
|
+
Tracing::Distributed::Datadog.new(fetcher: Tracing::Distributed::Fetcher),
|
28
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_TRACE_CONTEXT =>
|
29
|
+
Tracing::Distributed::TraceContext.new(fetcher: Tracing::Distributed::Fetcher),
|
30
|
+
Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new
|
31
|
+
})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../../metadata/ext'
|
2
4
|
require_relative '../analytics'
|
3
5
|
require_relative 'ext'
|
4
|
-
require_relative '
|
6
|
+
require_relative 'utils'
|
5
7
|
require_relative '../utils/quantization/hash'
|
8
|
+
require_relative 'distributed/propagation'
|
6
9
|
|
7
10
|
module Datadog
|
8
11
|
module Tracing
|
@@ -10,7 +13,7 @@ module Datadog
|
|
10
13
|
module Sidekiq
|
11
14
|
# Tracer is a Sidekiq server-side middleware which traces executed jobs
|
12
15
|
class ServerTracer
|
13
|
-
include
|
16
|
+
include Utils
|
14
17
|
|
15
18
|
QUANTIZE_SHOW_ALL = { args: { show: :all } }.freeze
|
16
19
|
|
@@ -19,9 +22,16 @@ module Datadog
|
|
19
22
|
@error_handler = options[:error_handler] || configuration[:error_handler]
|
20
23
|
end
|
21
24
|
|
25
|
+
# rubocop:disable Metrics/MethodLength
|
26
|
+
# rubocop:disable Metrics/AbcSize
|
22
27
|
def call(worker, job, queue)
|
23
28
|
resource = job_resource(job)
|
24
29
|
|
30
|
+
if configuration[:distributed_tracing]
|
31
|
+
trace_digest = propagation.extract(job)
|
32
|
+
Datadog::Tracing.continue_trace!(trace_digest)
|
33
|
+
end
|
34
|
+
|
25
35
|
service = worker_config(resource, :service_name) || @sidekiq_service
|
26
36
|
# DEV-2.0: Remove `tag_args`, as `quantize` can fulfill the same contract
|
27
37
|
tag_args = worker_config(resource, :tag_args) || configuration[:tag_args]
|
@@ -68,10 +78,16 @@ module Datadog
|
|
68
78
|
|
69
79
|
yield
|
70
80
|
end
|
81
|
+
# rubocop:enable Metrics/MethodLength
|
82
|
+
# rubocop:enable Metrics/AbcSize
|
71
83
|
end
|
72
84
|
|
73
85
|
private
|
74
86
|
|
87
|
+
def propagation
|
88
|
+
@propagation ||= Contrib::Sidekiq::Distributed::Propagation.new
|
89
|
+
end
|
90
|
+
|
75
91
|
def quantize_args(quantize, args)
|
76
92
|
quantize_options = quantize && quantize[:args]
|
77
93
|
quantize_options ||= {}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
|
3
5
|
require_relative '../../../core'
|
@@ -8,7 +10,7 @@ module Datadog
|
|
8
10
|
module Contrib
|
9
11
|
module Sidekiq
|
10
12
|
# Common functionality used by both client-side and server-side tracers.
|
11
|
-
module
|
13
|
+
module Utils
|
12
14
|
protected
|
13
15
|
|
14
16
|
# If class is wrapping something else, the interesting resource info
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Tracing
|
5
|
+
module Contrib
|
6
|
+
# Contains methods for fetching values according to span attributes schema
|
7
|
+
module SpanAttributeSchema
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def fetch_service_name(env, default)
|
11
|
+
ENV.fetch(env) do
|
12
|
+
if Datadog.configuration.tracing.span_attribute_schema ==
|
13
|
+
Tracing::Configuration::Ext::SpanAttributeSchema::VERSION_ONE
|
14
|
+
Datadog.configuration.service
|
15
|
+
else
|
16
|
+
default
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def default_span_attribute_schema?
|
22
|
+
Datadog.configuration.tracing.span_attribute_schema ==
|
23
|
+
Tracing::Configuration::Ext::SpanAttributeSchema::DEFAULT_VERSION
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -10,11 +10,11 @@ module Datadog
|
|
10
10
|
module HTTP
|
11
11
|
PLACEHOLDER = '?'.freeze
|
12
12
|
|
13
|
-
# taken from Ruby https://github.com/ruby/uri/blob/
|
13
|
+
# taken from Ruby https://github.com/ruby/uri/blob/eaf89cc31619d49e67c64d0b58ea9dc38892d175/lib/uri/rfc3986_parser.rb
|
14
14
|
# but adjusted to parse only <scheme>://<host>:<port>/ components
|
15
15
|
# and stop there, since we don't care about the path, query string,
|
16
16
|
# and fragment components
|
17
|
-
RFC3986_URL_BASE = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]
|
17
|
+
RFC3986_URL_BASE = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*+):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*+)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h++\.[!$&-.0-;=A-Z_a-z~]++))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*+))(?::(?<port>\d*+))?)))(?:\/|\z)/.freeze # rubocop:disable Style/RegexpLiteral, Layout/LineLength
|
18
18
|
|
19
19
|
module_function
|
20
20
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../tracing'
|
2
4
|
require_relative 'contrib/registry'
|
3
5
|
require_relative 'contrib/extensions'
|
@@ -67,6 +69,7 @@ require_relative 'contrib/rake/integration'
|
|
67
69
|
require_relative 'contrib/redis/integration'
|
68
70
|
require_relative 'contrib/resque/integration'
|
69
71
|
require_relative 'contrib/rest_client/integration'
|
72
|
+
require_relative 'contrib/roda/integration'
|
70
73
|
require_relative 'contrib/semantic_logger/integration'
|
71
74
|
require_relative 'contrib/sequel/integration'
|
72
75
|
require_relative 'contrib/shoryuken/integration'
|
@@ -46,18 +46,18 @@ module Datadog
|
|
46
46
|
version: nil
|
47
47
|
)
|
48
48
|
# Dup and freeze strings so they aren't modified by reference.
|
49
|
-
@env = Core::Utils::SafeDup.
|
50
|
-
@service = Core::Utils::SafeDup.
|
49
|
+
@env = Core::Utils::SafeDup.frozen_dup(env || Datadog.configuration.env)
|
50
|
+
@service = Core::Utils::SafeDup.frozen_dup(service || Datadog.configuration.service)
|
51
51
|
@span_id = span_id || 0
|
52
|
-
@span_name = Core::Utils::SafeDup.
|
53
|
-
@span_resource = Core::Utils::SafeDup.
|
54
|
-
@span_service = Core::Utils::SafeDup.
|
55
|
-
@span_type = Core::Utils::SafeDup.
|
52
|
+
@span_name = Core::Utils::SafeDup.frozen_dup(span_name)
|
53
|
+
@span_resource = Core::Utils::SafeDup.frozen_dup(span_resource)
|
54
|
+
@span_service = Core::Utils::SafeDup.frozen_dup(span_service)
|
55
|
+
@span_type = Core::Utils::SafeDup.frozen_dup(span_type)
|
56
56
|
@trace_id = trace_id || 0
|
57
|
-
@trace_name = Core::Utils::SafeDup.
|
58
|
-
@trace_resource = Core::Utils::SafeDup.
|
59
|
-
@trace_service = Core::Utils::SafeDup.
|
60
|
-
@version = Core::Utils::SafeDup.
|
57
|
+
@trace_name = Core::Utils::SafeDup.frozen_dup(trace_name)
|
58
|
+
@trace_resource = Core::Utils::SafeDup.frozen_dup(trace_resource)
|
59
|
+
@trace_service = Core::Utils::SafeDup.frozen_dup(trace_service)
|
60
|
+
@version = Core::Utils::SafeDup.frozen_dup(version || Datadog.configuration.version)
|
61
61
|
end
|
62
62
|
|
63
63
|
def to_log_format
|
@@ -193,20 +193,24 @@ module Datadog
|
|
193
193
|
|
194
194
|
# Serialize `_dd.p.{key}` by first removing the `_dd.p.` prefix.
|
195
195
|
# Then replacing invalid characters with `_`.
|
196
|
+
#
|
197
|
+
# The argument `name` is always frozen.
|
198
|
+
# Returns a new String object for the serialized key.
|
196
199
|
def serialize_tag_key(name)
|
197
200
|
key = name.delete_prefix(Tracing::Metadata::Ext::Distributed::TAGS_PREFIX)
|
198
201
|
|
199
202
|
# DEV: It's unlikely that characters will be out of range, as they mostly
|
200
203
|
# DEV: come from Datadog-controlled sources.
|
201
|
-
# DEV: Trying to `match?` is measurably faster than a `gsub
|
202
|
-
if INVALID_TAG_KEY_CHARS.match?(key)
|
203
|
-
|
204
|
-
|
205
|
-
key
|
206
|
-
end
|
204
|
+
# DEV: Trying to `match?` is measurably faster than a `gsub!` that does not match.
|
205
|
+
key.gsub!(INVALID_TAG_KEY_CHARS, '_') if INVALID_TAG_KEY_CHARS.match?(key)
|
206
|
+
|
207
|
+
key
|
207
208
|
end
|
208
209
|
|
209
|
-
# Replaces invalid characters with `_`, then replaces `=` with
|
210
|
+
# Replaces invalid characters with `_`, then replaces `=` with `~`.
|
211
|
+
#
|
212
|
+
# The argument `value` belongs to {TraceDigest}, thus should not be directly modified.
|
213
|
+
# Returns a new String object for the serialized value.
|
210
214
|
def serialize_tag_value(value)
|
211
215
|
# DEV: It's unlikely that characters will be out of range, as they mostly
|
212
216
|
# DEV: come from Datadog-controlled sources.
|
@@ -217,9 +221,12 @@ module Datadog
|
|
217
221
|
value
|
218
222
|
end
|
219
223
|
|
220
|
-
# DEV: Checking for an unlikely '=' is faster than a no-op `tr
|
221
|
-
|
222
|
-
|
224
|
+
# DEV: Checking for an unlikely '=' is faster than a no-op `tr`.
|
225
|
+
if ret.include?('=')
|
226
|
+
ret.tr('=', '~')
|
227
|
+
else
|
228
|
+
ret
|
229
|
+
end
|
223
230
|
end
|
224
231
|
|
225
232
|
def extract_traceparent(traceparent)
|
@@ -309,9 +316,9 @@ module Datadog
|
|
309
316
|
[origin, sampling_priority, tags, unknown_fields]
|
310
317
|
end
|
311
318
|
|
312
|
-
# Restore
|
319
|
+
# Restore `~` back to `=`.
|
313
320
|
def deserialize_tag_value(value)
|
314
|
-
value.tr!('
|
321
|
+
value.tr!('~', '=')
|
315
322
|
value
|
316
323
|
end
|
317
324
|
|
@@ -363,9 +370,9 @@ module Datadog
|
|
363
370
|
INVALID_TAG_KEY_CHARS = /[\u0000-\u0020,=\u007F-\u{10FFFF}]/.freeze
|
364
371
|
private_constant :INVALID_TAG_KEY_CHARS
|
365
372
|
|
366
|
-
# Replace all characters with `_`, except ASCII characters 0x20-
|
367
|
-
# Additionally,
|
368
|
-
INVALID_TAG_VALUE_CHARS = /[\u0000-\u001F
|
373
|
+
# Replace all characters with `_`, except ASCII characters 0x20-0x7D.
|
374
|
+
# Additionally, `,` and `;` must also be replaced by `_`.
|
375
|
+
INVALID_TAG_VALUE_CHARS = /[\u0000-\u001F,;\u007E-\u{10FFFF}]/.freeze
|
369
376
|
private_constant :INVALID_TAG_VALUE_CHARS
|
370
377
|
end
|
371
378
|
end
|
@@ -176,6 +176,12 @@ module Datadog
|
|
176
176
|
TAG_CONSUMER = 'consumer'
|
177
177
|
TAG_INTERNAL = 'internal'
|
178
178
|
end
|
179
|
+
|
180
|
+
# @public_api
|
181
|
+
module SpanAttributeSchema
|
182
|
+
# current span attribute schema version
|
183
|
+
TAG_SCHEMA_VERSION = '_dd.trace_span_attribute_schema'
|
184
|
+
end
|
179
185
|
end
|
180
186
|
end
|
181
187
|
end
|
data/lib/datadog/tracing.rb
CHANGED
@@ -53,6 +53,18 @@ module Datadog
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
def get(env)
|
57
|
+
get = ::Net::HTTP::Get.new(env.path, env.headers)
|
58
|
+
|
59
|
+
# Connect and send the request
|
60
|
+
http_response = open do |http|
|
61
|
+
http.request(get)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Build and return response
|
65
|
+
Response.new(http_response)
|
66
|
+
end
|
67
|
+
|
56
68
|
def post(env)
|
57
69
|
post = nil
|
58
70
|
|