ddtrace 0.54.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -16
- data/CHANGELOG.md +189 -2
- data/LICENSE-3rdparty.csv +3 -1
- data/README.md +4 -0
- data/bin/ddtracerb +5 -5
- data/ddtrace.gemspec +18 -6
- data/docs/0.x-trace.png +0 -0
- data/docs/1.0-trace.png +0 -0
- data/docs/AutoInstrumentation.md +36 -0
- data/docs/Deprecation.md +8 -0
- data/docs/DevelopmentGuide.md +1 -1
- data/docs/GettingStarted.md +574 -508
- data/docs/ProfilingDevelopment.md +20 -17
- data/docs/PublicApi.md +14 -0
- data/docs/UpgradeGuide.md +736 -0
- data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +118 -0
- data/ext/ddtrace_profiling_loader/extconf.rb +53 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +31 -5
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +0 -8
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +278 -0
- data/ext/ddtrace_profiling_native_extension/extconf.rb +95 -55
- data/ext/ddtrace_profiling_native_extension/libddprof_helpers.h +13 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +186 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +579 -7
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +30 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +10 -1
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +139 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +28 -0
- data/lib/datadog/appsec/assets/blocked.html +4 -0
- data/lib/datadog/appsec/assets/waf_rules/README.md +7 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +5638 -0
- data/lib/datadog/appsec/assets/waf_rules/risky.json +1499 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +1298 -0
- data/lib/datadog/appsec/assets.rb +38 -0
- data/lib/datadog/appsec/autoload.rb +16 -0
- data/lib/datadog/appsec/configuration/settings.rb +194 -0
- data/lib/datadog/appsec/configuration.rb +80 -0
- data/lib/datadog/appsec/contrib/auto_instrument.rb +29 -0
- data/lib/datadog/appsec/contrib/configuration/settings.rb +20 -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/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/rack/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +169 -0
- data/lib/datadog/appsec/contrib/rack/integration.rb +49 -0
- data/lib/datadog/appsec/contrib/rack/patcher.rb +32 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +87 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +64 -0
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +64 -0
- data/lib/datadog/appsec/contrib/rack/request.rb +58 -0
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +41 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +112 -0
- data/lib/datadog/appsec/contrib/rack/response.rb +24 -0
- data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/rails/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/rails/framework.rb +30 -0
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +81 -0
- data/lib/datadog/appsec/contrib/rails/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/rails/patcher.rb +158 -0
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +68 -0
- data/lib/datadog/appsec/contrib/rails/request.rb +33 -0
- data/lib/datadog/appsec/contrib/rails/request_middleware.rb +20 -0
- data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +34 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +124 -0
- data/lib/datadog/appsec/contrib/sinatra/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +144 -0
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +63 -0
- data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +20 -0
- data/lib/datadog/appsec/event.rb +121 -0
- data/lib/datadog/appsec/extensions.rb +118 -0
- data/lib/datadog/appsec/instrumentation/gateway.rb +44 -0
- data/lib/datadog/appsec/processor.rb +164 -0
- data/lib/datadog/appsec/rate_limiter.rb +60 -0
- data/lib/datadog/appsec/reactive/address_hash.rb +18 -0
- data/lib/datadog/appsec/reactive/engine.rb +44 -0
- data/lib/datadog/appsec/reactive/operation.rb +51 -0
- data/lib/datadog/appsec/reactive/subscriber.rb +18 -0
- data/lib/datadog/appsec.rb +23 -0
- data/lib/datadog/ci/configuration/components.rb +9 -8
- data/lib/datadog/ci/configuration/settings.rb +19 -3
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +4 -2
- data/lib/datadog/ci/contrib/cucumber/ext.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +4 -9
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +2 -1
- data/lib/datadog/ci/contrib/cucumber/integration.rb +3 -2
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +3 -2
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +4 -2
- data/lib/datadog/ci/contrib/rspec/example.rb +4 -9
- data/lib/datadog/ci/contrib/rspec/ext.rb +2 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +3 -2
- data/lib/datadog/ci/contrib/rspec/patcher.rb +3 -2
- data/lib/datadog/ci/ext/app_types.rb +2 -1
- data/lib/datadog/ci/ext/environment.rb +128 -110
- data/lib/datadog/ci/ext/settings.rb +2 -1
- data/lib/datadog/ci/ext/test.rb +1 -0
- data/lib/datadog/ci/extensions.rb +5 -4
- data/lib/datadog/ci/flush.rb +38 -0
- data/lib/datadog/ci/test.rb +15 -13
- data/lib/datadog/ci.rb +4 -1
- 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 +365 -0
- data/lib/datadog/core/configuration/base.rb +89 -0
- data/lib/datadog/core/configuration/components.rb +411 -0
- data/lib/datadog/core/configuration/dependency_resolver.rb +28 -0
- data/lib/datadog/core/configuration/option.rb +69 -0
- data/lib/datadog/core/configuration/option_definition.rb +126 -0
- data/lib/datadog/core/configuration/option_definition_set.rb +22 -0
- data/lib/datadog/core/configuration/option_set.rb +10 -0
- data/lib/datadog/core/configuration/options.rb +118 -0
- data/lib/datadog/core/configuration/settings.rb +618 -0
- data/lib/datadog/core/configuration.rb +286 -0
- data/lib/datadog/core/diagnostics/environment_logger.rb +283 -0
- data/lib/datadog/core/diagnostics/ext.rb +41 -0
- data/lib/datadog/core/diagnostics/health.rb +37 -0
- data/lib/datadog/core/encoding.rb +76 -0
- data/lib/datadog/core/environment/cgroup.rb +4 -1
- data/lib/datadog/core/environment/class_count.rb +1 -0
- data/lib/datadog/core/environment/container.rb +3 -1
- data/lib/datadog/core/environment/ext.rb +28 -9
- data/lib/datadog/core/environment/gc.rb +1 -0
- data/lib/datadog/core/environment/identity.rb +11 -4
- data/lib/datadog/core/environment/socket.rb +9 -2
- data/lib/datadog/core/environment/thread_count.rb +1 -0
- data/lib/datadog/core/environment/variable_helpers.rb +28 -2
- data/lib/datadog/core/environment/vm_cache.rb +1 -0
- data/lib/datadog/core/error.rb +101 -0
- data/lib/datadog/core/extensions.rb +16 -0
- data/lib/datadog/core/git/ext.rb +35 -0
- data/lib/datadog/core/logger.rb +46 -0
- data/lib/datadog/core/logging/ext.rb +11 -0
- data/lib/datadog/core/metrics/client.rb +198 -0
- data/lib/datadog/core/metrics/ext.rb +20 -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 +50 -0
- data/lib/datadog/core/pin.rb +75 -0
- data/lib/datadog/core/runtime/ext.rb +28 -0
- data/lib/datadog/core/runtime/metrics.rb +126 -0
- data/lib/datadog/core/utils/compression.rb +32 -0
- data/lib/datadog/core/utils/forking.rb +63 -0
- data/lib/datadog/core/utils/object_set.rb +43 -0
- data/lib/datadog/core/utils/only_once.rb +44 -0
- data/lib/datadog/core/utils/safe_dup.rb +27 -0
- data/lib/datadog/core/utils/sequence.rb +21 -0
- data/lib/datadog/core/utils/string_table.rb +49 -0
- data/lib/datadog/core/utils/time.rb +54 -0
- data/lib/datadog/core/utils.rb +115 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/composite_read_io.rb +120 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/multipartable.rb +61 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb +139 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/version.rb +13 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post.rb +12 -0
- data/lib/datadog/core/vendor/multipart-post/multipart.rb +16 -0
- data/lib/datadog/core/vendor/multipart-post/net/http/post/multipart.rb +36 -0
- data/lib/datadog/core/worker.rb +24 -0
- data/lib/datadog/core/workers/async.rb +182 -0
- data/lib/datadog/core/workers/interval_loop.rb +119 -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 +80 -0
- data/lib/datadog/kit/enable_core_dumps.rb +50 -0
- data/lib/datadog/kit/identity.rb +63 -0
- data/lib/datadog/kit.rb +11 -0
- data/lib/datadog/opentracer/binary_propagator.rb +26 -0
- data/lib/datadog/opentracer/carrier.rb +9 -0
- data/lib/datadog/opentracer/distributed_headers.rb +58 -0
- data/lib/datadog/opentracer/global_tracer.rb +17 -0
- data/lib/datadog/opentracer/propagator.rb +26 -0
- data/lib/datadog/opentracer/rack_propagator.rb +72 -0
- data/lib/datadog/opentracer/scope.rb +18 -0
- data/lib/datadog/opentracer/scope_manager.rb +9 -0
- data/lib/datadog/opentracer/span.rb +101 -0
- data/lib/datadog/opentracer/span_context.rb +19 -0
- data/lib/datadog/opentracer/span_context_factory.rb +27 -0
- data/lib/datadog/opentracer/text_map_propagator.rb +87 -0
- data/lib/datadog/opentracer/thread_local_scope.rb +34 -0
- data/lib/datadog/opentracer/thread_local_scope_manager.rb +43 -0
- data/lib/datadog/opentracer/tracer.rb +212 -0
- data/lib/datadog/opentracer.rb +24 -0
- data/lib/datadog/profiling/backtrace_location.rb +34 -0
- data/lib/datadog/profiling/buffer.rb +43 -0
- data/lib/datadog/profiling/collectors/code_provenance.rb +114 -0
- data/lib/datadog/profiling/collectors/old_stack.rb +298 -0
- data/lib/datadog/profiling/collectors/stack.rb +16 -0
- data/lib/datadog/profiling/encoding/profile.rb +47 -0
- data/lib/datadog/profiling/event.rb +15 -0
- data/lib/datadog/profiling/events/stack.rb +82 -0
- data/lib/datadog/profiling/exporter.rb +25 -0
- data/lib/datadog/profiling/ext/forking.rb +99 -0
- data/lib/datadog/profiling/ext.rb +57 -0
- data/lib/datadog/profiling/flush.rb +69 -0
- data/lib/datadog/profiling/load_native_extension.rb +22 -0
- data/lib/datadog/profiling/native_extension.rb +41 -0
- data/lib/datadog/profiling/pprof/builder.rb +127 -0
- data/lib/datadog/profiling/pprof/converter.rb +104 -0
- data/lib/datadog/profiling/pprof/message_set.rb +16 -0
- data/lib/datadog/profiling/pprof/payload.rb +20 -0
- data/lib/datadog/profiling/pprof/pprof_pb.rb +83 -0
- data/lib/datadog/profiling/pprof/stack_sample.rb +141 -0
- data/lib/datadog/profiling/pprof/string_table.rb +12 -0
- data/lib/datadog/profiling/pprof/template.rb +120 -0
- data/lib/datadog/profiling/preload.rb +5 -0
- data/lib/datadog/profiling/profiler.rb +34 -0
- data/lib/datadog/profiling/recorder.rb +117 -0
- data/lib/datadog/profiling/scheduler.rb +151 -0
- data/lib/datadog/profiling/stack_recorder.rb +33 -0
- data/lib/datadog/profiling/tag_builder.rb +48 -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 +93 -0
- data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +45 -0
- data/lib/datadog/profiling/trace_identifiers/helper.rb +47 -0
- data/lib/datadog/profiling/transport/client.rb +16 -0
- data/lib/datadog/profiling/transport/http/api/endpoint.rb +107 -0
- data/lib/datadog/profiling/transport/http/api/instance.rb +38 -0
- data/lib/datadog/profiling/transport/http/api/spec.rb +42 -0
- data/lib/datadog/profiling/transport/http/api.rb +45 -0
- data/lib/datadog/profiling/transport/http/builder.rb +30 -0
- data/lib/datadog/profiling/transport/http/client.rb +35 -0
- data/lib/datadog/profiling/transport/http/response.rb +23 -0
- data/lib/datadog/profiling/transport/http.rb +112 -0
- data/lib/datadog/profiling/transport/io/client.rb +29 -0
- data/lib/datadog/profiling/transport/io/response.rb +18 -0
- data/lib/datadog/profiling/transport/io.rb +32 -0
- data/lib/datadog/profiling/transport/parcel.rb +19 -0
- data/lib/datadog/profiling/transport/request.rb +17 -0
- data/lib/datadog/profiling/transport/response.rb +10 -0
- data/lib/datadog/profiling.rb +170 -0
- data/lib/datadog/tracing/analytics.rb +25 -0
- data/lib/datadog/tracing/buffer.rb +132 -0
- data/lib/datadog/tracing/configuration/ext.rb +51 -0
- data/lib/datadog/tracing/context.rb +68 -0
- data/lib/datadog/tracing/context_provider.rb +66 -0
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/action_cable/event.rb +72 -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 +32 -0
- data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +91 -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 +36 -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 +33 -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 +156 -0
- data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/action_pack/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/action_pack/integration.rb +50 -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 +36 -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 +24 -0
- data/lib/datadog/tracing/contrib/action_view/instrumentation/partial_renderer.rb +78 -0
- data/lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb +91 -0
- data/lib/datadog/tracing/contrib/action_view/integration.rb +57 -0
- data/lib/datadog/tracing/contrib/action_view/patcher.rb +47 -0
- data/lib/datadog/tracing/contrib/action_view/utils.rb +36 -0
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +37 -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 +39 -0
- data/lib/datadog/tracing/contrib/active_job/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/active_job/log_injection.rb +26 -0
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +36 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +33 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +69 -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 +24 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/integration.rb +45 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/makara_resolver.rb +36 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +138 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +39 -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 +78 -0
- data/lib/datadog/tracing/contrib/active_record/events.rb +34 -0
- data/lib/datadog/tracing/contrib/active_record/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/active_record/integration.rb +56 -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_record/vendor/connection_specification.rb +307 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +270 -0
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +73 -0
- data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +47 -0
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/active_support/ext.rb +31 -0
- data/lib/datadog/tracing/contrib/active_support/integration.rb +51 -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 +29 -0
- data/lib/datadog/tracing/contrib/auto_instrument.rb +53 -0
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/aws/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +95 -0
- data/lib/datadog/tracing/contrib/aws/integration.rb +47 -0
- data/lib/datadog/tracing/contrib/aws/parsed_context.rb +60 -0
- data/lib/datadog/tracing/contrib/aws/patcher.rb +57 -0
- data/lib/datadog/tracing/contrib/aws/services.rb +123 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +23 -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 +27 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +33 -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 +35 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +58 -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 +38 -0
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/delayed_job/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +101 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +151 -0
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +89 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +177 -0
- data/lib/datadog/tracing/contrib/ethon/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/ethon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +96 -0
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/excon/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/excon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +170 -0
- data/lib/datadog/tracing/contrib/excon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/extensions.rb +197 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/faraday/connection.rb +22 -0
- data/lib/datadog/tracing/contrib/faraday/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/faraday/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +93 -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 +42 -0
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +253 -0
- data/lib/datadog/tracing/contrib/grape/ext.rb +28 -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 +36 -0
- data/lib/datadog/tracing/contrib/graphql/ext.rb +19 -0
- data/lib/datadog/tracing/contrib/graphql/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/graphql/patcher.rb +91 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +84 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +90 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +104 -0
- data/lib/datadog/tracing/contrib/grpc/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/grpc/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +53 -0
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +44 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/http/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +139 -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_annotation_helper.rb +17 -0
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +117 -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 +37 -0
- data/lib/datadog/tracing/contrib/httprb/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +128 -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 +35 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +18 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +18 -0
- data/lib/datadog/tracing/contrib/kafka/event.rb +52 -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 +40 -0
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +43 -0
- data/lib/datadog/tracing/contrib/kafka/events.rb +48 -0
- data/lib/datadog/tracing/contrib/kafka/ext.rb +52 -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 +23 -0
- data/lib/datadog/tracing/contrib/lograge/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +47 -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 +38 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +27 -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 +121 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +62 -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/patchable.rb +109 -0
- data/lib/datadog/tracing/contrib/patcher.rb +74 -0
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/presto/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +125 -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/qless/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/qless/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/qless/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/qless/patcher.rb +38 -0
- data/lib/datadog/tracing/contrib/qless/qless_job.rb +75 -0
- data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +32 -0
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +49 -0
- data/lib/datadog/tracing/contrib/que/ext.rb +34 -0
- data/lib/datadog/tracing/contrib/que/integration.rb +46 -0
- data/lib/datadog/tracing/contrib/que/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/que/tracer.rb +61 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/event.rb +79 -0
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events/consume.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events.rb +36 -0
- data/lib/datadog/tracing/contrib/racecar/ext.rb +31 -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 +51 -0
- data/lib/datadog/tracing/contrib/rack/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/rack/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +255 -0
- data/lib/datadog/tracing/contrib/rack/patcher.rb +109 -0
- data/lib/datadog/tracing/contrib/rack/request_queue.rb +48 -0
- data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +12 -0
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +71 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/framework.rb +152 -0
- data/lib/datadog/tracing/contrib/rails/integration.rb +49 -0
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +34 -0
- data/lib/datadog/tracing/contrib/rails/middlewares.rb +47 -0
- data/lib/datadog/tracing/contrib/rails/patcher.rb +121 -0
- data/lib/datadog/tracing/contrib/rails/railtie.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/utils.rb +28 -0
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/rake/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/rake/instrumentation.rb +98 -0
- data/lib/datadog/tracing/contrib/rake/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rake/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +49 -0
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/redis/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +78 -0
- data/lib/datadog/tracing/contrib/redis/integration.rb +47 -0
- data/lib/datadog/tracing/contrib/redis/patcher.rb +35 -0
- data/lib/datadog/tracing/contrib/redis/quantize.rb +79 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +54 -0
- data/lib/datadog/tracing/contrib/redis/vendor/resolver.rb +162 -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 +37 -0
- data/lib/datadog/tracing/contrib/resque/ext.rb +21 -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 +103 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/rest_client/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rest_client/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +105 -0
- data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +23 -0
- data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +51 -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 +33 -0
- data/lib/datadog/tracing/contrib/sequel/database.rb +60 -0
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +65 -0
- data/lib/datadog/tracing/contrib/sequel/ext.rb +22 -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 +87 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +25 -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 +61 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +38 -0
- data/lib/datadog/tracing/contrib/sidekiq/integration.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +71 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +33 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +98 -0
- data/lib/datadog/tracing/contrib/sidekiq/tracing.rb +44 -0
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/sinatra/env.rb +66 -0
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/sinatra/framework.rb +118 -0
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +35 -0
- data/lib/datadog/tracing/contrib/sinatra/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +76 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +159 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +123 -0
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/sneakers/integration.rb +46 -0
- data/lib/datadog/tracing/contrib/sneakers/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +58 -0
- data/lib/datadog/tracing/contrib/status_code_matcher.rb +75 -0
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +28 -0
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +105 -0
- data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +37 -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 +99 -0
- data/lib/datadog/tracing/contrib.rb +76 -0
- data/lib/datadog/tracing/correlation.rb +100 -0
- data/lib/datadog/tracing/distributed/headers/b3.rb +55 -0
- data/lib/datadog/tracing/distributed/headers/b3_single.rb +67 -0
- data/lib/datadog/tracing/distributed/headers/datadog.rb +52 -0
- data/lib/datadog/tracing/distributed/headers/ext.rb +31 -0
- data/lib/datadog/tracing/distributed/helpers.rb +44 -0
- data/lib/datadog/tracing/distributed/parser.rb +70 -0
- data/lib/datadog/tracing/event.rb +78 -0
- data/lib/datadog/tracing/flush.rb +74 -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 +151 -0
- data/lib/datadog/tracing/metadata/tagging.rb +110 -0
- data/lib/datadog/tracing/metadata.rb +20 -0
- data/lib/datadog/tracing/pipeline/span_filter.rb +42 -0
- data/lib/datadog/tracing/pipeline/span_processor.rb +39 -0
- data/lib/datadog/tracing/pipeline.rb +65 -0
- data/lib/datadog/tracing/propagation/grpc.rb +88 -0
- data/lib/datadog/tracing/propagation/http.rb +109 -0
- data/lib/datadog/tracing/runtime/metrics.rb +19 -0
- data/lib/datadog/tracing/sampling/all_sampler.rb +25 -0
- data/lib/datadog/tracing/sampling/ext.rb +27 -0
- data/lib/datadog/tracing/sampling/matcher.rb +68 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +112 -0
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +97 -0
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +41 -0
- data/lib/datadog/tracing/sampling/rate_limiter.rb +185 -0
- data/lib/datadog/tracing/sampling/rate_sampler.rb +55 -0
- data/lib/datadog/tracing/sampling/rule.rb +76 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +131 -0
- data/lib/datadog/tracing/sampling/sampler.rb +44 -0
- data/lib/datadog/tracing/span.rb +212 -0
- data/lib/datadog/tracing/span_operation.rb +520 -0
- data/lib/datadog/tracing/sync_writer.rb +69 -0
- data/lib/datadog/tracing/trace_digest.rb +60 -0
- data/lib/datadog/tracing/trace_operation.rb +431 -0
- data/lib/datadog/tracing/trace_segment.rb +207 -0
- data/lib/datadog/tracing/tracer.rb +505 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +195 -0
- data/lib/datadog/tracing/workers.rb +125 -0
- data/lib/datadog/tracing/writer.rb +180 -0
- data/lib/datadog/tracing.rb +142 -0
- data/lib/ddtrace/auto_instrument.rb +6 -2
- data/lib/ddtrace/auto_instrument_base.rb +1 -0
- data/lib/ddtrace/profiling/preload.rb +2 -2
- data/lib/ddtrace/transport/ext.rb +35 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +3 -2
- data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +3 -2
- data/lib/ddtrace/transport/http/api/endpoint.rb +1 -0
- data/lib/ddtrace/transport/http/api/fallbacks.rb +1 -0
- data/lib/ddtrace/transport/http/api/instance.rb +1 -0
- data/lib/ddtrace/transport/http/api/map.rb +1 -0
- data/lib/ddtrace/transport/http/api/spec.rb +1 -0
- data/lib/ddtrace/transport/http/api.rb +5 -11
- data/lib/ddtrace/transport/http/builder.rb +3 -2
- data/lib/ddtrace/transport/http/client.rb +3 -1
- data/lib/ddtrace/transport/http/env.rb +1 -0
- data/lib/ddtrace/transport/http/response.rb +35 -4
- data/lib/ddtrace/transport/http/statistics.rb +1 -0
- data/lib/ddtrace/transport/http/traces.rb +3 -0
- data/lib/ddtrace/transport/http.rb +33 -28
- data/lib/ddtrace/transport/io/client.rb +4 -1
- data/lib/ddtrace/transport/io/response.rb +1 -0
- data/lib/ddtrace/transport/io/traces.rb +2 -1
- data/lib/ddtrace/transport/io.rb +3 -2
- data/lib/ddtrace/transport/parcel.rb +2 -0
- data/lib/ddtrace/transport/request.rb +1 -0
- data/lib/ddtrace/transport/response.rb +1 -0
- data/lib/ddtrace/transport/serializable_trace.rb +118 -0
- data/lib/ddtrace/transport/statistics.rb +6 -4
- data/lib/ddtrace/transport/trace_formatter.rb +187 -0
- data/lib/ddtrace/transport/traces.rb +15 -5
- data/lib/ddtrace/version.rb +14 -12
- data/lib/ddtrace.rb +9 -48
- metadata +604 -490
- data/.yardopts +0 -5
- data/lib/datadog/ci/context_flush.rb +0 -29
- data/lib/datadog/contrib.rb +0 -71
- data/lib/ddtrace/analytics.rb +0 -39
- data/lib/ddtrace/buffer.rb +0 -340
- data/lib/ddtrace/chunker.rb +0 -35
- data/lib/ddtrace/configuration/agent_settings_resolver.rb +0 -309
- data/lib/ddtrace/configuration/base.rb +0 -82
- data/lib/ddtrace/configuration/components.rb +0 -292
- data/lib/ddtrace/configuration/dependency_resolver.rb +0 -25
- data/lib/ddtrace/configuration/option.rb +0 -65
- data/lib/ddtrace/configuration/option_definition.rb +0 -122
- data/lib/ddtrace/configuration/option_definition_set.rb +0 -19
- data/lib/ddtrace/configuration/option_set.rb +0 -7
- data/lib/ddtrace/configuration/options.rb +0 -112
- data/lib/ddtrace/configuration/pin_setup.rb +0 -32
- data/lib/ddtrace/configuration/settings.rb +0 -413
- data/lib/ddtrace/configuration.rb +0 -195
- data/lib/ddtrace/context.rb +0 -334
- data/lib/ddtrace/context_flush.rb +0 -82
- data/lib/ddtrace/context_provider.rb +0 -62
- data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/action_cable/event.rb +0 -67
- data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +0 -50
- data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +0 -56
- data/lib/ddtrace/contrib/action_cable/events/transmit.rb +0 -51
- data/lib/ddtrace/contrib/action_cable/events.rb +0 -34
- data/lib/ddtrace/contrib/action_cable/ext.rb +0 -27
- data/lib/ddtrace/contrib/action_cable/instrumentation.rb +0 -78
- data/lib/ddtrace/contrib/action_cable/integration.rb +0 -46
- data/lib/ddtrace/contrib/action_cable/patcher.rb +0 -29
- data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/action_mailer/event.rb +0 -50
- data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +0 -54
- data/lib/ddtrace/contrib/action_mailer/events/process.rb +0 -41
- data/lib/ddtrace/contrib/action_mailer/events.rb +0 -31
- data/lib/ddtrace/contrib/action_mailer/ext.rb +0 -32
- data/lib/ddtrace/contrib/action_mailer/integration.rb +0 -45
- data/lib/ddtrace/contrib/action_mailer/patcher.rb +0 -27
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +0 -157
- data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +0 -26
- data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/action_pack/ext.rb +0 -20
- data/lib/ddtrace/contrib/action_pack/integration.rb +0 -46
- data/lib/ddtrace/contrib/action_pack/patcher.rb +0 -24
- data/lib/ddtrace/contrib/action_pack/utils.rb +0 -37
- data/lib/ddtrace/contrib/action_view/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/action_view/event.rb +0 -36
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +0 -47
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +0 -50
- data/lib/ddtrace/contrib/action_view/events.rb +0 -31
- data/lib/ddtrace/contrib/action_view/ext.rb +0 -21
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +0 -75
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +0 -168
- data/lib/ddtrace/contrib/action_view/integration.rb +0 -53
- data/lib/ddtrace/contrib/action_view/patcher.rb +0 -48
- data/lib/ddtrace/contrib/action_view/utils.rb +0 -33
- data/lib/ddtrace/contrib/active_job/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/active_job/event.rb +0 -54
- data/lib/ddtrace/contrib/active_job/events/discard.rb +0 -46
- data/lib/ddtrace/contrib/active_job/events/enqueue.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +0 -47
- data/lib/ddtrace/contrib/active_job/events/perform.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +0 -46
- data/lib/ddtrace/contrib/active_job/events.rb +0 -39
- data/lib/ddtrace/contrib/active_job/ext.rb +0 -32
- data/lib/ddtrace/contrib/active_job/integration.rb +0 -46
- data/lib/ddtrace/contrib/active_job/log_injection.rb +0 -21
- data/lib/ddtrace/contrib/active_job/patcher.rb +0 -33
- data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/active_model_serializers/event.rb +0 -69
- data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +0 -33
- data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +0 -36
- data/lib/ddtrace/contrib/active_model_serializers/events.rb +0 -31
- data/lib/ddtrace/contrib/active_model_serializers/ext.rb +0 -21
- data/lib/ddtrace/contrib/active_model_serializers/integration.rb +0 -41
- data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +0 -30
- data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +0 -31
- data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +0 -135
- data/lib/ddtrace/contrib/active_record/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/active_record/event.rb +0 -31
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +0 -61
- data/lib/ddtrace/contrib/active_record/events/sql.rb +0 -69
- data/lib/ddtrace/contrib/active_record/events.rb +0 -31
- data/lib/ddtrace/contrib/active_record/ext.rb +0 -25
- data/lib/ddtrace/contrib/active_record/integration.rb +0 -54
- data/lib/ddtrace/contrib/active_record/patcher.rb +0 -24
- data/lib/ddtrace/contrib/active_record/utils.rb +0 -124
- data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +0 -259
- data/lib/ddtrace/contrib/active_support/cache/patcher.rb +0 -70
- data/lib/ddtrace/contrib/active_support/cache/redis.rb +0 -44
- data/lib/ddtrace/contrib/active_support/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/active_support/ext.rb +0 -28
- data/lib/ddtrace/contrib/active_support/integration.rb +0 -47
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +0 -76
- data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +0 -68
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +0 -164
- data/lib/ddtrace/contrib/active_support/patcher.rb +0 -24
- data/lib/ddtrace/contrib/analytics.rb +0 -25
- data/lib/ddtrace/contrib/auto_instrument.rb +0 -48
- data/lib/ddtrace/contrib/aws/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/aws/ext.rb +0 -24
- data/lib/ddtrace/contrib/aws/instrumentation.rb +0 -91
- data/lib/ddtrace/contrib/aws/integration.rb +0 -43
- data/lib/ddtrace/contrib/aws/parsed_context.rb +0 -57
- data/lib/ddtrace/contrib/aws/patcher.rb +0 -54
- data/lib/ddtrace/contrib/aws/services.rb +0 -119
- data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +0 -21
- data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +0 -42
- data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +0 -13
- data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +0 -24
- data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +0 -39
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +0 -30
- data/lib/ddtrace/contrib/configurable.rb +0 -103
- data/lib/ddtrace/contrib/configuration/resolver.rb +0 -82
- data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +0 -40
- data/lib/ddtrace/contrib/configuration/settings.rb +0 -56
- data/lib/ddtrace/contrib/dalli/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/dalli/ext.rb +0 -21
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +0 -55
- data/lib/ddtrace/contrib/dalli/integration.rb +0 -39
- data/lib/ddtrace/contrib/dalli/patcher.rb +0 -26
- data/lib/ddtrace/contrib/dalli/quantize.rb +0 -23
- data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/delayed_job/ext.rb +0 -24
- data/lib/ddtrace/contrib/delayed_job/integration.rb +0 -39
- data/lib/ddtrace/contrib/delayed_job/patcher.rb +0 -29
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +0 -85
- data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/elasticsearch/ext.rb +0 -23
- data/lib/ddtrace/contrib/elasticsearch/integration.rb +0 -40
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +0 -123
- data/lib/ddtrace/contrib/elasticsearch/quantize.rb +0 -84
- data/lib/ddtrace/contrib/ethon/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +0 -152
- data/lib/ddtrace/contrib/ethon/ext.rb +0 -20
- data/lib/ddtrace/contrib/ethon/integration.rb +0 -44
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +0 -85
- data/lib/ddtrace/contrib/ethon/patcher.rb +0 -27
- data/lib/ddtrace/contrib/excon/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/excon/ext.rb +0 -18
- data/lib/ddtrace/contrib/excon/integration.rb +0 -44
- data/lib/ddtrace/contrib/excon/middleware.rb +0 -164
- data/lib/ddtrace/contrib/excon/patcher.rb +0 -28
- data/lib/ddtrace/contrib/extensions.rb +0 -169
- data/lib/ddtrace/contrib/faraday/configuration/settings.rb +0 -39
- data/lib/ddtrace/contrib/faraday/connection.rb +0 -19
- data/lib/ddtrace/contrib/faraday/ext.rb +0 -18
- data/lib/ddtrace/contrib/faraday/integration.rb +0 -44
- data/lib/ddtrace/contrib/faraday/middleware.rb +0 -86
- data/lib/ddtrace/contrib/faraday/patcher.rb +0 -54
- data/lib/ddtrace/contrib/faraday/rack_builder.rb +0 -19
- data/lib/ddtrace/contrib/grape/configuration/settings.rb +0 -39
- data/lib/ddtrace/contrib/grape/endpoint.rb +0 -246
- data/lib/ddtrace/contrib/grape/ext.rb +0 -24
- data/lib/ddtrace/contrib/grape/instrumentation.rb +0 -34
- data/lib/ddtrace/contrib/grape/integration.rb +0 -40
- data/lib/ddtrace/contrib/grape/patcher.rb +0 -32
- data/lib/ddtrace/contrib/graphql/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/graphql/ext.rb +0 -17
- data/lib/ddtrace/contrib/graphql/integration.rb +0 -40
- data/lib/ddtrace/contrib/graphql/patcher.rb +0 -61
- data/lib/ddtrace/contrib/grpc/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +0 -59
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +0 -80
- data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +0 -79
- data/lib/ddtrace/contrib/grpc/ext.rb +0 -19
- data/lib/ddtrace/contrib/grpc/integration.rb +0 -39
- data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +0 -50
- data/lib/ddtrace/contrib/grpc/patcher.rb +0 -34
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +0 -38
- data/lib/ddtrace/contrib/http/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/http/ext.rb +0 -18
- data/lib/ddtrace/contrib/http/instrumentation.rb +0 -180
- data/lib/ddtrace/contrib/http/integration.rb +0 -46
- data/lib/ddtrace/contrib/http/patcher.rb +0 -27
- data/lib/ddtrace/contrib/http_annotation_helper.rb +0 -11
- data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/httpclient/ext.rb +0 -18
- data/lib/ddtrace/contrib/httpclient/instrumentation.rb +0 -148
- data/lib/ddtrace/contrib/httpclient/integration.rb +0 -44
- data/lib/ddtrace/contrib/httpclient/patcher.rb +0 -39
- data/lib/ddtrace/contrib/httprb/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/httprb/ext.rb +0 -18
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +0 -158
- data/lib/ddtrace/contrib/httprb/integration.rb +0 -44
- data/lib/ddtrace/contrib/httprb/patcher.rb +0 -39
- data/lib/ddtrace/contrib/integration.rb +0 -17
- data/lib/ddtrace/contrib/kafka/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/kafka/consumer_event.rb +0 -15
- data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +0 -15
- data/lib/ddtrace/contrib/kafka/event.rb +0 -52
- data/lib/ddtrace/contrib/kafka/events/connection/request.rb +0 -35
- data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +0 -42
- data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +0 -40
- data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +0 -40
- data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +0 -33
- data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +0 -36
- data/lib/ddtrace/contrib/kafka/events.rb +0 -45
- data/lib/ddtrace/contrib/kafka/ext.rb +0 -42
- data/lib/ddtrace/contrib/kafka/integration.rb +0 -40
- data/lib/ddtrace/contrib/kafka/patcher.rb +0 -27
- data/lib/ddtrace/contrib/lograge/configuration/settings.rb +0 -19
- data/lib/ddtrace/contrib/lograge/ext.rb +0 -11
- data/lib/ddtrace/contrib/lograge/instrumentation.rb +0 -39
- data/lib/ddtrace/contrib/lograge/integration.rb +0 -46
- data/lib/ddtrace/contrib/lograge/patcher.rb +0 -26
- data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/mongodb/ext.rb +0 -24
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +0 -70
- data/lib/ddtrace/contrib/mongodb/integration.rb +0 -44
- data/lib/ddtrace/contrib/mongodb/parsers.rb +0 -69
- data/lib/ddtrace/contrib/mongodb/patcher.rb +0 -32
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +0 -112
- data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/mysql2/ext.rb +0 -19
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +0 -65
- data/lib/ddtrace/contrib/mysql2/integration.rb +0 -39
- data/lib/ddtrace/contrib/mysql2/patcher.rb +0 -28
- data/lib/ddtrace/contrib/patchable.rb +0 -71
- data/lib/ddtrace/contrib/patcher.rb +0 -66
- data/lib/ddtrace/contrib/presto/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/presto/ext.rb +0 -29
- data/lib/ddtrace/contrib/presto/instrumentation.rb +0 -111
- data/lib/ddtrace/contrib/presto/integration.rb +0 -39
- data/lib/ddtrace/contrib/presto/patcher.rb +0 -34
- data/lib/ddtrace/contrib/qless/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/qless/ext.rb +0 -21
- data/lib/ddtrace/contrib/qless/integration.rb +0 -39
- data/lib/ddtrace/contrib/qless/patcher.rb +0 -35
- data/lib/ddtrace/contrib/qless/qless_job.rb +0 -74
- data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +0 -34
- data/lib/ddtrace/contrib/que/configuration/settings.rb +0 -44
- data/lib/ddtrace/contrib/que/ext.rb +0 -31
- data/lib/ddtrace/contrib/que/integration.rb +0 -43
- data/lib/ddtrace/contrib/que/patcher.rb +0 -25
- data/lib/ddtrace/contrib/que/tracer.rb +0 -58
- data/lib/ddtrace/contrib/racecar/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/racecar/event.rb +0 -77
- data/lib/ddtrace/contrib/racecar/events/batch.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events/consume.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events/message.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events.rb +0 -33
- data/lib/ddtrace/contrib/racecar/ext.rb +0 -26
- data/lib/ddtrace/contrib/racecar/integration.rb +0 -40
- data/lib/ddtrace/contrib/racecar/patcher.rb +0 -27
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +0 -47
- data/lib/ddtrace/contrib/rack/ext.rb +0 -22
- data/lib/ddtrace/contrib/rack/integration.rb +0 -46
- data/lib/ddtrace/contrib/rack/middlewares.rb +0 -288
- data/lib/ddtrace/contrib/rack/patcher.rb +0 -106
- data/lib/ddtrace/contrib/rack/request_queue.rb +0 -45
- data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +0 -10
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +0 -101
- data/lib/ddtrace/contrib/rails/ext.rb +0 -18
- data/lib/ddtrace/contrib/rails/framework.rb +0 -172
- data/lib/ddtrace/contrib/rails/integration.rb +0 -45
- data/lib/ddtrace/contrib/rails/log_injection.rb +0 -42
- data/lib/ddtrace/contrib/rails/middlewares.rb +0 -44
- data/lib/ddtrace/contrib/rails/patcher.rb +0 -119
- data/lib/ddtrace/contrib/rails/railtie.rb +0 -18
- data/lib/ddtrace/contrib/rails/utils.rb +0 -25
- data/lib/ddtrace/contrib/rake/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/rake/ext.rb +0 -22
- data/lib/ddtrace/contrib/rake/instrumentation.rb +0 -91
- data/lib/ddtrace/contrib/rake/integration.rb +0 -39
- data/lib/ddtrace/contrib/rake/patcher.rb +0 -31
- data/lib/ddtrace/contrib/redis/configuration/resolver.rb +0 -46
- data/lib/ddtrace/contrib/redis/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/redis/ext.rb +0 -23
- data/lib/ddtrace/contrib/redis/instrumentation.rb +0 -90
- data/lib/ddtrace/contrib/redis/integration.rb +0 -43
- data/lib/ddtrace/contrib/redis/patcher.rb +0 -33
- data/lib/ddtrace/contrib/redis/quantize.rb +0 -76
- data/lib/ddtrace/contrib/redis/tags.rb +0 -47
- data/lib/ddtrace/contrib/redis/vendor/resolver.rb +0 -159
- data/lib/ddtrace/contrib/registerable.rb +0 -33
- data/lib/ddtrace/contrib/registry.rb +0 -43
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +0 -49
- data/lib/ddtrace/contrib/resque/ext.rb +0 -18
- data/lib/ddtrace/contrib/resque/integration.rb +0 -44
- data/lib/ddtrace/contrib/resque/patcher.rb +0 -30
- data/lib/ddtrace/contrib/resque/resque_job.rb +0 -104
- data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/rest_client/ext.rb +0 -18
- data/lib/ddtrace/contrib/rest_client/integration.rb +0 -39
- data/lib/ddtrace/contrib/rest_client/patcher.rb +0 -25
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +0 -92
- data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +0 -19
- data/lib/ddtrace/contrib/semantic_logger/ext.rb +0 -11
- data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +0 -43
- data/lib/ddtrace/contrib/semantic_logger/integration.rb +0 -48
- data/lib/ddtrace/contrib/semantic_logger/patcher.rb +0 -26
- data/lib/ddtrace/contrib/sequel/configuration/settings.rb +0 -29
- data/lib/ddtrace/contrib/sequel/database.rb +0 -64
- data/lib/ddtrace/contrib/sequel/dataset.rb +0 -64
- data/lib/ddtrace/contrib/sequel/ext.rb +0 -20
- data/lib/ddtrace/contrib/sequel/integration.rb +0 -39
- data/lib/ddtrace/contrib/sequel/patcher.rb +0 -34
- data/lib/ddtrace/contrib/sequel/utils.rb +0 -75
- data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/shoryuken/ext.rb +0 -22
- data/lib/ddtrace/contrib/shoryuken/integration.rb +0 -40
- data/lib/ddtrace/contrib/shoryuken/patcher.rb +0 -25
- data/lib/ddtrace/contrib/shoryuken/tracer.rb +0 -56
- data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +0 -44
- data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +0 -38
- data/lib/ddtrace/contrib/sidekiq/ext.rb +0 -31
- data/lib/ddtrace/contrib/sidekiq/integration.rb +0 -49
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +0 -68
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +0 -30
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +0 -30
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +0 -29
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +0 -66
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -45
- data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +0 -40
- data/lib/ddtrace/contrib/sinatra/env.rb +0 -59
- data/lib/ddtrace/contrib/sinatra/ext.rb +0 -28
- data/lib/ddtrace/contrib/sinatra/headers.rb +0 -30
- data/lib/ddtrace/contrib/sinatra/integration.rb +0 -39
- data/lib/ddtrace/contrib/sinatra/patcher.rb +0 -30
- data/lib/ddtrace/contrib/sinatra/tracer.rb +0 -150
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +0 -112
- data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/sneakers/ext.rb +0 -23
- data/lib/ddtrace/contrib/sneakers/integration.rb +0 -42
- data/lib/ddtrace/contrib/sneakers/patcher.rb +0 -25
- data/lib/ddtrace/contrib/sneakers/tracer.rb +0 -54
- data/lib/ddtrace/contrib/status_code_matcher.rb +0 -70
- data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +0 -25
- data/lib/ddtrace/contrib/sucker_punch/ext.rb +0 -22
- data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +0 -89
- data/lib/ddtrace/contrib/sucker_punch/integration.rb +0 -39
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +0 -44
- data/lib/ddtrace/correlation.rb +0 -40
- data/lib/ddtrace/diagnostics/environment_logger.rb +0 -280
- data/lib/ddtrace/diagnostics/health.rb +0 -34
- data/lib/ddtrace/distributed_tracing/headers/b3.rb +0 -45
- data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +0 -57
- data/lib/ddtrace/distributed_tracing/headers/datadog.rb +0 -43
- data/lib/ddtrace/distributed_tracing/headers/headers.rb +0 -72
- data/lib/ddtrace/distributed_tracing/headers/helpers.rb +0 -44
- data/lib/ddtrace/encoding.rb +0 -72
- data/lib/ddtrace/error.rb +0 -97
- data/lib/ddtrace/event.rb +0 -53
- data/lib/ddtrace/ext/analytics.rb +0 -13
- data/lib/ddtrace/ext/app_types.rb +0 -12
- data/lib/ddtrace/ext/correlation.rb +0 -12
- data/lib/ddtrace/ext/diagnostics.rb +0 -37
- data/lib/ddtrace/ext/distributed.rb +0 -40
- data/lib/ddtrace/ext/environment.rb +0 -24
- data/lib/ddtrace/ext/errors.rb +0 -11
- data/lib/ddtrace/ext/forced_tracing.rb +0 -26
- data/lib/ddtrace/ext/git.rb +0 -32
- data/lib/ddtrace/ext/http.rb +0 -47
- data/lib/ddtrace/ext/integration.rb +0 -9
- data/lib/ddtrace/ext/manual_tracing.rb +0 -10
- data/lib/ddtrace/ext/metrics.rb +0 -16
- data/lib/ddtrace/ext/net.rb +0 -11
- data/lib/ddtrace/ext/priority.rb +0 -19
- data/lib/ddtrace/ext/profiling.rb +0 -57
- data/lib/ddtrace/ext/runtime.rb +0 -25
- data/lib/ddtrace/ext/sampling.rb +0 -17
- data/lib/ddtrace/ext/sql.rb +0 -9
- data/lib/ddtrace/ext/test.rb +0 -9
- data/lib/ddtrace/ext/transport.rb +0 -32
- data/lib/ddtrace/forced_tracing.rb +0 -39
- data/lib/ddtrace/logger.rb +0 -41
- data/lib/ddtrace/metrics.rb +0 -282
- data/lib/ddtrace/opentelemetry/extensions.rb +0 -14
- data/lib/ddtrace/opentelemetry/span.rb +0 -34
- data/lib/ddtrace/opentracer/binary_propagator.rb +0 -25
- data/lib/ddtrace/opentracer/carrier.rb +0 -7
- data/lib/ddtrace/opentracer/distributed_headers.rb +0 -56
- data/lib/ddtrace/opentracer/global_tracer.rb +0 -16
- data/lib/ddtrace/opentracer/propagator.rb +0 -23
- data/lib/ddtrace/opentracer/rack_propagator.rb +0 -61
- data/lib/ddtrace/opentracer/scope.rb +0 -16
- data/lib/ddtrace/opentracer/scope_manager.rb +0 -7
- data/lib/ddtrace/opentracer/span.rb +0 -95
- data/lib/ddtrace/opentracer/span_context.rb +0 -15
- data/lib/ddtrace/opentracer/span_context_factory.rb +0 -24
- data/lib/ddtrace/opentracer/text_map_propagator.rb +0 -76
- data/lib/ddtrace/opentracer/thread_local_scope.rb +0 -32
- data/lib/ddtrace/opentracer/thread_local_scope_manager.rb +0 -41
- data/lib/ddtrace/opentracer/tracer.rb +0 -209
- data/lib/ddtrace/opentracer.rb +0 -22
- data/lib/ddtrace/patcher.rb +0 -69
- data/lib/ddtrace/pin.rb +0 -86
- data/lib/ddtrace/pipeline/span_filter.rb +0 -39
- data/lib/ddtrace/pipeline/span_processor.rb +0 -21
- data/lib/ddtrace/pipeline.rb +0 -47
- data/lib/ddtrace/profiling/backtrace_location.rb +0 -33
- data/lib/ddtrace/profiling/buffer.rb +0 -42
- data/lib/ddtrace/profiling/collectors/stack.rb +0 -301
- data/lib/ddtrace/profiling/encoding/profile.rb +0 -46
- data/lib/ddtrace/profiling/event.rb +0 -14
- data/lib/ddtrace/profiling/events/stack.rb +0 -81
- data/lib/ddtrace/profiling/exporter.rb +0 -24
- data/lib/ddtrace/profiling/ext/forking.rb +0 -98
- data/lib/ddtrace/profiling/flush.rb +0 -44
- data/lib/ddtrace/profiling/native_extension.rb +0 -40
- data/lib/ddtrace/profiling/pprof/builder.rb +0 -126
- data/lib/ddtrace/profiling/pprof/converter.rb +0 -103
- data/lib/ddtrace/profiling/pprof/message_set.rb +0 -15
- data/lib/ddtrace/profiling/pprof/payload.rb +0 -19
- data/lib/ddtrace/profiling/pprof/pprof_pb.rb +0 -82
- data/lib/ddtrace/profiling/pprof/stack_sample.rb +0 -140
- data/lib/ddtrace/profiling/pprof/string_table.rb +0 -11
- data/lib/ddtrace/profiling/pprof/template.rb +0 -119
- data/lib/ddtrace/profiling/profiler.rb +0 -31
- data/lib/ddtrace/profiling/recorder.rb +0 -96
- data/lib/ddtrace/profiling/scheduler.rb +0 -134
- data/lib/ddtrace/profiling/tasks/setup.rb +0 -90
- data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +0 -42
- data/lib/ddtrace/profiling/trace_identifiers/helper.rb +0 -46
- data/lib/ddtrace/profiling/transport/client.rb +0 -15
- data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +0 -101
- data/lib/ddtrace/profiling/transport/http/api/instance.rb +0 -37
- data/lib/ddtrace/profiling/transport/http/api/spec.rb +0 -41
- data/lib/ddtrace/profiling/transport/http/api.rb +0 -44
- data/lib/ddtrace/profiling/transport/http/builder.rb +0 -29
- data/lib/ddtrace/profiling/transport/http/client.rb +0 -34
- data/lib/ddtrace/profiling/transport/http/response.rb +0 -22
- data/lib/ddtrace/profiling/transport/http.rb +0 -111
- data/lib/ddtrace/profiling/transport/io/client.rb +0 -28
- data/lib/ddtrace/profiling/transport/io/response.rb +0 -17
- data/lib/ddtrace/profiling/transport/io.rb +0 -31
- data/lib/ddtrace/profiling/transport/parcel.rb +0 -18
- data/lib/ddtrace/profiling/transport/request.rb +0 -16
- data/lib/ddtrace/profiling/transport/response.rb +0 -9
- data/lib/ddtrace/profiling.rb +0 -149
- data/lib/ddtrace/propagation/grpc_propagator.rb +0 -75
- data/lib/ddtrace/propagation/http_propagator.rb +0 -91
- data/lib/ddtrace/quantization/hash.rb +0 -104
- data/lib/ddtrace/quantization/http.rb +0 -90
- data/lib/ddtrace/runtime/metrics.rb +0 -135
- data/lib/ddtrace/sampler.rb +0 -303
- data/lib/ddtrace/sampling/matcher.rb +0 -58
- data/lib/ddtrace/sampling/rate_limiter.rb +0 -177
- data/lib/ddtrace/sampling/rule.rb +0 -62
- data/lib/ddtrace/sampling/rule_sampler.rb +0 -133
- data/lib/ddtrace/sampling.rb +0 -3
- data/lib/ddtrace/span.rb +0 -445
- data/lib/ddtrace/sync_writer.rb +0 -69
- data/lib/ddtrace/tasks/exec.rb +0 -47
- data/lib/ddtrace/tasks/help.rb +0 -15
- data/lib/ddtrace/tracer.rb +0 -449
- data/lib/ddtrace/utils/compression.rb +0 -28
- data/lib/ddtrace/utils/database.rb +0 -26
- data/lib/ddtrace/utils/forking.rb +0 -53
- data/lib/ddtrace/utils/object_set.rb +0 -40
- data/lib/ddtrace/utils/only_once.rb +0 -41
- data/lib/ddtrace/utils/sequence.rb +0 -18
- data/lib/ddtrace/utils/string_table.rb +0 -46
- data/lib/ddtrace/utils/time.rb +0 -51
- data/lib/ddtrace/utils.rb +0 -80
- data/lib/ddtrace/vendor/active_record/connection_specification.rb +0 -302
- data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +0 -117
- data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +0 -58
- data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +0 -136
- data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +0 -10
- data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +0 -9
- data/lib/ddtrace/vendor/multipart-post/multipart.rb +0 -13
- data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +0 -33
- data/lib/ddtrace/worker.rb +0 -21
- data/lib/ddtrace/workers/async.rb +0 -175
- data/lib/ddtrace/workers/loop.rb +0 -132
- data/lib/ddtrace/workers/polling.rb +0 -56
- data/lib/ddtrace/workers/queue.rb +0 -41
- data/lib/ddtrace/workers/runtime_metrics.rb +0 -65
- data/lib/ddtrace/workers/trace_writer.rb +0 -200
- data/lib/ddtrace/workers.rb +0 -123
- data/lib/ddtrace/writer.rb +0 -200
- /data/lib/{ddtrace → datadog/core}/vendor/multipart-post/LICENSE +0 -0
- /data/lib/{ddtrace → datadog}/profiling/pprof/pprof.proto +0 -0
- /data/lib/{ddtrace/vendor/active_record → datadog/tracing/contrib/active_record/vendor}/MIT-LICENSE +0 -0
- /data/lib/{ddtrace → datadog/tracing}/contrib/redis/vendor/LICENSE +0 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
require 'datadog/core/utils/sequence'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Core
|
7
|
+
module Utils
|
8
|
+
# Acts as a unique dictionary of objects
|
9
|
+
class ObjectSet
|
10
|
+
# You can provide a block that defines how the key
|
11
|
+
# for this message type is resolved.
|
12
|
+
def initialize(seed = 0, &block)
|
13
|
+
@sequence = Sequence.new(seed)
|
14
|
+
@items = {}
|
15
|
+
@key_block = block
|
16
|
+
end
|
17
|
+
|
18
|
+
# Submit an array of arguments that define the message.
|
19
|
+
# If they match an existing message, it will return the
|
20
|
+
# matching object. If it doesn't match, it will yield to
|
21
|
+
# the block with the next ID & args given.
|
22
|
+
def fetch(*args)
|
23
|
+
# TODO: Array hashing is **really** expensive, we probably want to get rid of it in the future
|
24
|
+
key = @key_block ? @key_block.call(*args) : args.hash
|
25
|
+
@items[key] ||= yield(@sequence.next, *args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def length
|
29
|
+
@items.length
|
30
|
+
end
|
31
|
+
|
32
|
+
def objects
|
33
|
+
@items.values
|
34
|
+
end
|
35
|
+
|
36
|
+
def freeze
|
37
|
+
super
|
38
|
+
@items.freeze
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Core
|
7
|
+
module Utils
|
8
|
+
# Helper class to execute something only once such as not repeating warning logs, and instrumenting classes
|
9
|
+
# only once.
|
10
|
+
#
|
11
|
+
# Thread-safe when used correctly (e.g. be careful of races when lazily initializing instances of this class).
|
12
|
+
#
|
13
|
+
# Note: In its current state, this class is not Ractor-safe.
|
14
|
+
# In https://github.com/DataDog/dd-trace-rb/pull/1398#issuecomment-797378810 we have a discussion of alternatives,
|
15
|
+
# including an alternative implementation that is Ractor-safe once spent.
|
16
|
+
class OnlyOnce
|
17
|
+
def initialize
|
18
|
+
@mutex = Mutex.new
|
19
|
+
@ran_once = false
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
@mutex.synchronize do
|
24
|
+
return if @ran_once
|
25
|
+
|
26
|
+
@ran_once = true
|
27
|
+
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def ran?
|
33
|
+
@mutex.synchronize { @ran_once }
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def reset_ran_once_state_for_tests
|
39
|
+
@mutex.synchronize { @ran_once = false }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# typed: false
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Utils
|
6
|
+
# Helper methods for safer dup
|
7
|
+
module SafeDup
|
8
|
+
if RUBY_VERSION < '2.2' # nil.dup only fails in Ruby 2.1
|
9
|
+
# Ensures #initialize can call nil.dup safely
|
10
|
+
module RefineNil
|
11
|
+
refine NilClass do
|
12
|
+
def dup
|
13
|
+
self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
using RefineNil
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.frozen_or_dup(v)
|
22
|
+
v.frozen? ? v : v.dup
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Utils
|
6
|
+
# Generates values from a consistent sequence
|
7
|
+
class Sequence
|
8
|
+
def initialize(seed = 0, &block)
|
9
|
+
@current = seed
|
10
|
+
@next_item = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def next
|
14
|
+
next_item = @next_item ? @next_item.call(@current) : @current
|
15
|
+
@current += 1
|
16
|
+
next_item
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
require 'datadog/core/utils/sequence'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Core
|
7
|
+
module Utils
|
8
|
+
# Tracks strings and returns IDs
|
9
|
+
class StringTable
|
10
|
+
def initialize
|
11
|
+
@sequence = Sequence.new
|
12
|
+
@ids = { ''.freeze => @sequence.next }
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns an ID for the string
|
16
|
+
def fetch(string)
|
17
|
+
@ids[string.to_s] ||= @sequence.next
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the canonical copy of this string
|
21
|
+
# Typically used for psuedo interning; reduce
|
22
|
+
# identical copies of a string to one object.
|
23
|
+
def fetch_string(string)
|
24
|
+
return nil if string.nil?
|
25
|
+
|
26
|
+
# Co-erce to string
|
27
|
+
string = string.to_s
|
28
|
+
|
29
|
+
# Add to string table if no match
|
30
|
+
@ids[string] = @sequence.next unless @ids.key?(string)
|
31
|
+
|
32
|
+
# Get and return matching string in table
|
33
|
+
# NOTE: Have to resolve the key and retrieve from table again
|
34
|
+
# because "string" argument is not same object as string key.
|
35
|
+
id = @ids[string]
|
36
|
+
@ids.key(id)
|
37
|
+
end
|
38
|
+
|
39
|
+
def [](id)
|
40
|
+
@ids.key(id)
|
41
|
+
end
|
42
|
+
|
43
|
+
def strings
|
44
|
+
@ids.keys
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
module Datadog
|
4
|
+
module Core
|
5
|
+
module Utils
|
6
|
+
# Common database-related utility functions.
|
7
|
+
module Time
|
8
|
+
include Kernel # Ensure that kernel methods are always available (https://sorbet.org/docs/error-reference#7003)
|
9
|
+
|
10
|
+
module_function
|
11
|
+
|
12
|
+
# Current monotonic time
|
13
|
+
#
|
14
|
+
# @param unit [Symbol] unit for the resulting value, same as ::Process#clock_gettime, defaults to :float_second
|
15
|
+
# @return [Numeric] timestamp in the requested unit, since some unspecified starting point
|
16
|
+
def get_time(unit = :float_second)
|
17
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Current wall time.
|
21
|
+
#
|
22
|
+
# @return [Time] current time object
|
23
|
+
def now
|
24
|
+
::Time.now
|
25
|
+
end
|
26
|
+
|
27
|
+
# Overrides the implementation of `#now
|
28
|
+
# with the provided callable.
|
29
|
+
#
|
30
|
+
# Overriding the method `#now` instead of
|
31
|
+
# indirectly calling `block` removes
|
32
|
+
# one level of method call overhead.
|
33
|
+
#
|
34
|
+
# @param block [Proc] block that returns a `Time` object representing the current wall time
|
35
|
+
def now_provider=(block)
|
36
|
+
define_singleton_method(:now, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def measure
|
40
|
+
before = get_time
|
41
|
+
yield
|
42
|
+
after = get_time
|
43
|
+
after - before
|
44
|
+
end
|
45
|
+
|
46
|
+
def as_utc_epoch_ns(time)
|
47
|
+
# we use #to_r instead of #to_f because Float doesn't have enough precision to represent exact nanoseconds, see
|
48
|
+
# https://rubyapi.org/3.0/o/time#method-i-to_f
|
49
|
+
(time.to_r * 1_000_000_000).to_i
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
require 'datadog/core/utils/forking'
|
4
|
+
require 'datadog/tracing/span'
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module Core
|
8
|
+
# Utils contains low-level utilities, typically to provide pseudo-random trace IDs.
|
9
|
+
# @public_api
|
10
|
+
module Utils
|
11
|
+
extend Forking
|
12
|
+
|
13
|
+
EMPTY_STRING = ''.encode(::Encoding::UTF_8).freeze
|
14
|
+
# We use a custom random number generator because we want no interference
|
15
|
+
# with the default one. Using the default prng, we could break code that
|
16
|
+
# would rely on srand/rand sequences.
|
17
|
+
|
18
|
+
# Return a randomly generated integer, valid as a Span ID or Trace ID.
|
19
|
+
# This method is thread-safe and fork-safe.
|
20
|
+
def self.next_id
|
21
|
+
after_fork! { reset! }
|
22
|
+
id_rng.rand(Tracing::Span::RUBY_MAX_ID) # TODO: This should never return zero
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.id_rng
|
26
|
+
@id_rng ||= Random.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.reset!
|
30
|
+
@id_rng = Random.new
|
31
|
+
end
|
32
|
+
|
33
|
+
private_class_method :id_rng, :reset!
|
34
|
+
|
35
|
+
# Stringifies `value` and ensures the outcome is
|
36
|
+
# string is no longer than `size`.
|
37
|
+
# `omission` replaces the end of the output if
|
38
|
+
# `value.to_s` does not fit in `size`, to signify
|
39
|
+
# truncation.
|
40
|
+
#
|
41
|
+
# If `omission.size` is larger than `size`, the output
|
42
|
+
# will still be `omission.size` in length.
|
43
|
+
# @!visibility private
|
44
|
+
def self.truncate(value, size, omission = '...'.freeze)
|
45
|
+
string = value.to_s
|
46
|
+
|
47
|
+
return string if string.size <= size
|
48
|
+
|
49
|
+
string = string.slice(0, size - 1)
|
50
|
+
|
51
|
+
if size < omission.size
|
52
|
+
string[0, size] = omission
|
53
|
+
else
|
54
|
+
string[size - omission.size, size] = omission
|
55
|
+
end
|
56
|
+
|
57
|
+
string
|
58
|
+
end
|
59
|
+
|
60
|
+
# Ensure `str` is a valid UTF-8, ready to be
|
61
|
+
# sent through the tracer transport.
|
62
|
+
#
|
63
|
+
# @param [String,#to_s] str object to be converted to a UTF-8 string
|
64
|
+
# @param [Boolean] binary whether to expect binary data in the `str` parameter
|
65
|
+
# @param [String] placeholder string to be returned when encoding fails
|
66
|
+
# @return a UTF-8 string version of `str`
|
67
|
+
# @!visibility private
|
68
|
+
def self.utf8_encode(str, binary: false, placeholder: EMPTY_STRING)
|
69
|
+
str = str.to_s
|
70
|
+
|
71
|
+
if binary
|
72
|
+
# This option is useful for "gracefully" displaying binary data that
|
73
|
+
# often contains text such as marshalled objects
|
74
|
+
str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
75
|
+
elsif str.encoding == ::Encoding::UTF_8
|
76
|
+
str
|
77
|
+
elsif str.empty?
|
78
|
+
# DEV Optimization as `nil.to_s` is a very common source for an empty string,
|
79
|
+
# DEV but it comes encoded as US_ASCII.
|
80
|
+
EMPTY_STRING
|
81
|
+
else
|
82
|
+
str.encode(::Encoding::UTF_8)
|
83
|
+
end
|
84
|
+
rescue => e
|
85
|
+
Datadog.logger.debug("Error encoding string in UTF-8: #{e}")
|
86
|
+
|
87
|
+
placeholder
|
88
|
+
end
|
89
|
+
|
90
|
+
# @!visibility private
|
91
|
+
def self.without_warnings
|
92
|
+
# This is typically used when monkey patching functions such as
|
93
|
+
# intialize, which Ruby advices you not to. Use cautiously.
|
94
|
+
v = $VERBOSE
|
95
|
+
$VERBOSE = nil
|
96
|
+
begin
|
97
|
+
yield
|
98
|
+
ensure
|
99
|
+
$VERBOSE = v
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Extracts hostname and port from
|
104
|
+
# a string that contains both, separated by ':'.
|
105
|
+
# @return [String,Integer] hostname and port
|
106
|
+
# @return [nil] if format did not match
|
107
|
+
def self.extract_host_port(host_port)
|
108
|
+
match = /^([^:]+):(\d+)$/.match(host_port)
|
109
|
+
return unless match
|
110
|
+
|
111
|
+
[match[1], match[2].to_i]
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# typed: false
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2007-2012 Nick Sieger.
|
5
|
+
# See the file README.txt included with the distribution for
|
6
|
+
# software license details.
|
7
|
+
#++
|
8
|
+
|
9
|
+
# Concatenate together multiple IO objects into a single, composite IO object
|
10
|
+
# for purposes of reading as a single stream.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# crio = CompositeReadIO.new(StringIO.new('one'),
|
14
|
+
# StringIO.new('two'),
|
15
|
+
# StringIO.new('three'))
|
16
|
+
# puts crio.read # => "onetwothree"
|
17
|
+
module Datadog
|
18
|
+
module Core
|
19
|
+
module Vendor
|
20
|
+
module Multipart
|
21
|
+
module Post
|
22
|
+
class CompositeReadIO
|
23
|
+
# Create a new composite-read IO from the arguments, all of which should
|
24
|
+
# respond to #read in a manner consistent with IO.
|
25
|
+
def initialize(*ios)
|
26
|
+
@ios = ios.flatten
|
27
|
+
@index = 0
|
28
|
+
end
|
29
|
+
|
30
|
+
# Read from IOs in order until `length` bytes have been received.
|
31
|
+
def read(length = nil, outbuf = nil)
|
32
|
+
got_result = false
|
33
|
+
outbuf = outbuf ? outbuf.replace("") : ""
|
34
|
+
|
35
|
+
while io = current_io
|
36
|
+
if result = io.read(length)
|
37
|
+
got_result ||= !result.nil?
|
38
|
+
result.force_encoding("BINARY") if result.respond_to?(:force_encoding)
|
39
|
+
outbuf << result
|
40
|
+
length -= result.length if length
|
41
|
+
break if length == 0
|
42
|
+
end
|
43
|
+
advance_io
|
44
|
+
end
|
45
|
+
(!got_result && length) ? nil : outbuf
|
46
|
+
end
|
47
|
+
|
48
|
+
def rewind
|
49
|
+
@ios.each { |io| io.rewind }
|
50
|
+
@index = 0
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def current_io
|
56
|
+
@ios[@index]
|
57
|
+
end
|
58
|
+
|
59
|
+
def advance_io
|
60
|
+
@index += 1
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Convenience methods for dealing with files and IO that are to be uploaded.
|
65
|
+
class UploadIO
|
66
|
+
attr_reader :content_type, :original_filename, :local_path, :io, :opts
|
67
|
+
|
68
|
+
# Create an upload IO suitable for including in the params hash of a
|
69
|
+
# Net::HTTP::Post::Multipart.
|
70
|
+
#
|
71
|
+
# Can take two forms. The first accepts a filename and content type, and
|
72
|
+
# opens the file for reading (to be closed by finalizer).
|
73
|
+
#
|
74
|
+
# The second accepts an already-open IO, but also requires a third argument,
|
75
|
+
# the filename from which it was opened (particularly useful/recommended if
|
76
|
+
# uploading directly from a form in a framework, which often save the file to
|
77
|
+
# an arbitrarily named RackMultipart file in /tmp).
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# UploadIO.new("file.txt", "text/plain")
|
81
|
+
# UploadIO.new(file_io, "text/plain", "file.txt")
|
82
|
+
def initialize(filename_or_io, content_type, filename = nil, opts = {})
|
83
|
+
io = filename_or_io
|
84
|
+
local_path = ""
|
85
|
+
if io.respond_to? :read
|
86
|
+
# in Ruby 1.9.2, StringIOs no longer respond to path
|
87
|
+
# (since they respond to :length, so we don't need their local path, see parts.rb:41)
|
88
|
+
local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : "local.path"
|
89
|
+
else
|
90
|
+
io = File.open(filename_or_io)
|
91
|
+
local_path = filename_or_io
|
92
|
+
end
|
93
|
+
filename ||= local_path
|
94
|
+
|
95
|
+
@content_type = content_type
|
96
|
+
@original_filename = File.basename(filename)
|
97
|
+
@local_path = local_path
|
98
|
+
@io = io
|
99
|
+
@opts = opts
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.convert!(io, content_type, original_filename, local_path)
|
103
|
+
raise ArgumentError, "convert! has been removed. You must now wrap IOs " \
|
104
|
+
"using:\nUploadIO.new(filename_or_io, content_type, " \
|
105
|
+
"filename=nil)\nPlease update your code."
|
106
|
+
end
|
107
|
+
|
108
|
+
def method_missing(*args)
|
109
|
+
@io.send(*args)
|
110
|
+
end
|
111
|
+
|
112
|
+
def respond_to?(meth, include_all = false)
|
113
|
+
@io.respond_to?(meth, include_all) || super(meth, include_all)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# typed: false
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2007-2013 Nick Sieger.
|
5
|
+
# See the file README.txt included with the distribution for
|
6
|
+
# software license details.
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'datadog/core/vendor/multipart-post/multipart/post/parts'
|
10
|
+
require 'datadog/core/vendor/multipart-post/multipart/post/composite_read_io'
|
11
|
+
require 'securerandom'
|
12
|
+
|
13
|
+
module Datadog
|
14
|
+
module Core
|
15
|
+
module Vendor
|
16
|
+
module Multipart
|
17
|
+
module Post
|
18
|
+
module Multipartable
|
19
|
+
def self.secure_boundary
|
20
|
+
# https://tools.ietf.org/html/rfc7230
|
21
|
+
# tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
22
|
+
# / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
23
|
+
# / DIGIT / ALPHA
|
24
|
+
|
25
|
+
# https://tools.ietf.org/html/rfc2046
|
26
|
+
# bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
|
27
|
+
# "+" / "_" / "," / "-" / "." /
|
28
|
+
# "/" / ":" / "=" / "?"
|
29
|
+
|
30
|
+
"--#{SecureRandom.uuid}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(path, params, headers={}, boundary = Multipartable.secure_boundary)
|
34
|
+
headers = headers.clone # don't want to modify the original variable
|
35
|
+
parts_headers = headers.delete(:parts) || {}
|
36
|
+
super(path, headers)
|
37
|
+
parts = params.map do |k,v|
|
38
|
+
case v
|
39
|
+
when Array
|
40
|
+
v.map {|item| Parts::Part.new(boundary, "#{k}[]", item, parts_headers[k]) }
|
41
|
+
else
|
42
|
+
Parts::Part.new(boundary, k, v, parts_headers[k])
|
43
|
+
end
|
44
|
+
end.flatten
|
45
|
+
parts << Parts::EpiloguePart.new(boundary)
|
46
|
+
ios = parts.map {|p| p.to_io }
|
47
|
+
self.set_content_type(headers["Content-Type"] || "multipart/form-data",
|
48
|
+
{ "boundary" => boundary })
|
49
|
+
self.content_length = parts.inject(0) {|sum,i| sum + i.length }
|
50
|
+
self.body_stream = CompositeReadIO.new(*ios)
|
51
|
+
|
52
|
+
@boundary = boundary
|
53
|
+
end
|
54
|
+
|
55
|
+
attr :boundary
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2007-2013 Nick Sieger.
|
5
|
+
# See the file README.txt included with the distribution for
|
6
|
+
# software license details.
|
7
|
+
#++
|
8
|
+
|
9
|
+
module Datadog
|
10
|
+
module Core
|
11
|
+
module Vendor
|
12
|
+
module Multipart
|
13
|
+
module Post
|
14
|
+
module Parts
|
15
|
+
module Part
|
16
|
+
def self.new(boundary, name, value, headers = {})
|
17
|
+
headers ||= {} # avoid nil values
|
18
|
+
if file?(value)
|
19
|
+
FilePart.new(boundary, name, value, headers)
|
20
|
+
else
|
21
|
+
ParamPart.new(boundary, name, value, headers)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.file?(value)
|
26
|
+
value.respond_to?(:content_type) && value.respond_to?(:original_filename)
|
27
|
+
end
|
28
|
+
|
29
|
+
def length
|
30
|
+
@part.length
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_io
|
34
|
+
@io
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Represents a parametric part to be filled with given value.
|
39
|
+
class ParamPart
|
40
|
+
include Part
|
41
|
+
|
42
|
+
# @param boundary [String]
|
43
|
+
# @param name [#to_s]
|
44
|
+
# @param value [String]
|
45
|
+
# @param headers [Hash] Content-Type and Content-ID are used, if present.
|
46
|
+
def initialize(boundary, name, value, headers = {})
|
47
|
+
@part = build_part(boundary, name, value, headers)
|
48
|
+
@io = StringIO.new(@part)
|
49
|
+
end
|
50
|
+
|
51
|
+
def length
|
52
|
+
@part.bytesize
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param boundary [String]
|
56
|
+
# @param name [#to_s]
|
57
|
+
# @param value [String]
|
58
|
+
# @param headers [Hash] Content-Type is used, if present.
|
59
|
+
def build_part(boundary, name, value, headers = {})
|
60
|
+
part = ''
|
61
|
+
part << "--#{boundary}\r\n"
|
62
|
+
part << "Content-ID: #{headers["Content-ID"]}\r\n" if headers["Content-ID"]
|
63
|
+
part << "Content-Disposition: form-data; name=\"#{name.to_s}\"\r\n"
|
64
|
+
part << "Content-Type: #{headers["Content-Type"]}\r\n" if headers["Content-Type"]
|
65
|
+
part << "\r\n"
|
66
|
+
part << "#{value}\r\n"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Represents a part to be filled from file IO.
|
71
|
+
class FilePart
|
72
|
+
include Part
|
73
|
+
|
74
|
+
attr_reader :length
|
75
|
+
|
76
|
+
# @param boundary [String]
|
77
|
+
# @param name [#to_s]
|
78
|
+
# @param io [IO]
|
79
|
+
# @param headers [Hash]
|
80
|
+
def initialize(boundary, name, io, headers = {})
|
81
|
+
file_length = io.respond_to?(:length) ? io.length : File.size(io.local_path)
|
82
|
+
@head = build_head(boundary, name, io.original_filename, io.content_type, file_length,
|
83
|
+
io.respond_to?(:opts) ? io.opts.merge(headers) : headers)
|
84
|
+
@foot = "\r\n"
|
85
|
+
@length = @head.bytesize + file_length + @foot.length
|
86
|
+
@io = CompositeReadIO.new(StringIO.new(@head), io, StringIO.new(@foot))
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param boundary [String]
|
90
|
+
# @param name [#to_s]
|
91
|
+
# @param filename [String]
|
92
|
+
# @param type [String]
|
93
|
+
# @param content_len [Integer]
|
94
|
+
# @param opts [Hash]
|
95
|
+
def build_head(boundary, name, filename, type, content_len, opts = {})
|
96
|
+
opts = opts.clone
|
97
|
+
|
98
|
+
trans_encoding = opts.delete("Content-Transfer-Encoding") || "binary"
|
99
|
+
content_disposition = opts.delete("Content-Disposition") || "form-data"
|
100
|
+
|
101
|
+
part = ''
|
102
|
+
part << "--#{boundary}\r\n"
|
103
|
+
part << "Content-Disposition: #{content_disposition}; name=\"#{name.to_s}\"; filename=\"#{filename}\"\r\n"
|
104
|
+
part << "Content-Length: #{content_len}\r\n"
|
105
|
+
if content_id = opts.delete("Content-ID")
|
106
|
+
part << "Content-ID: #{content_id}\r\n"
|
107
|
+
end
|
108
|
+
|
109
|
+
if opts["Content-Type"] != nil
|
110
|
+
part << "Content-Type: " + opts["Content-Type"] + "\r\n"
|
111
|
+
else
|
112
|
+
part << "Content-Type: #{type}\r\n"
|
113
|
+
end
|
114
|
+
|
115
|
+
part << "Content-Transfer-Encoding: #{trans_encoding}\r\n"
|
116
|
+
|
117
|
+
opts.each do |k, v|
|
118
|
+
part << "#{k}: #{v}\r\n"
|
119
|
+
end
|
120
|
+
|
121
|
+
part << "\r\n"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Represents the epilogue or closing boundary.
|
126
|
+
class EpiloguePart
|
127
|
+
include Part
|
128
|
+
|
129
|
+
def initialize(boundary)
|
130
|
+
@part = "--#{boundary}--\r\n"
|
131
|
+
@io = StringIO.new(@part)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|