datadog 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +4236 -0
- data/LICENSE +6 -0
- data/LICENSE-3rdparty.csv +7 -0
- data/LICENSE.Apache +200 -0
- data/LICENSE.BSD3 +24 -0
- data/NOTICE +4 -0
- data/README.md +25 -0
- data/bin/ddprofrb +15 -0
- data/ext/datadog_profiling_loader/datadog_profiling_loader.c +134 -0
- data/ext/datadog_profiling_loader/extconf.rb +72 -0
- data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +156 -0
- data/ext/datadog_profiling_native_extension/clock_id.h +22 -0
- data/ext/datadog_profiling_native_extension/clock_id_from_pthread.c +56 -0
- data/ext/datadog_profiling_native_extension/clock_id_noop.c +22 -0
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +1153 -0
- data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.c +422 -0
- data/ext/datadog_profiling_native_extension/collectors_discrete_dynamic_sampler.h +101 -0
- data/ext/datadog_profiling_native_extension/collectors_dynamic_sampling_rate.c +150 -0
- data/ext/datadog_profiling_native_extension/collectors_dynamic_sampling_rate.h +18 -0
- data/ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.c +156 -0
- data/ext/datadog_profiling_native_extension/collectors_gc_profiling_helper.h +5 -0
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.c +244 -0
- data/ext/datadog_profiling_native_extension/collectors_idle_sampling_helper.h +3 -0
- data/ext/datadog_profiling_native_extension/collectors_stack.c +372 -0
- data/ext/datadog_profiling_native_extension/collectors_stack.h +27 -0
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +1391 -0
- data/ext/datadog_profiling_native_extension/collectors_thread_context.h +15 -0
- data/ext/datadog_profiling_native_extension/extconf.rb +302 -0
- data/ext/datadog_profiling_native_extension/heap_recorder.c +970 -0
- data/ext/datadog_profiling_native_extension/heap_recorder.h +155 -0
- data/ext/datadog_profiling_native_extension/helpers.h +23 -0
- data/ext/datadog_profiling_native_extension/http_transport.c +375 -0
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.c +62 -0
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.h +42 -0
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +319 -0
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +892 -0
- data/ext/datadog_profiling_native_extension/private_vm_api_access.h +61 -0
- data/ext/datadog_profiling_native_extension/profiling.c +267 -0
- data/ext/datadog_profiling_native_extension/ruby_helpers.c +267 -0
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +119 -0
- data/ext/datadog_profiling_native_extension/setup_signal_handler.c +115 -0
- data/ext/datadog_profiling_native_extension/setup_signal_handler.h +11 -0
- data/ext/datadog_profiling_native_extension/stack_recorder.c +941 -0
- data/ext/datadog_profiling_native_extension/stack_recorder.h +27 -0
- data/ext/datadog_profiling_native_extension/time_helpers.c +53 -0
- data/ext/datadog_profiling_native_extension/time_helpers.h +26 -0
- data/lib/datadog/appsec/assets/blocked.html +99 -0
- data/lib/datadog/appsec/assets/blocked.json +1 -0
- data/lib/datadog/appsec/assets/blocked.text +5 -0
- data/lib/datadog/appsec/assets/waf_rules/README.md +7 -0
- data/lib/datadog/appsec/assets/waf_rules/processors.json +92 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +7703 -0
- data/lib/datadog/appsec/assets/waf_rules/scanners.json +114 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +1635 -0
- data/lib/datadog/appsec/assets.rb +46 -0
- data/lib/datadog/appsec/autoload.rb +13 -0
- data/lib/datadog/appsec/component.rb +94 -0
- data/lib/datadog/appsec/configuration/settings.rb +202 -0
- data/lib/datadog/appsec/configuration.rb +11 -0
- data/lib/datadog/appsec/contrib/auto_instrument.rb +25 -0
- data/lib/datadog/appsec/contrib/devise/event.rb +57 -0
- data/lib/datadog/appsec/contrib/devise/ext.rb +13 -0
- data/lib/datadog/appsec/contrib/devise/integration.rb +42 -0
- data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +76 -0
- data/lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb +54 -0
- data/lib/datadog/appsec/contrib/devise/patcher.rb +45 -0
- data/lib/datadog/appsec/contrib/devise/resource.rb +35 -0
- data/lib/datadog/appsec/contrib/devise/tracking.rb +49 -0
- data/lib/datadog/appsec/contrib/integration.rb +37 -0
- data/lib/datadog/appsec/contrib/patcher.rb +12 -0
- data/lib/datadog/appsec/contrib/rack/ext.rb +13 -0
- data/lib/datadog/appsec/contrib/rack/gateway/request.rb +104 -0
- data/lib/datadog/appsec/contrib/rack/gateway/response.rb +30 -0
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +162 -0
- data/lib/datadog/appsec/contrib/rack/integration.rb +44 -0
- data/lib/datadog/appsec/contrib/rack/patcher.rb +34 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +81 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +60 -0
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +66 -0
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +44 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +196 -0
- data/lib/datadog/appsec/contrib/rails/ext.rb +13 -0
- data/lib/datadog/appsec/contrib/rails/framework.rb +16 -0
- data/lib/datadog/appsec/contrib/rails/gateway/request.rb +67 -0
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +71 -0
- data/lib/datadog/appsec/contrib/rails/integration.rb +43 -0
- data/lib/datadog/appsec/contrib/rails/patcher.rb +166 -0
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +66 -0
- data/lib/datadog/appsec/contrib/rails/request.rb +36 -0
- data/lib/datadog/appsec/contrib/rails/request_middleware.rb +20 -0
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +14 -0
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +20 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/request.rb +17 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/route_params.rb +23 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +117 -0
- data/lib/datadog/appsec/contrib/sinatra/integration.rb +43 -0
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +168 -0
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +61 -0
- data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +20 -0
- data/lib/datadog/appsec/event.rb +171 -0
- data/lib/datadog/appsec/ext.rb +10 -0
- data/lib/datadog/appsec/extensions.rb +15 -0
- data/lib/datadog/appsec/instrumentation/gateway/argument.rb +22 -0
- data/lib/datadog/appsec/instrumentation/gateway.rb +64 -0
- data/lib/datadog/appsec/instrumentation.rb +9 -0
- data/lib/datadog/appsec/monitor/gateway/watcher.rb +67 -0
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +58 -0
- data/lib/datadog/appsec/monitor.rb +11 -0
- data/lib/datadog/appsec/processor/actions.rb +49 -0
- data/lib/datadog/appsec/processor/rule_loader.rb +123 -0
- data/lib/datadog/appsec/processor/rule_merger.rb +152 -0
- data/lib/datadog/appsec/processor.rb +171 -0
- data/lib/datadog/appsec/rate_limiter.rb +60 -0
- data/lib/datadog/appsec/reactive/address_hash.rb +22 -0
- data/lib/datadog/appsec/reactive/engine.rb +47 -0
- data/lib/datadog/appsec/reactive/operation.rb +68 -0
- data/lib/datadog/appsec/reactive/subscriber.rb +19 -0
- data/lib/datadog/appsec/remote.rb +129 -0
- data/lib/datadog/appsec/response.rb +151 -0
- data/lib/datadog/appsec/sample_rate.rb +21 -0
- data/lib/datadog/appsec/scope.rb +61 -0
- data/lib/datadog/appsec/utils/http/media_range.rb +201 -0
- data/lib/datadog/appsec/utils/http/media_type.rb +87 -0
- data/lib/datadog/appsec/utils/http.rb +11 -0
- data/lib/datadog/appsec/utils.rb +9 -0
- data/lib/datadog/appsec.rb +60 -0
- data/lib/datadog/auto_instrument.rb +16 -0
- data/lib/datadog/auto_instrument_base.rb +8 -0
- data/lib/datadog/core/buffer/cruby.rb +55 -0
- data/lib/datadog/core/buffer/random.rb +134 -0
- data/lib/datadog/core/buffer/thread_safe.rb +58 -0
- data/lib/datadog/core/chunker.rb +35 -0
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +352 -0
- data/lib/datadog/core/configuration/base.rb +91 -0
- data/lib/datadog/core/configuration/components.rb +177 -0
- data/lib/datadog/core/configuration/ext.rb +45 -0
- data/lib/datadog/core/configuration/option.rb +319 -0
- data/lib/datadog/core/configuration/option_definition.rb +165 -0
- data/lib/datadog/core/configuration/options.rb +128 -0
- data/lib/datadog/core/configuration/settings.rb +786 -0
- data/lib/datadog/core/configuration.rb +296 -0
- data/lib/datadog/core/diagnostics/environment_logger.rb +173 -0
- data/lib/datadog/core/diagnostics/health.rb +19 -0
- data/lib/datadog/core/encoding.rb +74 -0
- data/lib/datadog/core/environment/cgroup.rb +53 -0
- data/lib/datadog/core/environment/class_count.rb +21 -0
- data/lib/datadog/core/environment/container.rb +91 -0
- data/lib/datadog/core/environment/execution.rb +103 -0
- data/lib/datadog/core/environment/ext.rb +45 -0
- data/lib/datadog/core/environment/gc.rb +20 -0
- data/lib/datadog/core/environment/git.rb +25 -0
- data/lib/datadog/core/environment/identity.rb +84 -0
- data/lib/datadog/core/environment/platform.rb +40 -0
- data/lib/datadog/core/environment/socket.rb +24 -0
- data/lib/datadog/core/environment/thread_count.rb +20 -0
- data/lib/datadog/core/environment/variable_helpers.rb +53 -0
- data/lib/datadog/core/environment/vm_cache.rb +64 -0
- data/lib/datadog/core/environment/yjit.rb +58 -0
- data/lib/datadog/core/error.rb +100 -0
- data/lib/datadog/core/extensions.rb +16 -0
- data/lib/datadog/core/git/ext.rb +16 -0
- data/lib/datadog/core/header_collection.rb +43 -0
- data/lib/datadog/core/logger.rb +45 -0
- data/lib/datadog/core/logging/ext.rb +13 -0
- data/lib/datadog/core/metrics/client.rb +199 -0
- data/lib/datadog/core/metrics/ext.rb +18 -0
- data/lib/datadog/core/metrics/helpers.rb +25 -0
- data/lib/datadog/core/metrics/logging.rb +44 -0
- data/lib/datadog/core/metrics/metric.rb +14 -0
- data/lib/datadog/core/metrics/options.rb +52 -0
- data/lib/datadog/core/pin.rb +75 -0
- data/lib/datadog/core/remote/client/capabilities.rb +62 -0
- data/lib/datadog/core/remote/client.rb +234 -0
- data/lib/datadog/core/remote/component.rb +162 -0
- data/lib/datadog/core/remote/configuration/content.rb +111 -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 +294 -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 +13 -0
- data/lib/datadog/core/remote/negotiation.rb +70 -0
- data/lib/datadog/core/remote/tie/tracing.rb +39 -0
- data/lib/datadog/core/remote/tie.rb +27 -0
- data/lib/datadog/core/remote/transport/config.rb +60 -0
- data/lib/datadog/core/remote/transport/http/api/instance.rb +39 -0
- data/lib/datadog/core/remote/transport/http/api/spec.rb +21 -0
- data/lib/datadog/core/remote/transport/http/api.rb +58 -0
- data/lib/datadog/core/remote/transport/http/builder.rb +219 -0
- data/lib/datadog/core/remote/transport/http/client.rb +48 -0
- data/lib/datadog/core/remote/transport/http/config.rb +280 -0
- data/lib/datadog/core/remote/transport/http/negotiation.rb +146 -0
- data/lib/datadog/core/remote/transport/http.rb +147 -0
- data/lib/datadog/core/remote/transport/negotiation.rb +62 -0
- data/lib/datadog/core/remote/worker.rb +102 -0
- data/lib/datadog/core/remote.rb +24 -0
- data/lib/datadog/core/runtime/ext.rb +38 -0
- data/lib/datadog/core/runtime/metrics.rb +185 -0
- data/lib/datadog/core/telemetry/client.rb +87 -0
- data/lib/datadog/core/telemetry/collector.rb +248 -0
- data/lib/datadog/core/telemetry/emitter.rb +50 -0
- data/lib/datadog/core/telemetry/event.rb +83 -0
- data/lib/datadog/core/telemetry/ext.rb +15 -0
- data/lib/datadog/core/telemetry/heartbeat.rb +35 -0
- data/lib/datadog/core/telemetry/http/adapters/net.rb +113 -0
- data/lib/datadog/core/telemetry/http/env.rb +20 -0
- data/lib/datadog/core/telemetry/http/ext.rb +22 -0
- data/lib/datadog/core/telemetry/http/response.rb +66 -0
- data/lib/datadog/core/telemetry/http/transport.rb +56 -0
- data/lib/datadog/core/telemetry/v1/app_event.rb +59 -0
- data/lib/datadog/core/telemetry/v1/application.rb +94 -0
- data/lib/datadog/core/telemetry/v1/configuration.rb +27 -0
- data/lib/datadog/core/telemetry/v1/dependency.rb +45 -0
- data/lib/datadog/core/telemetry/v1/host.rb +59 -0
- data/lib/datadog/core/telemetry/v1/install_signature.rb +38 -0
- data/lib/datadog/core/telemetry/v1/integration.rb +66 -0
- data/lib/datadog/core/telemetry/v1/product.rb +36 -0
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +108 -0
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +41 -0
- data/lib/datadog/core/telemetry/v2/request.rb +29 -0
- data/lib/datadog/core/transport/ext.rb +43 -0
- data/lib/datadog/core/transport/http/adapters/net.rb +159 -0
- data/lib/datadog/core/transport/http/adapters/registry.rb +29 -0
- data/lib/datadog/core/transport/http/adapters/test.rb +89 -0
- data/lib/datadog/core/transport/http/adapters/unix_socket.rb +83 -0
- data/lib/datadog/core/transport/http/api/endpoint.rb +31 -0
- data/lib/datadog/core/transport/http/api/fallbacks.rb +26 -0
- data/lib/datadog/core/transport/http/api/map.rb +18 -0
- data/lib/datadog/core/transport/http/env.rb +62 -0
- data/lib/datadog/core/transport/http/response.rb +60 -0
- data/lib/datadog/core/transport/parcel.rb +22 -0
- data/lib/datadog/core/transport/request.rb +17 -0
- data/lib/datadog/core/transport/response.rb +64 -0
- data/lib/datadog/core/utils/duration.rb +52 -0
- data/lib/datadog/core/utils/forking.rb +63 -0
- data/lib/datadog/core/utils/hash.rb +79 -0
- data/lib/datadog/core/utils/network.rb +121 -0
- data/lib/datadog/core/utils/only_once.rb +42 -0
- data/lib/datadog/core/utils/safe_dup.rb +40 -0
- data/lib/datadog/core/utils/sequence.rb +26 -0
- data/lib/datadog/core/utils/time.rb +52 -0
- data/lib/datadog/core/utils/url.rb +25 -0
- data/lib/datadog/core/utils.rb +94 -0
- data/lib/datadog/core/vendor/multipart-post/LICENSE +11 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/composite_read_io.rb +118 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/multipartable.rb +59 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb +137 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/version.rb +11 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post.rb +10 -0
- data/lib/datadog/core/vendor/multipart-post/multipart.rb +14 -0
- data/lib/datadog/core/vendor/multipart-post/net/http/post/multipart.rb +34 -0
- data/lib/datadog/core/worker.rb +24 -0
- data/lib/datadog/core/workers/async.rb +185 -0
- data/lib/datadog/core/workers/interval_loop.rb +123 -0
- data/lib/datadog/core/workers/polling.rb +59 -0
- data/lib/datadog/core/workers/queue.rb +44 -0
- data/lib/datadog/core/workers/runtime_metrics.rb +62 -0
- data/lib/datadog/core.rb +45 -0
- data/lib/datadog/kit/appsec/events.rb +169 -0
- data/lib/datadog/kit/enable_core_dumps.rb +49 -0
- data/lib/datadog/kit/identity.rb +104 -0
- data/lib/datadog/kit.rb +11 -0
- data/lib/datadog/opentelemetry/api/context.rb +193 -0
- data/lib/datadog/opentelemetry/api/trace/span.rb +14 -0
- data/lib/datadog/opentelemetry/sdk/configurator.rb +37 -0
- data/lib/datadog/opentelemetry/sdk/id_generator.rb +26 -0
- data/lib/datadog/opentelemetry/sdk/propagator.rb +92 -0
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +134 -0
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +167 -0
- data/lib/datadog/opentelemetry/trace.rb +59 -0
- data/lib/datadog/opentelemetry.rb +51 -0
- data/lib/datadog/profiling/collectors/code_provenance.rb +113 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +114 -0
- data/lib/datadog/profiling/collectors/dynamic_sampling_rate.rb +14 -0
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +70 -0
- data/lib/datadog/profiling/collectors/info.rb +103 -0
- data/lib/datadog/profiling/collectors/stack.rb +13 -0
- data/lib/datadog/profiling/collectors/thread_context.rb +61 -0
- data/lib/datadog/profiling/component.rb +418 -0
- data/lib/datadog/profiling/exporter.rb +103 -0
- data/lib/datadog/profiling/ext/forking.rb +98 -0
- data/lib/datadog/profiling/ext.rb +35 -0
- data/lib/datadog/profiling/flush.rb +43 -0
- data/lib/datadog/profiling/http_transport.rb +143 -0
- data/lib/datadog/profiling/load_native_extension.rb +28 -0
- data/lib/datadog/profiling/native_extension.rb +20 -0
- data/lib/datadog/profiling/preload.rb +5 -0
- data/lib/datadog/profiling/profiler.rb +64 -0
- data/lib/datadog/profiling/scheduler.rb +137 -0
- data/lib/datadog/profiling/stack_recorder.rb +69 -0
- data/lib/datadog/profiling/tag_builder.rb +60 -0
- data/lib/datadog/profiling/tasks/exec.rb +50 -0
- data/lib/datadog/profiling/tasks/help.rb +18 -0
- data/lib/datadog/profiling/tasks/setup.rb +60 -0
- data/lib/datadog/profiling.rb +152 -0
- data/lib/datadog/tracing/analytics.rb +25 -0
- data/lib/datadog/tracing/buffer.rb +129 -0
- data/lib/datadog/tracing/client_ip.rb +61 -0
- data/lib/datadog/tracing/component.rb +206 -0
- data/lib/datadog/tracing/configuration/dynamic/option.rb +71 -0
- data/lib/datadog/tracing/configuration/dynamic.rb +64 -0
- data/lib/datadog/tracing/configuration/ext.rb +98 -0
- data/lib/datadog/tracing/configuration/http.rb +74 -0
- data/lib/datadog/tracing/configuration/settings.rb +421 -0
- data/lib/datadog/tracing/context.rb +68 -0
- data/lib/datadog/tracing/context_provider.rb +82 -0
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +39 -0
- data/lib/datadog/tracing/contrib/action_cable/event.rb +71 -0
- data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +58 -0
- data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +63 -0
- data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +59 -0
- data/lib/datadog/tracing/contrib/action_cable/events.rb +37 -0
- data/lib/datadog/tracing/contrib/action_cable/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +90 -0
- data/lib/datadog/tracing/contrib/action_cable/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/action_cable/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/action_mailer/event.rb +52 -0
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +60 -0
- data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +47 -0
- data/lib/datadog/tracing/contrib/action_mailer/events.rb +34 -0
- data/lib/datadog/tracing/contrib/action_mailer/ext.rb +34 -0
- data/lib/datadog/tracing/contrib/action_mailer/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +138 -0
- data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/action_pack/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/action_pack/integration.rb +51 -0
- data/lib/datadog/tracing/contrib/action_pack/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/action_pack/utils.rb +40 -0
- data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/action_view/event.rb +35 -0
- data/lib/datadog/tracing/contrib/action_view/events/render_partial.rb +54 -0
- data/lib/datadog/tracing/contrib/action_view/events/render_template.rb +57 -0
- data/lib/datadog/tracing/contrib/action_view/events.rb +34 -0
- data/lib/datadog/tracing/contrib/action_view/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/action_view/integration.rb +58 -0
- data/lib/datadog/tracing/contrib/action_view/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/action_view/utils.rb +36 -0
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +39 -0
- data/lib/datadog/tracing/contrib/active_job/event.rb +58 -0
- data/lib/datadog/tracing/contrib/active_job/events/discard.rb +50 -0
- data/lib/datadog/tracing/contrib/active_job/events/enqueue.rb +49 -0
- data/lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb +49 -0
- data/lib/datadog/tracing/contrib/active_job/events/enqueue_retry.rb +51 -0
- data/lib/datadog/tracing/contrib/active_job/events/perform.rb +49 -0
- data/lib/datadog/tracing/contrib/active_job/events/retry_stopped.rb +50 -0
- data/lib/datadog/tracing/contrib/active_job/events.rb +42 -0
- data/lib/datadog/tracing/contrib/active_job/ext.rb +40 -0
- data/lib/datadog/tracing/contrib/active_job/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/active_job/log_injection.rb +24 -0
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +36 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +68 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +45 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +47 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +34 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/integration.rb +45 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +32 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/makara_resolver.rb +36 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +147 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +48 -0
- data/lib/datadog/tracing/contrib/active_record/event.rb +30 -0
- data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +58 -0
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +77 -0
- data/lib/datadog/tracing/contrib/active_record/events.rb +34 -0
- data/lib/datadog/tracing/contrib/active_record/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/active_record/integration.rb +57 -0
- data/lib/datadog/tracing/contrib/active_record/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/active_record/utils.rb +128 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +186 -0
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +76 -0
- data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +47 -0
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +47 -0
- data/lib/datadog/tracing/contrib/active_support/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/active_support/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +71 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +71 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +164 -0
- data/lib/datadog/tracing/contrib/active_support/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/analytics.rb +28 -0
- data/lib/datadog/tracing/contrib/auto_instrument.rb +53 -0
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +53 -0
- data/lib/datadog/tracing/contrib/aws/ext.rb +50 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +119 -0
- data/lib/datadog/tracing/contrib/aws/integration.rb +47 -0
- data/lib/datadog/tracing/contrib/aws/parsed_context.rb +64 -0
- data/lib/datadog/tracing/contrib/aws/patcher.rb +57 -0
- data/lib/datadog/tracing/contrib/aws/service/base.rb +16 -0
- data/lib/datadog/tracing/contrib/aws/service/dynamodb.rb +22 -0
- data/lib/datadog/tracing/contrib/aws/service/eventbridge.rb +22 -0
- data/lib/datadog/tracing/contrib/aws/service/kinesis.rb +32 -0
- data/lib/datadog/tracing/contrib/aws/service/s3.rb +22 -0
- data/lib/datadog/tracing/contrib/aws/service/sns.rb +30 -0
- data/lib/datadog/tracing/contrib/aws/service/sqs.rb +27 -0
- data/lib/datadog/tracing/contrib/aws/service/states.rb +40 -0
- data/lib/datadog/tracing/contrib/aws/services.rb +139 -0
- data/lib/datadog/tracing/contrib/component.rb +41 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/async_patch.rb +20 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +24 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +53 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +16 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +20 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +49 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/promises_future_patch.rb +22 -0
- data/lib/datadog/tracing/contrib/configurable.rb +102 -0
- data/lib/datadog/tracing/contrib/configuration/resolver.rb +85 -0
- data/lib/datadog/tracing/contrib/configuration/resolvers/pattern_resolver.rb +43 -0
- data/lib/datadog/tracing/contrib/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +58 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +40 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +75 -0
- data/lib/datadog/tracing/contrib/dalli/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/dalli/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/dalli/quantize.rb +26 -0
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +49 -0
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/delayed_job/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +108 -0
- data/lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb +34 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +57 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +34 -0
- data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +164 -0
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +87 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +56 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +223 -0
- data/lib/datadog/tracing/contrib/ethon/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/ethon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +102 -0
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +30 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +74 -0
- data/lib/datadog/tracing/contrib/excon/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/excon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +196 -0
- data/lib/datadog/tracing/contrib/excon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/ext.rb +55 -0
- data/lib/datadog/tracing/contrib/extensions.rb +228 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +77 -0
- data/lib/datadog/tracing/contrib/faraday/connection.rb +22 -0
- data/lib/datadog/tracing/contrib/faraday/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/faraday/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +112 -0
- data/lib/datadog/tracing/contrib/faraday/patcher.rb +56 -0
- data/lib/datadog/tracing/contrib/faraday/rack_builder.rb +22 -0
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +55 -0
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +256 -0
- data/lib/datadog/tracing/contrib/grape/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/grape/instrumentation.rb +37 -0
- data/lib/datadog/tracing/contrib/grape/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/grape/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +50 -0
- data/lib/datadog/tracing/contrib/graphql/ext.rb +20 -0
- data/lib/datadog/tracing/contrib/graphql/integration.rb +56 -0
- data/lib/datadog/tracing/contrib/graphql/patcher.rb +55 -0
- data/lib/datadog/tracing/contrib/graphql/trace_patcher.rb +24 -0
- data/lib/datadog/tracing/contrib/graphql/tracing_patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +58 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +117 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +96 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +107 -0
- data/lib/datadog/tracing/contrib/grpc/distributed/fetcher.rb +26 -0
- data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +46 -0
- data/lib/datadog/tracing/contrib/grpc/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/grpc/formatting.rb +127 -0
- data/lib/datadog/tracing/contrib/grpc/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +53 -0
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/grpc.rb +45 -0
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +47 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +23 -0
- data/lib/datadog/tracing/contrib/hanami/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/hanami/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/hanami/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/hanami/plugin.rb +23 -0
- data/lib/datadog/tracing/contrib/hanami/renderer_policy_tracing.rb +41 -0
- data/lib/datadog/tracing/contrib/hanami/router_tracing.rb +44 -0
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +40 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +69 -0
- data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +38 -0
- data/lib/datadog/tracing/contrib/http/distributed/propagation.rb +45 -0
- data/lib/datadog/tracing/contrib/http/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +144 -0
- data/lib/datadog/tracing/contrib/http/integration.rb +49 -0
- data/lib/datadog/tracing/contrib/http/patcher.rb +30 -0
- data/lib/datadog/tracing/contrib/http.rb +45 -0
- data/lib/datadog/tracing/contrib/http_annotation_helper.rb +17 -0
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +68 -0
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +137 -0
- data/lib/datadog/tracing/contrib/httpclient/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/httpclient/patcher.rb +42 -0
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +68 -0
- data/lib/datadog/tracing/contrib/httprb/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +145 -0
- data/lib/datadog/tracing/contrib/httprb/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/httprb/patcher.rb +42 -0
- data/lib/datadog/tracing/contrib/integration.rb +78 -0
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +39 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +19 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +18 -0
- data/lib/datadog/tracing/contrib/kafka/event.rb +53 -0
- data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +42 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +49 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +47 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +47 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/join_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/leave_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/sync_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +41 -0
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +44 -0
- data/lib/datadog/tracing/contrib/kafka/events.rb +48 -0
- data/lib/datadog/tracing/contrib/kafka/ext.rb +55 -0
- data/lib/datadog/tracing/contrib/kafka/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/kafka/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +24 -0
- data/lib/datadog/tracing/contrib/lograge/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +31 -0
- data/lib/datadog/tracing/contrib/lograge/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/lograge/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +56 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +38 -0
- data/lib/datadog/tracing/contrib/mongodb/instrumentation.rb +47 -0
- data/lib/datadog/tracing/contrib/mongodb/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/mongodb/parsers.rb +49 -0
- data/lib/datadog/tracing/contrib/mongodb/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +141 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +64 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +28 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +95 -0
- data/lib/datadog/tracing/contrib/mysql2/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/mysql2/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +54 -0
- data/lib/datadog/tracing/contrib/opensearch/ext.rb +38 -0
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +135 -0
- data/lib/datadog/tracing/contrib/opensearch/quantize.rb +81 -0
- data/lib/datadog/tracing/contrib/patchable.rb +109 -0
- data/lib/datadog/tracing/contrib/patcher.rb +85 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +64 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +35 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +211 -0
- data/lib/datadog/tracing/contrib/pg/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/pg/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +52 -0
- data/lib/datadog/tracing/contrib/presto/ext.rb +38 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +138 -0
- data/lib/datadog/tracing/contrib/presto/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/presto/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/comment.rb +41 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment/mode.rb +28 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +55 -0
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +55 -0
- data/lib/datadog/tracing/contrib/que/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/que/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/que/patcher.rb +26 -0
- data/lib/datadog/tracing/contrib/que/tracer.rb +63 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +47 -0
- data/lib/datadog/tracing/contrib/racecar/event.rb +81 -0
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +38 -0
- data/lib/datadog/tracing/contrib/racecar/events/consume.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +38 -0
- data/lib/datadog/tracing/contrib/racecar/events.rb +36 -0
- data/lib/datadog/tracing/contrib/racecar/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/racecar/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/racecar/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +59 -0
- data/lib/datadog/tracing/contrib/rack/ext.rb +30 -0
- data/lib/datadog/tracing/contrib/rack/header_collection.rb +40 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +63 -0
- data/lib/datadog/tracing/contrib/rack/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +265 -0
- data/lib/datadog/tracing/contrib/rack/patcher.rb +119 -0
- data/lib/datadog/tracing/contrib/rack/request_queue.rb +48 -0
- data/lib/datadog/tracing/contrib/rack/trace_proxy_middleware.rb +52 -0
- data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +10 -0
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +76 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/rails/framework.rb +148 -0
- data/lib/datadog/tracing/contrib/rails/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +29 -0
- data/lib/datadog/tracing/contrib/rails/middlewares.rb +46 -0
- data/lib/datadog/tracing/contrib/rails/patcher.rb +88 -0
- data/lib/datadog/tracing/contrib/rails/railtie.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/utils.rb +26 -0
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +55 -0
- data/lib/datadog/tracing/contrib/rake/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/rake/instrumentation.rb +103 -0
- data/lib/datadog/tracing/contrib/rake/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rake/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +49 -0
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +57 -0
- data/lib/datadog/tracing/contrib/redis/ext.rb +35 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +53 -0
- data/lib/datadog/tracing/contrib/redis/integration.rb +80 -0
- data/lib/datadog/tracing/contrib/redis/patcher.rb +92 -0
- data/lib/datadog/tracing/contrib/redis/quantize.rb +80 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +68 -0
- data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +85 -0
- data/lib/datadog/tracing/contrib/redis/vendor/LICENSE +20 -0
- data/lib/datadog/tracing/contrib/redis/vendor/resolver.rb +160 -0
- data/lib/datadog/tracing/contrib/registerable.rb +50 -0
- data/lib/datadog/tracing/contrib/registry.rb +52 -0
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/resque/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/resque/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/resque/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/resque/resque_job.rb +106 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +55 -0
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +28 -0
- data/lib/datadog/tracing/contrib/rest_client/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rest_client/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +129 -0
- data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/roda/ext.rb +19 -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 +24 -0
- data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +35 -0
- data/lib/datadog/tracing/contrib/semantic_logger/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/sequel/database.rb +62 -0
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +67 -0
- data/lib/datadog/tracing/contrib/sequel/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/sequel/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sequel/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/sequel/utils.rb +90 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/shoryuken/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +65 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +62 -0
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +47 -0
- data/lib/datadog/tracing/contrib/sidekiq/distributed/propagation.rb +46 -0
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq/integration.rb +61 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +90 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +61 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +36 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/redis_info.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_poller.rb +57 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/stop.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +88 -0
- data/lib/datadog/tracing/contrib/sidekiq/utils.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq.rb +37 -0
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +46 -0
- data/lib/datadog/tracing/contrib/sinatra/env.rb +38 -0
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +31 -0
- data/lib/datadog/tracing/contrib/sinatra/framework.rb +116 -0
- data/lib/datadog/tracing/contrib/sinatra/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +75 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +86 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +109 -0
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/sneakers/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/sneakers/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +60 -0
- data/lib/datadog/tracing/contrib/span_attribute_schema.rb +92 -0
- data/lib/datadog/tracing/contrib/status_range_env_parser.rb +33 -0
- data/lib/datadog/tracing/contrib/status_range_matcher.rb +25 -0
- data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/stripe/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/stripe/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/stripe/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/stripe/request.rb +67 -0
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +39 -0
- data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +28 -0
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +28 -0
- data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +104 -0
- data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +35 -0
- data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +58 -0
- data/lib/datadog/tracing/contrib/trilogy/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +94 -0
- data/lib/datadog/tracing/contrib/trilogy/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/trilogy/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/utils/database.rb +31 -0
- data/lib/datadog/tracing/contrib/utils/quantization/hash.rb +111 -0
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +179 -0
- data/lib/datadog/tracing/contrib.rb +81 -0
- data/lib/datadog/tracing/correlation.rb +103 -0
- data/lib/datadog/tracing/diagnostics/environment_logger.rb +159 -0
- data/lib/datadog/tracing/diagnostics/ext.rb +36 -0
- data/lib/datadog/tracing/diagnostics/health.rb +40 -0
- data/lib/datadog/tracing/distributed/b3_multi.rb +73 -0
- data/lib/datadog/tracing/distributed/b3_single.rb +69 -0
- data/lib/datadog/tracing/distributed/datadog.rb +200 -0
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +84 -0
- data/lib/datadog/tracing/distributed/fetcher.rb +21 -0
- data/lib/datadog/tracing/distributed/helpers.rb +65 -0
- data/lib/datadog/tracing/distributed/none.rb +18 -0
- data/lib/datadog/tracing/distributed/propagation.rb +121 -0
- data/lib/datadog/tracing/distributed/trace_context.rb +436 -0
- data/lib/datadog/tracing/event.rb +76 -0
- data/lib/datadog/tracing/flush.rb +96 -0
- data/lib/datadog/tracing/metadata/analytics.rb +26 -0
- data/lib/datadog/tracing/metadata/errors.rb +24 -0
- data/lib/datadog/tracing/metadata/ext.rb +193 -0
- data/lib/datadog/tracing/metadata/tagging.rb +131 -0
- data/lib/datadog/tracing/metadata.rb +20 -0
- data/lib/datadog/tracing/pipeline/span_filter.rb +46 -0
- data/lib/datadog/tracing/pipeline/span_processor.rb +39 -0
- data/lib/datadog/tracing/pipeline.rb +63 -0
- data/lib/datadog/tracing/remote.rb +78 -0
- data/lib/datadog/tracing/runtime/metrics.rb +17 -0
- data/lib/datadog/tracing/sampling/all_sampler.rb +24 -0
- data/lib/datadog/tracing/sampling/ext.rb +56 -0
- data/lib/datadog/tracing/sampling/matcher.rb +65 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +160 -0
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +87 -0
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +63 -0
- data/lib/datadog/tracing/sampling/rate_limiter.rb +185 -0
- data/lib/datadog/tracing/sampling/rate_sampler.rb +58 -0
- data/lib/datadog/tracing/sampling/rule.rb +61 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +148 -0
- data/lib/datadog/tracing/sampling/sampler.rb +32 -0
- data/lib/datadog/tracing/sampling/span/ext.rb +25 -0
- data/lib/datadog/tracing/sampling/span/matcher.rb +89 -0
- data/lib/datadog/tracing/sampling/span/rule.rb +78 -0
- data/lib/datadog/tracing/sampling/span/rule_parser.rb +104 -0
- data/lib/datadog/tracing/sampling/span/sampler.rb +77 -0
- data/lib/datadog/tracing/span.rb +207 -0
- data/lib/datadog/tracing/span_operation.rb +498 -0
- data/lib/datadog/tracing/sync_writer.rb +67 -0
- data/lib/datadog/tracing/trace_digest.rb +185 -0
- data/lib/datadog/tracing/trace_operation.rb +492 -0
- data/lib/datadog/tracing/trace_segment.rb +222 -0
- data/lib/datadog/tracing/tracer.rb +531 -0
- data/lib/datadog/tracing/transport/http/api/instance.rb +37 -0
- data/lib/datadog/tracing/transport/http/api/spec.rb +19 -0
- data/lib/datadog/tracing/transport/http/api.rb +43 -0
- data/lib/datadog/tracing/transport/http/builder.rb +162 -0
- data/lib/datadog/tracing/transport/http/client.rb +57 -0
- data/lib/datadog/tracing/transport/http/statistics.rb +47 -0
- data/lib/datadog/tracing/transport/http/traces.rb +152 -0
- data/lib/datadog/tracing/transport/http.rb +97 -0
- data/lib/datadog/tracing/transport/io/client.rb +89 -0
- data/lib/datadog/tracing/transport/io/response.rb +27 -0
- data/lib/datadog/tracing/transport/io/traces.rb +101 -0
- data/lib/datadog/tracing/transport/io.rb +30 -0
- data/lib/datadog/tracing/transport/serializable_trace.rb +126 -0
- data/lib/datadog/tracing/transport/statistics.rb +77 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +240 -0
- data/lib/datadog/tracing/transport/traces.rb +224 -0
- data/lib/datadog/tracing/utils.rb +83 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +196 -0
- data/lib/datadog/tracing/workers.rb +125 -0
- data/lib/datadog/tracing/writer.rb +188 -0
- data/lib/datadog/tracing.rb +169 -0
- data/lib/datadog/version.rb +26 -0
- data/lib/datadog.rb +10 -0
- metadata +886 -0
@@ -0,0 +1,280 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
require_relative '../config'
|
7
|
+
require_relative 'client'
|
8
|
+
require_relative '../../../transport/http/response'
|
9
|
+
require_relative '../../../transport/http/api/endpoint'
|
10
|
+
|
11
|
+
# TODO: Decouple standard transport/http/api/instance
|
12
|
+
#
|
13
|
+
# Separate classes are needed because transport/http/trace includes
|
14
|
+
# Trace::API::Instance which closes over and uses a single spec, which is
|
15
|
+
# negotiated as either /v3 or /v4 for the whole API at the spec level, but we
|
16
|
+
# need an independent toplevel path at the endpoint level.
|
17
|
+
#
|
18
|
+
# Separate classes are needed because of `include Trace::API::Instance`.
|
19
|
+
#
|
20
|
+
# Below should be:
|
21
|
+
# require_relative '../../../core/transport/http/api/instance'
|
22
|
+
require_relative 'api/instance'
|
23
|
+
# Below should be:
|
24
|
+
# require_relative '../../../core/transport/http/api/spec'
|
25
|
+
require_relative 'api/spec'
|
26
|
+
|
27
|
+
module Datadog
|
28
|
+
module Core
|
29
|
+
module Remote
|
30
|
+
module Transport
|
31
|
+
module HTTP
|
32
|
+
# HTTP transport behavior for remote configuration
|
33
|
+
module Config
|
34
|
+
# Response from HTTP transport for remote configuration
|
35
|
+
class Response
|
36
|
+
include Datadog::Core::Transport::HTTP::Response
|
37
|
+
include Core::Remote::Transport::Config::Response
|
38
|
+
|
39
|
+
def initialize(http_response, options = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
40
|
+
super(http_response)
|
41
|
+
|
42
|
+
begin
|
43
|
+
payload = JSON.parse(http_response.payload, symbolize_names: true)
|
44
|
+
rescue JSON::ParserError => e
|
45
|
+
raise ParseError.new(:roots, e)
|
46
|
+
end
|
47
|
+
|
48
|
+
raise TypeError.new(Hash, payload) unless payload.is_a?(Hash)
|
49
|
+
|
50
|
+
@empty = true if payload.empty?
|
51
|
+
|
52
|
+
# TODO: these fallbacks should be improved
|
53
|
+
roots = payload[:roots] || []
|
54
|
+
targets = payload[:targets] || Base64.encode64('{}').chomp
|
55
|
+
target_files = payload[:target_files] || []
|
56
|
+
client_configs = payload[:client_configs] || []
|
57
|
+
|
58
|
+
raise TypeError.new(Array, roots) unless roots.is_a?(Array)
|
59
|
+
|
60
|
+
@roots = roots.map do |root|
|
61
|
+
raise TypeError.new(String, root) unless root.is_a?(String)
|
62
|
+
|
63
|
+
decoded = begin
|
64
|
+
Base64.strict_decode64(root) # TODO: unprocessed, don't symbolize_names
|
65
|
+
rescue ArgumentError
|
66
|
+
raise DecodeError.new(:roots, root)
|
67
|
+
end
|
68
|
+
|
69
|
+
parsed = begin
|
70
|
+
JSON.parse(decoded)
|
71
|
+
rescue JSON::ParserError
|
72
|
+
raise ParseError.new(:roots, decoded)
|
73
|
+
end
|
74
|
+
|
75
|
+
# TODO: perform more processing to validate content. til then, no freeze
|
76
|
+
|
77
|
+
parsed
|
78
|
+
end
|
79
|
+
|
80
|
+
raise TypeError.new(String, targets) unless targets.is_a?(String)
|
81
|
+
|
82
|
+
@targets = begin
|
83
|
+
decoded = begin
|
84
|
+
Base64.strict_decode64(targets)
|
85
|
+
rescue ArgumentError
|
86
|
+
raise DecodeError.new(:targets, targets)
|
87
|
+
end
|
88
|
+
|
89
|
+
parsed = begin
|
90
|
+
JSON.parse(decoded) # TODO: unprocessed, don't symbolize_names
|
91
|
+
rescue JSON::ParserError
|
92
|
+
raise ParseError.new(:targets, decoded)
|
93
|
+
end
|
94
|
+
|
95
|
+
# TODO: perform more processing to validate content. til then, no freeze
|
96
|
+
|
97
|
+
parsed
|
98
|
+
end
|
99
|
+
|
100
|
+
raise TypeError.new(Array, target_files) unless target_files.is_a?(Array)
|
101
|
+
|
102
|
+
@target_files = target_files.map do |h|
|
103
|
+
raise TypeError.new(Hash, h) unless h.is_a?(Hash)
|
104
|
+
raise KeyError.new(:raw) unless h.key?(:raw) # rubocop:disable Style/RaiseArgs
|
105
|
+
raise KeyError.new(:path) unless h.key?(:path) # rubocop:disable Style/RaiseArgs
|
106
|
+
|
107
|
+
raw = h[:raw]
|
108
|
+
|
109
|
+
raise TypeError.new(String, raw) unless raw.is_a?(String)
|
110
|
+
|
111
|
+
content = begin
|
112
|
+
Base64.strict_decode64(raw)
|
113
|
+
rescue ArgumentError
|
114
|
+
raise DecodeError.new(:target_files, raw)
|
115
|
+
end
|
116
|
+
|
117
|
+
{
|
118
|
+
path: h[:path].freeze,
|
119
|
+
content: StringIO.new(content.freeze),
|
120
|
+
}
|
121
|
+
end.freeze
|
122
|
+
|
123
|
+
@client_configs = client_configs.map do |s|
|
124
|
+
raise TypeError.new(String, s) unless s.is_a?(String)
|
125
|
+
|
126
|
+
s.freeze
|
127
|
+
end.freeze
|
128
|
+
end
|
129
|
+
|
130
|
+
def inspect
|
131
|
+
"#{super}, #{
|
132
|
+
{
|
133
|
+
roots: @roots,
|
134
|
+
targets: @targets,
|
135
|
+
target_files: @target_files,
|
136
|
+
client_configs: @client_configs,
|
137
|
+
}}"
|
138
|
+
end
|
139
|
+
|
140
|
+
# When an expected key is missing
|
141
|
+
class KeyError < StandardError
|
142
|
+
def initialize(key)
|
143
|
+
message = "key not found: #{key.inspect}"
|
144
|
+
|
145
|
+
super(message)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# When an expected value type is incorrect
|
150
|
+
class TypeError < StandardError
|
151
|
+
def initialize(type, value)
|
152
|
+
message = "not a #{type}: #{value.inspect}"
|
153
|
+
|
154
|
+
super(message)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# When value decoding fails
|
159
|
+
class DecodeError < StandardError
|
160
|
+
def initialize(key, value)
|
161
|
+
message = "could not decode key #{key.inspect}: #{value.inspect}"
|
162
|
+
|
163
|
+
super(message)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# When value parsing fails
|
168
|
+
class ParseError < StandardError
|
169
|
+
def initialize(key, value)
|
170
|
+
message = "could not parse key #{key.inspect}: #{value.inspect}"
|
171
|
+
|
172
|
+
super(message)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Extensions for HTTP client
|
178
|
+
module Client
|
179
|
+
def send_config_payload(request)
|
180
|
+
send_request(request) do |api, env|
|
181
|
+
api.send_config(env)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
module API
|
187
|
+
# Extensions for HTTP API Spec
|
188
|
+
module Spec
|
189
|
+
attr_reader :config
|
190
|
+
|
191
|
+
def config=(endpoint)
|
192
|
+
@config = endpoint
|
193
|
+
end
|
194
|
+
|
195
|
+
def send_config(env, &block)
|
196
|
+
raise NoConfigEndpointDefinedError, self if config.nil?
|
197
|
+
|
198
|
+
config.call(env, &block)
|
199
|
+
end
|
200
|
+
|
201
|
+
# Raised when traces sent but no traces endpoint is defined
|
202
|
+
class NoConfigEndpointDefinedError < StandardError
|
203
|
+
attr_reader :spec
|
204
|
+
|
205
|
+
def initialize(spec)
|
206
|
+
super()
|
207
|
+
|
208
|
+
@spec = spec
|
209
|
+
end
|
210
|
+
|
211
|
+
def message
|
212
|
+
'No config endpoint is defined for API specification!'
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Extensions for HTTP API Instance
|
218
|
+
module Instance
|
219
|
+
def send_config(env)
|
220
|
+
raise ConfigNotSupportedError, spec unless spec.is_a?(Config::API::Spec)
|
221
|
+
|
222
|
+
spec.send_config(env) do |request_env|
|
223
|
+
call(request_env)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# Raised when traces sent to API that does not support traces
|
228
|
+
class ConfigNotSupportedError < StandardError
|
229
|
+
attr_reader :spec
|
230
|
+
|
231
|
+
def initialize(spec)
|
232
|
+
super()
|
233
|
+
|
234
|
+
@spec = spec
|
235
|
+
end
|
236
|
+
|
237
|
+
def message
|
238
|
+
'Config not supported for this API!'
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Endpoint for remote configuration
|
244
|
+
class Endpoint < Datadog::Core::Transport::HTTP::API::Endpoint
|
245
|
+
HEADER_CONTENT_TYPE = 'Content-Type'
|
246
|
+
|
247
|
+
attr_reader :encoder
|
248
|
+
|
249
|
+
def initialize(path, encoder)
|
250
|
+
super(:post, path)
|
251
|
+
@encoder = encoder
|
252
|
+
end
|
253
|
+
|
254
|
+
def call(env, &block)
|
255
|
+
# Encode body & type
|
256
|
+
env.headers[HEADER_CONTENT_TYPE] = encoder.content_type
|
257
|
+
env.body = env.request.parcel.data
|
258
|
+
|
259
|
+
# Query for response
|
260
|
+
http_response = super(env, &block)
|
261
|
+
|
262
|
+
response_options = {}
|
263
|
+
|
264
|
+
# Build and return a response
|
265
|
+
Config::Response.new(http_response, response_options)
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Add remote configuration behavior to transport components
|
271
|
+
###### overrides send_payload! which calls send_<endpoint>! kills any other possible endpoint!
|
272
|
+
HTTP::Client.include(Config::Client)
|
273
|
+
HTTP::API::Spec.include(Config::API::Spec)
|
274
|
+
HTTP::API::Instance.include(Config::API::Instance)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require_relative '../negotiation'
|
6
|
+
require_relative 'client'
|
7
|
+
require_relative '../../../transport/http/response'
|
8
|
+
require_relative '../../../transport/http/api/endpoint'
|
9
|
+
|
10
|
+
# TODO: Decouple standard transport/http/api/instance
|
11
|
+
#
|
12
|
+
# Separate classes are needed because transport/http/trace includes
|
13
|
+
# Trace::API::Instance which closes over and uses a single spec, which is
|
14
|
+
# negotiated as either /v3 or /v4 for the whole API at the spec level, but we
|
15
|
+
# need an independent toplevel path at the endpoint level.
|
16
|
+
#
|
17
|
+
# Separate classes are needed because of `include Trace::API::Instance`.
|
18
|
+
#
|
19
|
+
# Below should be:
|
20
|
+
# require_relative '../../../../datadog/core/transport/http/api/instance'
|
21
|
+
require_relative 'api/instance'
|
22
|
+
# Below should be:
|
23
|
+
# require_relative '../../../../datadog/core/transport/http/api/spec'
|
24
|
+
require_relative 'api/spec'
|
25
|
+
|
26
|
+
module Datadog
|
27
|
+
module Core
|
28
|
+
module Remote
|
29
|
+
module Transport
|
30
|
+
module HTTP
|
31
|
+
# HTTP transport behavior for agent feature negotiation
|
32
|
+
module Negotiation
|
33
|
+
# Response from HTTP transport for agent feature negotiation
|
34
|
+
class Response
|
35
|
+
include Datadog::Core::Transport::HTTP::Response
|
36
|
+
include Core::Remote::Transport::Negotiation::Response
|
37
|
+
|
38
|
+
def initialize(http_response, options = {})
|
39
|
+
super(http_response)
|
40
|
+
|
41
|
+
# TODO: transform endpoint hash in a better object for negotiation
|
42
|
+
# TODO: transform config in a better object, notably config has max_request_bytes
|
43
|
+
@version = options[:version]
|
44
|
+
@endpoints = options[:endpoints]
|
45
|
+
@config = options[:config]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Extensions for HTTP client
|
50
|
+
module Client
|
51
|
+
def send_info_payload(request)
|
52
|
+
send_request(request) do |api, env|
|
53
|
+
api.send_info(env)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
module API
|
59
|
+
# Extensions for HTTP API Spec
|
60
|
+
module Spec
|
61
|
+
attr_reader :info
|
62
|
+
|
63
|
+
def info=(endpoint)
|
64
|
+
@info = endpoint
|
65
|
+
end
|
66
|
+
|
67
|
+
def send_info(env, &block)
|
68
|
+
raise NoNegotiationEndpointDefinedError, self if info.nil?
|
69
|
+
|
70
|
+
info.call(env, &block)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Raised when traces sent but no traces endpoint is defined
|
74
|
+
class NoNegotiationEndpointDefinedError < StandardError
|
75
|
+
attr_reader :spec
|
76
|
+
|
77
|
+
def initialize(spec)
|
78
|
+
super()
|
79
|
+
|
80
|
+
@spec = spec
|
81
|
+
end
|
82
|
+
|
83
|
+
def message
|
84
|
+
'No info endpoint is defined for API specification!'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Extensions for HTTP API Instance
|
90
|
+
module Instance
|
91
|
+
def send_info(env)
|
92
|
+
raise NegotiationNotSupportedError, spec unless spec.is_a?(Negotiation::API::Spec)
|
93
|
+
|
94
|
+
spec.send_info(env) do |request_env|
|
95
|
+
call(request_env)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Raised when traces sent to API that does not support traces
|
100
|
+
class NegotiationNotSupportedError < StandardError
|
101
|
+
attr_reader :spec
|
102
|
+
|
103
|
+
def initialize(spec)
|
104
|
+
super()
|
105
|
+
|
106
|
+
@spec = spec
|
107
|
+
end
|
108
|
+
|
109
|
+
def message
|
110
|
+
'Info not supported for this API!'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Endpoint for negotiation
|
116
|
+
class Endpoint < Datadog::Core::Transport::HTTP::API::Endpoint
|
117
|
+
def initialize(path)
|
118
|
+
super(:get, path)
|
119
|
+
end
|
120
|
+
|
121
|
+
def call(env, &block)
|
122
|
+
# Query for response
|
123
|
+
http_response = super(env, &block)
|
124
|
+
|
125
|
+
# Process the response
|
126
|
+
body = JSON.parse(http_response.payload, symbolize_names: true) if http_response.ok?
|
127
|
+
|
128
|
+
# TODO: there should be more processing here to ensure a proper response_options
|
129
|
+
response_options = body.is_a?(Hash) ? body : {}
|
130
|
+
|
131
|
+
# Build and return a trace response
|
132
|
+
Negotiation::Response.new(http_response, response_options)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Add negotiation behavior to transport components
|
138
|
+
HTTP::Client.include(Negotiation::Client)
|
139
|
+
HTTP::API::Spec.include(Negotiation::API::Spec)
|
140
|
+
HTTP::API::Instance.include(Negotiation::API::Instance)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
require_relative '../../environment/container'
|
6
|
+
require_relative '../../environment/ext'
|
7
|
+
require_relative '../../transport/ext'
|
8
|
+
require_relative '../../transport/http/adapters/net'
|
9
|
+
require_relative '../../transport/http/adapters/unix_socket'
|
10
|
+
require_relative '../../transport/http/adapters/test'
|
11
|
+
|
12
|
+
# TODO: Improve negotiation to allow per endpoint selection
|
13
|
+
#
|
14
|
+
# Since endpoint negotiation happens at the `API::Spec` level there can not be
|
15
|
+
# a mix of endpoints at various versions or versionless without describing all
|
16
|
+
# the possible combinations as specs. See http/api.
|
17
|
+
#
|
18
|
+
# Below should be:
|
19
|
+
# require_relative '../../transport/http/api'
|
20
|
+
require_relative 'http/api'
|
21
|
+
|
22
|
+
# TODO: Decouple transport/http/builder
|
23
|
+
#
|
24
|
+
# See http/builder
|
25
|
+
#
|
26
|
+
# Below should be:
|
27
|
+
# require_relative '../../transport/http/builder'
|
28
|
+
require_relative 'http/builder'
|
29
|
+
|
30
|
+
# TODO: Decouple transport/http
|
31
|
+
#
|
32
|
+
# Because a new transport is required for every (API, Client, Transport)
|
33
|
+
# triplet and endpoints cannot be negotiated independently, there can not be a
|
34
|
+
# single `default` transport, but only endpoint-specific ones.
|
35
|
+
|
36
|
+
module Datadog
|
37
|
+
module Core
|
38
|
+
module Remote
|
39
|
+
module Transport
|
40
|
+
# Namespace for HTTP transport components
|
41
|
+
module HTTP
|
42
|
+
# NOTE: Due to... legacy reasons... This class likes having a default `AgentSettings` instance to fall back to.
|
43
|
+
# Because we generate this instance with an empty instance of `Settings`, the resulting `AgentSettings` below
|
44
|
+
# represents only settings specified via environment variables + the usual defaults.
|
45
|
+
#
|
46
|
+
# DO NOT USE THIS IN NEW CODE, as it ignores any settings specified by users via `Datadog.configure`.
|
47
|
+
DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS = Datadog::Core::Configuration::AgentSettingsResolver.call(
|
48
|
+
Datadog::Core::Configuration::Settings.new,
|
49
|
+
logger: nil,
|
50
|
+
)
|
51
|
+
|
52
|
+
module_function
|
53
|
+
|
54
|
+
# Builds a new Transport::HTTP::Client
|
55
|
+
def new(klass, &block)
|
56
|
+
Builder.new(&block).to_transport(klass)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Builds a new Transport::HTTP::Client with default settings
|
60
|
+
# Pass a block to override any settings.
|
61
|
+
def root(
|
62
|
+
agent_settings: DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS,
|
63
|
+
**options
|
64
|
+
)
|
65
|
+
new(Core::Remote::Transport::Negotiation::Transport) do |transport|
|
66
|
+
transport.adapter(agent_settings)
|
67
|
+
transport.headers(default_headers)
|
68
|
+
|
69
|
+
apis = API.defaults
|
70
|
+
|
71
|
+
transport.api API::ROOT, apis[API::ROOT]
|
72
|
+
|
73
|
+
# Apply any settings given by options
|
74
|
+
unless options.empty?
|
75
|
+
transport.default_api = options[:api_version] if options.key?(:api_version)
|
76
|
+
transport.headers options[:headers] if options.key?(:headers)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Call block to apply any customization, if provided
|
80
|
+
yield(transport) if block_given?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Builds a new Transport::HTTP::Client with default settings
|
85
|
+
# Pass a block to override any settings.
|
86
|
+
def v7(
|
87
|
+
agent_settings: DO_NOT_USE_ENVIRONMENT_AGENT_SETTINGS,
|
88
|
+
**options
|
89
|
+
)
|
90
|
+
new(Core::Remote::Transport::Config::Transport) do |transport|
|
91
|
+
transport.adapter(agent_settings)
|
92
|
+
transport.headers default_headers
|
93
|
+
|
94
|
+
apis = API.defaults
|
95
|
+
|
96
|
+
transport.api API::V7, apis[API::V7]
|
97
|
+
|
98
|
+
# Apply any settings given by options
|
99
|
+
unless options.empty?
|
100
|
+
transport.default_api = options[:api_version] if options.key?(:api_version)
|
101
|
+
transport.headers options[:headers] if options.key?(:headers)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Call block to apply any customization, if provided
|
105
|
+
yield(transport) if block_given?
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def default_headers
|
110
|
+
{
|
111
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_CLIENT_COMPUTED_TOP_LEVEL => '1',
|
112
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG => Datadog::Core::Environment::Ext::LANG,
|
113
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_VERSION =>
|
114
|
+
Datadog::Core::Environment::Ext::LANG_VERSION,
|
115
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_META_LANG_INTERPRETER =>
|
116
|
+
Datadog::Core::Environment::Ext::LANG_INTERPRETER,
|
117
|
+
Datadog::Core::Transport::Ext::HTTP::HEADER_META_TRACER_VERSION =>
|
118
|
+
Datadog::Core::Environment::Ext::GEM_DATADOG_VERSION
|
119
|
+
}.tap do |headers|
|
120
|
+
# Add container ID, if present.
|
121
|
+
container_id = Datadog::Core::Environment::Container.container_id
|
122
|
+
headers[Datadog::Core::Transport::Ext::HTTP::HEADER_CONTAINER_ID] = container_id unless container_id.nil?
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def default_adapter
|
127
|
+
Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
|
128
|
+
end
|
129
|
+
|
130
|
+
# Add adapters to registry
|
131
|
+
Builder::REGISTRY.set(
|
132
|
+
Datadog::Core::Transport::HTTP::Adapters::Net,
|
133
|
+
Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER
|
134
|
+
)
|
135
|
+
Builder::REGISTRY.set(
|
136
|
+
Datadog::Core::Transport::HTTP::Adapters::Test,
|
137
|
+
Datadog::Core::Transport::Ext::Test::ADAPTER
|
138
|
+
)
|
139
|
+
Builder::REGISTRY.set(
|
140
|
+
Datadog::Core::Transport::HTTP::Adapters::UnixSocket,
|
141
|
+
Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER
|
142
|
+
)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../../core/transport/request'
|
4
|
+
|
5
|
+
# TODO: Resolve conceptual conundrum
|
6
|
+
#
|
7
|
+
# It seems that through naming of `Transport::Traces::Transport` the transport
|
8
|
+
# is specific to traces, which kind of matches the almost-generic-but-not-quite
|
9
|
+
# implementation.
|
10
|
+
#
|
11
|
+
# This may be why `Transport::Traces::Transport` negotiates only considering
|
12
|
+
# the `/vX/traces` path, but here we don't negotiate since we are at the root.
|
13
|
+
#
|
14
|
+
# In turn this means that API::Spec cannot describe multiple roots, or even
|
15
|
+
# endpoints that happen to differ in version.
|
16
|
+
#
|
17
|
+
# Concepts such as Spec, API, Endpoint, and Transport should be clarified
|
18
|
+
# before attempting further refactoring here, to attempt to resolve whether a
|
19
|
+
# Transport - via its negotiated Spec - describes a function (implemented as
|
20
|
+
# one or more endpoints) or whether the Spec describes the API towards the
|
21
|
+
# agent as a whole, morphing through negotiation into the best available
|
22
|
+
# version for each endpoint.
|
23
|
+
|
24
|
+
module Datadog
|
25
|
+
module Core
|
26
|
+
module Remote
|
27
|
+
module Transport
|
28
|
+
module Negotiation
|
29
|
+
# Negotiation request
|
30
|
+
class Request < Datadog::Core::Transport::Request
|
31
|
+
end
|
32
|
+
|
33
|
+
# Negotiation response
|
34
|
+
module Response
|
35
|
+
attr_reader :version, :endpoints, :config
|
36
|
+
end
|
37
|
+
|
38
|
+
# Negotiation transport
|
39
|
+
class Transport
|
40
|
+
attr_reader :client, :apis, :default_api, :current_api_id
|
41
|
+
|
42
|
+
def initialize(apis, default_api)
|
43
|
+
@apis = apis
|
44
|
+
|
45
|
+
@client = HTTP::Client.new(current_api)
|
46
|
+
end
|
47
|
+
|
48
|
+
def send_info
|
49
|
+
request = Request.new
|
50
|
+
|
51
|
+
@client.send_info_payload(request)
|
52
|
+
end
|
53
|
+
|
54
|
+
def current_api
|
55
|
+
@apis[HTTP::API::ROOT]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|