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,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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Transport
|
6
|
+
module HTTP
|
7
|
+
module API
|
8
|
+
# An API configured with adapter and routes
|
9
|
+
class Instance
|
10
|
+
attr_reader \
|
11
|
+
:adapter,
|
12
|
+
:headers,
|
13
|
+
:spec
|
14
|
+
|
15
|
+
def initialize(spec, adapter, options = {})
|
16
|
+
@spec = spec
|
17
|
+
@adapter = adapter
|
18
|
+
@headers = options.fetch(:headers, {})
|
19
|
+
end
|
20
|
+
|
21
|
+
def encoder
|
22
|
+
spec.encoder
|
23
|
+
end
|
24
|
+
|
25
|
+
def call(env)
|
26
|
+
# Add headers to request env, unless empty.
|
27
|
+
env.headers.merge!(headers) unless headers.empty?
|
28
|
+
|
29
|
+
# Send request env to the adapter.
|
30
|
+
adapter.call(env)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Transport
|
6
|
+
module HTTP
|
7
|
+
module API
|
8
|
+
# Specification for an HTTP API
|
9
|
+
# Defines behaviors without specific configuration details.
|
10
|
+
class Spec
|
11
|
+
def initialize
|
12
|
+
yield(self) if block_given?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../encoding'
|
4
|
+
|
5
|
+
require_relative '../../../../ddtrace/transport/http/api/map'
|
6
|
+
|
7
|
+
# TODO: Decouple standard transport/http/api/instance
|
8
|
+
#
|
9
|
+
# Separate classes are needed because transport/http/traces includes
|
10
|
+
# Trace::API::Instance which closes over and uses a single spec, which is
|
11
|
+
# negotiated as either /v3 or /v4 for the whole API at the spec level, but we
|
12
|
+
# need an independent toplevel path at the endpoint level.
|
13
|
+
#
|
14
|
+
# Separate classes are needed because of `include Trace::API::Instance`.
|
15
|
+
#
|
16
|
+
# Below should be:
|
17
|
+
# require_relative '../../../../ddtrace/transport/http/api/spec'
|
18
|
+
require_relative 'api/spec'
|
19
|
+
|
20
|
+
# TODO: only needed for Negotiation::API::Endpoint
|
21
|
+
require_relative 'negotiation'
|
22
|
+
|
23
|
+
# TODO: only needed for Config::API::Endpoint
|
24
|
+
require_relative 'config'
|
25
|
+
|
26
|
+
module Datadog
|
27
|
+
module Core
|
28
|
+
module Transport
|
29
|
+
module HTTP
|
30
|
+
# Namespace for API components
|
31
|
+
module API
|
32
|
+
# Default API versions
|
33
|
+
ROOT = 'root'
|
34
|
+
V7 = 'v0.7'
|
35
|
+
|
36
|
+
module_function
|
37
|
+
|
38
|
+
def defaults
|
39
|
+
Datadog::Transport::HTTP::API::Map[
|
40
|
+
ROOT => Spec.new do |s|
|
41
|
+
s.info = Negotiation::API::Endpoint.new(
|
42
|
+
'/info',
|
43
|
+
)
|
44
|
+
end,
|
45
|
+
V7 => Spec.new do |s|
|
46
|
+
s.config = Config::API::Endpoint.new(
|
47
|
+
'/v0.7/config',
|
48
|
+
Core::Encoding::JSONEncoder,
|
49
|
+
)
|
50
|
+
end,
|
51
|
+
]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../configuration/agent_settings_resolver'
|
4
|
+
require_relative '../../../../ddtrace/transport/http/adapters/registry'
|
5
|
+
require_relative '../../../../ddtrace/transport/http/api/map'
|
6
|
+
|
7
|
+
# TODO: Decouple standard transport/http/api/instance
|
8
|
+
#
|
9
|
+
# Separate classes are needed because transport/http/trace includes
|
10
|
+
# Trace::API::Instance which closes over and uses a single spec, which is
|
11
|
+
# negotiated as either /v3 or /v4 for the whole API at the spec level, but we
|
12
|
+
# need an independent toplevel path at the endpoint level.
|
13
|
+
#
|
14
|
+
# Separate classes are needed because of `include Trace::API::Instance`.
|
15
|
+
#
|
16
|
+
# Below should be:
|
17
|
+
# require_relative '../../../../ddtrace/transport/http/api/instance'
|
18
|
+
require_relative 'api/instance'
|
19
|
+
|
20
|
+
# TODO: Decouple transport/http/client
|
21
|
+
#
|
22
|
+
# The standard one does `include Transport::HTTP::Statistics` and performs
|
23
|
+
# stats updates, which may or may not be desirable in general.
|
24
|
+
#
|
25
|
+
# Below should be:
|
26
|
+
# require_relative '../../../../ddtrace/transport/http/client'
|
27
|
+
require_relative 'client'
|
28
|
+
|
29
|
+
# TODO: Decouple transport/http/builder
|
30
|
+
#
|
31
|
+
# This class is duplicated even though it is tantalisingly close to the
|
32
|
+
# one in ddtrace/transport mostly because it refers to a different
|
33
|
+
# `API::Instance` in `#api_instance_class` but also because it operates on a
|
34
|
+
# different `HTTP::Client`, as well as de-hardcoding the transport class
|
35
|
+
# `Transport::Traces::Transport` in `#to_transport`
|
36
|
+
#
|
37
|
+
# Additionally, its design makes it so there can be only one (API, Client,
|
38
|
+
# Transport) triplet, requiring a new transport instance for any varying
|
39
|
+
# element of the triplet.
|
40
|
+
|
41
|
+
module Datadog
|
42
|
+
module Core
|
43
|
+
module Transport
|
44
|
+
module HTTP
|
45
|
+
# Builds new instances of Transport::HTTP::Client
|
46
|
+
class Builder
|
47
|
+
REGISTRY = Datadog::Transport::HTTP::Adapters::Registry.new
|
48
|
+
|
49
|
+
attr_reader \
|
50
|
+
:apis,
|
51
|
+
:api_options,
|
52
|
+
:default_adapter,
|
53
|
+
:default_api,
|
54
|
+
:default_headers
|
55
|
+
|
56
|
+
def initialize
|
57
|
+
# Global settings
|
58
|
+
@default_adapter = nil
|
59
|
+
@default_headers = {}
|
60
|
+
|
61
|
+
# Client settings
|
62
|
+
@apis = Datadog::Transport::HTTP::API::Map.new
|
63
|
+
@default_api = nil
|
64
|
+
|
65
|
+
# API settings
|
66
|
+
@api_options = {}
|
67
|
+
|
68
|
+
yield(self) if block_given?
|
69
|
+
end
|
70
|
+
|
71
|
+
def adapter(config, *args, **kwargs)
|
72
|
+
@default_adapter = case config
|
73
|
+
when Core::Configuration::AgentSettingsResolver::AgentSettings
|
74
|
+
registry_klass = REGISTRY.get(config.adapter)
|
75
|
+
raise UnknownAdapterError, config.adapter if registry_klass.nil?
|
76
|
+
|
77
|
+
registry_klass.build(config)
|
78
|
+
when Symbol
|
79
|
+
registry_klass = REGISTRY.get(config)
|
80
|
+
raise UnknownAdapterError, config if registry_klass.nil?
|
81
|
+
|
82
|
+
registry_klass.new(*args, **kwargs)
|
83
|
+
else
|
84
|
+
config
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def headers(values = {})
|
89
|
+
@default_headers.merge!(values)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Adds a new API to the client
|
93
|
+
# Valid options:
|
94
|
+
# - :adapter
|
95
|
+
# - :default
|
96
|
+
# - :fallback
|
97
|
+
# - :headers
|
98
|
+
def api(key, spec, options = {})
|
99
|
+
options = options.dup
|
100
|
+
|
101
|
+
# Copy spec into API map
|
102
|
+
@apis[key] = spec
|
103
|
+
|
104
|
+
# Apply as default API, if specified to do so.
|
105
|
+
@default_api = key if options.delete(:default) || @default_api.nil?
|
106
|
+
|
107
|
+
# Save all other settings for initialization
|
108
|
+
(@api_options[key] ||= {}).merge!(options)
|
109
|
+
end
|
110
|
+
|
111
|
+
def default_api=(key)
|
112
|
+
raise UnknownApiError, key unless @apis.key?(key)
|
113
|
+
|
114
|
+
@default_api = key
|
115
|
+
end
|
116
|
+
|
117
|
+
def to_transport(klass)
|
118
|
+
raise NoDefaultApiError if @default_api.nil?
|
119
|
+
|
120
|
+
klass.new(to_api_instances, @default_api)
|
121
|
+
end
|
122
|
+
|
123
|
+
def to_api_instances
|
124
|
+
raise NoApisError if @apis.empty?
|
125
|
+
|
126
|
+
@apis.inject(Datadog::Transport::HTTP::API::Map.new) do |instances, (key, spec)|
|
127
|
+
instances.tap do
|
128
|
+
api_options = @api_options[key].dup
|
129
|
+
|
130
|
+
# Resolve the adapter to use for this API
|
131
|
+
adapter = api_options.delete(:adapter) || @default_adapter
|
132
|
+
raise NoAdapterForApiError, key if adapter.nil?
|
133
|
+
|
134
|
+
# Resolve fallback and merge headers
|
135
|
+
fallback = api_options.delete(:fallback)
|
136
|
+
api_options[:headers] = @default_headers.merge((api_options[:headers] || {}))
|
137
|
+
|
138
|
+
# Add API::Instance with all settings
|
139
|
+
instances[key] = api_instance_class.new(
|
140
|
+
spec,
|
141
|
+
adapter,
|
142
|
+
api_options
|
143
|
+
)
|
144
|
+
|
145
|
+
# Configure fallback, if provided.
|
146
|
+
instances.with_fallbacks(key => fallback) unless fallback.nil?
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def api_instance_class
|
152
|
+
API::Instance
|
153
|
+
end
|
154
|
+
|
155
|
+
# Raised when the API key does not match known APIs.
|
156
|
+
class UnknownApiError < StandardError
|
157
|
+
attr_reader :key
|
158
|
+
|
159
|
+
def initialize(key)
|
160
|
+
super()
|
161
|
+
|
162
|
+
@key = key
|
163
|
+
end
|
164
|
+
|
165
|
+
def message
|
166
|
+
"Unknown transport API '#{key}'!"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Raised when the identifier cannot be matched to an adapter.
|
171
|
+
class UnknownAdapterError < StandardError
|
172
|
+
attr_reader :type
|
173
|
+
|
174
|
+
def initialize(type)
|
175
|
+
super()
|
176
|
+
|
177
|
+
@type = type
|
178
|
+
end
|
179
|
+
|
180
|
+
def message
|
181
|
+
"Unknown transport adapter '#{type}'!"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Raised when an adapter cannot be resolved for an API instance.
|
186
|
+
class NoAdapterForApiError < StandardError
|
187
|
+
attr_reader :key
|
188
|
+
|
189
|
+
def initialize(key)
|
190
|
+
super()
|
191
|
+
|
192
|
+
@key = key
|
193
|
+
end
|
194
|
+
|
195
|
+
def message
|
196
|
+
"No adapter resolved for transport API '#{key}'!"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Raised when built without defining APIs.
|
201
|
+
class NoApisError < StandardError
|
202
|
+
def message
|
203
|
+
'No APIs configured for transport!'
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Raised when client built without defining a default API.
|
208
|
+
class NoDefaultApiError < StandardError
|
209
|
+
def message
|
210
|
+
'No default API configured for transport!'
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../../ddtrace/transport/http/env'
|
4
|
+
|
5
|
+
# TODO: Decouple transport/http/client
|
6
|
+
#
|
7
|
+
# The standard one does `include Transport::HTTP::Statistics` and performs
|
8
|
+
# stats updates, which may or may not be desirable in general.
|
9
|
+
|
10
|
+
module Datadog
|
11
|
+
module Core
|
12
|
+
module Transport
|
13
|
+
module HTTP
|
14
|
+
# Routes, encodes, and sends tracer data to the trace agent via HTTP.
|
15
|
+
class Client
|
16
|
+
attr_reader :api
|
17
|
+
|
18
|
+
def initialize(api)
|
19
|
+
@api = api
|
20
|
+
end
|
21
|
+
|
22
|
+
def send_request(request, &block)
|
23
|
+
# Build request into env
|
24
|
+
env = build_env(request)
|
25
|
+
|
26
|
+
# Get responses from API
|
27
|
+
yield(api, env)
|
28
|
+
rescue StandardError => e
|
29
|
+
message =
|
30
|
+
"Internal error during #{self.class.name} request. Cause: #{e.class.name} #{e.message} " \
|
31
|
+
"Location: #{Array(e.backtrace).first}"
|
32
|
+
|
33
|
+
Datadog.logger.error(message)
|
34
|
+
|
35
|
+
Datadog::Transport::InternalErrorResponse.new(e)
|
36
|
+
end
|
37
|
+
|
38
|
+
def build_env(request)
|
39
|
+
Datadog::Transport::HTTP::Env.new(request)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|