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,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../core/utils/only_once'
|
4
|
+
require_relative '../ext/forking'
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module Profiling
|
8
|
+
module Tasks
|
9
|
+
# Takes care of loading our extensions/monkey patches to handle fork() and validating if CPU-time profiling is usable
|
10
|
+
class Setup
|
11
|
+
ACTIVATE_EXTENSIONS_ONLY_ONCE = Core::Utils::OnlyOnce.new
|
12
|
+
|
13
|
+
def run
|
14
|
+
ACTIVATE_EXTENSIONS_ONLY_ONCE.run do
|
15
|
+
begin
|
16
|
+
activate_forking_extensions
|
17
|
+
setup_at_fork_hooks
|
18
|
+
rescue StandardError, ScriptError => e
|
19
|
+
Datadog.logger.warn do
|
20
|
+
"Profiler extensions unavailable. Cause: #{e.class.name} #{e.message} " \
|
21
|
+
"Location: #{Array(e.backtrace).first}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def activate_forking_extensions
|
30
|
+
if Ext::Forking.supported?
|
31
|
+
Ext::Forking.apply!
|
32
|
+
elsif Datadog.configuration.profiling.enabled
|
33
|
+
Datadog.logger.debug('Profiler forking extensions skipped; forking not supported.')
|
34
|
+
end
|
35
|
+
rescue StandardError, ScriptError => e
|
36
|
+
Datadog.logger.warn do
|
37
|
+
"Profiler forking extensions unavailable. Cause: #{e.class.name} #{e.message} " \
|
38
|
+
"Location: #{Array(e.backtrace).first}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def setup_at_fork_hooks
|
43
|
+
if Process.respond_to?(:at_fork)
|
44
|
+
Process.at_fork(:child) do
|
45
|
+
begin
|
46
|
+
# Restart profiler, if enabled
|
47
|
+
Profiling.start_if_enabled
|
48
|
+
rescue StandardError => e
|
49
|
+
Datadog.logger.warn do
|
50
|
+
"Error during post-fork hooks. Cause: #{e.class.name} #{e.message} " \
|
51
|
+
"Location: #{Array(e.backtrace).first}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'core'
|
4
|
+
require_relative 'core/environment/variable_helpers'
|
5
|
+
require_relative 'core/utils/only_once'
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
# Datadog Continuous Profiler implementation: https://docs.datadoghq.com/profiler/
|
9
|
+
module Profiling
|
10
|
+
def self.supported?
|
11
|
+
unsupported_reason.nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.unsupported_reason
|
15
|
+
# NOTE: Only the first matching reason is returned, so try to keep a nice order on reasons -- e.g. tell users
|
16
|
+
# first that they can't use this on JRuby before telling them that something else failed
|
17
|
+
|
18
|
+
native_library_compilation_skipped? || native_library_failed_to_load?
|
19
|
+
end
|
20
|
+
|
21
|
+
# Starts the profiler, if the profiler is supported by in
|
22
|
+
# this runtime environment and if the profiler has been enabled
|
23
|
+
# in configuration.
|
24
|
+
#
|
25
|
+
# @return [Boolean] `true` if the profiler has successfully started, otherwise `false`.
|
26
|
+
# @public_api
|
27
|
+
def self.start_if_enabled
|
28
|
+
# If the profiler was not previously touched, getting the profiler instance triggers start as a side-effect
|
29
|
+
# otherwise we get nil
|
30
|
+
profiler = Datadog.send(:components).profiler
|
31
|
+
# ...but we still try to start it BECAUSE if the process forks, the profiler will exist but may
|
32
|
+
# not yet have been started in the fork
|
33
|
+
profiler.start if profiler
|
34
|
+
!!profiler
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns an ever-increasing counter of the number of allocations observed by the profiler in this thread.
|
38
|
+
#
|
39
|
+
# Note 1: This counter may not start from zero on new threads. It should only be used to measure how many
|
40
|
+
# allocations have happened between two calls to this API:
|
41
|
+
# ```
|
42
|
+
# allocations_before = Datadog::Profiling.allocation_count
|
43
|
+
# do_some_work()
|
44
|
+
# allocations_after = Datadog::Profiling.allocation_count
|
45
|
+
# puts "Allocations during do_some_work: #{allocations_after - allocations_before}"
|
46
|
+
# ```
|
47
|
+
# (This is similar to some OS-based time representations.)
|
48
|
+
#
|
49
|
+
# Note 2: All fibers in the same thread will share the same counter values.
|
50
|
+
#
|
51
|
+
# Only available when the profiler is running, and allocation-related features are not disabled via configuration.
|
52
|
+
#
|
53
|
+
# @return [Integer] number of allocations observed in the current thread.
|
54
|
+
# @return [nil] when not available.
|
55
|
+
# @public_api
|
56
|
+
def self.allocation_count
|
57
|
+
# This no-op implementation is used when profiling failed to load.
|
58
|
+
# It gets replaced inside #replace_noop_allocation_count.
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.enabled?
|
63
|
+
profiler = Datadog.send(:components).profiler
|
64
|
+
# Use .send(...) to avoid exposing the attr_reader as an API to the outside
|
65
|
+
!!(profiler.send(:scheduler).running? if profiler)
|
66
|
+
end
|
67
|
+
|
68
|
+
private_class_method def self.replace_noop_allocation_count
|
69
|
+
def self.allocation_count # rubocop:disable Lint/NestedMethodDefinition (On purpose!)
|
70
|
+
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private_class_method def self.native_library_compilation_skipped?
|
75
|
+
skipped_reason = try_reading_skipped_reason_file
|
76
|
+
|
77
|
+
"Your datadog installation is missing support for the Continuous Profiler because #{skipped_reason}" if skipped_reason
|
78
|
+
end
|
79
|
+
|
80
|
+
private_class_method def self.try_reading_skipped_reason_file(file_api = File)
|
81
|
+
# This file, if it exists, is recorded by extconf.rb during compilation of the native extension
|
82
|
+
skipped_reason_file = "#{__dir__}/../../ext/datadog_profiling_native_extension/skipped_reason.txt"
|
83
|
+
|
84
|
+
begin
|
85
|
+
return unless file_api.exist?(skipped_reason_file)
|
86
|
+
|
87
|
+
contents = file_api.read(skipped_reason_file).strip
|
88
|
+
contents unless contents.empty?
|
89
|
+
rescue StandardError
|
90
|
+
# Do nothing
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
private_class_method def self.native_library_failed_to_load?
|
95
|
+
success, exception = try_loading_native_library
|
96
|
+
|
97
|
+
unless success
|
98
|
+
if exception
|
99
|
+
'There was an error loading the profiling native extension due to ' \
|
100
|
+
"'#{exception.class.name} #{exception.message}' at '#{Array(exception.backtrace).first}'"
|
101
|
+
else
|
102
|
+
'The profiling native extension did not load correctly. ' \
|
103
|
+
'For help solving this issue, please contact Datadog support at <https://docs.datadoghq.com/help/>.' \
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
private_class_method def self.try_loading_native_library
|
109
|
+
begin
|
110
|
+
require_relative 'profiling/load_native_extension'
|
111
|
+
|
112
|
+
success =
|
113
|
+
defined?(Profiling::NativeExtension) && Profiling::NativeExtension.send(:native_working?)
|
114
|
+
[success, nil]
|
115
|
+
rescue StandardError, LoadError => e
|
116
|
+
[false, e]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# All requires for the profiler should be directly added here; and everything should be loaded eagerly.
|
121
|
+
# (Currently there's a leftovers that need to be cleaned up, but we should avoid other exceptions.)
|
122
|
+
#
|
123
|
+
# All of the profiler should be loaded and ready to go when this method returns `true`.
|
124
|
+
private_class_method def self.load_profiling
|
125
|
+
return false unless supported?
|
126
|
+
|
127
|
+
require_relative 'profiling/ext/forking'
|
128
|
+
require_relative 'profiling/collectors/info'
|
129
|
+
require_relative 'profiling/collectors/code_provenance'
|
130
|
+
require_relative 'profiling/collectors/cpu_and_wall_time_worker'
|
131
|
+
require_relative 'profiling/collectors/dynamic_sampling_rate'
|
132
|
+
require_relative 'profiling/collectors/idle_sampling_helper'
|
133
|
+
require_relative 'profiling/collectors/stack'
|
134
|
+
require_relative 'profiling/collectors/thread_context'
|
135
|
+
require_relative 'profiling/stack_recorder'
|
136
|
+
require_relative 'profiling/exporter'
|
137
|
+
require_relative 'profiling/flush'
|
138
|
+
require_relative 'profiling/scheduler'
|
139
|
+
require_relative 'profiling/tasks/setup'
|
140
|
+
require_relative 'profiling/profiler'
|
141
|
+
require_relative 'profiling/native_extension'
|
142
|
+
require_relative 'profiling/tag_builder'
|
143
|
+
require_relative 'profiling/http_transport'
|
144
|
+
|
145
|
+
replace_noop_allocation_count
|
146
|
+
|
147
|
+
true
|
148
|
+
end
|
149
|
+
|
150
|
+
load_profiling
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'metadata/ext'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Tracing
|
7
|
+
# Defines analytics behavior
|
8
|
+
module Analytics
|
9
|
+
class << self
|
10
|
+
def set_sample_rate(span_op, sample_rate)
|
11
|
+
return if span_op.nil? || !sample_rate.is_a?(Numeric)
|
12
|
+
|
13
|
+
span_op.set_metric(Metadata::Ext::Analytics::TAG_SAMPLE_RATE, sample_rate)
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_measured(span_op, value = true)
|
17
|
+
return if span_op.nil?
|
18
|
+
|
19
|
+
value = value == true || value == 1 ? 1 : 0 # rubocop:disable Style/MultipleComparison
|
20
|
+
span_op.set_metric(Metadata::Ext::Analytics::TAG_MEASURED, value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../core/environment/ext'
|
4
|
+
require_relative '../core/buffer/thread_safe'
|
5
|
+
require_relative '../core/buffer/cruby'
|
6
|
+
require_relative '../core/diagnostics/health'
|
7
|
+
|
8
|
+
module Datadog
|
9
|
+
module Tracing
|
10
|
+
# Health metrics for trace buffers.
|
11
|
+
module MeasuredBuffer
|
12
|
+
def initialize(*_)
|
13
|
+
super
|
14
|
+
|
15
|
+
@buffer_accepted = 0
|
16
|
+
@buffer_accepted_lengths = 0
|
17
|
+
@buffer_dropped = 0
|
18
|
+
@buffer_spans = 0
|
19
|
+
end
|
20
|
+
|
21
|
+
def add!(trace)
|
22
|
+
super
|
23
|
+
|
24
|
+
# Emit health metrics
|
25
|
+
measure_accept(trace)
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_all!(traces)
|
29
|
+
super
|
30
|
+
|
31
|
+
# Emit health metrics
|
32
|
+
traces.each { |trace| measure_accept(trace) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def replace!(trace)
|
36
|
+
discarded_trace = super
|
37
|
+
|
38
|
+
# Emit health metrics
|
39
|
+
measure_accept(trace)
|
40
|
+
measure_drop(discarded_trace) if discarded_trace
|
41
|
+
|
42
|
+
discarded_trace
|
43
|
+
end
|
44
|
+
|
45
|
+
# Stored traces are returned and the local buffer is reset.
|
46
|
+
def drain!
|
47
|
+
traces = super
|
48
|
+
measure_pop(traces)
|
49
|
+
traces
|
50
|
+
end
|
51
|
+
|
52
|
+
def measure_accept(trace)
|
53
|
+
@buffer_accepted += 1
|
54
|
+
@buffer_accepted_lengths += trace.length
|
55
|
+
|
56
|
+
@buffer_spans += trace.length
|
57
|
+
rescue StandardError => e
|
58
|
+
Datadog.logger.debug(
|
59
|
+
"Failed to measure queue accept. Cause: #{e.class.name} #{e.message} Source: #{Array(e.backtrace).first}"
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def measure_drop(trace)
|
64
|
+
@buffer_dropped += 1
|
65
|
+
|
66
|
+
@buffer_spans -= trace.length
|
67
|
+
rescue StandardError => e
|
68
|
+
Datadog.logger.debug(
|
69
|
+
"Failed to measure queue drop. Cause: #{e.class.name} #{e.message} Source: #{Array(e.backtrace).first}"
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
def measure_pop(traces)
|
74
|
+
# Accepted, cumulative totals
|
75
|
+
Datadog.health_metrics.queue_accepted(@buffer_accepted)
|
76
|
+
Datadog.health_metrics.queue_accepted_lengths(@buffer_accepted_lengths)
|
77
|
+
|
78
|
+
# Dropped, cumulative totals
|
79
|
+
Datadog.health_metrics.queue_dropped(@buffer_dropped)
|
80
|
+
# TODO: are we missing a +queue_dropped_lengths+ metric?
|
81
|
+
|
82
|
+
# Queue gauges, current values
|
83
|
+
Datadog.health_metrics.queue_max_length(@max_size)
|
84
|
+
Datadog.health_metrics.queue_spans(@buffer_spans)
|
85
|
+
Datadog.health_metrics.queue_length(traces.length)
|
86
|
+
|
87
|
+
# Reset aggregated metrics
|
88
|
+
@buffer_accepted = 0
|
89
|
+
@buffer_accepted_lengths = 0
|
90
|
+
@buffer_dropped = 0
|
91
|
+
@buffer_spans = 0
|
92
|
+
rescue StandardError => e
|
93
|
+
Datadog.logger.debug(
|
94
|
+
"Failed to measure queue. Cause: #{e.class.name} #{e.message} Source: #{Array(e.backtrace).first}"
|
95
|
+
)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Trace buffer that stores application traces, has a maximum size, and
|
100
|
+
# can be safely used concurrently on any environment.
|
101
|
+
#
|
102
|
+
# @see Datadog::Core::Buffer::ThreadSafe
|
103
|
+
class ThreadSafeTraceBuffer < Core::Buffer::ThreadSafe
|
104
|
+
prepend MeasuredBuffer
|
105
|
+
end
|
106
|
+
|
107
|
+
# Trace buffer that stores application traces, has a maximum size, and
|
108
|
+
# can be safely used concurrently with CRuby.
|
109
|
+
#
|
110
|
+
# @see Datadog::Core::Buffer::CRuby
|
111
|
+
class CRubyTraceBuffer < Core::Buffer::CRuby
|
112
|
+
prepend MeasuredBuffer
|
113
|
+
end
|
114
|
+
|
115
|
+
# Trace buffer that stores application traces. The buffer has a maximum size and when
|
116
|
+
# the buffer is full, a random trace is discarded. This class is thread-safe and is used
|
117
|
+
# automatically by the ``Tracer`` instance when a ``Span`` is finished.
|
118
|
+
#
|
119
|
+
# We choose the default TraceBuffer implementation for current platform dynamically here.
|
120
|
+
#
|
121
|
+
# TODO We should restructure this module, so that classes are not declared at top-level ::Datadog.
|
122
|
+
# TODO Making such a change is potentially breaking for users manually configuring the tracer.
|
123
|
+
TraceBuffer = if Core::Environment::Ext::RUBY_ENGINE == 'ruby'
|
124
|
+
CRubyTraceBuffer
|
125
|
+
else
|
126
|
+
ThreadSafeTraceBuffer
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../core/configuration'
|
4
|
+
require_relative '../core/utils/network'
|
5
|
+
require_relative 'metadata/ext'
|
6
|
+
require_relative 'span'
|
7
|
+
|
8
|
+
module Datadog
|
9
|
+
module Tracing
|
10
|
+
# Common functions for supporting the `http.client_ip` span attribute.
|
11
|
+
module ClientIp
|
12
|
+
class << self
|
13
|
+
# Sets the `http.client_ip` tag on the given span.
|
14
|
+
#
|
15
|
+
# This function respects the user's settings: if they disable the client IP tagging,
|
16
|
+
# or provide a different IP header name.
|
17
|
+
#
|
18
|
+
# @param [Span] span The span that's associated with the request.
|
19
|
+
# @param [HeaderCollection, #get, nil] headers A collection with the request headers.
|
20
|
+
# @param [String, nil] remote_ip The remote IP the request associated with the span is sent to.
|
21
|
+
def set_client_ip_tag(span, headers: nil, remote_ip: nil)
|
22
|
+
return unless configuration.enabled
|
23
|
+
|
24
|
+
set_client_ip_tag!(span, headers: headers, remote_ip: remote_ip)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Forcefully sets the `http.client_ip` tag on the given span.
|
28
|
+
#
|
29
|
+
# This function ignores the user's `enabled` setting.
|
30
|
+
#
|
31
|
+
# @param [Span] span The span that's associated with the request.
|
32
|
+
# @param [HeaderCollection, #get, nil] headers A collection with the request headers.
|
33
|
+
# @param [String, nil] remote_ip The remote IP the request associated with the span is sent to.
|
34
|
+
def set_client_ip_tag!(span, headers: nil, remote_ip: nil)
|
35
|
+
ip = extract_client_ip(headers, remote_ip)
|
36
|
+
|
37
|
+
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_CLIENT_IP, ip) if ip
|
38
|
+
end
|
39
|
+
|
40
|
+
def extract_client_ip(headers, remote_ip)
|
41
|
+
if headers && configuration.header_name
|
42
|
+
return Datadog::Core::Utils::Network.stripped_ip_from_request_headers(
|
43
|
+
headers,
|
44
|
+
ip_headers_to_check: Array(configuration.header_name)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
ip_from_headers = Datadog::Core::Utils::Network.stripped_ip_from_request_headers(headers) if headers
|
49
|
+
|
50
|
+
ip_from_headers || Datadog::Core::Utils::Network.stripped_ip(remote_ip)
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def configuration
|
56
|
+
Datadog.configuration.tracing.client_ip
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'tracer'
|
4
|
+
require_relative 'flush'
|
5
|
+
require_relative 'sync_writer'
|
6
|
+
require_relative 'sampling/span/rule_parser'
|
7
|
+
require_relative 'sampling/span/sampler'
|
8
|
+
require_relative 'diagnostics/environment_logger'
|
9
|
+
|
10
|
+
module Datadog
|
11
|
+
module Tracing
|
12
|
+
# Tracing component
|
13
|
+
module Component
|
14
|
+
# Methods that interact with component instance fields.
|
15
|
+
module InstanceMethods
|
16
|
+
# Hot-swaps with a new sampler.
|
17
|
+
# This operation acquires the Components lock to ensure
|
18
|
+
# there is no concurrent modification of the sampler.
|
19
|
+
def reconfigure_live_sampler
|
20
|
+
sampler = self.class.build_sampler(Datadog.configuration)
|
21
|
+
Datadog.send(:safely_synchronize) { tracer.sampler.sampler = sampler }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def build_tracer(settings, agent_settings, logger:)
|
26
|
+
# If a custom tracer has been provided, use it instead.
|
27
|
+
# Ignore all other options (they should already be configured.)
|
28
|
+
tracer = settings.tracing.instance
|
29
|
+
return tracer unless tracer.nil?
|
30
|
+
|
31
|
+
# Apply test mode settings if test mode is activated
|
32
|
+
if settings.tracing.test_mode.enabled
|
33
|
+
trace_flush = build_test_mode_trace_flush(settings)
|
34
|
+
sampler = build_test_mode_sampler
|
35
|
+
writer = build_test_mode_writer(settings, agent_settings)
|
36
|
+
else
|
37
|
+
trace_flush = build_trace_flush(settings)
|
38
|
+
sampler = build_sampler(settings)
|
39
|
+
writer = build_writer(settings, agent_settings)
|
40
|
+
end
|
41
|
+
|
42
|
+
# The sampler instance is wrapped in a delegator,
|
43
|
+
# so dynamic instrumentation can hot-swap it.
|
44
|
+
# This prevents full tracer reinitialization on sampling changes.
|
45
|
+
sampler_delegator = SamplerDelegatorComponent.new(sampler)
|
46
|
+
|
47
|
+
subscribe_to_writer_events!(writer, sampler_delegator, settings.tracing.test_mode.enabled)
|
48
|
+
|
49
|
+
Tracing::Tracer.new(
|
50
|
+
default_service: settings.service,
|
51
|
+
enabled: settings.tracing.enabled,
|
52
|
+
trace_flush: trace_flush,
|
53
|
+
sampler: sampler_delegator,
|
54
|
+
span_sampler: build_span_sampler(settings),
|
55
|
+
writer: writer,
|
56
|
+
tags: build_tracer_tags(settings),
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def build_trace_flush(settings)
|
61
|
+
if settings.tracing.partial_flush.enabled
|
62
|
+
Tracing::Flush::Partial.new(
|
63
|
+
min_spans_before_partial_flush: settings.tracing.partial_flush.min_spans_threshold
|
64
|
+
)
|
65
|
+
else
|
66
|
+
Tracing::Flush::Finished.new
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def build_sampler(settings)
|
71
|
+
# A custom sampler is provided
|
72
|
+
if (sampler = settings.tracing.sampler)
|
73
|
+
return sampler
|
74
|
+
end
|
75
|
+
|
76
|
+
# Sampling rules are provided
|
77
|
+
if (rules = settings.tracing.sampling.rules)
|
78
|
+
post_sampler = Tracing::Sampling::RuleSampler.parse(
|
79
|
+
rules,
|
80
|
+
settings.tracing.sampling.rate_limit,
|
81
|
+
settings.tracing.sampling.default_rate
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
# The default sampler.
|
86
|
+
# Used if no custom sampler is provided, or if sampling rule parsing fails.
|
87
|
+
post_sampler ||= Tracing::Sampling::RuleSampler.new(
|
88
|
+
rate_limit: settings.tracing.sampling.rate_limit,
|
89
|
+
default_sample_rate: settings.tracing.sampling.default_rate
|
90
|
+
)
|
91
|
+
|
92
|
+
Tracing::Sampling::PrioritySampler.new(
|
93
|
+
base_sampler: Tracing::Sampling::AllSampler.new,
|
94
|
+
post_sampler: post_sampler
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
# TODO: Writer should be a top-level component.
|
99
|
+
# It is currently part of the Tracer initialization
|
100
|
+
# process, but can take a variety of options (including
|
101
|
+
# a fully custom instance) that makes the Tracer
|
102
|
+
# initialization process complex.
|
103
|
+
def build_writer(settings, agent_settings, options = settings.tracing.writer_options)
|
104
|
+
if (writer = settings.tracing.writer)
|
105
|
+
return writer
|
106
|
+
end
|
107
|
+
|
108
|
+
Tracing::Writer.new(agent_settings: agent_settings, **options)
|
109
|
+
end
|
110
|
+
|
111
|
+
def subscribe_to_writer_events!(writer, sampler_delegator, test_mode)
|
112
|
+
return unless writer.respond_to?(:events) # Check if it's a custom, external writer
|
113
|
+
|
114
|
+
writer.events.after_send.subscribe(&WRITER_RECORD_ENVIRONMENT_INFORMATION_CALLBACK)
|
115
|
+
|
116
|
+
# DEV: We need to ignore priority sampling updates coming from the agent in test mode
|
117
|
+
# because test mode wants to *unconditionally* sample all traces.
|
118
|
+
#
|
119
|
+
# This can cause trace metrics to be overestimated, but that's a trade-off we take
|
120
|
+
# here to achieve 100% sampling rate.
|
121
|
+
return if test_mode
|
122
|
+
|
123
|
+
writer.events.after_send.subscribe(&writer_update_priority_sampler_rates_callback(sampler_delegator))
|
124
|
+
end
|
125
|
+
|
126
|
+
WRITER_RECORD_ENVIRONMENT_INFORMATION_CALLBACK = lambda do |_, responses|
|
127
|
+
Tracing::Diagnostics::EnvironmentLogger.collect_and_log!(responses: responses)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Create new lambda for writer callback,
|
131
|
+
# capture the current sampler in the callback closure.
|
132
|
+
def writer_update_priority_sampler_rates_callback(sampler)
|
133
|
+
lambda do |_, responses|
|
134
|
+
response = responses.last
|
135
|
+
|
136
|
+
next unless response && !response.internal_error? && response.service_rates
|
137
|
+
|
138
|
+
sampler.update(response.service_rates, decision: Tracing::Sampling::Ext::Decision::AGENT_RATE)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def build_span_sampler(settings)
|
143
|
+
rules = Tracing::Sampling::Span::RuleParser.parse_json(settings.tracing.sampling.span_rules)
|
144
|
+
Tracing::Sampling::Span::Sampler.new(rules || [])
|
145
|
+
end
|
146
|
+
|
147
|
+
# Configure non-privileged components.
|
148
|
+
def configure_tracing(settings)
|
149
|
+
Datadog::Tracing::Contrib::Component.configure(settings)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Sampler wrapper component, to allow for hot-swapping
|
153
|
+
# the sampler instance used by the tracer.
|
154
|
+
# Swapping samplers happens during Dynamic Configuration.
|
155
|
+
class SamplerDelegatorComponent
|
156
|
+
attr_accessor :sampler
|
157
|
+
|
158
|
+
def initialize(sampler)
|
159
|
+
@sampler = sampler
|
160
|
+
end
|
161
|
+
|
162
|
+
def sample!(trace)
|
163
|
+
@sampler.sample!(trace)
|
164
|
+
end
|
165
|
+
|
166
|
+
def update(*args, **kwargs)
|
167
|
+
return unless @sampler.respond_to?(:update)
|
168
|
+
|
169
|
+
@sampler.update(*args, **kwargs)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
private
|
174
|
+
|
175
|
+
def build_tracer_tags(settings)
|
176
|
+
settings.tags.dup.tap do |tags|
|
177
|
+
tags[Core::Environment::Ext::TAG_ENV] = settings.env unless settings.env.nil?
|
178
|
+
tags[Core::Environment::Ext::TAG_VERSION] = settings.version unless settings.version.nil?
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def build_test_mode_trace_flush(settings)
|
183
|
+
# If context flush behavior is provided, use it instead.
|
184
|
+
settings.tracing.test_mode.trace_flush || build_trace_flush(settings)
|
185
|
+
end
|
186
|
+
|
187
|
+
def build_test_mode_sampler
|
188
|
+
# Do not sample any spans for tests; all must be preserved.
|
189
|
+
# Set priority sampler to ensure the agent doesn't drop any traces.
|
190
|
+
Tracing::Sampling::PrioritySampler.new(
|
191
|
+
base_sampler: Tracing::Sampling::AllSampler.new,
|
192
|
+
post_sampler: Tracing::Sampling::AllSampler.new
|
193
|
+
)
|
194
|
+
end
|
195
|
+
|
196
|
+
def build_test_mode_writer(settings, agent_settings)
|
197
|
+
writer_options = settings.tracing.test_mode.writer_options || {}
|
198
|
+
|
199
|
+
return build_writer(settings, agent_settings, writer_options) if settings.tracing.test_mode.async
|
200
|
+
|
201
|
+
# Flush traces synchronously, to guarantee they are written.
|
202
|
+
Tracing::SyncWriter.new(agent_settings: agent_settings, **writer_options)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|