ddtrace 1.10.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +125 -1
- data/README.md +8 -10
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +110 -18
- 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 -4
- 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 +68 -17
- 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 +70 -16
- 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 +58 -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 +225 -0
- data/lib/datadog/core/remote/component.rb +158 -0
- data/lib/datadog/core/remote/configuration/content.rb +84 -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 +292 -0
- data/lib/datadog/core/remote/configuration/target.rb +74 -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/negotiation.rb +57 -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/async.rb +6 -2
- data/lib/datadog/core/workers/interval_loop.rb +7 -1
- 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 +8 -1
- data/lib/datadog/tracing/contrib/active_record/event.rb +2 -0
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +4 -1
- 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 +6 -2
- 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 -1
- 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 +8 -1
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +4 -1
- 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 +8 -1
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +4 -1
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +8 -1
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +5 -3
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +6 -2
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +8 -1
- data/lib/datadog/tracing/contrib/excon/middleware.rb +5 -2
- data/lib/datadog/tracing/contrib/excon/patcher.rb +2 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +8 -1
- data/lib/datadog/tracing/contrib/faraday/connection.rb +2 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +5 -2
- 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 +8 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +5 -2
- 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 +8 -1
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +5 -2
- 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/integration.rb +8 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +16 -2
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +11 -4
- 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_internal_tracer/stop.rb +34 -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 +9 -5
- data/lib/ddtrace.rb +2 -0
- metadata +43 -6
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'path'
|
4
|
+
require_relative 'digest'
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module Core
|
8
|
+
module Remote
|
9
|
+
class Configuration
|
10
|
+
# TargetMap stores information regarding Configuration::Path and Configuration::Target
|
11
|
+
class TargetMap < Hash
|
12
|
+
class << self
|
13
|
+
def parse(hash)
|
14
|
+
opaque_backend_state = hash['signed']['custom']['opaque_backend_state']
|
15
|
+
version = hash['signed']['version']
|
16
|
+
|
17
|
+
map = new
|
18
|
+
|
19
|
+
map.instance_eval do
|
20
|
+
@opaque_backend_state = opaque_backend_state
|
21
|
+
@version = version
|
22
|
+
end
|
23
|
+
|
24
|
+
hash['signed']['targets'].each_with_object(map) do |(p, t), m|
|
25
|
+
path = Configuration::Path.parse(p)
|
26
|
+
target = Configuration::Target.parse(t)
|
27
|
+
|
28
|
+
m[path] = target
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
attr_reader :opaque_backend_state, :version
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
super
|
37
|
+
|
38
|
+
@opaque_backend_state = nil
|
39
|
+
@version = nil
|
40
|
+
end
|
41
|
+
|
42
|
+
private_class_method :new
|
43
|
+
end
|
44
|
+
|
45
|
+
# Target stores digest information
|
46
|
+
class Target
|
47
|
+
class << self
|
48
|
+
def parse(hash)
|
49
|
+
length = Integer(hash['length'])
|
50
|
+
digests = Configuration::DigestList.parse(hash['hashes'])
|
51
|
+
version = Integer(hash['custom']['v'])
|
52
|
+
|
53
|
+
new(digests: digests, length: length, version: version)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
attr_reader :length, :digests, :version
|
58
|
+
|
59
|
+
def initialize(digests:, length:, version:)
|
60
|
+
@digests = digests
|
61
|
+
@length = length
|
62
|
+
@version = version
|
63
|
+
end
|
64
|
+
|
65
|
+
private_class_method :new
|
66
|
+
|
67
|
+
def check(content)
|
68
|
+
digests.check(content)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'configuration/path'
|
4
|
+
require_relative 'configuration/content'
|
5
|
+
require_relative 'configuration/target'
|
6
|
+
require_relative 'configuration/repository'
|
7
|
+
|
8
|
+
module Datadog
|
9
|
+
module Core
|
10
|
+
module Remote
|
11
|
+
# Configuration
|
12
|
+
# rubocop:disable Lint/EmptyClass
|
13
|
+
class Configuration
|
14
|
+
end
|
15
|
+
# rubocop:enable Lint/EmptyClass
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Remote
|
6
|
+
# Repository update dispatcher
|
7
|
+
class Dispatcher
|
8
|
+
attr_reader :receivers
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@receivers = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def dispatch(changes, repository)
|
15
|
+
receivers.each do |receiver|
|
16
|
+
matching_changes = changes.select { |c| receiver.match?(c.path) }
|
17
|
+
|
18
|
+
receiver.call(repository, matching_changes) if matching_changes.any?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Store Matcher and block to be executed on a match
|
23
|
+
class Receiver
|
24
|
+
def initialize(matcher, &block)
|
25
|
+
@block = block
|
26
|
+
@matcher = matcher
|
27
|
+
end
|
28
|
+
|
29
|
+
def match?(path)
|
30
|
+
@matcher.match?(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
def call(repository, changes)
|
34
|
+
@block.call(repository, changes)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Matcher checks if the path matches
|
39
|
+
class Matcher
|
40
|
+
def initialize(&block)
|
41
|
+
@block = block
|
42
|
+
end
|
43
|
+
|
44
|
+
def match?(path)
|
45
|
+
@block.call(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Matches on the produc's path
|
49
|
+
class Product < Matcher
|
50
|
+
def initialize(products)
|
51
|
+
block = ->(path) { products.include?(path.product) }
|
52
|
+
super(&block)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../transport/http'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Core
|
7
|
+
module Remote
|
8
|
+
# Endpoint negotiation
|
9
|
+
class Negotiation
|
10
|
+
def initialize(_settings, agent_settings)
|
11
|
+
transport_options = {}
|
12
|
+
transport_options[:agent_settings] = agent_settings if agent_settings
|
13
|
+
|
14
|
+
@transport_root = Datadog::Core::Transport::HTTP.root(**transport_options.dup)
|
15
|
+
end
|
16
|
+
|
17
|
+
def endpoint?(path)
|
18
|
+
res = @transport_root.send_info
|
19
|
+
|
20
|
+
if res.internal_error? && network_error?(res.error)
|
21
|
+
Datadog.logger.error { "agent unreachable: cannot negotiate #{path}" }
|
22
|
+
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
26
|
+
if res.not_found?
|
27
|
+
Datadog.logger.error { "agent reachable but has no /info endpoint: cannot negotiate #{path}" }
|
28
|
+
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
|
32
|
+
unless res.ok?
|
33
|
+
Datadog.logger.error { "agent reachable but unexpected response: cannot negotiate #{path}" }
|
34
|
+
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
|
38
|
+
unless res.endpoints.include?(path)
|
39
|
+
Datadog.logger.error { "agent reachable but does not report #{path}" }
|
40
|
+
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
44
|
+
Datadog.logger.debug { "agent reachable and reports #{path}" }
|
45
|
+
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def network_error?(error)
|
52
|
+
error.is_a?(Errno::ECONNREFUSED)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Remote
|
6
|
+
# Worker executes a block every interval on a separate Thread
|
7
|
+
class Worker
|
8
|
+
def initialize(interval:, &block)
|
9
|
+
@mutex = Mutex.new
|
10
|
+
@thr = nil
|
11
|
+
|
12
|
+
@starting = false
|
13
|
+
@stopping = false
|
14
|
+
@started = false
|
15
|
+
|
16
|
+
@interval = interval
|
17
|
+
raise ArgumentError, 'can not initialize a worker without a block' unless block
|
18
|
+
|
19
|
+
@block = block
|
20
|
+
end
|
21
|
+
|
22
|
+
def start
|
23
|
+
Datadog.logger.debug { 'remote worker starting' }
|
24
|
+
|
25
|
+
acquire_lock
|
26
|
+
|
27
|
+
return if @starting || @started
|
28
|
+
|
29
|
+
@starting = true
|
30
|
+
|
31
|
+
@thr = Thread.new { poll(@interval) }
|
32
|
+
|
33
|
+
@started = true
|
34
|
+
@starting = false
|
35
|
+
|
36
|
+
Datadog.logger.debug { 'remote worker started' }
|
37
|
+
ensure
|
38
|
+
release_lock
|
39
|
+
end
|
40
|
+
|
41
|
+
def stop
|
42
|
+
Datadog.logger.debug { 'remote worker stopping' }
|
43
|
+
|
44
|
+
acquire_lock
|
45
|
+
|
46
|
+
@stopping = true
|
47
|
+
|
48
|
+
thread = @thr
|
49
|
+
|
50
|
+
if thread
|
51
|
+
thread.kill
|
52
|
+
thread.join
|
53
|
+
end
|
54
|
+
|
55
|
+
@started = false
|
56
|
+
@stopping = false
|
57
|
+
@thr = nil
|
58
|
+
|
59
|
+
Datadog.logger.debug { 'remote worker stopped' }
|
60
|
+
ensure
|
61
|
+
release_lock
|
62
|
+
end
|
63
|
+
|
64
|
+
def started?
|
65
|
+
@started
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def acquire_lock
|
71
|
+
@mutex.lock
|
72
|
+
end
|
73
|
+
|
74
|
+
def release_lock
|
75
|
+
@mutex.unlock
|
76
|
+
end
|
77
|
+
|
78
|
+
def poll(interval)
|
79
|
+
loop do
|
80
|
+
break unless @mutex.synchronize { @starting || @started }
|
81
|
+
|
82
|
+
call
|
83
|
+
|
84
|
+
sleep(interval)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def call
|
89
|
+
Datadog.logger.debug { 'remote worker perform' }
|
90
|
+
|
91
|
+
@block.call
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
# Module to interact with core remote component
|
6
|
+
module Remote
|
7
|
+
class << self
|
8
|
+
def active_remote
|
9
|
+
remote
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def components
|
15
|
+
Datadog.send(:components)
|
16
|
+
end
|
17
|
+
|
18
|
+
def remote
|
19
|
+
components.remote
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -5,6 +5,7 @@ require 'etc'
|
|
5
5
|
require_relative '../configuration/agent_settings_resolver'
|
6
6
|
require_relative '../environment/ext'
|
7
7
|
require_relative '../environment/platform'
|
8
|
+
require_relative '../utils/hash'
|
8
9
|
require_relative 'v1/application'
|
9
10
|
require_relative 'v1/dependency'
|
10
11
|
require_relative 'v1/host'
|
@@ -18,6 +19,7 @@ module Datadog
|
|
18
19
|
# Module defining methods for collecting metadata for telemetry
|
19
20
|
module Collector
|
20
21
|
include Datadog::Core::Configuration
|
22
|
+
using Core::Utils::Hash::Refinement
|
21
23
|
|
22
24
|
# Forms a hash of configuration key value pairs to be sent in the additional payload
|
23
25
|
def additional_payload
|
@@ -41,12 +43,13 @@ module Datadog
|
|
41
43
|
|
42
44
|
# Forms a hash of standard key value pairs to be sent in the app-started event configuration
|
43
45
|
def configurations
|
44
|
-
|
46
|
+
hash = {
|
45
47
|
DD_AGENT_HOST: Datadog.configuration.agent.host,
|
46
48
|
DD_AGENT_TRANSPORT: agent_transport,
|
47
49
|
DD_TRACE_SAMPLE_RATE: format_configuration_value(Datadog.configuration.tracing.sampling.default_rate),
|
48
50
|
}
|
49
|
-
|
51
|
+
hash.compact!
|
52
|
+
hash
|
50
53
|
end
|
51
54
|
|
52
55
|
# Forms a telemetry app-started dependencies object
|
@@ -134,7 +137,8 @@ module Datadog
|
|
134
137
|
options['logger.instance'] = configuration.logger.instance.class.to_s
|
135
138
|
options['appsec.enabled'] = configuration.dig('appsec', 'enabled') if configuration.respond_to?('appsec')
|
136
139
|
options['tracing.opentelemetry.enabled'] = !defined?(Datadog::OpenTelemetry::LOADED).nil?
|
137
|
-
|
140
|
+
options.compact!
|
141
|
+
options
|
138
142
|
end
|
139
143
|
|
140
144
|
def format_configuration_value(value)
|
@@ -147,11 +151,6 @@ module Datadog
|
|
147
151
|
end
|
148
152
|
end
|
149
153
|
|
150
|
-
# Manual implementation of hash.compact used because it is unsupported by older Ruby versions (<2.4)
|
151
|
-
def compact_hash(hash)
|
152
|
-
hash.delete_if { |_k, v| v.nil? }
|
153
|
-
end
|
154
|
-
|
155
154
|
def env
|
156
155
|
Datadog.configuration.env
|
157
156
|
end
|
@@ -222,7 +221,7 @@ module Datadog
|
|
222
221
|
desc += ", Patchable? #{integration.klass.class.patchable?}"
|
223
222
|
desc
|
224
223
|
else
|
225
|
-
patch_error_result.to_s
|
224
|
+
patch_error_result.compact.to_s
|
226
225
|
end
|
227
226
|
end
|
228
227
|
end
|
@@ -1,9 +1,13 @@
|
|
1
|
+
require_relative '../../utils/hash'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Core
|
3
5
|
module Telemetry
|
4
6
|
module V1
|
5
7
|
# Describes attributes for application environment object
|
6
8
|
class Application
|
9
|
+
using Core::Utils::Hash::Refinement
|
10
|
+
|
7
11
|
ERROR_NIL_LANGUAGE_NAME_MESSAGE = ':language_name must not be nil'.freeze
|
8
12
|
ERROR_NIL_LANGUAGE_VERSION_MESSAGE = ':language_version must not be nil'.freeze
|
9
13
|
ERROR_NIL_SERVICE_NAME_MESSAGE = ':service_name must not be nil'.freeze
|
@@ -54,7 +58,7 @@ module Datadog
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def to_h
|
57
|
-
{
|
61
|
+
hash = {
|
58
62
|
env: @env,
|
59
63
|
language_name: @language_name,
|
60
64
|
language_version: @language_version,
|
@@ -66,6 +70,8 @@ module Datadog
|
|
66
70
|
service_version: @service_version,
|
67
71
|
tracer_version: @tracer_version
|
68
72
|
}
|
73
|
+
hash.compact!
|
74
|
+
hash
|
69
75
|
end
|
70
76
|
|
71
77
|
private
|
@@ -1,9 +1,13 @@
|
|
1
|
+
require_relative '../../utils/hash'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Core
|
3
5
|
module Telemetry
|
4
6
|
module V1
|
5
7
|
# Describes attributes for dependency object
|
6
8
|
class Dependency
|
9
|
+
using Core::Utils::Hash::Refinement
|
10
|
+
|
7
11
|
ERROR_NIL_NAME_MESSAGE = ':name must not be nil'.freeze
|
8
12
|
|
9
13
|
attr_reader \
|
@@ -23,11 +27,13 @@ module Datadog
|
|
23
27
|
end
|
24
28
|
|
25
29
|
def to_h
|
26
|
-
{
|
30
|
+
hash = {
|
27
31
|
hash: @hash,
|
28
32
|
name: @name,
|
29
33
|
version: @version
|
30
34
|
}
|
35
|
+
hash.compact!
|
36
|
+
hash
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -1,9 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../utils/hash'
|
4
|
+
|
1
5
|
module Datadog
|
2
6
|
module Core
|
3
7
|
module Telemetry
|
4
8
|
module V1
|
5
9
|
# Describes attributes for host object
|
6
10
|
class Host
|
11
|
+
using Core::Utils::Hash::Refinement
|
12
|
+
|
7
13
|
attr_reader \
|
8
14
|
:container_id,
|
9
15
|
:hostname,
|
@@ -34,7 +40,7 @@ module Datadog
|
|
34
40
|
end
|
35
41
|
|
36
42
|
def to_h
|
37
|
-
{
|
43
|
+
hash = {
|
38
44
|
container_id: @container_id,
|
39
45
|
hostname: @hostname,
|
40
46
|
kernel_name: @kernel_name,
|
@@ -43,6 +49,8 @@ module Datadog
|
|
43
49
|
os: @os,
|
44
50
|
os_version: @os_version,
|
45
51
|
}
|
52
|
+
hash.compact!
|
53
|
+
hash
|
46
54
|
end
|
47
55
|
end
|
48
56
|
end
|
@@ -1,9 +1,13 @@
|
|
1
|
+
require_relative '../../utils/hash'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Core
|
3
5
|
module Telemetry
|
4
6
|
module V1
|
5
7
|
# Describes attributes for integration object
|
6
8
|
class Integration
|
9
|
+
using Core::Utils::Hash::Refinement
|
10
|
+
|
7
11
|
ERROR_NIL_ENABLED_MESSAGE = ':enabled must not be nil'.freeze
|
8
12
|
ERROR_NIL_NAME_MESSAGE = ':name must not be nil'.freeze
|
9
13
|
|
@@ -32,7 +36,7 @@ module Datadog
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def to_h
|
35
|
-
{
|
39
|
+
hash = {
|
36
40
|
auto_enabled: @auto_enabled,
|
37
41
|
compatible: @compatible,
|
38
42
|
enabled: @enabled,
|
@@ -40,6 +44,8 @@ module Datadog
|
|
40
44
|
name: @name,
|
41
45
|
version: @version
|
42
46
|
}
|
47
|
+
hash.compact!
|
48
|
+
hash
|
43
49
|
end
|
44
50
|
|
45
51
|
private
|
@@ -1,9 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../utils/hash'
|
4
|
+
|
1
5
|
module Datadog
|
2
6
|
module Core
|
3
7
|
module Telemetry
|
4
8
|
module V1
|
5
9
|
# Describes attributes for products object
|
6
10
|
class Product
|
11
|
+
using Core::Utils::Hash::Refinement
|
12
|
+
|
7
13
|
attr_reader \
|
8
14
|
:appsec,
|
9
15
|
:profiler
|
@@ -16,10 +22,12 @@ module Datadog
|
|
16
22
|
end
|
17
23
|
|
18
24
|
def to_h
|
19
|
-
{
|
25
|
+
hash = {
|
20
26
|
appsec: @appsec,
|
21
27
|
profiler: @profiler
|
22
28
|
}
|
29
|
+
hash.compact!
|
30
|
+
hash
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -1,9 +1,13 @@
|
|
1
|
+
require_relative '../../utils/hash'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Core
|
3
5
|
module Telemetry
|
4
6
|
module V1
|
5
7
|
# Describes attributes for telemetry API request
|
6
8
|
class TelemetryRequest
|
9
|
+
using Core::Utils::Hash::Refinement
|
10
|
+
|
7
11
|
ERROR_NIL_API_VERSION_MESSAGE = ':api_version must not be nil'.freeze
|
8
12
|
ERROR_NIL_APPLICATION_MESSAGE = ':application must not be nil'.freeze
|
9
13
|
ERROR_NIL_HOST_MESSAGE = ':host must not be nil'.freeze
|
@@ -64,7 +68,7 @@ module Datadog
|
|
64
68
|
end
|
65
69
|
|
66
70
|
def to_h
|
67
|
-
{
|
71
|
+
hash = {
|
68
72
|
api_version: @api_version,
|
69
73
|
application: @application.to_h,
|
70
74
|
debug: @debug,
|
@@ -76,6 +80,8 @@ module Datadog
|
|
76
80
|
session_id: @session_id,
|
77
81
|
tracer_time: @tracer_time
|
78
82
|
}
|
83
|
+
hash.compact!
|
84
|
+
hash
|
79
85
|
end
|
80
86
|
|
81
87
|
private
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../ddtrace/transport/request'
|
4
|
+
require_relative '../../../ddtrace/transport/parcel'
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module Core
|
8
|
+
module Transport
|
9
|
+
module Config
|
10
|
+
# Data transfer object for encoded traces
|
11
|
+
class EncodedParcel
|
12
|
+
include Datadog::Transport::Parcel
|
13
|
+
|
14
|
+
def count
|
15
|
+
data.length
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Config request
|
20
|
+
class Request < Datadog::Transport::Request
|
21
|
+
end
|
22
|
+
|
23
|
+
# Config response
|
24
|
+
module Response
|
25
|
+
attr_reader :roots, :targets, :target_files, :client_configs
|
26
|
+
|
27
|
+
def empty?
|
28
|
+
@empty
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Config transport
|
33
|
+
class Transport
|
34
|
+
attr_reader :client, :apis, :default_api, :current_api_id
|
35
|
+
|
36
|
+
def initialize(apis, default_api)
|
37
|
+
@apis = apis
|
38
|
+
|
39
|
+
@client = HTTP::Client.new(current_api)
|
40
|
+
end
|
41
|
+
|
42
|
+
##### there is only one transport! it's negotiation!
|
43
|
+
def send_config(payload)
|
44
|
+
json = JSON.dump(payload)
|
45
|
+
parcel = EncodedParcel.new(json)
|
46
|
+
request = Request.new(parcel)
|
47
|
+
|
48
|
+
@client.send_config_payload(request)
|
49
|
+
end
|
50
|
+
|
51
|
+
def current_api
|
52
|
+
@apis[HTTP::API::V7]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|