ddtrace 0.53.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +687 -12
- data/LICENSE-3rdparty.csv +6 -1
- data/README.md +10 -1
- data/bin/ddtracerb +5 -5
- data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +134 -0
- data/ext/ddtrace_profiling_loader/extconf.rb +74 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +156 -0
- data/ext/ddtrace_profiling_native_extension/clock_id.h +25 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +75 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +23 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +899 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.h +9 -0
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +776 -0
- data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.c +142 -0
- data/ext/ddtrace_profiling_native_extension/collectors_dynamic_sampling_rate.h +14 -0
- data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c +241 -0
- data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.h +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +390 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +18 -0
- data/ext/ddtrace_profiling_native_extension/extconf.rb +234 -14
- data/ext/ddtrace_profiling_native_extension/helpers.h +17 -0
- data/ext/ddtrace_profiling_native_extension/http_transport.c +354 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +18 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +319 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +846 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +45 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +237 -3
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.c +110 -0
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +89 -0
- data/ext/ddtrace_profiling_native_extension/setup_signal_handler.c +115 -0
- data/ext/ddtrace_profiling_native_extension/setup_signal_handler.h +11 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +487 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +39 -0
- data/ext/ddtrace_profiling_native_extension/time_helpers.c +17 -0
- data/ext/ddtrace_profiling_native_extension/time_helpers.h +10 -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/recommended.json +6588 -0
- data/lib/datadog/appsec/assets/waf_rules/risky.json +1499 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +1533 -0
- data/lib/datadog/appsec/assets.rb +38 -0
- data/lib/datadog/appsec/autoload.rb +18 -0
- data/lib/datadog/appsec/configuration/settings.rb +211 -0
- data/lib/datadog/appsec/configuration.rb +86 -0
- data/lib/datadog/appsec/contrib/auto_instrument.rb +27 -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 +174 -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 +83 -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 +78 -0
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +41 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +139 -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 +82 -0
- data/lib/datadog/appsec/contrib/rails/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/rails/patcher.rb +159 -0
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +68 -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/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +16 -0
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +34 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +126 -0
- data/lib/datadog/appsec/contrib/sinatra/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +151 -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 +117 -0
- data/lib/datadog/appsec/extensions.rb +138 -0
- data/lib/datadog/appsec/instrumentation/gateway.rb +58 -0
- data/lib/datadog/appsec/processor.rb +194 -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/response.rb +63 -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 +9 -0
- data/lib/datadog/appsec/utils.rb +7 -0
- data/lib/datadog/appsec.rb +23 -0
- data/lib/datadog/ci/configuration/components.rb +9 -8
- data/lib/datadog/ci/configuration/settings.rb +20 -4
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +5 -3
- data/lib/datadog/ci/contrib/cucumber/ext.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +9 -13
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +3 -2
- data/lib/datadog/ci/contrib/cucumber/integration.rb +6 -5
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +4 -3
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +5 -3
- data/lib/datadog/ci/contrib/rspec/example.rb +9 -13
- data/lib/datadog/ci/contrib/rspec/ext.rb +2 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +6 -5
- data/lib/datadog/ci/contrib/rspec/patcher.rb +4 -3
- data/lib/datadog/ci/ext/app_types.rb +2 -1
- data/lib/datadog/ci/ext/environment.rb +214 -133
- data/lib/datadog/ci/ext/settings.rb +2 -1
- data/lib/datadog/ci/ext/test.rb +2 -0
- data/lib/datadog/ci/extensions.rb +7 -6
- data/lib/datadog/ci/flush.rb +38 -0
- data/lib/datadog/ci/test.rb +22 -16
- data/lib/datadog/ci.rb +7 -4
- 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 +362 -0
- data/lib/datadog/core/configuration/base.rb +101 -0
- data/lib/datadog/core/configuration/components.rb +462 -0
- data/lib/datadog/core/configuration/dependency_resolver.rb +28 -0
- data/lib/datadog/core/configuration/ext.rb +26 -0
- data/lib/datadog/core/configuration/option.rb +69 -0
- data/lib/datadog/core/configuration/option_definition.rb +135 -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 +446 -0
- data/lib/datadog/core/configuration.rb +289 -0
- data/lib/datadog/core/diagnostics/environment_logger.rb +288 -0
- data/lib/datadog/core/diagnostics/health.rb +19 -0
- data/lib/datadog/core/encoding.rb +76 -0
- data/lib/datadog/core/environment/cgroup.rb +5 -2
- data/lib/datadog/core/environment/class_count.rb +1 -0
- data/lib/datadog/core/environment/container.rb +4 -2
- data/lib/datadog/core/environment/ext.rb +29 -10
- data/lib/datadog/core/environment/gc.rb +1 -0
- data/lib/datadog/core/environment/identity.rb +12 -5
- data/lib/datadog/core/environment/platform.rb +40 -0
- 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 +85 -11
- 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/header_collection.rb +41 -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 +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 +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/telemetry/client.rb +79 -0
- data/lib/datadog/core/telemetry/collector.rb +233 -0
- data/lib/datadog/core/telemetry/emitter.rb +48 -0
- data/lib/datadog/core/telemetry/event.rb +71 -0
- data/lib/datadog/core/telemetry/ext.rb +11 -0
- data/lib/datadog/core/telemetry/heartbeat.rb +37 -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 +20 -0
- data/lib/datadog/core/telemetry/http/response.rb +68 -0
- data/lib/datadog/core/telemetry/http/transport.rb +53 -0
- data/lib/datadog/core/telemetry/v1/app_event.rb +52 -0
- data/lib/datadog/core/telemetry/v1/application.rb +86 -0
- data/lib/datadog/core/telemetry/v1/configuration.rb +25 -0
- data/lib/datadog/core/telemetry/v1/dependency.rb +36 -0
- data/lib/datadog/core/telemetry/v1/host.rb +51 -0
- data/lib/datadog/core/telemetry/v1/integration.rb +58 -0
- data/lib/datadog/core/telemetry/v1/product.rb +28 -0
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +100 -0
- data/lib/datadog/core/utils/compression.rb +36 -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 +26 -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 +94 -0
- data/lib/{ddtrace → datadog/core}/vendor/multipart-post/LICENSE +0 -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 +180 -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 +46 -0
- data/lib/datadog/kit/appsec/events.rb +75 -0
- data/lib/datadog/kit/enable_core_dumps.rb +51 -0
- data/lib/datadog/kit/identity.rb +64 -0
- data/lib/datadog/kit.rb +11 -0
- data/lib/datadog/opentelemetry/api/context.rb +187 -0
- data/lib/datadog/opentelemetry/api/trace/span.rb +15 -0
- data/lib/datadog/opentelemetry/sdk/configurator.rb +38 -0
- data/lib/datadog/opentelemetry/sdk/id_generator.rb +27 -0
- data/lib/datadog/opentelemetry/sdk/propagator.rb +91 -0
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +92 -0
- data/lib/datadog/opentelemetry.rb +48 -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 +56 -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 +73 -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 +88 -0
- data/lib/datadog/opentracer/thread_local_scope.rb +34 -0
- data/lib/datadog/opentracer/thread_local_scope_manager.rb +66 -0
- data/lib/datadog/opentracer/tracer.rb +214 -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 +115 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time.rb +43 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +91 -0
- data/lib/datadog/profiling/collectors/dynamic_sampling_rate.rb +14 -0
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +68 -0
- data/lib/datadog/profiling/collectors/old_stack.rb +305 -0
- data/lib/datadog/profiling/collectors/stack.rb +13 -0
- data/lib/datadog/profiling/encoding/profile.rb +43 -0
- data/lib/datadog/profiling/event.rb +15 -0
- data/lib/datadog/profiling/events/stack.rb +82 -0
- data/lib/datadog/profiling/exporter.rb +85 -0
- data/lib/datadog/profiling/ext/forking.rb +98 -0
- data/lib/datadog/profiling/ext.rb +45 -0
- data/lib/datadog/profiling/flush.rb +38 -0
- data/lib/datadog/profiling/http_transport.rb +132 -0
- data/lib/datadog/profiling/load_native_extension.rb +22 -0
- data/lib/datadog/profiling/native_extension.rb +41 -0
- data/lib/datadog/profiling/old_recorder.rb +109 -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/{ddtrace → datadog}/profiling/pprof/pprof.proto +0 -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 +41 -0
- data/lib/datadog/profiling/scheduler.rb +130 -0
- data/lib/datadog/profiling/stack_recorder.rb +79 -0
- data/lib/datadog/profiling/tag_builder.rb +53 -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 +86 -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.rb +173 -0
- data/lib/datadog/tracing/analytics.rb +25 -0
- data/lib/datadog/tracing/buffer.rb +132 -0
- data/lib/datadog/tracing/client_ip.rb +164 -0
- data/lib/datadog/tracing/configuration/ext.rb +94 -0
- data/lib/datadog/tracing/configuration/settings.rb +433 -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 +35 -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 +32 -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 +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 +160 -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 +24 -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 +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 +24 -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 +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/{ddtrace/vendor/active_record → datadog/tracing/contrib/active_record/vendor}/MIT-LICENSE +0 -0
- data/lib/datadog/tracing/contrib/active_record/vendor/connection_specification.rb +307 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +280 -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 +38 -0
- data/lib/datadog/tracing/contrib/aws/ext.rb +28 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +96 -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 +121 -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 +38 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +61 -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 +28 -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 +104 -0
- data/lib/datadog/tracing/contrib/delayed_job/server_internal_tracer/worker.rb +32 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +153 -0
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +89 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +176 -0
- data/lib/datadog/tracing/contrib/ethon/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/ethon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +97 -0
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/excon/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/excon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +171 -0
- data/lib/datadog/tracing/contrib/excon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/extensions.rb +199 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +46 -0
- data/lib/datadog/tracing/contrib/faraday/connection.rb +22 -0
- data/lib/datadog/tracing/contrib/faraday/ext.rb +22 -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 +250 -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 +90 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +99 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +90 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +107 -0
- data/lib/datadog/tracing/contrib/grpc/distributed/fetcher.rb +27 -0
- data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +43 -0
- data/lib/datadog/tracing/contrib/grpc/ext.rb +27 -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 +35 -0
- data/lib/datadog/tracing/contrib/hanami/action_tracer.rb +47 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +22 -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 +43 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +47 -0
- data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +39 -0
- data/lib/datadog/tracing/contrib/http/distributed/propagation.rb +38 -0
- data/lib/datadog/tracing/contrib/http/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +137 -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 +47 -0
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +23 -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 +47 -0
- data/lib/datadog/tracing/contrib/httprb/ext.rb +23 -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 +19 -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 +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 +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 +46 -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 +42 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +35 -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 +127 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +50 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +77 -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 +86 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +50 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +168 -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 +38 -0
- data/lib/datadog/tracing/contrib/presto/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +124 -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 +43 -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 +47 -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 +37 -0
- data/lib/datadog/tracing/contrib/qless/qless_job.rb +74 -0
- data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +30 -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 +63 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/event.rb +78 -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 +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/header_collection.rb +35 -0
- data/lib/datadog/tracing/contrib/rack/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +323 -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/rails/auto_instrument_railtie.rb +12 -0
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +74 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/framework.rb +148 -0
- data/lib/datadog/tracing/contrib/rails/integration.rb +49 -0
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +32 -0
- data/lib/datadog/tracing/contrib/rails/middlewares.rb +46 -0
- data/lib/datadog/tracing/contrib/rails/patcher.rb +120 -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 +51 -0
- data/lib/datadog/tracing/contrib/rake/ext.rb +26 -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 +43 -0
- data/lib/datadog/tracing/contrib/redis/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +88 -0
- data/lib/datadog/tracing/contrib/redis/integration.rb +80 -0
- data/lib/datadog/tracing/contrib/redis/patcher.rb +79 -0
- data/lib/datadog/tracing/contrib/redis/quantize.rb +82 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +56 -0
- data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +72 -0
- data/lib/{ddtrace → datadog/tracing}/contrib/redis/vendor/LICENSE +0 -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 +104 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +22 -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 +106 -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 +50 -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 +59 -0
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +64 -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 +63 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +57 -0
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq/integration.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +78 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +52 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/redis_info.rb +32 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_poller.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +102 -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 +55 -0
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +36 -0
- data/lib/datadog/tracing/contrib/sinatra/framework.rb +116 -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 +86 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +127 -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 +59 -0
- data/lib/datadog/tracing/contrib/status_code_matcher.rb +75 -0
- data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +33 -0
- data/lib/datadog/tracing/contrib/stripe/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/stripe/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/stripe/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/stripe/request.rb +67 -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 +104 -0
- data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +36 -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 +181 -0
- data/lib/datadog/tracing/contrib.rb +79 -0
- data/lib/datadog/tracing/correlation.rb +100 -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 +66 -0
- data/lib/datadog/tracing/distributed/b3_single.rb +66 -0
- data/lib/datadog/tracing/distributed/datadog.rb +153 -0
- data/lib/datadog/tracing/distributed/datadog_tags_codec.rb +85 -0
- data/lib/datadog/tracing/distributed/fetcher.rb +30 -0
- data/lib/datadog/tracing/distributed/headers/ext.rb +35 -0
- data/lib/datadog/tracing/distributed/helpers.rb +80 -0
- data/lib/datadog/tracing/distributed/none.rb +19 -0
- data/lib/datadog/tracing/distributed/propagation.rb +127 -0
- data/lib/datadog/tracing/distributed/trace_context.rb +378 -0
- data/lib/datadog/tracing/event.rb +78 -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 +178 -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 +65 -0
- data/lib/datadog/tracing/propagation/http.rb +14 -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 +58 -0
- data/lib/datadog/tracing/sampling/matcher.rb +68 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +165 -0
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +96 -0
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +65 -0
- data/lib/datadog/tracing/sampling/rate_limiter.rb +188 -0
- data/lib/datadog/tracing/sampling/rate_sampler.rb +72 -0
- data/lib/datadog/tracing/sampling/rule.rb +76 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +132 -0
- data/lib/datadog/tracing/sampling/sampler.rb +44 -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 +82 -0
- data/lib/datadog/tracing/sampling/span/rule_parser.rb +104 -0
- data/lib/datadog/tracing/sampling/span/sampler.rb +75 -0
- data/lib/datadog/tracing/span.rb +216 -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 +146 -0
- data/lib/datadog/tracing/trace_operation.rb +476 -0
- data/lib/datadog/tracing/trace_segment.rb +212 -0
- data/lib/datadog/tracing/tracer.rb +533 -0
- data/lib/datadog/tracing/utils.rb +50 -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 +187 -0
- data/lib/datadog/tracing.rb +142 -0
- data/lib/ddtrace/auto_instrument.rb +14 -3
- data/lib/ddtrace/auto_instrument_base.rb +1 -0
- data/lib/ddtrace/profiling/preload.rb +2 -2
- data/lib/ddtrace/transport/ext.rb +41 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +5 -3
- data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +2 -1
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +4 -3
- 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 +2 -1
- data/lib/ddtrace/transport/http/api/spec.rb +1 -0
- data/lib/ddtrace/transport/http/api.rb +8 -14
- data/lib/ddtrace/transport/http/builder.rb +7 -6
- data/lib/ddtrace/transport/http/client.rb +5 -3
- data/lib/ddtrace/transport/http/env.rb +1 -0
- data/lib/ddtrace/transport/http/response.rb +36 -5
- data/lib/ddtrace/transport/http/statistics.rb +2 -1
- data/lib/ddtrace/transport/http/traces.rb +6 -3
- data/lib/ddtrace/transport/http.rb +39 -31
- data/lib/ddtrace/transport/io/client.rb +6 -3
- data/lib/ddtrace/transport/io/response.rb +2 -1
- data/lib/ddtrace/transport/io/traces.rb +5 -4
- data/lib/ddtrace/transport/io.rb +5 -4
- 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 +191 -0
- data/lib/ddtrace/transport/traces.rb +20 -8
- data/lib/ddtrace/version.rb +14 -12
- data/lib/ddtrace.rb +9 -48
- metadata +697 -499
- data/.editorconfig +0 -22
- data/.gitignore +0 -67
- data/.yardopts +0 -5
- data/CONTRIBUTING.md +0 -81
- data/ddtrace.gemspec +0 -53
- data/docs/DevelopmentGuide.md +0 -259
- data/docs/GettingStarted.md +0 -2585
- data/docs/ProfilingDevelopment.md +0 -107
- 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 -328
- data/lib/ddtrace/chunker.rb +0 -35
- data/lib/ddtrace/configuration/agent_settings_resolver.rb +0 -298
- 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 -326
- 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 -39
- 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 -94
- data/lib/ddtrace/contrib/rails/ext.rb +0 -18
- data/lib/ddtrace/contrib/rails/framework.rb +0 -171
- 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/integration.rb +0 -43
- data/lib/ddtrace/contrib/redis/patcher.rb +0 -115
- 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 -48
- 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 -17
- 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/cpu.rb +0 -67
- data/lib/ddtrace/profiling/ext/cthread.rb +0 -156
- 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 -18
- data/lib/ddtrace/profiling/pprof/builder.rb +0 -120
- 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 -143
- 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 -81
- data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +0 -41
- 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 -151
- 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 -293
- 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 -121
- 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 -45
- 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/docs/GettingStarted.md
DELETED
@@ -1,2585 +0,0 @@
|
|
1
|
-
# Datadog Ruby Trace Client
|
2
|
-
|
3
|
-
`ddtrace` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
|
4
|
-
databases and microservices so that developers have high visibility into bottlenecks and troublesome requests.
|
5
|
-
|
6
|
-
## Getting started
|
7
|
-
|
8
|
-
For the general APM documentation, see our [setup documentation][setup docs].
|
9
|
-
|
10
|
-
For more information about what APM looks like once your application is sending information to Datadog, take a look at [Visualizing your APM data][visualization docs].
|
11
|
-
|
12
|
-
To contribute, check out the [contribution guidelines][contribution docs] and [development guide][development docs].
|
13
|
-
|
14
|
-
[setup docs]: https://docs.datadoghq.com/tracing/
|
15
|
-
[development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/README.md#development
|
16
|
-
[visualization docs]: https://docs.datadoghq.com/tracing/visualization/
|
17
|
-
[contribution docs]: https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md
|
18
|
-
[development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/docs/DevelopmentGuide.md
|
19
|
-
|
20
|
-
## Table of Contents
|
21
|
-
|
22
|
-
- [Compatibility](#compatibility)
|
23
|
-
- [Installation](#installation)
|
24
|
-
- [Quickstart for Rails applications](#quickstart-for-rails-applications)
|
25
|
-
- [Quickstart for Ruby applications](#quickstart-for-ruby-applications)
|
26
|
-
- [Quickstart for OpenTracing](#quickstart-for-opentracing)
|
27
|
-
- [Manual instrumentation](#manual-instrumentation)
|
28
|
-
- [Integration instrumentation](#integration-instrumentation)
|
29
|
-
- [Action Cable](#action-cable)
|
30
|
-
- [Action View](#action-view)
|
31
|
-
- [Action Mailer](#action-mailer)
|
32
|
-
- [Active Model Serializers](#active-model-serializers)
|
33
|
-
- [Action Pack](#action-pack)
|
34
|
-
- [Active Job](#active-job)
|
35
|
-
- [Active Record](#active-record)
|
36
|
-
- [Active Support](#active-support)
|
37
|
-
- [AWS](#aws)
|
38
|
-
- [Concurrent Ruby](#concurrent-ruby)
|
39
|
-
- [Cucumber](#cucumber)
|
40
|
-
- [Dalli](#dalli)
|
41
|
-
- [DelayedJob](#delayedjob)
|
42
|
-
- [Elasticsearch](#elasticsearch)
|
43
|
-
- [Ethon & Typhoeus](#ethon)
|
44
|
-
- [Excon](#excon)
|
45
|
-
- [Faraday](#faraday)
|
46
|
-
- [Grape](#grape)
|
47
|
-
- [GraphQL](#graphql)
|
48
|
-
- [gRPC](#grpc)
|
49
|
-
- [http.rb](#httprb)
|
50
|
-
- [httpclient](#httpclient)
|
51
|
-
- [httpx](#httpx)
|
52
|
-
- [MongoDB](#mongodb)
|
53
|
-
- [MySQL2](#mysql2)
|
54
|
-
- [Net/HTTP](#nethttp)
|
55
|
-
- [Presto](#presto)
|
56
|
-
- [Qless](#qless)
|
57
|
-
- [Que](#que)
|
58
|
-
- [Racecar](#racecar)
|
59
|
-
- [Rack](#rack)
|
60
|
-
- [Rails](#rails)
|
61
|
-
- [Rake](#rake)
|
62
|
-
- [Redis](#redis)
|
63
|
-
- [Rest Client](#rest-client)
|
64
|
-
- [Resque](#resque)
|
65
|
-
- [RSpec](#rspec)
|
66
|
-
- [Shoryuken](#shoryuken)
|
67
|
-
- [Sequel](#sequel)
|
68
|
-
- [Sidekiq](#sidekiq)
|
69
|
-
- [Sinatra](#sinatra)
|
70
|
-
- [Sneakers](#sneakers)
|
71
|
-
- [Sucker Punch](#sucker-punch)
|
72
|
-
- [Advanced configuration](#advanced-configuration)
|
73
|
-
- [Tracer settings](#tracer-settings)
|
74
|
-
- [Custom logging](#custom-logging)
|
75
|
-
- [Environment and tags](#environment-and-tags)
|
76
|
-
- [Environment variables](#environment-variables)
|
77
|
-
- [Sampling](#sampling)
|
78
|
-
- [Application-side sampling](#application-side-sampling)
|
79
|
-
- [Priority sampling](#priority-sampling)
|
80
|
-
- [Distributed tracing](#distributed-tracing)
|
81
|
-
- [HTTP request queuing](#http-request-queuing)
|
82
|
-
- [Processing pipeline](#processing-pipeline)
|
83
|
-
- [Filtering](#filtering)
|
84
|
-
- [Processing](#processing)
|
85
|
-
- [Trace correlation](#trace-correlation)
|
86
|
-
- [Configuring the transport layer](#configuring-the-transport-layer)
|
87
|
-
- [Metrics](#metrics)
|
88
|
-
- [For application runtime](#for-application-runtime)
|
89
|
-
- [OpenTracing](#opentracing)
|
90
|
-
- [Profiling](#profiling)
|
91
|
-
- [Troubleshooting](#troubleshooting)
|
92
|
-
- [Profiling Resque jobs](#profiling-resque-jobs)
|
93
|
-
- [Known issues and suggested configurations](#known-issues-and-suggested-configurations)
|
94
|
-
- [Payload too large](#payload-too-large)
|
95
|
-
- [Stack level too deep](#stack-level-too-deep)
|
96
|
-
|
97
|
-
## Compatibility
|
98
|
-
|
99
|
-
**Supported Ruby interpreters**:
|
100
|
-
|
101
|
-
| Type | Documentation | Version | Support type | Gem version support |
|
102
|
-
| ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
|
103
|
-
| MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
|
104
|
-
| | | 2.7 | Full | Latest |
|
105
|
-
| | | 2.6 | Full | Latest |
|
106
|
-
| | | 2.5 | Full | Latest |
|
107
|
-
| | | 2.4 | Full | Latest |
|
108
|
-
| | | 2.3 | Full | Latest |
|
109
|
-
| | | 2.2 | Full | Latest |
|
110
|
-
| | | 2.1 | Full | Latest |
|
111
|
-
| | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
|
112
|
-
| | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
|
113
|
-
| | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
|
114
|
-
| JRuby | https://www.jruby.org | 9.2 | Full | Latest |
|
115
|
-
|
116
|
-
**Supported web servers**:
|
117
|
-
|
118
|
-
| Type | Documentation | Version | Support type |
|
119
|
-
| --------- | --------------------------------- | ------------ | ------------ |
|
120
|
-
| Puma | http://puma.io/ | 2.16+ / 3.6+ | Full |
|
121
|
-
| Unicorn | https://bogomips.org/unicorn/ | 4.8+ / 5.1+ | Full |
|
122
|
-
| Passenger | https://www.phusionpassenger.com/ | 5.0+ | Full |
|
123
|
-
|
124
|
-
**Supported tracing frameworks**:
|
125
|
-
|
126
|
-
| Type | Documentation | Version | Gem version support |
|
127
|
-
| ----------- | ----------------------------------------------- | --------------------- | ------------------- |
|
128
|
-
| OpenTracing | https://github.com/opentracing/opentracing-ruby | 0.4.1+ (w/ Ruby 2.1+) | >= 0.16.0 |
|
129
|
-
|
130
|
-
*Full* support indicates all tracer features are available.
|
131
|
-
|
132
|
-
*Deprecated* indicates support will transition to *Maintenance* in a future release.
|
133
|
-
|
134
|
-
*Maintenance* indicates only critical bugfixes are backported until EOL.
|
135
|
-
|
136
|
-
*EOL* indicates support is no longer provided.
|
137
|
-
|
138
|
-
## Installation
|
139
|
-
|
140
|
-
The following steps will help you quickly start tracing your Ruby application.
|
141
|
-
|
142
|
-
### Configure the Datadog Agent for APM
|
143
|
-
|
144
|
-
Before downloading tracing on your application, install the Datadog Agent. The Ruby APM tracer sends trace data through the Datadog Agent.
|
145
|
-
|
146
|
-
Install and configure the Datadog Agent to receive traces from your now instrumented application. By default the Datadog Agent is enabled in your `datadog.yaml` file under `apm_enabled: true` and listens for trace traffic at `localhost:8126`. For containerized environments, follow the steps below to enable trace collection within the Datadog Agent.
|
147
|
-
|
148
|
-
#### Containers
|
149
|
-
|
150
|
-
1. Set `apm_non_local_traffic: true` in your main [`datadog.yaml` configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-main-configuration-file).
|
151
|
-
|
152
|
-
2. See the specific setup instructions for [Docker](https://docs.datadoghq.com/agent/docker/apm/?tab=ruby), [Kubernetes](https://docs.datadoghq.com/agent/kubernetes/apm/?tab=helm), [Amazon ECS](https://docs.datadoghq.com/agent/amazon_ecs/apm/?tab=ruby) or [Fargate](https://docs.datadoghq.com/integrations/ecs_fargate/#trace-collection) to ensure that the Agent is configured to receive traces in a containerized environment:
|
153
|
-
|
154
|
-
3. After having instrumented your application, the tracing client sends traces to `localhost:8126` by default. If this is not the correct host and port change it by setting the env variables `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`.
|
155
|
-
|
156
|
-
|
157
|
-
### Quickstart for Rails applications
|
158
|
-
|
159
|
-
#### Automatic instrumentation
|
160
|
-
|
161
|
-
1. Add the `ddtrace` gem to your Gemfile:
|
162
|
-
|
163
|
-
```ruby
|
164
|
-
source 'https://rubygems.org'
|
165
|
-
gem 'ddtrace', require: 'ddtrace/auto_instrument'
|
166
|
-
```
|
167
|
-
|
168
|
-
2. Install the gem with `bundle install`
|
169
|
-
|
170
|
-
3. You can configure, override, or disable any specific integration settings by also adding a Rails manual instrumentation configuration file (next).
|
171
|
-
|
172
|
-
#### Manual instrumentation
|
173
|
-
|
174
|
-
1. Add the `ddtrace` gem to your Gemfile:
|
175
|
-
|
176
|
-
```ruby
|
177
|
-
source 'https://rubygems.org'
|
178
|
-
gem 'ddtrace'
|
179
|
-
```
|
180
|
-
|
181
|
-
2. Install the gem with `bundle install`
|
182
|
-
3. Create a `config/initializers/datadog.rb` file containing:
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
Datadog.configure do |c|
|
186
|
-
# This will activate auto-instrumentation for Rails
|
187
|
-
c.use :rails
|
188
|
-
end
|
189
|
-
```
|
190
|
-
|
191
|
-
You can also activate additional integrations here (see [Integration instrumentation](#integration-instrumentation))
|
192
|
-
|
193
|
-
### Quickstart for Ruby applications
|
194
|
-
|
195
|
-
#### Automatic instrumentation
|
196
|
-
|
197
|
-
1. Install the gem with `gem install ddtrace`
|
198
|
-
2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
|
199
|
-
3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
|
200
|
-
|
201
|
-
```ruby
|
202
|
-
# Example frameworks and libraries
|
203
|
-
require 'sinatra'
|
204
|
-
require 'faraday'
|
205
|
-
require 'redis'
|
206
|
-
|
207
|
-
require 'ddtrace/auto_instrument'
|
208
|
-
```
|
209
|
-
|
210
|
-
You can configure, override, or disable any specific integration settings by also adding a Ruby manual configuration block (next).
|
211
|
-
|
212
|
-
#### Manual instrumentation
|
213
|
-
|
214
|
-
1. Install the gem with `gem install ddtrace`
|
215
|
-
2. Add a configuration block to your Ruby application:
|
216
|
-
|
217
|
-
```ruby
|
218
|
-
require 'ddtrace'
|
219
|
-
Datadog.configure do |c|
|
220
|
-
# Configure the tracer here.
|
221
|
-
# Activate integrations, change tracer settings, etc...
|
222
|
-
# By default without additional configuration, nothing will be traced.
|
223
|
-
end
|
224
|
-
```
|
225
|
-
|
226
|
-
3. Add or activate instrumentation by doing either of the following:
|
227
|
-
- Activate integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
|
228
|
-
- Add manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
|
229
|
-
|
230
|
-
### Quickstart for OpenTracing
|
231
|
-
|
232
|
-
1. Install the gem with `gem install ddtrace`
|
233
|
-
2. To your OpenTracing configuration file, add the following:
|
234
|
-
|
235
|
-
```ruby
|
236
|
-
require 'opentracing'
|
237
|
-
require 'ddtrace'
|
238
|
-
require 'ddtrace/opentracer'
|
239
|
-
|
240
|
-
# Activate the Datadog tracer for OpenTracing
|
241
|
-
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new
|
242
|
-
```
|
243
|
-
|
244
|
-
3. (Optional) Add a configuration block to your Ruby application to configure Datadog with:
|
245
|
-
|
246
|
-
```ruby
|
247
|
-
Datadog.configure do |c|
|
248
|
-
# Configure the Datadog tracer here.
|
249
|
-
# Activate integrations, change tracer settings, etc...
|
250
|
-
# By default without additional configuration,
|
251
|
-
# no additional integrations will be traced, only
|
252
|
-
# what you have instrumented with OpenTracing.
|
253
|
-
end
|
254
|
-
```
|
255
|
-
|
256
|
-
4. (Optional) Add or activate additional instrumentation by doing either of the following:
|
257
|
-
- Activate Datadog integration instrumentation (see [Integration instrumentation](#integration-instrumentation))
|
258
|
-
- Add Datadog manual instrumentation around your code (see [Manual instrumentation](#manual-instrumentation))
|
259
|
-
|
260
|
-
### Final steps for installation
|
261
|
-
|
262
|
-
After setting up, your services will appear on the [APM services page](https://app.datadoghq.com/apm/services) within a few minutes. Learn more about [using the APM UI][visualization docs].
|
263
|
-
|
264
|
-
## Manual Instrumentation
|
265
|
-
|
266
|
-
If you aren't using a supported framework instrumentation, you may want to manually instrument your code.
|
267
|
-
|
268
|
-
To trace any Ruby code, you can use the `Datadog.tracer.trace` method:
|
269
|
-
|
270
|
-
```ruby
|
271
|
-
Datadog.tracer.trace(name, options) do |span|
|
272
|
-
# Wrap this block around the code you want to instrument
|
273
|
-
# Additionally, you can modify the span here.
|
274
|
-
# e.g. Change the resource name, set tags, etc...
|
275
|
-
end
|
276
|
-
```
|
277
|
-
|
278
|
-
Where `name` should be a `String` that describes the generic kind of operation being done (e.g. `'web.request'`, or `'request.parse'`)
|
279
|
-
|
280
|
-
And `options` is an optional `Hash` that accepts the following parameters:
|
281
|
-
|
282
|
-
| Key | Type | Description | Default |
|
283
|
-
| --- | --- | --- | --- |
|
284
|
-
| `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
|
285
|
-
| `resource` | `String` | Name of the resource or action being operated on. Traces with the same resource value will be grouped together for the purpose of metrics (but still independently viewable.) Usually domain specific, such as a URL, query, request, etc. (e.g. `'Article#submit'`, `http://example.com/articles/list`.) | `name` of Span. |
|
286
|
-
| `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
|
287
|
-
| `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
|
288
|
-
| `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
|
289
|
-
| `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
|
290
|
-
| `on_error` | `Proc` | Handler invoked when a block is provided to trace, and it raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
291
|
-
|
292
|
-
It's highly recommended you set both `service` and `resource` at a minimum. Spans without a `service` or `resource` as `nil` will be discarded by the Datadog agent.
|
293
|
-
|
294
|
-
Example of manual instrumentation in action:
|
295
|
-
|
296
|
-
```ruby
|
297
|
-
get '/posts' do
|
298
|
-
Datadog.tracer.trace('web.request', service: 'my-blog', resource: 'GET /posts') do |span|
|
299
|
-
# Trace the activerecord call
|
300
|
-
Datadog.tracer.trace('posts.fetch') do
|
301
|
-
@posts = Posts.order(created_at: :desc).limit(10)
|
302
|
-
end
|
303
|
-
|
304
|
-
# Add some APM tags
|
305
|
-
span.set_tag('http.method', request.request_method)
|
306
|
-
span.set_tag('posts.count', @posts.length)
|
307
|
-
|
308
|
-
# Trace the template rendering
|
309
|
-
Datadog.tracer.trace('template.render') do
|
310
|
-
erb :index
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
```
|
315
|
-
|
316
|
-
### Asynchronous tracing
|
317
|
-
|
318
|
-
It might not always be possible to wrap `Datadog.tracer.trace` around a block of code. Some event or notification based instrumentation might only notify you when an event begins or ends.
|
319
|
-
|
320
|
-
To trace these operations, you can trace code asynchronously by calling `Datadog.tracer.trace` without a block:
|
321
|
-
|
322
|
-
```ruby
|
323
|
-
# Some instrumentation framework calls this after an event finishes...
|
324
|
-
def db_query(start, finish, query)
|
325
|
-
span = Datadog.tracer.trace('database.query')
|
326
|
-
span.resource = query
|
327
|
-
span.start_time = start
|
328
|
-
span.finish(finish)
|
329
|
-
end
|
330
|
-
```
|
331
|
-
|
332
|
-
Calling `Datadog.tracer.trace` without a block will cause the function to return a `Datadog::Span` that is started, but not finished. You can then modify this span however you wish, then close it `finish`.
|
333
|
-
|
334
|
-
*You must not leave any unfinished spans.* If any spans are left open when the trace completes, the trace will be discarded. You can [activate debug mode](#tracer-settings) to check for warnings if you suspect this might be happening.
|
335
|
-
|
336
|
-
To avoid this scenario when handling start/finish events, you can use `Datadog.tracer.active_span` to get the current active span.
|
337
|
-
|
338
|
-
```ruby
|
339
|
-
# e.g. ActiveSupport::Notifications calls this when an event starts
|
340
|
-
def start(name, id, payload)
|
341
|
-
# Start a span
|
342
|
-
Datadog.tracer.trace(name)
|
343
|
-
end
|
344
|
-
|
345
|
-
# e.g. ActiveSupport::Notifications calls this when an event finishes
|
346
|
-
def finish(name, id, payload)
|
347
|
-
# Retrieve current active span (thread-safe)
|
348
|
-
current_span = Datadog.tracer.active_span
|
349
|
-
unless current_span.nil?
|
350
|
-
current_span.resource = payload[:query]
|
351
|
-
current_span.finish
|
352
|
-
end
|
353
|
-
end
|
354
|
-
```
|
355
|
-
### Enriching traces from nested methods
|
356
|
-
|
357
|
-
You can tag additional information to the current active span from any method. Note however that if the method is called and there is no span currently active `active_span` will be nil.
|
358
|
-
|
359
|
-
```ruby
|
360
|
-
# e.g. adding tag to active span
|
361
|
-
|
362
|
-
current_span = Datadog.tracer.active_span
|
363
|
-
current_span.set_tag('my_tag', 'my_value') unless current_span.nil?
|
364
|
-
```
|
365
|
-
|
366
|
-
You can also get the root span of the current active trace using the `active_root_span` method. This method will return `nil` if there is no active trace.
|
367
|
-
|
368
|
-
```ruby
|
369
|
-
# e.g. adding tag to active root span
|
370
|
-
|
371
|
-
current_root_span = Datadog.tracer.active_root_span
|
372
|
-
current_root_span.set_tag('my_tag', 'my_value') unless current_root_span.nil?
|
373
|
-
```
|
374
|
-
|
375
|
-
## Integration instrumentation
|
376
|
-
|
377
|
-
Many popular libraries and frameworks are supported out-of-the-box, which can be auto-instrumented. Although they are not activated automatically, they can be easily activated and configured by using the `Datadog.configure` API:
|
378
|
-
|
379
|
-
```ruby
|
380
|
-
Datadog.configure do |c|
|
381
|
-
# Activates and configures an integration
|
382
|
-
c.use :integration_name, options
|
383
|
-
end
|
384
|
-
```
|
385
|
-
|
386
|
-
`options` is a `Hash` of integration-specific configuration settings.
|
387
|
-
|
388
|
-
For a list of available integrations, and their configuration options, please refer to the following:
|
389
|
-
|
390
|
-
| Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
|
391
|
-
| ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
|
392
|
-
| Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
|
393
|
-
| Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
|
394
|
-
| Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
|
395
|
-
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
396
|
-
| Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
|
397
|
-
| Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
|
398
|
-
| Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
399
|
-
| Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
|
400
|
-
| AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
401
|
-
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
402
|
-
| Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
|
403
|
-
| Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
404
|
-
| DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
405
|
-
| Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
406
|
-
| Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
|
407
|
-
| Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
|
408
|
-
| Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
|
409
|
-
| Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
410
|
-
| GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
411
|
-
| gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
412
|
-
| http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
|
413
|
-
| httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
|
414
|
-
| httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
|
415
|
-
| Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
|
416
|
-
| Makara (through Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
|
417
|
-
| MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
418
|
-
| MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
419
|
-
| Net/HTTP | `http` | *(Any supported Ruby)* | *(Any supported Ruby)* | *[Link](#nethttp)* | *[Link](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html)* |
|
420
|
-
| Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
|
421
|
-
| Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
|
422
|
-
| Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
|
423
|
-
| Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
|
424
|
-
| Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
|
425
|
-
| Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
|
426
|
-
| Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
|
427
|
-
| Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
|
428
|
-
| Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
|
429
|
-
| Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
|
430
|
-
| RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
|
431
|
-
| Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
|
432
|
-
| Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
|
433
|
-
| Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
|
434
|
-
| Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
|
435
|
-
| Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
|
436
|
-
| Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
|
437
|
-
|
438
|
-
### Action Cable
|
439
|
-
|
440
|
-
The Action Cable integration traces broadcast messages and channel actions.
|
441
|
-
|
442
|
-
You can enable it through `Datadog.configure`:
|
443
|
-
|
444
|
-
```ruby
|
445
|
-
require 'ddtrace'
|
446
|
-
|
447
|
-
Datadog.configure do |c|
|
448
|
-
c.use :action_cable, options
|
449
|
-
end
|
450
|
-
```
|
451
|
-
|
452
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
453
|
-
|
454
|
-
| Key | Description | Default |
|
455
|
-
| --- | ----------- | ------- |
|
456
|
-
| `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
|
457
|
-
|
458
|
-
### Action View
|
459
|
-
|
460
|
-
Most of the time, Active Support is set up as part of Rails, but it can be activated separately:
|
461
|
-
|
462
|
-
```ruby
|
463
|
-
require 'actionview'
|
464
|
-
require 'ddtrace'
|
465
|
-
|
466
|
-
Datadog.configure do |c|
|
467
|
-
c.use :action_view, options
|
468
|
-
end
|
469
|
-
```
|
470
|
-
|
471
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
472
|
-
|
473
|
-
| Key | Description | Default |
|
474
|
-
| ---| --- | --- |
|
475
|
-
| `service_name` | Service name used for rendering instrumentation. | `action_view` |
|
476
|
-
| `template_base_path` | Used when the template name is parsed. If you don't store your templates in the `views/` folder, you may need to change this value | `'views/'` |
|
477
|
-
|
478
|
-
### Action Mailer
|
479
|
-
|
480
|
-
The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
|
481
|
-
|
482
|
-
You can enable it through `Datadog.configure`:
|
483
|
-
|
484
|
-
```ruby
|
485
|
-
require 'ddtrace'
|
486
|
-
Datadog.configure do |c|
|
487
|
-
c.use :action_mailer, options
|
488
|
-
end
|
489
|
-
```
|
490
|
-
|
491
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
492
|
-
|
493
|
-
| Key | Description | Default |
|
494
|
-
| --- | ----------- | ------- |
|
495
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
496
|
-
| `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
|
497
|
-
| `email_data` | Whether or not to append additional email payload metadata to `action_mailer.deliver` spans. Fields include `['subject', 'to', 'from', 'bcc', 'cc', 'date', 'perform_deliveries']`. | `false` |
|
498
|
-
|
499
|
-
### Active Model Serializers
|
500
|
-
|
501
|
-
The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
|
502
|
-
|
503
|
-
```ruby
|
504
|
-
require 'active_model_serializers'
|
505
|
-
require 'ddtrace'
|
506
|
-
|
507
|
-
Datadog.configure do |c|
|
508
|
-
c.use :active_model_serializers, options
|
509
|
-
end
|
510
|
-
|
511
|
-
my_object = MyModel.new(name: 'my object')
|
512
|
-
ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
513
|
-
```
|
514
|
-
|
515
|
-
| Key | Description | Default |
|
516
|
-
| --- | ----------- | ------- |
|
517
|
-
| `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
|
518
|
-
|
519
|
-
### Action Pack
|
520
|
-
|
521
|
-
Most of the time, Action Pack is set up as part of Rails, but it can be activated separately:
|
522
|
-
|
523
|
-
```ruby
|
524
|
-
require 'actionpack'
|
525
|
-
require 'ddtrace'
|
526
|
-
|
527
|
-
Datadog.configure do |c|
|
528
|
-
c.use :action_pack, options
|
529
|
-
end
|
530
|
-
```
|
531
|
-
|
532
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
533
|
-
|
534
|
-
| Key | Description | Default |
|
535
|
-
| ---| --- | --- |
|
536
|
-
| `service_name` | Service name used for rendering instrumentation. | `action_pack` |
|
537
|
-
|
538
|
-
### Active Job
|
539
|
-
|
540
|
-
Most of the time, Active Job is set up as part of Rails, but it can be activated separately:
|
541
|
-
|
542
|
-
```ruby
|
543
|
-
require 'activejob'
|
544
|
-
require 'ddtrace'
|
545
|
-
|
546
|
-
Datadog.configure do |c|
|
547
|
-
c.use :active_job, options
|
548
|
-
end
|
549
|
-
|
550
|
-
ExampleJob.perform_later
|
551
|
-
```
|
552
|
-
|
553
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
554
|
-
|
555
|
-
| Key | Description | Default |
|
556
|
-
| --- | ----------- | ------- |
|
557
|
-
| `service_name` | Service name used for `active_job` instrumentation | `'active_job'` |
|
558
|
-
| `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Active Job logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
|
559
|
-
|
560
|
-
### Active Record
|
561
|
-
|
562
|
-
Most of the time, Active Record is set up as part of a web framework (Rails, Sinatra...) however, it can be set up alone:
|
563
|
-
|
564
|
-
```ruby
|
565
|
-
require 'tmpdir'
|
566
|
-
require 'sqlite3'
|
567
|
-
require 'active_record'
|
568
|
-
require 'ddtrace'
|
569
|
-
|
570
|
-
Datadog.configure do |c|
|
571
|
-
c.use :active_record, options
|
572
|
-
end
|
573
|
-
|
574
|
-
Dir::Tmpname.create(['test', '.sqlite']) do |db|
|
575
|
-
conn = ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
|
576
|
-
database: db)
|
577
|
-
conn.connection.execute('SELECT 42') # traced!
|
578
|
-
end
|
579
|
-
```
|
580
|
-
|
581
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
582
|
-
|
583
|
-
| Key | Description | Default |
|
584
|
-
| ---| --- | --- |
|
585
|
-
| `orm_service_name` | Service name used for the mapping portion of query results to ActiveRecord objects. Inherits service name from parent by default. | _parent.service_name_ (e.g. `'mysql2'`) |
|
586
|
-
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
587
|
-
|
588
|
-
**Configuring trace settings per database**
|
589
|
-
|
590
|
-
You can configure trace settings per database connection by using the `describes` option:
|
591
|
-
|
592
|
-
```ruby
|
593
|
-
# Provide a `:describes` option with a connection key.
|
594
|
-
# Any of the following keys are acceptable and equivalent to one another.
|
595
|
-
# If a block is provided, it yields a Settings object that
|
596
|
-
# accepts any of the configuration options listed above.
|
597
|
-
|
598
|
-
Datadog.configure do |c|
|
599
|
-
# Symbol matching your database connection in config/database.yml
|
600
|
-
# Only available if you are using Rails with ActiveRecord.
|
601
|
-
c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
|
602
|
-
|
603
|
-
# Block configuration pattern.
|
604
|
-
c.use :active_record, describes: :secondary_database do |second_db|
|
605
|
-
second_db.service_name = 'secondary-db'
|
606
|
-
end
|
607
|
-
|
608
|
-
# Connection string with the following connection settings:
|
609
|
-
# adapter, username, host, port, database
|
610
|
-
# Other fields are ignored.
|
611
|
-
c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
|
612
|
-
|
613
|
-
# Hash with following connection settings:
|
614
|
-
# adapter, username, host, port, database
|
615
|
-
# Other fields are ignored.
|
616
|
-
c.use :active_record, describes: {
|
617
|
-
adapter: 'mysql2',
|
618
|
-
host: '127.0.0.1',
|
619
|
-
port: '3306',
|
620
|
-
database: 'mysql',
|
621
|
-
username: 'root'
|
622
|
-
},
|
623
|
-
service_name: 'secondary-db'
|
624
|
-
|
625
|
-
# If using the `makara` gem, it's possible to match on connection `role`:
|
626
|
-
c.use :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
|
627
|
-
c.use :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
|
628
|
-
end
|
629
|
-
```
|
630
|
-
|
631
|
-
You can also create configurations based on partial matching of database connection fields:
|
632
|
-
|
633
|
-
```ruby
|
634
|
-
Datadog.configure do |c|
|
635
|
-
# Matches any connection on host `127.0.0.1`.
|
636
|
-
c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
|
637
|
-
|
638
|
-
# Matches any `mysql2` connection.
|
639
|
-
c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
|
640
|
-
|
641
|
-
# Matches any `mysql2` connection to the `reports` database.
|
642
|
-
#
|
643
|
-
# In case of multiple matching `describe` configurations, the latest one applies.
|
644
|
-
# In this case a connection with both adapter `mysql` and database `reports`
|
645
|
-
# will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
|
646
|
-
c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
|
647
|
-
end
|
648
|
-
```
|
649
|
-
|
650
|
-
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
651
|
-
|
652
|
-
If ActiveRecord traces an event that uses a connection that matches a key defined by `describes`, it will use the trace settings assigned to that connection. If the connection does not match any of the described connections, it will use default settings defined by `c.use :active_record` instead.
|
653
|
-
|
654
|
-
### Active Support
|
655
|
-
|
656
|
-
Most of the time, Active Support is set up as part of Rails, but it can be activated separately:
|
657
|
-
|
658
|
-
```ruby
|
659
|
-
require 'activesupport'
|
660
|
-
require 'ddtrace'
|
661
|
-
|
662
|
-
Datadog.configure do |c|
|
663
|
-
c.use :active_support, options
|
664
|
-
end
|
665
|
-
|
666
|
-
cache = ActiveSupport::Cache::MemoryStore.new
|
667
|
-
cache.read('city')
|
668
|
-
```
|
669
|
-
|
670
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
671
|
-
|
672
|
-
| Key | Description | Default |
|
673
|
-
| ---| --- | --- |
|
674
|
-
| `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
|
675
|
-
|
676
|
-
### AWS
|
677
|
-
|
678
|
-
The AWS integration will trace every interaction (e.g. API calls) with AWS services (S3, ElastiCache etc.).
|
679
|
-
|
680
|
-
```ruby
|
681
|
-
require 'aws-sdk'
|
682
|
-
require 'ddtrace'
|
683
|
-
|
684
|
-
Datadog.configure do |c|
|
685
|
-
c.use :aws, options
|
686
|
-
end
|
687
|
-
|
688
|
-
# Perform traced call
|
689
|
-
Aws::S3::Client.new.list_buckets
|
690
|
-
```
|
691
|
-
|
692
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
693
|
-
|
694
|
-
| Key | Description | Default |
|
695
|
-
| --- | ----------- | ------- |
|
696
|
-
| `service_name` | Service name used for `aws` instrumentation | `'aws'` |
|
697
|
-
|
698
|
-
### Concurrent Ruby
|
699
|
-
|
700
|
-
The Concurrent Ruby integration adds support for context propagation when using `::Concurrent::Future`.
|
701
|
-
Making sure that code traced within the `Future#execute` will have correct parent set.
|
702
|
-
|
703
|
-
To activate your integration, use the `Datadog.configure` method:
|
704
|
-
|
705
|
-
```ruby
|
706
|
-
# Inside Rails initializer or equivalent
|
707
|
-
Datadog.configure do |c|
|
708
|
-
# Patches ::Concurrent::Future to use ExecutorService that propagates context
|
709
|
-
c.use :concurrent_ruby, options
|
710
|
-
end
|
711
|
-
|
712
|
-
# Pass context into code executed within Concurrent::Future
|
713
|
-
Datadog.tracer.trace('outer') do
|
714
|
-
Concurrent::Future.execute { Datadog.tracer.trace('inner') { } }.wait
|
715
|
-
end
|
716
|
-
```
|
717
|
-
|
718
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
719
|
-
|
720
|
-
| Key | Description | Default |
|
721
|
-
| --- | ----------- | ------- |
|
722
|
-
| `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
|
723
|
-
|
724
|
-
### Cucumber
|
725
|
-
|
726
|
-
Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
|
727
|
-
|
728
|
-
To activate your integration, use the `Datadog.configure` method:
|
729
|
-
|
730
|
-
```ruby
|
731
|
-
require 'cucumber'
|
732
|
-
require 'ddtrace'
|
733
|
-
|
734
|
-
# Configure default Cucumber integration
|
735
|
-
Datadog.configure do |c|
|
736
|
-
c.use :cucumber, options
|
737
|
-
end
|
738
|
-
|
739
|
-
# Example of how to attach tags from scenario to active span
|
740
|
-
Around do |scenario, block|
|
741
|
-
active_span = Datadog.configuration[:cucumber][:tracer].active_span
|
742
|
-
unless active_span.nil?
|
743
|
-
scenario.tags.filter { |tag| tag.include? ':' }.each do |tag|
|
744
|
-
active_span.set_tag(*tag.name.split(':', 2))
|
745
|
-
end
|
746
|
-
end
|
747
|
-
block.call
|
748
|
-
end
|
749
|
-
```
|
750
|
-
|
751
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
752
|
-
|
753
|
-
| Key | Description | Default |
|
754
|
-
| --- | ----------- | ------- |
|
755
|
-
| `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
756
|
-
| `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
|
757
|
-
| `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
|
758
|
-
|
759
|
-
### Dalli
|
760
|
-
|
761
|
-
Dalli integration will trace all calls to your `memcached` server:
|
762
|
-
|
763
|
-
```ruby
|
764
|
-
require 'dalli'
|
765
|
-
require 'ddtrace'
|
766
|
-
|
767
|
-
# Configure default Dalli tracing behavior
|
768
|
-
Datadog.configure do |c|
|
769
|
-
c.use :dalli, options
|
770
|
-
end
|
771
|
-
|
772
|
-
# Configure Dalli tracing behavior for single client
|
773
|
-
client = Dalli::Client.new('localhost:11211', options)
|
774
|
-
client.set('abc', 123)
|
775
|
-
```
|
776
|
-
|
777
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
778
|
-
|
779
|
-
| Key | Description | Default |
|
780
|
-
| --- | ----------- | ------- |
|
781
|
-
| `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
|
782
|
-
|
783
|
-
### DelayedJob
|
784
|
-
|
785
|
-
The DelayedJob integration uses lifecycle hooks to trace the job executions and enqueues.
|
786
|
-
|
787
|
-
You can enable it through `Datadog.configure`:
|
788
|
-
|
789
|
-
```ruby
|
790
|
-
require 'ddtrace'
|
791
|
-
|
792
|
-
Datadog.configure do |c|
|
793
|
-
c.use :delayed_job, options
|
794
|
-
end
|
795
|
-
```
|
796
|
-
|
797
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
798
|
-
|
799
|
-
| Key | Description | Default |
|
800
|
-
| --- | ----------- | ------- |
|
801
|
-
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
802
|
-
| `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
|
803
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
804
|
-
|
805
|
-
### Elasticsearch
|
806
|
-
|
807
|
-
The Elasticsearch integration will trace any call to `perform_request` in the `Client` object:
|
808
|
-
|
809
|
-
```ruby
|
810
|
-
require 'elasticsearch/transport'
|
811
|
-
require 'ddtrace'
|
812
|
-
|
813
|
-
Datadog.configure do |c|
|
814
|
-
c.use :elasticsearch, options
|
815
|
-
end
|
816
|
-
|
817
|
-
# Perform a query to Elasticsearch
|
818
|
-
client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
|
819
|
-
response = client.perform_request 'GET', '_cluster/health'
|
820
|
-
```
|
821
|
-
|
822
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
823
|
-
|
824
|
-
| Key | Description | Default |
|
825
|
-
| --- | ----------- | ------- |
|
826
|
-
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` |
|
827
|
-
| `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
|
828
|
-
|
829
|
-
### Ethon
|
830
|
-
|
831
|
-
The `ethon` integration will trace any HTTP request through `Easy` or `Multi` objects. Note that this integration also supports `Typhoeus` library which is based on `Ethon`.
|
832
|
-
|
833
|
-
```ruby
|
834
|
-
require 'ddtrace'
|
835
|
-
|
836
|
-
Datadog.configure do |c|
|
837
|
-
c.use :ethon, options
|
838
|
-
|
839
|
-
# optionally, specify a different service name for hostnames matching a regex
|
840
|
-
c.use :ethon, describes: /user-[^.]+\.example\.com/ do |ethon|
|
841
|
-
ethon.service_name = 'user.example.com'
|
842
|
-
ethon.split_by_domain = false # Only necessary if split_by_domain is true by default
|
843
|
-
end
|
844
|
-
end
|
845
|
-
```
|
846
|
-
|
847
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
848
|
-
|
849
|
-
| Key | Description | Default |
|
850
|
-
| --- | ----------- | ------- |
|
851
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
852
|
-
| `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
|
853
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
854
|
-
|
855
|
-
### Excon
|
856
|
-
|
857
|
-
The `excon` integration is available through the `ddtrace` middleware:
|
858
|
-
|
859
|
-
```ruby
|
860
|
-
require 'excon'
|
861
|
-
require 'ddtrace'
|
862
|
-
|
863
|
-
# Configure default Excon tracing behavior
|
864
|
-
Datadog.configure do |c|
|
865
|
-
c.use :excon, options
|
866
|
-
|
867
|
-
# optionally, specify a different service name for hostnames matching a regex
|
868
|
-
c.use :excon, describes: /user-[^.]+\.example\.com/ do |excon|
|
869
|
-
excon.service_name = 'user.example.com'
|
870
|
-
excon.split_by_domain = false # Only necessary if split_by_domain is true by default
|
871
|
-
end
|
872
|
-
end
|
873
|
-
|
874
|
-
connection = Excon.new('https://example.com')
|
875
|
-
connection.get
|
876
|
-
```
|
877
|
-
|
878
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
879
|
-
|
880
|
-
| Key | Description | Default |
|
881
|
-
| --- | ----------- | ------- |
|
882
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
883
|
-
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
884
|
-
| `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
|
885
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
886
|
-
|
887
|
-
**Configuring connections to use different settings**
|
888
|
-
|
889
|
-
If you use multiple connections with Excon, you can give each of them different settings by configuring their constructors with middleware:
|
890
|
-
|
891
|
-
```ruby
|
892
|
-
# Wrap the Datadog tracing middleware around the default middleware stack
|
893
|
-
Excon.new(
|
894
|
-
'http://example.com',
|
895
|
-
middlewares: Datadog::Contrib::Excon::Middleware.with(options).around_default_stack
|
896
|
-
)
|
897
|
-
|
898
|
-
# Insert the middleware into a custom middleware stack.
|
899
|
-
# NOTE: Trace middleware must be inserted after ResponseParser!
|
900
|
-
Excon.new(
|
901
|
-
'http://example.com',
|
902
|
-
middlewares: [
|
903
|
-
Excon::Middleware::ResponseParser,
|
904
|
-
Datadog::Contrib::Excon::Middleware.with(options),
|
905
|
-
Excon::Middleware::Idempotent
|
906
|
-
]
|
907
|
-
)
|
908
|
-
```
|
909
|
-
|
910
|
-
Where `options` is a Hash that contains any of the parameters listed in the table above.
|
911
|
-
|
912
|
-
### Faraday
|
913
|
-
|
914
|
-
The `faraday` integration is available through the `ddtrace` middleware:
|
915
|
-
|
916
|
-
```ruby
|
917
|
-
require 'faraday'
|
918
|
-
require 'ddtrace'
|
919
|
-
|
920
|
-
# Configure default Faraday tracing behavior
|
921
|
-
Datadog.configure do |c|
|
922
|
-
c.use :faraday, options
|
923
|
-
|
924
|
-
# optionally, specify a different service name for hostnames matching a regex
|
925
|
-
c.use :faraday, describes: /user-[^.]+\.example\.com/ do |faraday|
|
926
|
-
faraday.service_name = 'user.example.com'
|
927
|
-
faraday.split_by_domain = false # Only necessary if split_by_domain is true by default
|
928
|
-
end
|
929
|
-
end
|
930
|
-
|
931
|
-
# In case you want to override the global configuration for a certain client instance
|
932
|
-
connection = Faraday.new('https://example.com') do |builder|
|
933
|
-
builder.use(:ddtrace, options)
|
934
|
-
builder.adapter Faraday.default_adapter
|
935
|
-
end
|
936
|
-
|
937
|
-
connection.get('/foo')
|
938
|
-
```
|
939
|
-
|
940
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
941
|
-
|
942
|
-
| Key | Description | Default |
|
943
|
-
| --- | ----------- | ------- |
|
944
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
945
|
-
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
946
|
-
| `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
|
947
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
948
|
-
|
949
|
-
### Grape
|
950
|
-
|
951
|
-
The Grape integration adds the instrumentation to Grape endpoints and filters. This integration can work side by side with other integrations like Rack and Rails.
|
952
|
-
|
953
|
-
To activate your integration, use the `Datadog.configure` method before defining your Grape application:
|
954
|
-
|
955
|
-
```ruby
|
956
|
-
# api.rb
|
957
|
-
require 'grape'
|
958
|
-
require 'ddtrace'
|
959
|
-
|
960
|
-
Datadog.configure do |c|
|
961
|
-
c.use :grape, options
|
962
|
-
end
|
963
|
-
|
964
|
-
# Then define your application
|
965
|
-
class RackTestingAPI < Grape::API
|
966
|
-
desc 'main endpoint'
|
967
|
-
get :success do
|
968
|
-
'Hello world!'
|
969
|
-
end
|
970
|
-
end
|
971
|
-
```
|
972
|
-
|
973
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
974
|
-
|
975
|
-
| Key | Description | Default |
|
976
|
-
| --- | ----------- | ------- |
|
977
|
-
| `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
978
|
-
| `service_name` | Service name used for `grape` instrumentation | `'grape'` |
|
979
|
-
| `error_statuses`| Defines a status code or range of status codes which should be marked as errors. `'404,405,500-599'` or `[404,405,'500-599']` | `nil` |
|
980
|
-
|
981
|
-
### GraphQL
|
982
|
-
|
983
|
-
The GraphQL integration activates instrumentation for GraphQL queries.
|
984
|
-
|
985
|
-
To activate your integration, use the `Datadog.configure` method:
|
986
|
-
|
987
|
-
```ruby
|
988
|
-
# Inside Rails initializer or equivalent
|
989
|
-
Datadog.configure do |c|
|
990
|
-
c.use :graphql, schemas: [YourSchema], options
|
991
|
-
end
|
992
|
-
|
993
|
-
# Then run a GraphQL query
|
994
|
-
YourSchema.execute(query, variables: {}, context: {}, operation_name: nil)
|
995
|
-
```
|
996
|
-
|
997
|
-
The `use :graphql` method accepts the following parameters. Additional options can be substituted in for `options`:
|
998
|
-
|
999
|
-
| Key | Description | Default |
|
1000
|
-
| --- | ----------- | ------- |
|
1001
|
-
| `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
|
1002
|
-
| `schemas` | Required. Array of `GraphQL::Schema` objects which to trace. Tracing will be added to all the schemas listed, using the options provided to this configuration. If you do not provide any, then tracing will not be activated. | `[]` |
|
1003
|
-
|
1004
|
-
**Manually configuring GraphQL schemas**
|
1005
|
-
|
1006
|
-
If you prefer to individually configure the tracer settings for a schema (e.g. you have multiple schemas with different service names), in the schema definition, you can add the following [using the GraphQL API](http://graphql-ruby.org/queries/tracing.html):
|
1007
|
-
|
1008
|
-
```ruby
|
1009
|
-
# Class-based schema
|
1010
|
-
class YourSchema < GraphQL::Schema
|
1011
|
-
use(
|
1012
|
-
GraphQL::Tracing::DataDogTracing,
|
1013
|
-
service: 'graphql'
|
1014
|
-
)
|
1015
|
-
end
|
1016
|
-
```
|
1017
|
-
|
1018
|
-
```ruby
|
1019
|
-
# .define-style schema
|
1020
|
-
YourSchema = GraphQL::Schema.define do
|
1021
|
-
use(
|
1022
|
-
GraphQL::Tracing::DataDogTracing,
|
1023
|
-
service: 'graphql'
|
1024
|
-
)
|
1025
|
-
end
|
1026
|
-
```
|
1027
|
-
|
1028
|
-
Or you can modify an already defined schema:
|
1029
|
-
|
1030
|
-
```ruby
|
1031
|
-
# Class-based schema
|
1032
|
-
YourSchema.use(
|
1033
|
-
GraphQL::Tracing::DataDogTracing,
|
1034
|
-
service: 'graphql'
|
1035
|
-
)
|
1036
|
-
```
|
1037
|
-
|
1038
|
-
```ruby
|
1039
|
-
# .define-style schema
|
1040
|
-
YourSchema.define do
|
1041
|
-
use(
|
1042
|
-
GraphQL::Tracing::DataDogTracing,
|
1043
|
-
service: 'graphql'
|
1044
|
-
)
|
1045
|
-
end
|
1046
|
-
```
|
1047
|
-
|
1048
|
-
Do *NOT* `use :graphql` in `Datadog.configure` if you choose to configure manually, as to avoid double tracing. These two means of configuring GraphQL tracing are considered mutually exclusive.
|
1049
|
-
|
1050
|
-
### gRPC
|
1051
|
-
|
1052
|
-
The `grpc` integration adds both client and server interceptors, which run as middleware before executing the service's remote procedure call. As gRPC applications are often distributed, the integration shares trace information between client and server.
|
1053
|
-
|
1054
|
-
To setup your integration, use the `Datadog.configure` method like so:
|
1055
|
-
|
1056
|
-
```ruby
|
1057
|
-
require 'grpc'
|
1058
|
-
require 'ddtrace'
|
1059
|
-
|
1060
|
-
Datadog.configure do |c|
|
1061
|
-
c.use :grpc, options
|
1062
|
-
end
|
1063
|
-
|
1064
|
-
# Server side
|
1065
|
-
server = GRPC::RpcServer.new
|
1066
|
-
server.add_http2_port('localhost:50051', :this_port_is_insecure)
|
1067
|
-
server.handle(Demo)
|
1068
|
-
server.run_till_terminated
|
1069
|
-
|
1070
|
-
# Client side
|
1071
|
-
client = Demo.rpc_stub_class.new('localhost:50051', :this_channel_is_insecure)
|
1072
|
-
client.my_endpoint(DemoMessage.new(contents: 'hello!'))
|
1073
|
-
```
|
1074
|
-
|
1075
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1076
|
-
|
1077
|
-
| Key | Description | Default |
|
1078
|
-
| --- | ----------- | ------- |
|
1079
|
-
| `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
|
1080
|
-
| `error_handler` | Custom error handler invoked when a request is an error. A `Proc` that accepts `span` and `error` parameters. Sets error on the span by default. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1081
|
-
|
1082
|
-
**Configuring clients to use different settings**
|
1083
|
-
|
1084
|
-
In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
|
1085
|
-
|
1086
|
-
```ruby
|
1087
|
-
configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
|
1088
|
-
c.service_name = "Alternate"
|
1089
|
-
end
|
1090
|
-
|
1091
|
-
alternate_client = Demo::Echo::Service.rpc_stub_class.new(
|
1092
|
-
'localhost:50052',
|
1093
|
-
:this_channel_is_insecure,
|
1094
|
-
:interceptors => [configured_interceptor]
|
1095
|
-
)
|
1096
|
-
```
|
1097
|
-
|
1098
|
-
The integration will ensure that the `configured_interceptor` establishes a unique tracing setup for that client instance.
|
1099
|
-
|
1100
|
-
### http.rb
|
1101
|
-
|
1102
|
-
The http.rb integration will trace any HTTP call using the Http.rb gem.
|
1103
|
-
|
1104
|
-
```ruby
|
1105
|
-
require 'http'
|
1106
|
-
require 'ddtrace'
|
1107
|
-
Datadog.configure do |c|
|
1108
|
-
c.use :httprb, options
|
1109
|
-
# optionally, specify a different service name for hostnames matching a regex
|
1110
|
-
c.use :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
|
1111
|
-
httprb.service_name = 'user.example.com'
|
1112
|
-
httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1113
|
-
end
|
1114
|
-
end
|
1115
|
-
```
|
1116
|
-
|
1117
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1118
|
-
|
1119
|
-
| Key | Description | Default |
|
1120
|
-
| --- | ----------- | ------- |
|
1121
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1122
|
-
| `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
|
1123
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1124
|
-
|
1125
|
-
### httpclient
|
1126
|
-
|
1127
|
-
The httpclient integration will trace any HTTP call using the httpclient gem.
|
1128
|
-
|
1129
|
-
```ruby
|
1130
|
-
require 'httpclient'
|
1131
|
-
require 'ddtrace'
|
1132
|
-
Datadog.configure do |c|
|
1133
|
-
c.use :httpclient, options
|
1134
|
-
# optionally, specify a different service name for hostnames matching a regex
|
1135
|
-
c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
|
1136
|
-
httpclient.service_name = 'user.example.com'
|
1137
|
-
httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1138
|
-
end
|
1139
|
-
end
|
1140
|
-
```
|
1141
|
-
|
1142
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1143
|
-
|
1144
|
-
| Key | Description | Default |
|
1145
|
-
| --- | ----------- | ------- |
|
1146
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1147
|
-
| `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
|
1148
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1149
|
-
|
1150
|
-
### httpx
|
1151
|
-
|
1152
|
-
`httpx` maintains its [own integration with `ddtrace`](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter):
|
1153
|
-
|
1154
|
-
```ruby
|
1155
|
-
require "ddtrace"
|
1156
|
-
require "httpx/adapters/datadog"
|
1157
|
-
|
1158
|
-
Datadog.configure do |c|
|
1159
|
-
c.use :httpx
|
1160
|
-
|
1161
|
-
# optionally, specify a different service name for hostnames matching a regex
|
1162
|
-
c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
|
1163
|
-
http.service_name = 'user.example.com'
|
1164
|
-
http.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1165
|
-
end
|
1166
|
-
end
|
1167
|
-
```
|
1168
|
-
|
1169
|
-
### Kafka
|
1170
|
-
|
1171
|
-
The Kafka integration provides tracing of the `ruby-kafka` gem:
|
1172
|
-
|
1173
|
-
You can enable it through `Datadog.configure`:
|
1174
|
-
|
1175
|
-
```ruby
|
1176
|
-
require 'active_support/notifications' # required to enable 'ruby-kafka' instrumentation
|
1177
|
-
require 'kafka'
|
1178
|
-
require 'ddtrace'
|
1179
|
-
|
1180
|
-
Datadog.configure do |c|
|
1181
|
-
c.use :kafka, options
|
1182
|
-
end
|
1183
|
-
```
|
1184
|
-
|
1185
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1186
|
-
|
1187
|
-
| Key | Description | Default |
|
1188
|
-
| --- | ----------- | ------- |
|
1189
|
-
| `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
|
1190
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1191
|
-
|
1192
|
-
### MongoDB
|
1193
|
-
|
1194
|
-
The integration traces any `Command` that is sent from the [MongoDB Ruby Driver](https://github.com/mongodb/mongo-ruby-driver) to a MongoDB cluster. By extension, Object Document Mappers (ODM) such as Mongoid are automatically instrumented if they use the official Ruby driver. To activate the integration, simply:
|
1195
|
-
|
1196
|
-
```ruby
|
1197
|
-
require 'mongo'
|
1198
|
-
require 'ddtrace'
|
1199
|
-
|
1200
|
-
Datadog.configure do |c|
|
1201
|
-
c.use :mongo, options
|
1202
|
-
end
|
1203
|
-
|
1204
|
-
# Create a MongoDB client and use it as usual
|
1205
|
-
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
|
1206
|
-
collection = client[:people]
|
1207
|
-
collection.insert_one({ name: 'Steve' })
|
1208
|
-
|
1209
|
-
# In case you want to override the global configuration for a certain client instance
|
1210
|
-
Datadog.configure(client, options)
|
1211
|
-
```
|
1212
|
-
|
1213
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1214
|
-
|
1215
|
-
| Key | Description | Default |
|
1216
|
-
| --- | ----------- | ------- |
|
1217
|
-
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{ show: [:collection, :database, :operation] }` |
|
1218
|
-
| `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
|
1219
|
-
|
1220
|
-
### MySQL2
|
1221
|
-
|
1222
|
-
The MySQL2 integration traces any SQL command sent through `mysql2` gem.
|
1223
|
-
|
1224
|
-
```ruby
|
1225
|
-
require 'mysql2'
|
1226
|
-
require 'ddtrace'
|
1227
|
-
|
1228
|
-
Datadog.configure do |c|
|
1229
|
-
c.use :mysql2, options
|
1230
|
-
end
|
1231
|
-
|
1232
|
-
client = Mysql2::Client.new(:host => "localhost", :username => "root")
|
1233
|
-
client.query("SELECT * FROM users WHERE group='x'")
|
1234
|
-
```
|
1235
|
-
|
1236
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1237
|
-
|
1238
|
-
| Key | Description | Default |
|
1239
|
-
| --- | ----------- | ------- |
|
1240
|
-
| `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
|
1241
|
-
|
1242
|
-
### Net/HTTP
|
1243
|
-
|
1244
|
-
The Net/HTTP integration will trace any HTTP call using the standard lib Net::HTTP module.
|
1245
|
-
|
1246
|
-
```ruby
|
1247
|
-
require 'net/http'
|
1248
|
-
require 'ddtrace'
|
1249
|
-
|
1250
|
-
Datadog.configure do |c|
|
1251
|
-
c.use :http, options
|
1252
|
-
|
1253
|
-
# optionally, specify a different service name for hostnames matching a regex
|
1254
|
-
c.use :http, describes: /user-[^.]+\.example\.com/ do |http|
|
1255
|
-
http.service_name = 'user.example.com'
|
1256
|
-
http.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1257
|
-
end
|
1258
|
-
end
|
1259
|
-
|
1260
|
-
Net::HTTP.start('127.0.0.1', 8080) do |http|
|
1261
|
-
request = Net::HTTP::Get.new '/index'
|
1262
|
-
response = http.request(request)
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
content = Net::HTTP.get(URI('http://127.0.0.1/index.html'))
|
1266
|
-
```
|
1267
|
-
|
1268
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1269
|
-
|
1270
|
-
| Key | Description | Default |
|
1271
|
-
| --- | ----------- | ------- |
|
1272
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1273
|
-
| `service_name` | Service name used for `http` instrumentation | `'net/http'` |
|
1274
|
-
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1275
|
-
|
1276
|
-
If you wish to configure each connection object individually, you may use the `Datadog.configure` as it follows:
|
1277
|
-
|
1278
|
-
```ruby
|
1279
|
-
client = Net::HTTP.new(host, port)
|
1280
|
-
Datadog.configure(client, options)
|
1281
|
-
```
|
1282
|
-
|
1283
|
-
### Presto
|
1284
|
-
|
1285
|
-
The Presto integration traces any SQL command sent through `presto-client` gem.
|
1286
|
-
|
1287
|
-
```ruby
|
1288
|
-
require 'presto-client'
|
1289
|
-
require 'ddtrace'
|
1290
|
-
|
1291
|
-
Datadog.configure do |c|
|
1292
|
-
c.use :presto, options
|
1293
|
-
end
|
1294
|
-
|
1295
|
-
client = Presto::Client.new(
|
1296
|
-
server: "localhost:8880",
|
1297
|
-
ssl: {verify: false},
|
1298
|
-
catalog: "native",
|
1299
|
-
schema: "default",
|
1300
|
-
time_zone: "US/Pacific",
|
1301
|
-
language: "English",
|
1302
|
-
http_debug: true,
|
1303
|
-
)
|
1304
|
-
|
1305
|
-
client.run("select * from system.nodes")
|
1306
|
-
```
|
1307
|
-
|
1308
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1309
|
-
|
1310
|
-
| Key | Description | Default |
|
1311
|
-
| --- | ----------- | ------- |
|
1312
|
-
| `service_name` | Service name used for `presto` instrumentation | `'presto'` |
|
1313
|
-
|
1314
|
-
### Qless
|
1315
|
-
|
1316
|
-
The Qless integration uses lifecycle hooks to trace job executions.
|
1317
|
-
|
1318
|
-
To add tracing to a Qless job:
|
1319
|
-
|
1320
|
-
```ruby
|
1321
|
-
require 'ddtrace'
|
1322
|
-
|
1323
|
-
Datadog.configure do |c|
|
1324
|
-
c.use :qless, options
|
1325
|
-
end
|
1326
|
-
```
|
1327
|
-
|
1328
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1329
|
-
|
1330
|
-
| Key | Description | Default |
|
1331
|
-
| --- | ----------- | ------- |
|
1332
|
-
| `service_name` | Service name used for `qless` instrumentation | `'qless'` |
|
1333
|
-
| `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
|
1334
|
-
| `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
|
1335
|
-
|
1336
|
-
### Que
|
1337
|
-
|
1338
|
-
The Que integration is a middleware which will trace job executions.
|
1339
|
-
|
1340
|
-
You can enable it through `Datadog.configure`:
|
1341
|
-
|
1342
|
-
```ruby
|
1343
|
-
require 'ddtrace'
|
1344
|
-
|
1345
|
-
Datadog.configure do |c|
|
1346
|
-
c.use :que, options
|
1347
|
-
end
|
1348
|
-
```
|
1349
|
-
|
1350
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1351
|
-
|
1352
|
-
| Key | Description | Default |
|
1353
|
-
| --- | ----------- | ------- |
|
1354
|
-
| `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1355
|
-
| `service_name` | Service name used for `que` instrumentation | `'que'` |
|
1356
|
-
| `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
|
1357
|
-
| `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
|
1358
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1359
|
-
|
1360
|
-
### Racecar
|
1361
|
-
|
1362
|
-
The Racecar integration provides tracing for Racecar jobs.
|
1363
|
-
|
1364
|
-
You can enable it through `Datadog.configure`:
|
1365
|
-
|
1366
|
-
```ruby
|
1367
|
-
require 'ddtrace'
|
1368
|
-
|
1369
|
-
Datadog.configure do |c|
|
1370
|
-
c.use :racecar, options
|
1371
|
-
end
|
1372
|
-
```
|
1373
|
-
|
1374
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1375
|
-
|
1376
|
-
| Key | Description | Default |
|
1377
|
-
| --- | ----------- | ------- |
|
1378
|
-
| `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
|
1379
|
-
|
1380
|
-
### Rack
|
1381
|
-
|
1382
|
-
The Rack integration provides a middleware that traces all requests before they reach the underlying framework or application. It responds to the Rack minimal interface, providing reasonable values that can be retrieved at the Rack level.
|
1383
|
-
|
1384
|
-
This integration is automatically activated with web frameworks like Rails. If you're using a plain Rack application, enable the integration it to your `config.ru`:
|
1385
|
-
|
1386
|
-
```ruby
|
1387
|
-
# config.ru example
|
1388
|
-
require 'ddtrace'
|
1389
|
-
|
1390
|
-
Datadog.configure do |c|
|
1391
|
-
c.use :rack, options
|
1392
|
-
end
|
1393
|
-
|
1394
|
-
use Datadog::Contrib::Rack::TraceMiddleware
|
1395
|
-
|
1396
|
-
app = proc do |env|
|
1397
|
-
[ 200, {'Content-Type' => 'text/plain'}, ['OK'] ]
|
1398
|
-
end
|
1399
|
-
|
1400
|
-
run app
|
1401
|
-
```
|
1402
|
-
|
1403
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1404
|
-
|
1405
|
-
| Key | Description | Default |
|
1406
|
-
| --- | ----------- | ------- |
|
1407
|
-
| `application` | Your Rack application. Required for `middleware_names`. | `nil` |
|
1408
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `true` |
|
1409
|
-
| `headers` | Hash of HTTP request or response headers to add as tags to the `rack.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
1410
|
-
| `middleware_names` | Enable this if you want to use the last executed middleware class as the resource name for the `rack` span. If enabled alongside the `rails` instrumention, `rails` takes precedence by setting the `rack` resource name to the active `rails` controller when applicable. Requires `application` option to use. | `false` |
|
1411
|
-
| `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
|
1412
|
-
| `quantize.query` | Hash containing options for query portion of URL quantization. May include `:show` or `:exclude`. See options below. Option must be nested inside the `quantize` option. | `{}` |
|
1413
|
-
| `quantize.query.show` | Defines which values should always be shown. Shows no values by default. May be an Array of strings, or `:all` to show all values. Option must be nested inside the `query` option. | `nil` |
|
1414
|
-
| `quantize.query.exclude` | Defines which values should be removed entirely. Excludes nothing by default. May be an Array of strings, or `:all` to remove the query string entirely. Option must be nested inside the `query` option. | `nil` |
|
1415
|
-
| `quantize.fragment` | Defines behavior for URL fragments. Removes fragments by default. May be `:show` to show URL fragments. Option must be nested inside the `quantize` option. | `nil` |
|
1416
|
-
| `request_queuing` | Track HTTP request time spent in the queue of the frontend server. See [HTTP request queuing](#http-request-queuing) for setup details. Set to `true` to enable. | `false` |
|
1417
|
-
| `service_name` | Service name used for `rack` instrumentation | `'rack'` |
|
1418
|
-
| `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
|
1419
|
-
|
1420
|
-
**Configuring URL quantization behavior**
|
1421
|
-
|
1422
|
-
```ruby
|
1423
|
-
Datadog.configure do |c|
|
1424
|
-
# Default behavior: all values are quantized, fragment is removed.
|
1425
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by
|
1426
|
-
# http://example.com/path?categories[]=1&categories[]=2 --> http://example.com/path?categories[]
|
1427
|
-
|
1428
|
-
# Show values for any query string parameter matching 'category_id' exactly
|
1429
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by
|
1430
|
-
c.use :rack, quantize: { query: { show: ['category_id'] } }
|
1431
|
-
|
1432
|
-
# Show all values for all query string parameters
|
1433
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by=asc
|
1434
|
-
c.use :rack, quantize: { query: { show: :all } }
|
1435
|
-
|
1436
|
-
# Totally exclude any query string parameter matching 'sort_by' exactly
|
1437
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id
|
1438
|
-
c.use :rack, quantize: { query: { exclude: ['sort_by'] } }
|
1439
|
-
|
1440
|
-
# Remove the query string entirely
|
1441
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path
|
1442
|
-
c.use :rack, quantize: { query: { exclude: :all } }
|
1443
|
-
|
1444
|
-
# Show URL fragments
|
1445
|
-
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by#featured
|
1446
|
-
c.use :rack, quantize: { fragment: :show }
|
1447
|
-
end
|
1448
|
-
```
|
1449
|
-
|
1450
|
-
### Rails
|
1451
|
-
|
1452
|
-
The Rails integration will trace requests, database calls, templates rendering, and cache read/write/delete operations. The integration makes use of the Active Support Instrumentation, listening to the Notification API so that any operation instrumented by the API is traced.
|
1453
|
-
|
1454
|
-
To enable the Rails instrumentation, create an initializer file in your `config/initializers` folder:
|
1455
|
-
|
1456
|
-
```ruby
|
1457
|
-
# config/initializers/datadog.rb
|
1458
|
-
require 'ddtrace'
|
1459
|
-
|
1460
|
-
Datadog.configure do |c|
|
1461
|
-
c.use :rails, options
|
1462
|
-
end
|
1463
|
-
```
|
1464
|
-
|
1465
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1466
|
-
|
1467
|
-
| Key | Description | Default |
|
1468
|
-
| --- | ----------- | ------- |
|
1469
|
-
| `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
|
1470
|
-
| `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
|
1471
|
-
| `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
|
1472
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `true` |
|
1473
|
-
| `exception_controller` | Class or Module which identifies a custom exception controller class. Tracer provides improved error behavior when it can identify custom exception controllers. By default, without this option, it 'guesses' what a custom exception controller looks like. Providing this option aids this identification. | `nil` |
|
1474
|
-
| `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
|
1475
|
-
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
|
1476
|
-
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
1477
|
-
| `template_base_path` | Used when the template name is parsed. If you don't store your templates in the `views/` folder, you may need to change this value | `'views/'` |
|
1478
|
-
| `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
|
1479
|
-
|
1480
|
-
**Supported versions**
|
1481
|
-
|
1482
|
-
| MRI Versions | JRuby Versions | Rails Versions |
|
1483
|
-
| ------------- | -------------- | -------------- |
|
1484
|
-
| 2.1 | | 3.0 - 4.2 |
|
1485
|
-
| 2.2 - 2.3 | | 3.0 - 5.2 |
|
1486
|
-
| 2.4 | | 4.2.8 - 5.2 |
|
1487
|
-
| 2.5 | | 4.2.8 - 6.1 |
|
1488
|
-
| 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
|
1489
|
-
| 3.0 | | 6.1 |
|
1490
|
-
|
1491
|
-
### Rake
|
1492
|
-
|
1493
|
-
You can add instrumentation around your Rake tasks by activating the `rake` integration. Each task and its subsequent subtasks will be traced.
|
1494
|
-
|
1495
|
-
To activate Rake task tracing, add the following to your `Rakefile`:
|
1496
|
-
|
1497
|
-
```ruby
|
1498
|
-
# At the top of your Rakefile:
|
1499
|
-
require 'rake'
|
1500
|
-
require 'ddtrace'
|
1501
|
-
|
1502
|
-
Datadog.configure do |c|
|
1503
|
-
c.use :rake, options
|
1504
|
-
end
|
1505
|
-
|
1506
|
-
task :my_task do
|
1507
|
-
# Do something task work here...
|
1508
|
-
end
|
1509
|
-
|
1510
|
-
Rake::Task['my_task'].invoke
|
1511
|
-
```
|
1512
|
-
|
1513
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1514
|
-
|
1515
|
-
| Key | Description | Default |
|
1516
|
-
| --- | ----------- | ------- |
|
1517
|
-
| `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1518
|
-
| `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
|
1519
|
-
| `service_name` | Service name used for `rake` instrumentation | `'rake'` |
|
1520
|
-
|
1521
|
-
**Configuring task quantization behavior**
|
1522
|
-
|
1523
|
-
```ruby
|
1524
|
-
Datadog.configure do |c|
|
1525
|
-
# Given a task that accepts :one, :two, :three...
|
1526
|
-
# Invoked with 'foo', 'bar', 'baz'.
|
1527
|
-
|
1528
|
-
# Default behavior: all arguments are quantized.
|
1529
|
-
# `rake.invoke.args` tag --> ['?']
|
1530
|
-
# `rake.execute.args` tag --> { one: '?', two: '?', three: '?' }
|
1531
|
-
c.use :rake
|
1532
|
-
|
1533
|
-
# Show values for any argument matching :two exactly
|
1534
|
-
# `rake.invoke.args` tag --> ['?']
|
1535
|
-
# `rake.execute.args` tag --> { one: '?', two: 'bar', three: '?' }
|
1536
|
-
c.use :rake, quantize: { args: { show: [:two] } }
|
1537
|
-
|
1538
|
-
# Show all values for all arguments.
|
1539
|
-
# `rake.invoke.args` tag --> ['foo', 'bar', 'baz']
|
1540
|
-
# `rake.execute.args` tag --> { one: 'foo', two: 'bar', three: 'baz' }
|
1541
|
-
c.use :rake, quantize: { args: { show: :all } }
|
1542
|
-
|
1543
|
-
# Totally exclude any argument matching :three exactly
|
1544
|
-
# `rake.invoke.args` tag --> ['?']
|
1545
|
-
# `rake.execute.args` tag --> { one: '?', two: '?' }
|
1546
|
-
c.use :rake, quantize: { args: { exclude: [:three] } }
|
1547
|
-
|
1548
|
-
# Remove the arguments entirely
|
1549
|
-
# `rake.invoke.args` tag --> ['?']
|
1550
|
-
# `rake.execute.args` tag --> {}
|
1551
|
-
c.use :rake, quantize: { args: { exclude: :all } }
|
1552
|
-
end
|
1553
|
-
```
|
1554
|
-
|
1555
|
-
### Redis
|
1556
|
-
|
1557
|
-
The Redis integration will trace simple calls as well as pipelines.
|
1558
|
-
|
1559
|
-
```ruby
|
1560
|
-
require 'redis'
|
1561
|
-
require 'ddtrace'
|
1562
|
-
|
1563
|
-
Datadog.configure do |c|
|
1564
|
-
c.use :redis, options
|
1565
|
-
end
|
1566
|
-
|
1567
|
-
# Perform Redis commands
|
1568
|
-
redis = Redis.new
|
1569
|
-
redis.set 'foo', 'bar'
|
1570
|
-
```
|
1571
|
-
|
1572
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1573
|
-
|
1574
|
-
| Key | Description | Default |
|
1575
|
-
| --- | ----------- | ------- |
|
1576
|
-
| `service_name` | Service name used for `redis` instrumentation | `'redis'` |
|
1577
|
-
| `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
|
1578
|
-
|
1579
|
-
You can also set *per-instance* configuration as it follows:
|
1580
|
-
|
1581
|
-
```ruby
|
1582
|
-
require 'redis'
|
1583
|
-
require 'ddtrace'
|
1584
|
-
|
1585
|
-
Datadog.configure do |c|
|
1586
|
-
c.use :redis # Enabling integration instrumentation is still required
|
1587
|
-
end
|
1588
|
-
|
1589
|
-
customer_cache = Redis.new
|
1590
|
-
invoice_cache = Redis.new
|
1591
|
-
|
1592
|
-
Datadog.configure(customer_cache, service_name: 'customer-cache')
|
1593
|
-
Datadog.configure(invoice_cache, service_name: 'invoice-cache')
|
1594
|
-
|
1595
|
-
# Traced call will belong to `customer-cache` service
|
1596
|
-
customer_cache.get(...)
|
1597
|
-
# Traced call will belong to `invoice-cache` service
|
1598
|
-
invoice_cache.get(...)
|
1599
|
-
```
|
1600
|
-
|
1601
|
-
**Configuring trace settings per connection**
|
1602
|
-
|
1603
|
-
You can configure trace settings per connection by using the `describes` option:
|
1604
|
-
|
1605
|
-
```ruby
|
1606
|
-
# Provide a `:describes` option with a connection key.
|
1607
|
-
# Any of the following keys are acceptable and equivalent to one another.
|
1608
|
-
# If a block is provided, it yields a Settings object that
|
1609
|
-
# accepts any of the configuration options listed above.
|
1610
|
-
|
1611
|
-
Datadog.configure do |c|
|
1612
|
-
# The default configuration for any redis client
|
1613
|
-
c.use :redis, service_name: 'redis-default'
|
1614
|
-
|
1615
|
-
# The configuration matching a given unix socket.
|
1616
|
-
c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
|
1617
|
-
|
1618
|
-
# For network connections, only these fields are considered during matching:
|
1619
|
-
# scheme, host, port, db
|
1620
|
-
# Other fields are ignored.
|
1621
|
-
|
1622
|
-
# Network connection string
|
1623
|
-
c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
|
1624
|
-
c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
|
1625
|
-
# Network client hash
|
1626
|
-
c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
|
1627
|
-
# Only a subset of the connection hash
|
1628
|
-
c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
|
1629
|
-
c.use :redis, describes: { host: ENV['SIDEKIQ_CACHE_HOST'] }, service_name: 'redis-sidekiq'
|
1630
|
-
end
|
1631
|
-
```
|
1632
|
-
|
1633
|
-
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
1634
|
-
|
1635
|
-
### Resque
|
1636
|
-
|
1637
|
-
The Resque integration uses Resque hooks that wraps the `perform` method.
|
1638
|
-
|
1639
|
-
To add tracing to a Resque job:
|
1640
|
-
|
1641
|
-
```ruby
|
1642
|
-
require 'resque'
|
1643
|
-
require 'ddtrace'
|
1644
|
-
|
1645
|
-
Datadog.configure do |c|
|
1646
|
-
c.use :resque, **options
|
1647
|
-
end
|
1648
|
-
```
|
1649
|
-
|
1650
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1651
|
-
|
1652
|
-
| Key | Description | Default |
|
1653
|
-
| --- | ----------- | ------- |
|
1654
|
-
| `service_name` | Service name used for `resque` instrumentation | `'resque'` |
|
1655
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1656
|
-
| `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
|
1657
|
-
|
1658
|
-
### Rest Client
|
1659
|
-
|
1660
|
-
The `rest-client` integration is available through the `ddtrace` middleware:
|
1661
|
-
|
1662
|
-
```ruby
|
1663
|
-
require 'rest_client'
|
1664
|
-
require 'ddtrace'
|
1665
|
-
|
1666
|
-
Datadog.configure do |c|
|
1667
|
-
c.use :rest_client, options
|
1668
|
-
end
|
1669
|
-
```
|
1670
|
-
|
1671
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1672
|
-
|
1673
|
-
| Key | Description | Default |
|
1674
|
-
| --- | ----------- | ------- |
|
1675
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1676
|
-
| `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
|
1677
|
-
|
1678
|
-
### RSpec
|
1679
|
-
|
1680
|
-
RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
|
1681
|
-
|
1682
|
-
To activate your integration, use the `Datadog.configure` method:
|
1683
|
-
|
1684
|
-
```ruby
|
1685
|
-
require 'rspec'
|
1686
|
-
require 'ddtrace'
|
1687
|
-
|
1688
|
-
# Configure default RSpec integration
|
1689
|
-
Datadog.configure do |c|
|
1690
|
-
c.use :rspec, options
|
1691
|
-
end
|
1692
|
-
```
|
1693
|
-
|
1694
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1695
|
-
|
1696
|
-
| Key | Description | Default |
|
1697
|
-
| --- | ----------- | ------- |
|
1698
|
-
| `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1699
|
-
| `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
|
1700
|
-
| `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
|
1701
|
-
|
1702
|
-
### Sequel
|
1703
|
-
|
1704
|
-
The Sequel integration traces queries made to your database.
|
1705
|
-
|
1706
|
-
```ruby
|
1707
|
-
require 'sequel'
|
1708
|
-
require 'ddtrace'
|
1709
|
-
|
1710
|
-
# Connect to database
|
1711
|
-
database = Sequel.sqlite
|
1712
|
-
|
1713
|
-
# Create a table
|
1714
|
-
database.create_table :articles do
|
1715
|
-
primary_key :id
|
1716
|
-
String :name
|
1717
|
-
end
|
1718
|
-
|
1719
|
-
Datadog.configure do |c|
|
1720
|
-
c.use :sequel, options
|
1721
|
-
end
|
1722
|
-
|
1723
|
-
# Perform a query
|
1724
|
-
articles = database[:articles]
|
1725
|
-
articles.all
|
1726
|
-
```
|
1727
|
-
|
1728
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1729
|
-
|
1730
|
-
| Key | Description | Default |
|
1731
|
-
| --- | ----------- | ------- |
|
1732
|
-
| `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
|
1733
|
-
|
1734
|
-
**Configuring databases to use different settings**
|
1735
|
-
|
1736
|
-
If you use multiple databases with Sequel, you can give each of them different settings by configuring their respective `Sequel::Database` objects:
|
1737
|
-
|
1738
|
-
```ruby
|
1739
|
-
sqlite_database = Sequel.sqlite
|
1740
|
-
postgres_database = Sequel.connect('postgres://user:password@host:port/database_name')
|
1741
|
-
|
1742
|
-
# Configure each database with different service names
|
1743
|
-
Datadog.configure(sqlite_database, service_name: 'my-sqlite-db')
|
1744
|
-
Datadog.configure(postgres_database, service_name: 'my-postgres-db')
|
1745
|
-
```
|
1746
|
-
|
1747
|
-
### Shoryuken
|
1748
|
-
|
1749
|
-
The Shoryuken integration is a server-side middleware which will trace job executions.
|
1750
|
-
|
1751
|
-
You can enable it through `Datadog.configure`:
|
1752
|
-
|
1753
|
-
```ruby
|
1754
|
-
require 'ddtrace'
|
1755
|
-
|
1756
|
-
Datadog.configure do |c|
|
1757
|
-
c.use :shoryuken, options
|
1758
|
-
end
|
1759
|
-
```
|
1760
|
-
|
1761
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1762
|
-
|
1763
|
-
| Key | Description | Default |
|
1764
|
-
| --- | ----------- | ------- |
|
1765
|
-
| `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
|
1766
|
-
| `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
|
1767
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1768
|
-
|
1769
|
-
### Sidekiq
|
1770
|
-
|
1771
|
-
The Sidekiq integration is a client-side & server-side middleware which will trace job queuing and executions respectively.
|
1772
|
-
|
1773
|
-
You can enable it through `Datadog.configure`:
|
1774
|
-
|
1775
|
-
```ruby
|
1776
|
-
require 'ddtrace'
|
1777
|
-
|
1778
|
-
Datadog.configure do |c|
|
1779
|
-
c.use :sidekiq, options
|
1780
|
-
end
|
1781
|
-
```
|
1782
|
-
|
1783
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1784
|
-
|
1785
|
-
| Key | Description | Default |
|
1786
|
-
| --- | ----------- | ------- |
|
1787
|
-
| `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
|
1788
|
-
| `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
|
1789
|
-
| `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
|
1790
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1791
|
-
|
1792
|
-
### Sinatra
|
1793
|
-
|
1794
|
-
The Sinatra integration traces requests and template rendering.
|
1795
|
-
|
1796
|
-
To start using the tracing client, make sure you import `ddtrace` and `use :sinatra` after either `sinatra` or `sinatra/base`, and before you define your application/routes:
|
1797
|
-
|
1798
|
-
#### Classic application
|
1799
|
-
|
1800
|
-
```ruby
|
1801
|
-
require 'sinatra'
|
1802
|
-
require 'ddtrace'
|
1803
|
-
|
1804
|
-
Datadog.configure do |c|
|
1805
|
-
c.use :sinatra, options
|
1806
|
-
end
|
1807
|
-
|
1808
|
-
get '/' do
|
1809
|
-
'Hello world!'
|
1810
|
-
end
|
1811
|
-
```
|
1812
|
-
|
1813
|
-
#### Modular application
|
1814
|
-
|
1815
|
-
```ruby
|
1816
|
-
require 'sinatra/base'
|
1817
|
-
require 'ddtrace'
|
1818
|
-
|
1819
|
-
Datadog.configure do |c|
|
1820
|
-
c.use :sinatra, options
|
1821
|
-
end
|
1822
|
-
|
1823
|
-
class NestedApp < Sinatra::Base
|
1824
|
-
register Datadog::Contrib::Sinatra::Tracer
|
1825
|
-
|
1826
|
-
get '/nested' do
|
1827
|
-
'Hello from nested app!'
|
1828
|
-
end
|
1829
|
-
end
|
1830
|
-
|
1831
|
-
class App < Sinatra::Base
|
1832
|
-
register Datadog::Contrib::Sinatra::Tracer
|
1833
|
-
|
1834
|
-
use NestedApp
|
1835
|
-
|
1836
|
-
get '/' do
|
1837
|
-
'Hello world!'
|
1838
|
-
end
|
1839
|
-
end
|
1840
|
-
```
|
1841
|
-
|
1842
|
-
Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
|
1843
|
-
|
1844
|
-
#### Instrumentation options
|
1845
|
-
|
1846
|
-
`options` is an optional `Hash` that accepts the following parameters:
|
1847
|
-
|
1848
|
-
| Key | Description | Default |
|
1849
|
-
| --- | ----------- | ------- |
|
1850
|
-
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) so that this service trace is connected with a trace of another service if tracing headers are received | `true` |
|
1851
|
-
| `headers` | Hash of HTTP request or response headers to add as tags to the `sinatra.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
1852
|
-
| `resource_script_names` | Prepend resource names with script name | `false` |
|
1853
|
-
| `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
|
1854
|
-
|
1855
|
-
### Sneakers
|
1856
|
-
|
1857
|
-
The Sneakers integration is a server-side middleware which will trace job executions.
|
1858
|
-
|
1859
|
-
You can enable it through `Datadog.configure`:
|
1860
|
-
|
1861
|
-
```ruby
|
1862
|
-
require 'ddtrace'
|
1863
|
-
|
1864
|
-
Datadog.configure do |c|
|
1865
|
-
c.use :sneakers, options
|
1866
|
-
end
|
1867
|
-
```
|
1868
|
-
|
1869
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1870
|
-
|
1871
|
-
| Key | Description | Default |
|
1872
|
-
| --- | ----------- | ------- |
|
1873
|
-
| `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1874
|
-
| `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
|
1875
|
-
| `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
|
1876
|
-
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
1877
|
-
|
1878
|
-
### Sucker Punch
|
1879
|
-
|
1880
|
-
The `sucker_punch` integration traces all scheduled jobs:
|
1881
|
-
|
1882
|
-
```ruby
|
1883
|
-
require 'ddtrace'
|
1884
|
-
|
1885
|
-
Datadog.configure do |c|
|
1886
|
-
c.use :sucker_punch, options
|
1887
|
-
end
|
1888
|
-
|
1889
|
-
# Execution of this job is traced
|
1890
|
-
LogJob.perform_async('login')
|
1891
|
-
```
|
1892
|
-
|
1893
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1894
|
-
|
1895
|
-
| Key | Description | Default |
|
1896
|
-
| --- | ----------- | ------- |
|
1897
|
-
| `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
|
1898
|
-
|
1899
|
-
## Advanced configuration
|
1900
|
-
|
1901
|
-
### Tracer settings
|
1902
|
-
|
1903
|
-
To change the default behavior of the Datadog tracer, you can provide custom options inside the `Datadog.configure` block as in:
|
1904
|
-
|
1905
|
-
```ruby
|
1906
|
-
# config/initializers/datadog-tracer.rb
|
1907
|
-
|
1908
|
-
Datadog.configure do |c|
|
1909
|
-
c.tracer.enabled = true
|
1910
|
-
c.tracer.hostname = 'my-agent'
|
1911
|
-
c.tracer.port = 8126
|
1912
|
-
|
1913
|
-
# Ensure all traces are ingested by Datadog
|
1914
|
-
c.sampling.default_rate = 1.0 # Recommended
|
1915
|
-
c.sampling.rate_limit = 200
|
1916
|
-
# or provide a custom implementation (overrides c.sampling settings)
|
1917
|
-
c.tracer.sampler = Datadog::AllSampler.new
|
1918
|
-
|
1919
|
-
# Breaks down very large traces into smaller batches
|
1920
|
-
c.tracer.partial_flush.enabled = false
|
1921
|
-
|
1922
|
-
# You can specify your own tracer
|
1923
|
-
c.tracer.instance = Datadog::Tracer.new
|
1924
|
-
|
1925
|
-
# To enable debug mode
|
1926
|
-
c.diagnostics.debug = true
|
1927
|
-
end
|
1928
|
-
```
|
1929
|
-
|
1930
|
-
Available options are:
|
1931
|
-
|
1932
|
-
- `enabled`: defines if the `tracer` is enabled or not. If set to `false` instrumentation will still run, but no spans are sent to the trace agent. Can be configured through the `DD_TRACE_ENABLED` environment variable. Defaults to `true`.
|
1933
|
-
- `hostname`: set the hostname of the trace agent.
|
1934
|
-
- `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
|
1935
|
-
- `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
1936
|
-
- `port`: set the port the trace agent is listening on.
|
1937
|
-
- `sampling.default_rate`: default tracer sampling rate, between `0.0` (0%) and `1.0` (100%, recommended). `1.0` or Tracing without Limits™, allows you to send all of your traffic and retention can be [configured within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/). When this configuration is not set, the Datadog agent will keep an intelligent assortment of diverse traces.
|
1938
|
-
- `sampling.rate_limit`: maximum number of traces per second to sample. Defaults to 100 per second.
|
1939
|
-
- `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
|
1940
|
-
- `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
|
1941
|
-
- `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
|
1942
|
-
- `time_now_provider`: when testing, it might be helpful to use a different time provider. For Timecop, for example, `->{ Time.now_without_mock_time }` allows the tracer to use the real wall time. Span duration calculation will still use the system monotonic clock when available, thus not being affected by this setting. Defaults to `->{ Time.now }`.
|
1943
|
-
|
1944
|
-
#### Custom logging
|
1945
|
-
|
1946
|
-
By default, all logs are processed by the default Ruby logger. When using Rails, you should see the messages in your application log file.
|
1947
|
-
|
1948
|
-
Datadog client log messages are marked with `[ddtrace]` so you should be able to isolate them from other messages.
|
1949
|
-
|
1950
|
-
Additionally, it is possible to override the default logger and replace it by a custom one. This is done using the `log` setting.
|
1951
|
-
|
1952
|
-
```ruby
|
1953
|
-
f = File.new("my-custom.log", "w+") # Log messages should go there
|
1954
|
-
Datadog.configure do |c|
|
1955
|
-
c.logger = Logger.new(f) # Overriding the default logger
|
1956
|
-
c.logger.level = ::Logger::INFO
|
1957
|
-
end
|
1958
|
-
|
1959
|
-
Datadog.logger.info { "this is typically called by tracing code" }
|
1960
|
-
```
|
1961
|
-
|
1962
|
-
### Environment and tags
|
1963
|
-
|
1964
|
-
By default, the trace agent (not this library, but the program running in the background collecting data from various clients) uses the tags set in the agent config file, see our [environments tutorial](https://app.datadoghq.com/apm/docs/tutorials/environments) for details.
|
1965
|
-
|
1966
|
-
You can configure the application to automatically tag your traces and metrics, using the following environment variables:
|
1967
|
-
|
1968
|
-
- `DD_ENV`: Your application environment (e.g. `production`, `staging`, etc.)
|
1969
|
-
- `DD_SERVICE`: Your application's default service name (e.g. `billing-api`)
|
1970
|
-
- `DD_VERSION`: Your application version (e.g. `2.5`, `202003181415`, `1.3-alpha`, etc.)
|
1971
|
-
- `DD_TAGS`: Custom tags in value pairs separated by `,` (e.g. `layer:api,team:intake`)
|
1972
|
-
- If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are set, it will override any respective `env`/`service`/`version` tag defined in `DD_TAGS`.
|
1973
|
-
- If `DD_ENV`, `DD_SERVICE` or `DD_VERSION` are NOT set, tags defined in `DD_TAGS` will be used to populate `env`/`service`/`version` respectively.
|
1974
|
-
|
1975
|
-
These values can also be overridden at the tracer level:
|
1976
|
-
|
1977
|
-
```ruby
|
1978
|
-
Datadog.configure do |c|
|
1979
|
-
c.service = 'billing-api'
|
1980
|
-
c.env = 'test'
|
1981
|
-
c.tags = { 'team' => 'qa' }
|
1982
|
-
c.version = '1.3-alpha'
|
1983
|
-
end
|
1984
|
-
```
|
1985
|
-
|
1986
|
-
This enables you to set this value on a per application basis, so you can have for example several applications reporting for different environments on the same host.
|
1987
|
-
|
1988
|
-
Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
|
1989
|
-
|
1990
|
-
### Environment variables
|
1991
|
-
|
1992
|
-
Other Environment Variables:
|
1993
|
-
|
1994
|
-
- `DD_TRACE_AGENT_URL`: Sets the URL endpoint where traces are sent. Has priority over `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT` if set. e.g. `DD_TRACE_AGENT_URL=http://localhost:8126`.
|
1995
|
-
- `DD_TRACE_<INTEGRATION>_ENABLED`: Enables or disables an **activated** integration. Defaults to `true`.. e.g. `DD_TRACE_RAILS_ENABLED=false`. This option has no effects on integrations that have not been explicitly activated (e.g. `Datadog.configure{ |c| c.use :integration }`).on code. This environment variable can only be used to disable an integration.
|
1996
|
-
- `DD_TRACE_SAMPLE_RATE`: Sets the trace sampling rate between `0.0` (0%) and `1.0` (100%, recommended). `1.0` or Tracing without Limits™, allows you to send all of your traffic and retention can be [configured within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/). When this configuration is not set, the Datadog agent will keep an intelligent assortment of diverse traces.
|
1997
|
-
- `DD_LOGS_INJECTION`: Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Rails logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. Valid values are: `true` or `false`(default). e.g. `DD_LOGS_INJECTION=true`.
|
1998
|
-
|
1999
|
-
### Sampling
|
2000
|
-
|
2001
|
-
Datadog's Tracing without Limits™ allows you to send all of your traffic and [configure retention within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/).
|
2002
|
-
|
2003
|
-
We recommend setting the environment variable `DD_TRACE_SAMPLE_RATE=1.0` in all new applications using `ddtrace`.
|
2004
|
-
|
2005
|
-
App Analytics, previously configured with the `analytics_enabled` setting, is deprecated in favor of Tracing without Limits™. Documentation for this [deprecated configuration is still available](https://docs.datadoghq.com/tracing/legacy_app_analytics/).
|
2006
|
-
|
2007
|
-
#### Application-side sampling
|
2008
|
-
|
2009
|
-
While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
|
2010
|
-
|
2011
|
-
This will **reduce visibility and is not recommended**. See [DD_TRACE_SAMPLE_RATE](#environment-variables) for the recommended sampling approach.
|
2012
|
-
|
2013
|
-
`Datadog::RateSampler` samples a ratio of the traces. For example:
|
2014
|
-
|
2015
|
-
```ruby
|
2016
|
-
# Sample rate is between 0 (nothing sampled) to 1 (everything sampled).
|
2017
|
-
sampler = Datadog::RateSampler.new(0.5) # sample 50% of the traces
|
2018
|
-
|
2019
|
-
Datadog.configure do |c|
|
2020
|
-
c.tracer.sampler = sampler
|
2021
|
-
end
|
2022
|
-
```
|
2023
|
-
|
2024
|
-
#### Priority sampling
|
2025
|
-
|
2026
|
-
Priority sampling decides whether to keep a trace by using a priority attribute propagated for distributed traces. Its value indicates to the Agent and the backend about how important the trace is.
|
2027
|
-
|
2028
|
-
The sampler can set the priority to the following values:
|
2029
|
-
|
2030
|
-
- `Datadog::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
|
2031
|
-
- `Datadog::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
|
2032
|
-
|
2033
|
-
Priority sampling is enabled by default. Enabling it ensures that your sampled distributed traces will be complete. Once enabled, the sampler will automatically assign a priority of 0 or 1 to traces, depending on their service and volume.
|
2034
|
-
|
2035
|
-
You can also set this priority manually to either drop a non-interesting trace or to keep an important one. For that, set the `context#sampling_priority` to:
|
2036
|
-
|
2037
|
-
- `Datadog::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
|
2038
|
-
- `Datadog::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
|
2039
|
-
|
2040
|
-
When not using [distributed tracing](#distributed-tracing), you may change the priority at any time, as long as the trace incomplete. But it has to be done before any context propagation (fork, RPC calls) to be useful in a distributed context. Changing the priority after the context has been propagated causes different parts of a distributed trace to use different priorities. Some parts might be kept, some parts might be rejected, and this can cause the trace to be partially stored and remain incomplete.
|
2041
|
-
|
2042
|
-
If you change the priority, we recommend you do it as soon as possible - when the root span has just been created.
|
2043
|
-
|
2044
|
-
```ruby
|
2045
|
-
# First, grab the active span
|
2046
|
-
span = Datadog.tracer.active_span
|
2047
|
-
|
2048
|
-
# Indicate to reject the trace
|
2049
|
-
span.context.sampling_priority = Datadog::Ext::Priority::USER_REJECT
|
2050
|
-
|
2051
|
-
# Indicate to keep the trace
|
2052
|
-
span.context.sampling_priority = Datadog::Ext::Priority::USER_KEEP
|
2053
|
-
```
|
2054
|
-
|
2055
|
-
### Distributed Tracing
|
2056
|
-
|
2057
|
-
Distributed tracing allows traces to be propagated across multiple instrumented applications so that a request can be presented as a single trace, rather than a separate trace per service.
|
2058
|
-
|
2059
|
-
To trace requests across application boundaries, the following must be propagated between each application:
|
2060
|
-
|
2061
|
-
| Property | Type | Description |
|
2062
|
-
| --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
|
2063
|
-
| **Trace ID** | Integer | ID of the trace. This value should be the same across all requests that belong to the same trace. |
|
2064
|
-
| **Parent Span ID** | Integer | ID of the span in the service originating the request. This value will always be different for each request within a trace. |
|
2065
|
-
| **Sampling Priority** | Integer | Sampling priority level for the trace. This value should be the same across all requests that belong to the same trace. |
|
2066
|
-
|
2067
|
-
Such propagation can be visualized as:
|
2068
|
-
|
2069
|
-
```
|
2070
|
-
Service A:
|
2071
|
-
Trace ID: 100000000000000001
|
2072
|
-
Parent ID: 0
|
2073
|
-
Span ID: 100000000000000123
|
2074
|
-
Priority: 1
|
2075
|
-
|
2076
|
-
|
|
2077
|
-
| Service B Request:
|
2078
|
-
| Metadata:
|
2079
|
-
| Trace ID: 100000000000000001
|
2080
|
-
| Parent ID: 100000000000000123
|
2081
|
-
| Priority: 1
|
2082
|
-
|
|
2083
|
-
V
|
2084
|
-
|
2085
|
-
Service B:
|
2086
|
-
Trace ID: 100000000000000001
|
2087
|
-
Parent ID: 100000000000000123
|
2088
|
-
Span ID: 100000000000000456
|
2089
|
-
Priority: 1
|
2090
|
-
|
2091
|
-
|
|
2092
|
-
| Service C Request:
|
2093
|
-
| Metadata:
|
2094
|
-
| Trace ID: 100000000000000001
|
2095
|
-
| Parent ID: 100000000000000456
|
2096
|
-
| Priority: 1
|
2097
|
-
|
|
2098
|
-
V
|
2099
|
-
|
2100
|
-
Service C:
|
2101
|
-
Trace ID: 100000000000000001
|
2102
|
-
Parent ID: 100000000000000456
|
2103
|
-
Span ID: 100000000000000789
|
2104
|
-
Priority: 1
|
2105
|
-
```
|
2106
|
-
|
2107
|
-
**Via HTTP**
|
2108
|
-
|
2109
|
-
For HTTP requests between instrumented applications, this trace metadata is propagated by use of HTTP Request headers:
|
2110
|
-
|
2111
|
-
| Property | Type | HTTP Header name |
|
2112
|
-
| --------------------- | ------- | ----------------------------- |
|
2113
|
-
| **Trace ID** | Integer | `x-datadog-trace-id` |
|
2114
|
-
| **Parent Span ID** | Integer | `x-datadog-parent-id` |
|
2115
|
-
| **Sampling Priority** | Integer | `x-datadog-sampling-priority` |
|
2116
|
-
|
2117
|
-
Such that:
|
2118
|
-
|
2119
|
-
```
|
2120
|
-
Service A:
|
2121
|
-
Trace ID: 100000000000000001
|
2122
|
-
Parent ID: 0
|
2123
|
-
Span ID: 100000000000000123
|
2124
|
-
Priority: 1
|
2125
|
-
|
2126
|
-
|
|
2127
|
-
| Service B HTTP Request:
|
2128
|
-
| Headers:
|
2129
|
-
| x-datadog-trace-id: 100000000000000001
|
2130
|
-
| x-datadog-parent-id: 100000000000000123
|
2131
|
-
| x-datadog-sampling-priority: 1
|
2132
|
-
|
|
2133
|
-
V
|
2134
|
-
|
2135
|
-
Service B:
|
2136
|
-
Trace ID: 100000000000000001
|
2137
|
-
Parent ID: 100000000000000123
|
2138
|
-
Span ID: 100000000000000456
|
2139
|
-
Priority: 1
|
2140
|
-
|
2141
|
-
|
|
2142
|
-
| Service C HTTP Request:
|
2143
|
-
| Headers:
|
2144
|
-
| x-datadog-trace-id: 100000000000000001
|
2145
|
-
| x-datadog-parent-id: 100000000000000456
|
2146
|
-
| x-datadog-sampling-priority: 1
|
2147
|
-
|
|
2148
|
-
V
|
2149
|
-
|
2150
|
-
Service C:
|
2151
|
-
Trace ID: 100000000000000001
|
2152
|
-
Parent ID: 100000000000000456
|
2153
|
-
Span ID: 100000000000000789
|
2154
|
-
Priority: 1
|
2155
|
-
```
|
2156
|
-
|
2157
|
-
**Activating distributed tracing for integrations**
|
2158
|
-
|
2159
|
-
Many integrations included in `ddtrace` support distributed tracing. Distributed tracing is enabled by default in Agent v7 and most versions of Agent v6. If needed, you can activate distributed tracing with configuration settings.
|
2160
|
-
|
2161
|
-
- If your application receives requests from services with distributed tracing activated, you must activate distributed tracing on the integrations that handle these requests (e.g. Rails)
|
2162
|
-
- If your application send requests to services with distributed tracing activated, you must activate distributed tracing on the integrations that send these requests (e.g. Faraday)
|
2163
|
-
- If your application both sends and receives requests implementing distributed tracing, it must activate all integrations that handle these requests.
|
2164
|
-
|
2165
|
-
For more details on how to activate distributed tracing for integrations, see their documentation:
|
2166
|
-
|
2167
|
-
- [Excon](#excon)
|
2168
|
-
- [Faraday](#faraday)
|
2169
|
-
- [Rest Client](#rest-client)
|
2170
|
-
- [Net/HTTP](#nethttp)
|
2171
|
-
- [Rack](#rack)
|
2172
|
-
- [Rails](#rails)
|
2173
|
-
- [Sinatra](#sinatra)
|
2174
|
-
- [http.rb](#httprb)
|
2175
|
-
- [httpclient](#httpclient)
|
2176
|
-
- [httpx](#httpx)
|
2177
|
-
|
2178
|
-
**Using the HTTP propagator**
|
2179
|
-
|
2180
|
-
To make the process of propagating this metadata easier, you can use the `Datadog::HTTPPropagator` module.
|
2181
|
-
|
2182
|
-
On the client:
|
2183
|
-
|
2184
|
-
```ruby
|
2185
|
-
Datadog.tracer.trace('web.call') do |span|
|
2186
|
-
# Inject span context into headers (`env` must be a Hash)
|
2187
|
-
Datadog::HTTPPropagator.inject!(span.context, env)
|
2188
|
-
end
|
2189
|
-
```
|
2190
|
-
|
2191
|
-
On the server:
|
2192
|
-
|
2193
|
-
```ruby
|
2194
|
-
Datadog.tracer.trace('web.work') do |span|
|
2195
|
-
# Build a context from headers (`env` must be a Hash)
|
2196
|
-
context = HTTPPropagator.extract(request.env)
|
2197
|
-
Datadog.tracer.provider.context = context if context.trace_id
|
2198
|
-
end
|
2199
|
-
```
|
2200
|
-
|
2201
|
-
### HTTP request queuing
|
2202
|
-
|
2203
|
-
Traces that originate from HTTP requests can be configured to include the time spent in a frontend web server or load balancer queue before the request reaches the Ruby application.
|
2204
|
-
|
2205
|
-
This feature is disabled by default. To activate it, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
|
2206
|
-
|
2207
|
-
```
|
2208
|
-
# /etc/nginx/conf.d/ruby_service.conf
|
2209
|
-
server {
|
2210
|
-
listen 8080;
|
2211
|
-
|
2212
|
-
location / {
|
2213
|
-
proxy_set_header X-Request-Start "t=${msec}";
|
2214
|
-
proxy_pass http://web:3000;
|
2215
|
-
}
|
2216
|
-
}
|
2217
|
-
```
|
2218
|
-
|
2219
|
-
Then you must enable the request queuing feature, by setting `request_queuing: true`, in the integration handling the request. For Rack-based applications, see the [documentation](#rack) for details.
|
2220
|
-
|
2221
|
-
### Processing Pipeline
|
2222
|
-
|
2223
|
-
Some applications might require that traces be altered or filtered out before they are sent upstream. The processing pipeline allows users to create *processors* to define such behavior.
|
2224
|
-
|
2225
|
-
Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
|
2226
|
-
|
2227
|
-
For example:
|
2228
|
-
|
2229
|
-
```ruby
|
2230
|
-
lambda_processor = ->(trace) do
|
2231
|
-
# Processing logic...
|
2232
|
-
trace
|
2233
|
-
end
|
2234
|
-
|
2235
|
-
class MyCustomProcessor
|
2236
|
-
def call(trace)
|
2237
|
-
# Processing logic...
|
2238
|
-
trace
|
2239
|
-
end
|
2240
|
-
end
|
2241
|
-
custom_processor = MyFancyProcessor.new
|
2242
|
-
```
|
2243
|
-
|
2244
|
-
`#call` blocks of processors *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
|
2245
|
-
|
2246
|
-
These processors must then be added to the pipeline via `Datadog::Pipeline.before_flush`:
|
2247
|
-
|
2248
|
-
```ruby
|
2249
|
-
Datadog::Pipeline.before_flush(lambda_processor, custom_processor)
|
2250
|
-
```
|
2251
|
-
|
2252
|
-
You can also define processors using the short-hand block syntax for `Datadog::Pipeline.before_flush`:
|
2253
|
-
|
2254
|
-
```ruby
|
2255
|
-
Datadog::Pipeline.before_flush do |trace|
|
2256
|
-
trace.delete_if { |span| span.name =~ /forbidden/ }
|
2257
|
-
end
|
2258
|
-
```
|
2259
|
-
|
2260
|
-
#### Filtering
|
2261
|
-
|
2262
|
-
You can use the `Datadog::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
|
2263
|
-
|
2264
|
-
```ruby
|
2265
|
-
Datadog::Pipeline.before_flush(
|
2266
|
-
# Remove spans that match a particular resource
|
2267
|
-
Datadog::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
|
2268
|
-
# Remove spans that are trafficked to localhost
|
2269
|
-
Datadog::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
|
2270
|
-
)
|
2271
|
-
```
|
2272
|
-
|
2273
|
-
#### Processing
|
2274
|
-
|
2275
|
-
You can use the `Datadog::Pipeline::SpanProcessor` processor to modify spans:
|
2276
|
-
|
2277
|
-
```ruby
|
2278
|
-
Datadog::Pipeline.before_flush(
|
2279
|
-
# Strip matching text from the resource field
|
2280
|
-
Datadog::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
|
2281
|
-
)
|
2282
|
-
```
|
2283
|
-
|
2284
|
-
### Trace correlation
|
2285
|
-
|
2286
|
-
In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
|
2287
|
-
|
2288
|
-
#### For logging in Rails applications
|
2289
|
-
|
2290
|
-
##### Automatic
|
2291
|
-
|
2292
|
-
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `semantic_logger`, or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
|
2293
|
-
|
2294
|
-
```ruby
|
2295
|
-
# config/initializers/datadog.rb
|
2296
|
-
require 'ddtrace'
|
2297
|
-
|
2298
|
-
Datadog.configure do |c|
|
2299
|
-
c.use :rails, log_injection: true
|
2300
|
-
end
|
2301
|
-
```
|
2302
|
-
|
2303
|
-
##### Manual (Lograge)
|
2304
|
-
|
2305
|
-
After [setting up Lograge in a Rails application](https://docs.datadoghq.com/logs/log_collection/ruby/), manually modify the `custom_options` block in your environment configuration file (e.g. `config/environments/production.rb`) to add the trace IDs.
|
2306
|
-
|
2307
|
-
```ruby
|
2308
|
-
config.lograge.custom_options = lambda do |event|
|
2309
|
-
# Retrieves trace information for current thread
|
2310
|
-
correlation = Datadog.tracer.active_correlation
|
2311
|
-
|
2312
|
-
{
|
2313
|
-
# Adds IDs as tags to log output
|
2314
|
-
:dd => {
|
2315
|
-
# To preserve precision during JSON serialization, use strings for large numbers
|
2316
|
-
:trace_id => correlation.trace_id.to_s,
|
2317
|
-
:span_id => correlation.span_id.to_s,
|
2318
|
-
:env => correlation.env.to_s,
|
2319
|
-
:service => correlation.service.to_s,
|
2320
|
-
:version => correlation.version.to_s
|
2321
|
-
},
|
2322
|
-
:ddsource => ["ruby"],
|
2323
|
-
:params => event.payload[:params].reject { |k| %w(controller action).include? k }
|
2324
|
-
}
|
2325
|
-
end
|
2326
|
-
```
|
2327
|
-
|
2328
|
-
##### Manual (ActiveSupport::TaggedLogging)
|
2329
|
-
|
2330
|
-
Rails applications which are configured with the default `ActiveSupport::TaggedLogging` logger can append correlation IDs as tags to log output. To enable Trace Correlation with `ActiveSupport::TaggedLogging`, in your Rails environment configuration file, add the following:
|
2331
|
-
|
2332
|
-
```ruby
|
2333
|
-
Rails.application.configure do
|
2334
|
-
config.log_tags = [proc { Datadog.tracer.active_correlation.to_s }]
|
2335
|
-
end
|
2336
|
-
|
2337
|
-
# Given:
|
2338
|
-
# DD_ENV = 'production' (The name of the environment your application is running in.)
|
2339
|
-
# DD_SERVICE = 'billing-api' (Default service name of your application.)
|
2340
|
-
# DD_VERSION = '2.5.17' (The version of your application.)
|
2341
|
-
|
2342
|
-
# Web requests will produce:
|
2343
|
-
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Started GET "/articles" for 172.22.0.1 at 2019-01-16 18:50:57 +0000
|
2344
|
-
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Processing by ArticlesController#index as */*
|
2345
|
-
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Article Load (0.5ms) SELECT "articles".* FROM "articles"
|
2346
|
-
# [dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=7110975754844687674 dd.span_id=7518426836986654206] Completed 200 OK in 7ms (Views: 5.5ms | ActiveRecord: 0.5ms)
|
2347
|
-
```
|
2348
|
-
|
2349
|
-
#### For logging in Ruby applications
|
2350
|
-
|
2351
|
-
To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog.tracer.active_correlation`, then add them to the message.
|
2352
|
-
|
2353
|
-
To properly correlate with Datadog logging, be sure the following is present in the log message, in order as they appear:
|
2354
|
-
|
2355
|
-
- `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.tracer.active_correlation.env`. Omit if no environment is configured.
|
2356
|
-
- `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog.tracer.active_correlation.service`. Omit if no default service name is configured.
|
2357
|
-
- `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog.tracer.active_correlation.version`. Omit if no application version is configured.
|
2358
|
-
- `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog.tracer.active_correlation.trace_id` or `0` if no trace is active during logging.
|
2359
|
-
- `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog.tracer.active_correlation.span_id` or `0` if no trace is active during logging.
|
2360
|
-
|
2361
|
-
By default, `Datadog::Correlation::Identifier#to_s` will return `dd.env=<ENV> dd.service=<SERVICE> dd.version=<VERSION> dd.trace_id=<TRACE_ID> dd.span_id=<SPAN_ID>`.
|
2362
|
-
|
2363
|
-
If a trace is not active and the application environment & version is not configured, it will return `dd.trace_id=0 dd.span_id=0 dd.env= dd.version=`.
|
2364
|
-
|
2365
|
-
An example of this in practice:
|
2366
|
-
|
2367
|
-
```ruby
|
2368
|
-
require 'ddtrace'
|
2369
|
-
require 'logger'
|
2370
|
-
|
2371
|
-
ENV['DD_ENV'] = 'production'
|
2372
|
-
ENV['DD_SERVICE'] = 'billing-api'
|
2373
|
-
ENV['DD_VERSION'] = '2.5.17'
|
2374
|
-
|
2375
|
-
logger = Logger.new(STDOUT)
|
2376
|
-
logger.progname = 'my_app'
|
2377
|
-
logger.formatter = proc do |severity, datetime, progname, msg|
|
2378
|
-
"[#{datetime}][#{progname}][#{severity}][#{Datadog.tracer.active_correlation}] #{msg}\n"
|
2379
|
-
end
|
2380
|
-
|
2381
|
-
# When no trace is active
|
2382
|
-
logger.warn('This is an untraced operation.')
|
2383
|
-
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=0 dd.span_id=0] This is an untraced operation.
|
2384
|
-
|
2385
|
-
# When a trace is active
|
2386
|
-
Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.') }
|
2387
|
-
# [2019-01-16 18:38:41 +0000][my_app][WARN][dd.env=production dd.service=billing-api dd.version=2.5.17 dd.trace_id=8545847825299552251 dd.span_id=3711755234730770098] This is a traced operation.
|
2388
|
-
```
|
2389
|
-
|
2390
|
-
### Configuring the transport layer
|
2391
|
-
|
2392
|
-
By default, the tracer submits trace data using the Unix socket `/var/run/datadog/apm.socket`, if one is created by the Agent. Otherwise, it connects via HTTP to `127.0.0.1:8126`, the default TCP location the Agent listens on.
|
2393
|
-
|
2394
|
-
However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
|
2395
|
-
|
2396
|
-
Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
|
2397
|
-
|
2398
|
-
#### Using the Net::HTTP adapter
|
2399
|
-
|
2400
|
-
The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default transport adapter.
|
2401
|
-
|
2402
|
-
```ruby
|
2403
|
-
Datadog.configure do |c|
|
2404
|
-
c.tracer.transport_options = proc { |t|
|
2405
|
-
# Hostname, port, and additional options. :timeout is in seconds.
|
2406
|
-
t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
|
2407
|
-
}
|
2408
|
-
end
|
2409
|
-
```
|
2410
|
-
|
2411
|
-
#### Using the Unix socket adapter
|
2412
|
-
|
2413
|
-
The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
|
2414
|
-
|
2415
|
-
To use, first configure your trace agent to listen by Unix socket, then configure the tracer with:
|
2416
|
-
|
2417
|
-
```ruby
|
2418
|
-
Datadog.configure do |c|
|
2419
|
-
c.tracer.transport_options = proc { |t|
|
2420
|
-
# Provide local path to trace agent Unix socket
|
2421
|
-
t.adapter :unix, '/tmp/ddagent/trace.sock'
|
2422
|
-
}
|
2423
|
-
end
|
2424
|
-
```
|
2425
|
-
|
2426
|
-
#### Using the transport test adapter
|
2427
|
-
|
2428
|
-
The `Test` adapter is a no-op transport that can optionally buffer requests. For use in test suites or other non-production environments.
|
2429
|
-
|
2430
|
-
```ruby
|
2431
|
-
Datadog.configure do |c|
|
2432
|
-
c.tracer.transport_options = proc { |t|
|
2433
|
-
# Set transport to no-op mode. Does not retain traces.
|
2434
|
-
t.adapter :test
|
2435
|
-
|
2436
|
-
# Alternatively, you can provide a buffer to examine trace output.
|
2437
|
-
# The buffer must respond to '<<'.
|
2438
|
-
t.adapter :test, []
|
2439
|
-
}
|
2440
|
-
end
|
2441
|
-
```
|
2442
|
-
|
2443
|
-
#### Using a custom transport adapter
|
2444
|
-
|
2445
|
-
Custom adapters can be configured with:
|
2446
|
-
|
2447
|
-
```ruby
|
2448
|
-
Datadog.configure do |c|
|
2449
|
-
c.tracer.transport_options = proc { |t|
|
2450
|
-
# Initialize and pass an instance of the adapter
|
2451
|
-
custom_adapter = CustomAdapter.new
|
2452
|
-
t.adapter custom_adapter
|
2453
|
-
}
|
2454
|
-
end
|
2455
|
-
```
|
2456
|
-
|
2457
|
-
### Metrics
|
2458
|
-
|
2459
|
-
The tracer and its integrations can produce some additional metrics that can provide useful insight into the performance of your application. These metrics are collected with `dogstatsd-ruby`, and can be sent to the same Datadog agent to which you send your traces.
|
2460
|
-
|
2461
|
-
To configure your application for metrics collection:
|
2462
|
-
|
2463
|
-
1. [Configure your Datadog agent for StatsD](https://docs.datadoghq.com/developers/dogstatsd/#setup)
|
2464
|
-
2. Add `gem 'dogstatsd-ruby', '~> 5.2'` to your Gemfile
|
2465
|
-
|
2466
|
-
#### For application runtime
|
2467
|
-
|
2468
|
-
If runtime metrics are configured, the trace library will automatically collect and send metrics about the health of your application.
|
2469
|
-
|
2470
|
-
To configure runtime metrics, add the following configuration:
|
2471
|
-
|
2472
|
-
```ruby
|
2473
|
-
# config/initializers/datadog.rb
|
2474
|
-
require 'datadog/statsd'
|
2475
|
-
require 'ddtrace'
|
2476
|
-
|
2477
|
-
Datadog.configure do |c|
|
2478
|
-
# To enable runtime metrics collection, set `true`. Defaults to `false`
|
2479
|
-
# You can also set DD_RUNTIME_METRICS_ENABLED=true to configure this.
|
2480
|
-
c.runtime_metrics.enabled = true
|
2481
|
-
|
2482
|
-
# Optionally, you can configure the Statsd instance used for sending runtime metrics.
|
2483
|
-
# Statsd is automatically configured with default settings if `dogstatsd-ruby` is available.
|
2484
|
-
# You can configure with host and port of Datadog agent; defaults to 'localhost:8125'.
|
2485
|
-
c.runtime_metrics.statsd = Datadog::Statsd.new
|
2486
|
-
end
|
2487
|
-
```
|
2488
|
-
|
2489
|
-
See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/frames) for more details about configuring `Datadog::Statsd`.
|
2490
|
-
|
2491
|
-
The stats are VM specific and will include:
|
2492
|
-
|
2493
|
-
| Name | Type | Description | Available on |
|
2494
|
-
| -------------------------- | ------- | -------------------------------------------------------- | ------------ |
|
2495
|
-
| `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. | CRuby |
|
2496
|
-
| `runtime.ruby.gc.*` | `gauge` | Garbage collection statistics: collected from `GC.stat`. | All runtimes |
|
2497
|
-
| `runtime.ruby.thread_count` | `gauge` | Number of threads. | All runtimes |
|
2498
|
-
| `runtime.ruby.global_constant_state` | `gauge` | Global constant cache generation. | CRuby |
|
2499
|
-
| `runtime.ruby.global_method_state` | `gauge` | [Global method cache generation.](https://tenderlovemaking.com/2015/12/23/inline-caching-in-mri.html) | [CRuby < 3.0.0](https://docs.ruby-lang.org/en/3.0.0/NEWS_md.html#label-Implementation+improvements) |
|
2500
|
-
|
2501
|
-
In addition, all metrics include the following tags:
|
2502
|
-
|
2503
|
-
| Name | Description |
|
2504
|
-
| ------------ | ------------------------------------------------------- |
|
2505
|
-
| `language` | Programming language traced. (e.g. `ruby`) |
|
2506
|
-
| `service` | List of services this associated with this metric. |
|
2507
|
-
|
2508
|
-
### OpenTracing
|
2509
|
-
|
2510
|
-
For setting up Datadog with OpenTracing, see out [Quickstart for OpenTracing](#quickstart-for-opentracing) section for details.
|
2511
|
-
|
2512
|
-
**Configuring Datadog tracer settings**
|
2513
|
-
|
2514
|
-
The underlying Datadog tracer can be configured by passing options (which match `Datadog::Tracer`) when configuring the global tracer:
|
2515
|
-
|
2516
|
-
```ruby
|
2517
|
-
# Where `options` is a Hash of options provided to Datadog::Tracer
|
2518
|
-
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(options)
|
2519
|
-
```
|
2520
|
-
|
2521
|
-
It can also be configured by using `Datadog.configure` described in the [Tracer settings](#tracer-settings) section.
|
2522
|
-
|
2523
|
-
**Activating and configuring integrations**
|
2524
|
-
|
2525
|
-
By default, configuring OpenTracing with Datadog will not automatically activate any additional instrumentation provided by Datadog. You will only receive spans and traces from OpenTracing instrumentation you have in your application.
|
2526
|
-
|
2527
|
-
However, additional instrumentation provided by Datadog can be activated alongside OpenTracing using `Datadog.configure`, which can be used to enhance your tracing further. To activate this, see [Integration instrumentation](#integration-instrumentation) for more details.
|
2528
|
-
|
2529
|
-
**Supported serialization formats**
|
2530
|
-
|
2531
|
-
| Type | Supported? | Additional information |
|
2532
|
-
| ------------------------------ | ---------- | ---------------------- |
|
2533
|
-
| `OpenTracing::FORMAT_TEXT_MAP` | Yes | |
|
2534
|
-
| `OpenTracing::FORMAT_RACK` | Yes | Because of the loss of resolution in the Rack format, please note that baggage items with names containing either upper case characters or `-` will be converted to lower case and `_` in a round-trip respectively. We recommend avoiding these characters or accommodating accordingly on the receiving end. |
|
2535
|
-
| `OpenTracing::FORMAT_BINARY` | No | |
|
2536
|
-
|
2537
|
-
### Profiling
|
2538
|
-
|
2539
|
-
*Currently available as BETA feature.*
|
2540
|
-
|
2541
|
-
`ddtrace` can produce profiles that measure method-level application resource usage within production environments. These profiles can give insight into resources spent in Ruby code outside of existing trace instrumentation.
|
2542
|
-
|
2543
|
-
**Setup**
|
2544
|
-
|
2545
|
-
To get started with profiling, follow the [Enabling the Ruby Profiler](https://docs.datadoghq.com/tracing/profiler/enabling/ruby/) guide.
|
2546
|
-
|
2547
|
-
#### Troubleshooting
|
2548
|
-
|
2549
|
-
If you run into issues with profiling, please check the [Profiler Troubleshooting Guide](https://docs.datadoghq.com/tracing/profiler/profiler_troubleshooting/?code-lang=ruby).
|
2550
|
-
|
2551
|
-
#### Profiling Resque jobs
|
2552
|
-
|
2553
|
-
When profiling [Resque](https://github.com/resque/resque) jobs, you should set the `RUN_AT_EXIT_HOOKS=1` option described in the [Resque](https://github.com/resque/resque/blob/v2.0.0/docs/HOOKS.md#worker-hooks) documentation.
|
2554
|
-
|
2555
|
-
Without this flag, profiles for short-lived Resque jobs will not be available as Resque kills worker processes before they have a chance to submit this information.
|
2556
|
-
|
2557
|
-
## Known issues and suggested configurations
|
2558
|
-
|
2559
|
-
### Payload too large
|
2560
|
-
|
2561
|
-
By default, Datadog limits the size of trace payloads to prevent memory overhead within instrumented applications. As a result, traces containing thousands of operations may not be sent to Datadog.
|
2562
|
-
|
2563
|
-
If traces are missing, enable [debug mode](#tracer-settings) to check if messages containing `"Dropping trace. Payload too large"` are logged.
|
2564
|
-
|
2565
|
-
Since debug mode is verbose, Datadog does not recommend leaving this enabled or enabling this in production. Disable it after confirming. You can inspect the [Datadog Agent logs](https://docs.datadoghq.com/agent/guide/agent-log-files/) for similar messages.
|
2566
|
-
|
2567
|
-
If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#tracer-settings) setting to break down large traces into smaller chunks.
|
2568
|
-
|
2569
|
-
### Stack level too deep
|
2570
|
-
|
2571
|
-
Datadog tracing collects trace data by adding instrumentation into other common libraries (e.g. Rails, Rack, etc.) Some libraries provide APIs to add this instrumentation, but some do not. In order to add instrumentation into libraries lacking an instrumentation API, Datadog uses a technique called "monkey-patching" to modify the code of that library.
|
2572
|
-
|
2573
|
-
In Ruby version 1.9.3 and earlier, "monkey-patching" often involved the use of [`alias_method`](https://ruby-doc.org/core-3.0.0/Module.html#method-i-alias_method), also known as *method rewriting*, to destructively replace existing Ruby methods. However, this practice would often create conflicts & errors if two libraries attempted to "rewrite" the same method. (e.g. two different APM packages trying to instrument the same method.)
|
2574
|
-
|
2575
|
-
In Ruby 2.0, the [`Module#prepend`](https://ruby-doc.org/core-3.0.0/Module.html#method-i-prepend) feature was introduced. This feature avoids destructive method rewriting and allows multiple "monkey patches" on the same method. Consequently, it has become the safest, preferred means to "monkey patch" code.
|
2576
|
-
|
2577
|
-
Datadog instrumentation almost exclusively uses the `Module#prepend` feature to add instrumentation non-destructively. However, some libraries (typically those supporting Ruby < 2.0) still use `alias_method` which can create conflicts with Datadog instrumentation, often resulting in `SystemStackError` or `stack level too deep` errors.
|
2578
|
-
|
2579
|
-
As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
|
2580
|
-
|
2581
|
-
* `rack-mini-profiler`: [Net::HTTP stack level too deep errors](https://github.com/MiniProfiler/rack-mini-profiler#nethttp-stack-level-too-deep-errors).
|
2582
|
-
|
2583
|
-
For libraries without a known workaround, consider removing the library using `alias` or `Module#alias_method` or separating libraries into different environments for testing.
|
2584
|
-
|
2585
|
-
For any further questions or to report an occurence of this issue, please [reach out to Datadog support](https://docs.datadoghq.com/help)
|