ddtrace 0.54.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -16
- data/CHANGELOG.md +213 -1
- data/CONTRIBUTING.md +1 -1
- data/LICENSE-3rdparty.csv +3 -1
- data/README.md +10 -1
- data/bin/ddtracerb +5 -5
- data/ddtrace.gemspec +22 -7
- data/docs/0.x-trace.png +0 -0
- data/docs/1.0-trace.png +0 -0
- data/docs/AutoInstrumentation.md +36 -0
- data/docs/Deprecation.md +8 -0
- data/docs/DevelopmentGuide.md +1 -1
- data/docs/GettingStarted.md +596 -510
- data/docs/ProfilingDevelopment.md +36 -34
- data/docs/PublicApi.md +14 -0
- data/docs/UpgradeGuide.md +736 -0
- data/ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c +118 -0
- data/ext/ddtrace_profiling_loader/extconf.rb +54 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +36 -9
- data/ext/ddtrace_profiling_native_extension/clock_id.h +1 -1
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +1 -9
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +1 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +269 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +278 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +9 -0
- data/ext/ddtrace_profiling_native_extension/extconf.rb +123 -103
- data/ext/ddtrace_profiling_native_extension/http_transport.c +341 -0
- data/ext/ddtrace_profiling_native_extension/libddprof_helpers.h +13 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +274 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +655 -8
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +33 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +14 -1
- data/ext/ddtrace_profiling_native_extension/ruby_helpers.h +33 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +147 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +37 -0
- data/lib/datadog/appsec/assets/blocked.html +4 -0
- data/lib/datadog/appsec/assets/waf_rules/README.md +7 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +5638 -0
- data/lib/datadog/appsec/assets/waf_rules/risky.json +1499 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +1298 -0
- data/lib/datadog/appsec/assets.rb +38 -0
- data/lib/datadog/appsec/autoload.rb +16 -0
- data/lib/datadog/appsec/configuration/settings.rb +194 -0
- data/lib/datadog/appsec/configuration.rb +80 -0
- data/lib/datadog/appsec/contrib/auto_instrument.rb +29 -0
- data/lib/datadog/appsec/contrib/configuration/settings.rb +20 -0
- data/lib/datadog/appsec/contrib/integration.rb +37 -0
- data/lib/datadog/appsec/contrib/patcher.rb +12 -0
- data/lib/datadog/appsec/contrib/rack/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/rack/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +169 -0
- data/lib/datadog/appsec/contrib/rack/integration.rb +49 -0
- data/lib/datadog/appsec/contrib/rack/patcher.rb +32 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +87 -0
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +64 -0
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +64 -0
- data/lib/datadog/appsec/contrib/rack/request.rb +58 -0
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +41 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +112 -0
- data/lib/datadog/appsec/contrib/rack/response.rb +24 -0
- data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/rails/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/rails/framework.rb +30 -0
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +81 -0
- data/lib/datadog/appsec/contrib/rails/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/rails/patcher.rb +158 -0
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +68 -0
- data/lib/datadog/appsec/contrib/rails/request.rb +33 -0
- data/lib/datadog/appsec/contrib/rails/request_middleware.rb +20 -0
- data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +22 -0
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +15 -0
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +34 -0
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +124 -0
- data/lib/datadog/appsec/contrib/sinatra/integration.rb +48 -0
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +144 -0
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +63 -0
- data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +20 -0
- data/lib/datadog/appsec/event.rb +121 -0
- data/lib/datadog/appsec/extensions.rb +118 -0
- data/lib/datadog/appsec/instrumentation/gateway.rb +44 -0
- data/lib/datadog/appsec/processor.rb +164 -0
- data/lib/datadog/appsec/rate_limiter.rb +60 -0
- data/lib/datadog/appsec/reactive/address_hash.rb +18 -0
- data/lib/datadog/appsec/reactive/engine.rb +44 -0
- data/lib/datadog/appsec/reactive/operation.rb +51 -0
- data/lib/datadog/appsec/reactive/subscriber.rb +18 -0
- data/lib/datadog/appsec.rb +23 -0
- data/lib/datadog/ci/configuration/components.rb +9 -8
- data/lib/datadog/ci/configuration/settings.rb +19 -3
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +4 -2
- data/lib/datadog/ci/contrib/cucumber/ext.rb +2 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +4 -9
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +2 -1
- data/lib/datadog/ci/contrib/cucumber/integration.rb +3 -2
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +3 -2
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +4 -2
- data/lib/datadog/ci/contrib/rspec/example.rb +4 -9
- data/lib/datadog/ci/contrib/rspec/ext.rb +2 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +3 -2
- data/lib/datadog/ci/contrib/rspec/patcher.rb +3 -2
- data/lib/datadog/ci/ext/app_types.rb +2 -1
- data/lib/datadog/ci/ext/environment.rb +128 -110
- data/lib/datadog/ci/ext/settings.rb +2 -1
- data/lib/datadog/ci/ext/test.rb +1 -0
- data/lib/datadog/ci/extensions.rb +5 -4
- data/lib/datadog/ci/flush.rb +38 -0
- data/lib/datadog/ci/test.rb +15 -13
- data/lib/datadog/ci.rb +4 -1
- data/lib/datadog/core/buffer/cruby.rb +55 -0
- data/lib/datadog/core/buffer/random.rb +134 -0
- data/lib/datadog/core/buffer/thread_safe.rb +58 -0
- data/lib/datadog/core/chunker.rb +35 -0
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +365 -0
- data/lib/datadog/core/configuration/base.rb +89 -0
- data/lib/datadog/core/configuration/components.rb +426 -0
- data/lib/datadog/core/configuration/dependency_resolver.rb +28 -0
- data/lib/datadog/core/configuration/option.rb +69 -0
- data/lib/datadog/core/configuration/option_definition.rb +126 -0
- data/lib/datadog/core/configuration/option_definition_set.rb +22 -0
- data/lib/datadog/core/configuration/option_set.rb +10 -0
- data/lib/datadog/core/configuration/options.rb +118 -0
- data/lib/datadog/core/configuration/settings.rb +625 -0
- data/lib/datadog/core/configuration.rb +286 -0
- data/lib/datadog/core/diagnostics/environment_logger.rb +283 -0
- data/lib/datadog/core/diagnostics/ext.rb +41 -0
- data/lib/datadog/core/diagnostics/health.rb +37 -0
- data/lib/datadog/core/encoding.rb +76 -0
- data/lib/datadog/core/environment/cgroup.rb +4 -1
- data/lib/datadog/core/environment/class_count.rb +1 -0
- data/lib/datadog/core/environment/container.rb +3 -1
- data/lib/datadog/core/environment/ext.rb +28 -9
- data/lib/datadog/core/environment/gc.rb +1 -0
- data/lib/datadog/core/environment/identity.rb +11 -4
- data/lib/datadog/core/environment/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 +28 -2
- data/lib/datadog/core/environment/vm_cache.rb +1 -0
- data/lib/datadog/core/error.rb +101 -0
- data/lib/datadog/core/extensions.rb +16 -0
- data/lib/datadog/core/git/ext.rb +35 -0
- data/lib/datadog/core/logger.rb +46 -0
- data/lib/datadog/core/logging/ext.rb +11 -0
- data/lib/datadog/core/metrics/client.rb +198 -0
- data/lib/datadog/core/metrics/ext.rb +20 -0
- data/lib/datadog/core/metrics/helpers.rb +25 -0
- data/lib/datadog/core/metrics/logging.rb +44 -0
- data/lib/datadog/core/metrics/metric.rb +14 -0
- data/lib/datadog/core/metrics/options.rb +50 -0
- data/lib/datadog/core/pin.rb +75 -0
- data/lib/datadog/core/runtime/ext.rb +28 -0
- data/lib/datadog/core/runtime/metrics.rb +126 -0
- data/lib/datadog/core/utils/compression.rb +32 -0
- data/lib/datadog/core/utils/forking.rb +63 -0
- data/lib/datadog/core/utils/object_set.rb +43 -0
- data/lib/datadog/core/utils/only_once.rb +44 -0
- data/lib/datadog/core/utils/safe_dup.rb +27 -0
- data/lib/datadog/core/utils/sequence.rb +21 -0
- data/lib/datadog/core/utils/string_table.rb +49 -0
- data/lib/datadog/core/utils/time.rb +54 -0
- data/lib/datadog/core/utils.rb +115 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/composite_read_io.rb +120 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/multipartable.rb +61 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb +139 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post/version.rb +13 -0
- data/lib/datadog/core/vendor/multipart-post/multipart/post.rb +12 -0
- data/lib/datadog/core/vendor/multipart-post/multipart.rb +16 -0
- data/lib/datadog/core/vendor/multipart-post/net/http/post/multipart.rb +36 -0
- data/lib/datadog/core/worker.rb +24 -0
- data/lib/datadog/core/workers/async.rb +182 -0
- data/lib/datadog/core/workers/interval_loop.rb +119 -0
- data/lib/datadog/core/workers/polling.rb +59 -0
- data/lib/datadog/core/workers/queue.rb +44 -0
- data/lib/datadog/core/workers/runtime_metrics.rb +62 -0
- data/lib/datadog/core.rb +80 -0
- data/lib/datadog/kit/enable_core_dumps.rb +50 -0
- data/lib/datadog/kit/identity.rb +63 -0
- data/lib/datadog/kit.rb +11 -0
- data/lib/datadog/opentracer/binary_propagator.rb +26 -0
- data/lib/datadog/opentracer/carrier.rb +9 -0
- data/lib/datadog/opentracer/distributed_headers.rb +58 -0
- data/lib/datadog/opentracer/global_tracer.rb +17 -0
- data/lib/datadog/opentracer/propagator.rb +26 -0
- data/lib/datadog/opentracer/rack_propagator.rb +72 -0
- data/lib/datadog/opentracer/scope.rb +18 -0
- data/lib/datadog/opentracer/scope_manager.rb +9 -0
- data/lib/datadog/opentracer/span.rb +101 -0
- data/lib/datadog/opentracer/span_context.rb +19 -0
- data/lib/datadog/opentracer/span_context_factory.rb +27 -0
- data/lib/datadog/opentracer/text_map_propagator.rb +87 -0
- data/lib/datadog/opentracer/thread_local_scope.rb +34 -0
- data/lib/datadog/opentracer/thread_local_scope_manager.rb +66 -0
- data/lib/datadog/opentracer/tracer.rb +212 -0
- data/lib/datadog/opentracer.rb +24 -0
- data/lib/datadog/profiling/backtrace_location.rb +34 -0
- data/lib/datadog/profiling/buffer.rb +43 -0
- data/lib/datadog/profiling/collectors/code_provenance.rb +115 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time.rb +42 -0
- data/lib/datadog/profiling/collectors/old_stack.rb +298 -0
- data/lib/datadog/profiling/collectors/stack.rb +18 -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 +74 -0
- data/lib/datadog/profiling/ext/forking.rb +99 -0
- data/lib/datadog/profiling/ext.rb +44 -0
- data/lib/datadog/profiling/flush.rb +41 -0
- data/lib/datadog/profiling/http_transport.rb +131 -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_ext.rb +42 -0
- data/lib/datadog/profiling/old_recorder.rb +106 -0
- data/lib/datadog/profiling/pprof/builder.rb +127 -0
- data/lib/datadog/profiling/pprof/converter.rb +104 -0
- data/lib/datadog/profiling/pprof/message_set.rb +16 -0
- data/lib/datadog/profiling/pprof/payload.rb +20 -0
- data/lib/datadog/profiling/pprof/pprof_pb.rb +83 -0
- data/lib/datadog/profiling/pprof/stack_sample.rb +141 -0
- data/lib/datadog/profiling/pprof/string_table.rb +12 -0
- data/lib/datadog/profiling/pprof/template.rb +120 -0
- data/lib/datadog/profiling/preload.rb +5 -0
- data/lib/datadog/profiling/profiler.rb +34 -0
- data/lib/datadog/profiling/scheduler.rb +132 -0
- data/lib/datadog/profiling/stack_recorder.rb +33 -0
- data/lib/datadog/profiling/tag_builder.rb +48 -0
- data/lib/datadog/profiling/tasks/exec.rb +50 -0
- data/lib/datadog/profiling/tasks/help.rb +18 -0
- data/lib/datadog/profiling/tasks/setup.rb +93 -0
- data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +45 -0
- data/lib/datadog/profiling/trace_identifiers/helper.rb +47 -0
- data/lib/datadog/profiling/transport/http/api/endpoint.rb +85 -0
- data/lib/datadog/profiling/transport/http/api/instance.rb +38 -0
- data/lib/datadog/profiling/transport/http/api/spec.rb +42 -0
- data/lib/datadog/profiling/transport/http/api.rb +45 -0
- data/lib/datadog/profiling/transport/http/builder.rb +30 -0
- data/lib/datadog/profiling/transport/http/client.rb +37 -0
- data/lib/datadog/profiling/transport/http/response.rb +21 -0
- data/lib/datadog/profiling/transport/http.rb +112 -0
- data/lib/datadog/profiling.rb +170 -0
- data/lib/datadog/tracing/analytics.rb +25 -0
- data/lib/datadog/tracing/buffer.rb +132 -0
- data/lib/datadog/tracing/configuration/ext.rb +51 -0
- data/lib/datadog/tracing/context.rb +68 -0
- data/lib/datadog/tracing/context_provider.rb +82 -0
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/action_cable/event.rb +72 -0
- data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +58 -0
- data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +63 -0
- data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +59 -0
- data/lib/datadog/tracing/contrib/action_cable/events.rb +37 -0
- data/lib/datadog/tracing/contrib/action_cable/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/action_cable/instrumentation.rb +91 -0
- data/lib/datadog/tracing/contrib/action_cable/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/action_cable/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/action_mailer/event.rb +52 -0
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +60 -0
- data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +47 -0
- data/lib/datadog/tracing/contrib/action_mailer/events.rb +34 -0
- data/lib/datadog/tracing/contrib/action_mailer/ext.rb +33 -0
- data/lib/datadog/tracing/contrib/action_mailer/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +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 +26 -0
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +36 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +33 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/event.rb +69 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +45 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +47 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +34 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/integration.rb +45 -0
- data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/makara_resolver.rb +36 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +138 -0
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +39 -0
- data/lib/datadog/tracing/contrib/active_record/event.rb +30 -0
- data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +58 -0
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +78 -0
- data/lib/datadog/tracing/contrib/active_record/events.rb +34 -0
- data/lib/datadog/tracing/contrib/active_record/ext.rb +29 -0
- data/lib/datadog/tracing/contrib/active_record/integration.rb +56 -0
- data/lib/datadog/tracing/contrib/active_record/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/active_record/utils.rb +128 -0
- data/lib/datadog/tracing/contrib/active_record/vendor/connection_specification.rb +307 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +270 -0
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +73 -0
- data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +47 -0
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/active_support/ext.rb +31 -0
- data/lib/datadog/tracing/contrib/active_support/integration.rb +51 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +71 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +71 -0
- data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +164 -0
- data/lib/datadog/tracing/contrib/active_support/patcher.rb +27 -0
- data/lib/datadog/tracing/contrib/analytics.rb +29 -0
- data/lib/datadog/tracing/contrib/auto_instrument.rb +53 -0
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/aws/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +95 -0
- data/lib/datadog/tracing/contrib/aws/integration.rb +47 -0
- data/lib/datadog/tracing/contrib/aws/parsed_context.rb +60 -0
- data/lib/datadog/tracing/contrib/aws/patcher.rb +57 -0
- data/lib/datadog/tracing/contrib/aws/services.rb +123 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +23 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/context_composite_executor_service.rb +53 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +16 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/future_patch.rb +27 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/configurable.rb +102 -0
- data/lib/datadog/tracing/contrib/configuration/resolver.rb +85 -0
- data/lib/datadog/tracing/contrib/configuration/resolvers/pattern_resolver.rb +43 -0
- data/lib/datadog/tracing/contrib/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +58 -0
- data/lib/datadog/tracing/contrib/dalli/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/dalli/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/dalli/quantize.rb +26 -0
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/delayed_job/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/delayed_job/plugin.rb +101 -0
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/elasticsearch/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +151 -0
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +89 -0
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +177 -0
- data/lib/datadog/tracing/contrib/ethon/ext.rb +24 -0
- data/lib/datadog/tracing/contrib/ethon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +96 -0
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/excon/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/excon/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +170 -0
- data/lib/datadog/tracing/contrib/excon/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/extensions.rb +197 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/faraday/connection.rb +22 -0
- data/lib/datadog/tracing/contrib/faraday/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/faraday/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +93 -0
- data/lib/datadog/tracing/contrib/faraday/patcher.rb +56 -0
- data/lib/datadog/tracing/contrib/faraday/rack_builder.rb +22 -0
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +42 -0
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +253 -0
- data/lib/datadog/tracing/contrib/grape/ext.rb +28 -0
- data/lib/datadog/tracing/contrib/grape/instrumentation.rb +37 -0
- data/lib/datadog/tracing/contrib/grape/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/grape/patcher.rb +33 -0
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/graphql/ext.rb +19 -0
- data/lib/datadog/tracing/contrib/graphql/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/graphql/patcher.rb +91 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +84 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +90 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +108 -0
- data/lib/datadog/tracing/contrib/grpc/ext.rb +23 -0
- data/lib/datadog/tracing/contrib/grpc/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/grpc/intercept_with_datadog.rb +53 -0
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +44 -0
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/http/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +139 -0
- data/lib/datadog/tracing/contrib/http/integration.rb +49 -0
- data/lib/datadog/tracing/contrib/http/patcher.rb +30 -0
- data/lib/datadog/tracing/contrib/http_annotation_helper.rb +17 -0
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +117 -0
- data/lib/datadog/tracing/contrib/httpclient/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/httpclient/patcher.rb +42 -0
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/httprb/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +128 -0
- data/lib/datadog/tracing/contrib/httprb/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/httprb/patcher.rb +42 -0
- data/lib/datadog/tracing/contrib/integration.rb +78 -0
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +18 -0
- data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +18 -0
- data/lib/datadog/tracing/contrib/kafka/event.rb +52 -0
- data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +42 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +49 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +47 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +47 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/join_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/leave_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/sync_group.rb +37 -0
- data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +40 -0
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +43 -0
- data/lib/datadog/tracing/contrib/kafka/events.rb +48 -0
- data/lib/datadog/tracing/contrib/kafka/ext.rb +52 -0
- data/lib/datadog/tracing/contrib/kafka/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/kafka/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +23 -0
- data/lib/datadog/tracing/contrib/lograge/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +47 -0
- data/lib/datadog/tracing/contrib/lograge/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/lograge/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/mongodb/instrumentation.rb +47 -0
- data/lib/datadog/tracing/contrib/mongodb/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/mongodb/parsers.rb +49 -0
- data/lib/datadog/tracing/contrib/mongodb/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +121 -0
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +62 -0
- data/lib/datadog/tracing/contrib/mysql2/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/mysql2/patcher.rb +31 -0
- data/lib/datadog/tracing/contrib/patchable.rb +109 -0
- data/lib/datadog/tracing/contrib/patcher.rb +74 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/pg/ext.rb +31 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +129 -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 +35 -0
- data/lib/datadog/tracing/contrib/presto/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +125 -0
- data/lib/datadog/tracing/contrib/presto/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/presto/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/qless/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/qless/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/qless/patcher.rb +38 -0
- data/lib/datadog/tracing/contrib/qless/qless_job.rb +75 -0
- data/lib/datadog/tracing/contrib/qless/tracer_cleaner.rb +32 -0
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +49 -0
- data/lib/datadog/tracing/contrib/que/ext.rb +34 -0
- data/lib/datadog/tracing/contrib/que/integration.rb +46 -0
- data/lib/datadog/tracing/contrib/que/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/que/tracer.rb +61 -0
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/event.rb +79 -0
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events/consume.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +35 -0
- data/lib/datadog/tracing/contrib/racecar/events.rb +36 -0
- data/lib/datadog/tracing/contrib/racecar/ext.rb +31 -0
- data/lib/datadog/tracing/contrib/racecar/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/racecar/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +51 -0
- data/lib/datadog/tracing/contrib/rack/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/rack/integration.rb +50 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +255 -0
- data/lib/datadog/tracing/contrib/rack/patcher.rb +109 -0
- data/lib/datadog/tracing/contrib/rack/request_queue.rb +48 -0
- data/lib/datadog/tracing/contrib/rails/auto_instrument_railtie.rb +12 -0
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +74 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/framework.rb +153 -0
- data/lib/datadog/tracing/contrib/rails/integration.rb +49 -0
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +34 -0
- data/lib/datadog/tracing/contrib/rails/middlewares.rb +47 -0
- data/lib/datadog/tracing/contrib/rails/patcher.rb +121 -0
- data/lib/datadog/tracing/contrib/rails/railtie.rb +19 -0
- data/lib/datadog/tracing/contrib/rails/utils.rb +28 -0
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +36 -0
- data/lib/datadog/tracing/contrib/rake/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/rake/instrumentation.rb +98 -0
- data/lib/datadog/tracing/contrib/rake/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rake/patcher.rb +34 -0
- data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +49 -0
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +40 -0
- data/lib/datadog/tracing/contrib/redis/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/redis/instrumentation.rb +78 -0
- data/lib/datadog/tracing/contrib/redis/integration.rb +47 -0
- data/lib/datadog/tracing/contrib/redis/patcher.rb +35 -0
- data/lib/datadog/tracing/contrib/redis/quantize.rb +79 -0
- data/lib/datadog/tracing/contrib/redis/tags.rb +54 -0
- data/lib/datadog/tracing/contrib/redis/vendor/resolver.rb +162 -0
- data/lib/datadog/tracing/contrib/registerable.rb +50 -0
- data/lib/datadog/tracing/contrib/registry.rb +52 -0
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/resque/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/resque/integration.rb +48 -0
- data/lib/datadog/tracing/contrib/resque/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/resque/resque_job.rb +103 -0
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +37 -0
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +21 -0
- data/lib/datadog/tracing/contrib/rest_client/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/rest_client/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +105 -0
- data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +23 -0
- data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +15 -0
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +51 -0
- data/lib/datadog/tracing/contrib/semantic_logger/integration.rb +52 -0
- data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +33 -0
- data/lib/datadog/tracing/contrib/sequel/database.rb +60 -0
- data/lib/datadog/tracing/contrib/sequel/dataset.rb +65 -0
- data/lib/datadog/tracing/contrib/sequel/ext.rb +22 -0
- data/lib/datadog/tracing/contrib/sequel/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sequel/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/sequel/utils.rb +87 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +25 -0
- data/lib/datadog/tracing/contrib/shoryuken/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +28 -0
- data/lib/datadog/tracing/contrib/shoryuken/tracer.rb +61 -0
- data/lib/datadog/tracing/contrib/sidekiq/client_tracer.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +44 -0
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +38 -0
- data/lib/datadog/tracing/contrib/sidekiq/integration.rb +53 -0
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +71 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/heartbeat.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/job_fetch.rb +34 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +33 -0
- data/lib/datadog/tracing/contrib/sidekiq/server_tracer.rb +98 -0
- data/lib/datadog/tracing/contrib/sidekiq/tracing.rb +44 -0
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +43 -0
- data/lib/datadog/tracing/contrib/sinatra/env.rb +66 -0
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +32 -0
- data/lib/datadog/tracing/contrib/sinatra/framework.rb +118 -0
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +35 -0
- data/lib/datadog/tracing/contrib/sinatra/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +76 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +159 -0
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +123 -0
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +38 -0
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +26 -0
- data/lib/datadog/tracing/contrib/sneakers/integration.rb +46 -0
- data/lib/datadog/tracing/contrib/sneakers/patcher.rb +29 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +58 -0
- data/lib/datadog/tracing/contrib/status_code_matcher.rb +75 -0
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +35 -0
- data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +28 -0
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +27 -0
- data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +105 -0
- data/lib/datadog/tracing/contrib/sucker_punch/integration.rb +43 -0
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +37 -0
- data/lib/datadog/tracing/contrib/utils/database.rb +31 -0
- data/lib/datadog/tracing/contrib/utils/quantization/hash.rb +111 -0
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +99 -0
- data/lib/datadog/tracing/contrib.rb +77 -0
- data/lib/datadog/tracing/correlation.rb +100 -0
- data/lib/datadog/tracing/distributed/headers/b3.rb +55 -0
- data/lib/datadog/tracing/distributed/headers/b3_single.rb +67 -0
- data/lib/datadog/tracing/distributed/headers/datadog.rb +52 -0
- data/lib/datadog/tracing/distributed/headers/ext.rb +31 -0
- data/lib/datadog/tracing/distributed/headers/parser.rb +37 -0
- data/lib/datadog/tracing/distributed/helpers.rb +78 -0
- data/lib/datadog/tracing/distributed/metadata/b3.rb +55 -0
- data/lib/datadog/tracing/distributed/metadata/b3_single.rb +66 -0
- data/lib/datadog/tracing/distributed/metadata/datadog.rb +73 -0
- data/lib/datadog/tracing/distributed/metadata/parser.rb +34 -0
- data/lib/datadog/tracing/event.rb +78 -0
- data/lib/datadog/tracing/flush.rb +74 -0
- data/lib/datadog/tracing/metadata/analytics.rb +26 -0
- data/lib/datadog/tracing/metadata/errors.rb +24 -0
- data/lib/datadog/tracing/metadata/ext.rb +176 -0
- data/lib/datadog/tracing/metadata/tagging.rb +116 -0
- data/lib/datadog/tracing/metadata.rb +20 -0
- data/lib/datadog/tracing/pipeline/span_filter.rb +42 -0
- data/lib/datadog/tracing/pipeline/span_processor.rb +39 -0
- data/lib/datadog/tracing/pipeline.rb +65 -0
- data/lib/datadog/tracing/propagation/grpc.rb +98 -0
- data/lib/datadog/tracing/propagation/http.rb +109 -0
- data/lib/datadog/tracing/runtime/metrics.rb +19 -0
- data/lib/datadog/tracing/sampling/all_sampler.rb +25 -0
- data/lib/datadog/tracing/sampling/ext.rb +27 -0
- data/lib/datadog/tracing/sampling/matcher.rb +68 -0
- data/lib/datadog/tracing/sampling/priority_sampler.rb +112 -0
- data/lib/datadog/tracing/sampling/rate_by_key_sampler.rb +97 -0
- data/lib/datadog/tracing/sampling/rate_by_service_sampler.rb +41 -0
- data/lib/datadog/tracing/sampling/rate_limiter.rb +185 -0
- data/lib/datadog/tracing/sampling/rate_sampler.rb +55 -0
- data/lib/datadog/tracing/sampling/rule.rb +76 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +131 -0
- data/lib/datadog/tracing/sampling/sampler.rb +44 -0
- data/lib/datadog/tracing/sampling/span/matcher.rb +80 -0
- data/lib/datadog/tracing/span.rb +232 -0
- data/lib/datadog/tracing/span_operation.rb +521 -0
- data/lib/datadog/tracing/sync_writer.rb +69 -0
- data/lib/datadog/tracing/trace_digest.rb +60 -0
- data/lib/datadog/tracing/trace_operation.rb +431 -0
- data/lib/datadog/tracing/trace_segment.rb +207 -0
- data/lib/datadog/tracing/tracer.rb +505 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +195 -0
- data/lib/datadog/tracing/workers.rb +125 -0
- data/lib/datadog/tracing/writer.rb +180 -0
- data/lib/datadog/tracing.rb +142 -0
- data/lib/ddtrace/auto_instrument.rb +6 -2
- data/lib/ddtrace/auto_instrument_base.rb +1 -0
- data/lib/ddtrace/profiling/preload.rb +2 -2
- data/lib/ddtrace/transport/ext.rb +35 -0
- data/lib/ddtrace/transport/http/adapters/net.rb +3 -2
- data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +3 -2
- data/lib/ddtrace/transport/http/api/endpoint.rb +1 -0
- data/lib/ddtrace/transport/http/api/fallbacks.rb +1 -0
- data/lib/ddtrace/transport/http/api/instance.rb +1 -0
- data/lib/ddtrace/transport/http/api/map.rb +1 -0
- data/lib/ddtrace/transport/http/api/spec.rb +1 -0
- data/lib/ddtrace/transport/http/api.rb +5 -11
- data/lib/ddtrace/transport/http/builder.rb +3 -2
- data/lib/ddtrace/transport/http/client.rb +3 -1
- data/lib/ddtrace/transport/http/env.rb +1 -0
- data/lib/ddtrace/transport/http/response.rb +35 -4
- data/lib/ddtrace/transport/http/statistics.rb +1 -0
- data/lib/ddtrace/transport/http/traces.rb +3 -0
- data/lib/ddtrace/transport/http.rb +33 -28
- data/lib/ddtrace/transport/io/client.rb +4 -1
- data/lib/ddtrace/transport/io/response.rb +1 -0
- data/lib/ddtrace/transport/io/traces.rb +2 -1
- data/lib/ddtrace/transport/io.rb +3 -2
- data/lib/ddtrace/transport/parcel.rb +2 -0
- data/lib/ddtrace/transport/request.rb +1 -0
- data/lib/ddtrace/transport/response.rb +1 -0
- data/lib/ddtrace/transport/serializable_trace.rb +118 -0
- data/lib/ddtrace/transport/statistics.rb +6 -4
- data/lib/ddtrace/transport/trace_formatter.rb +187 -0
- data/lib/ddtrace/transport/traces.rb +15 -5
- data/lib/ddtrace/version.rb +15 -13
- data/lib/ddtrace.rb +9 -48
- metadata +615 -490
- data/.yardopts +0 -5
- data/lib/datadog/ci/context_flush.rb +0 -29
- data/lib/datadog/contrib.rb +0 -71
- data/lib/ddtrace/analytics.rb +0 -39
- data/lib/ddtrace/buffer.rb +0 -340
- data/lib/ddtrace/chunker.rb +0 -35
- data/lib/ddtrace/configuration/agent_settings_resolver.rb +0 -309
- data/lib/ddtrace/configuration/base.rb +0 -82
- data/lib/ddtrace/configuration/components.rb +0 -292
- data/lib/ddtrace/configuration/dependency_resolver.rb +0 -25
- data/lib/ddtrace/configuration/option.rb +0 -65
- data/lib/ddtrace/configuration/option_definition.rb +0 -122
- data/lib/ddtrace/configuration/option_definition_set.rb +0 -19
- data/lib/ddtrace/configuration/option_set.rb +0 -7
- data/lib/ddtrace/configuration/options.rb +0 -112
- data/lib/ddtrace/configuration/pin_setup.rb +0 -32
- data/lib/ddtrace/configuration/settings.rb +0 -413
- data/lib/ddtrace/configuration.rb +0 -195
- data/lib/ddtrace/context.rb +0 -334
- data/lib/ddtrace/context_flush.rb +0 -82
- data/lib/ddtrace/context_provider.rb +0 -62
- data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/action_cable/event.rb +0 -67
- data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +0 -50
- data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +0 -56
- data/lib/ddtrace/contrib/action_cable/events/transmit.rb +0 -51
- data/lib/ddtrace/contrib/action_cable/events.rb +0 -34
- data/lib/ddtrace/contrib/action_cable/ext.rb +0 -27
- data/lib/ddtrace/contrib/action_cable/instrumentation.rb +0 -78
- data/lib/ddtrace/contrib/action_cable/integration.rb +0 -46
- data/lib/ddtrace/contrib/action_cable/patcher.rb +0 -29
- data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/action_mailer/event.rb +0 -50
- data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +0 -54
- data/lib/ddtrace/contrib/action_mailer/events/process.rb +0 -41
- data/lib/ddtrace/contrib/action_mailer/events.rb +0 -31
- data/lib/ddtrace/contrib/action_mailer/ext.rb +0 -32
- data/lib/ddtrace/contrib/action_mailer/integration.rb +0 -45
- data/lib/ddtrace/contrib/action_mailer/patcher.rb +0 -27
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +0 -157
- data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +0 -26
- data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/action_pack/ext.rb +0 -20
- data/lib/ddtrace/contrib/action_pack/integration.rb +0 -46
- data/lib/ddtrace/contrib/action_pack/patcher.rb +0 -24
- data/lib/ddtrace/contrib/action_pack/utils.rb +0 -37
- data/lib/ddtrace/contrib/action_view/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/action_view/event.rb +0 -36
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +0 -47
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +0 -50
- data/lib/ddtrace/contrib/action_view/events.rb +0 -31
- data/lib/ddtrace/contrib/action_view/ext.rb +0 -21
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +0 -75
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +0 -168
- data/lib/ddtrace/contrib/action_view/integration.rb +0 -53
- data/lib/ddtrace/contrib/action_view/patcher.rb +0 -48
- data/lib/ddtrace/contrib/action_view/utils.rb +0 -33
- data/lib/ddtrace/contrib/active_job/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/active_job/event.rb +0 -54
- data/lib/ddtrace/contrib/active_job/events/discard.rb +0 -46
- data/lib/ddtrace/contrib/active_job/events/enqueue.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +0 -47
- data/lib/ddtrace/contrib/active_job/events/perform.rb +0 -45
- data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +0 -46
- data/lib/ddtrace/contrib/active_job/events.rb +0 -39
- data/lib/ddtrace/contrib/active_job/ext.rb +0 -32
- data/lib/ddtrace/contrib/active_job/integration.rb +0 -46
- data/lib/ddtrace/contrib/active_job/log_injection.rb +0 -21
- data/lib/ddtrace/contrib/active_job/patcher.rb +0 -33
- data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/active_model_serializers/event.rb +0 -69
- data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +0 -33
- data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +0 -36
- data/lib/ddtrace/contrib/active_model_serializers/events.rb +0 -31
- data/lib/ddtrace/contrib/active_model_serializers/ext.rb +0 -21
- data/lib/ddtrace/contrib/active_model_serializers/integration.rb +0 -41
- data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +0 -30
- data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +0 -31
- data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +0 -135
- data/lib/ddtrace/contrib/active_record/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/active_record/event.rb +0 -31
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +0 -61
- data/lib/ddtrace/contrib/active_record/events/sql.rb +0 -69
- data/lib/ddtrace/contrib/active_record/events.rb +0 -31
- data/lib/ddtrace/contrib/active_record/ext.rb +0 -25
- data/lib/ddtrace/contrib/active_record/integration.rb +0 -54
- data/lib/ddtrace/contrib/active_record/patcher.rb +0 -24
- data/lib/ddtrace/contrib/active_record/utils.rb +0 -124
- data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +0 -259
- data/lib/ddtrace/contrib/active_support/cache/patcher.rb +0 -70
- data/lib/ddtrace/contrib/active_support/cache/redis.rb +0 -44
- data/lib/ddtrace/contrib/active_support/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/active_support/ext.rb +0 -28
- data/lib/ddtrace/contrib/active_support/integration.rb +0 -47
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +0 -76
- data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +0 -68
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +0 -164
- data/lib/ddtrace/contrib/active_support/patcher.rb +0 -24
- data/lib/ddtrace/contrib/analytics.rb +0 -25
- data/lib/ddtrace/contrib/auto_instrument.rb +0 -48
- data/lib/ddtrace/contrib/aws/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/aws/ext.rb +0 -24
- data/lib/ddtrace/contrib/aws/instrumentation.rb +0 -91
- data/lib/ddtrace/contrib/aws/integration.rb +0 -43
- data/lib/ddtrace/contrib/aws/parsed_context.rb +0 -57
- data/lib/ddtrace/contrib/aws/patcher.rb +0 -54
- data/lib/ddtrace/contrib/aws/services.rb +0 -119
- data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +0 -21
- data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +0 -42
- data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +0 -13
- data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +0 -24
- data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +0 -39
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +0 -30
- data/lib/ddtrace/contrib/configurable.rb +0 -103
- data/lib/ddtrace/contrib/configuration/resolver.rb +0 -82
- data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +0 -40
- data/lib/ddtrace/contrib/configuration/settings.rb +0 -56
- data/lib/ddtrace/contrib/dalli/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/dalli/ext.rb +0 -21
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +0 -55
- data/lib/ddtrace/contrib/dalli/integration.rb +0 -39
- data/lib/ddtrace/contrib/dalli/patcher.rb +0 -26
- data/lib/ddtrace/contrib/dalli/quantize.rb +0 -23
- data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/delayed_job/ext.rb +0 -24
- data/lib/ddtrace/contrib/delayed_job/integration.rb +0 -39
- data/lib/ddtrace/contrib/delayed_job/patcher.rb +0 -29
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +0 -85
- data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/elasticsearch/ext.rb +0 -23
- data/lib/ddtrace/contrib/elasticsearch/integration.rb +0 -40
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +0 -123
- data/lib/ddtrace/contrib/elasticsearch/quantize.rb +0 -84
- data/lib/ddtrace/contrib/ethon/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +0 -152
- data/lib/ddtrace/contrib/ethon/ext.rb +0 -20
- data/lib/ddtrace/contrib/ethon/integration.rb +0 -44
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +0 -85
- data/lib/ddtrace/contrib/ethon/patcher.rb +0 -27
- data/lib/ddtrace/contrib/excon/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/excon/ext.rb +0 -18
- data/lib/ddtrace/contrib/excon/integration.rb +0 -44
- data/lib/ddtrace/contrib/excon/middleware.rb +0 -164
- data/lib/ddtrace/contrib/excon/patcher.rb +0 -28
- data/lib/ddtrace/contrib/extensions.rb +0 -169
- data/lib/ddtrace/contrib/faraday/configuration/settings.rb +0 -39
- data/lib/ddtrace/contrib/faraday/connection.rb +0 -19
- data/lib/ddtrace/contrib/faraday/ext.rb +0 -18
- data/lib/ddtrace/contrib/faraday/integration.rb +0 -44
- data/lib/ddtrace/contrib/faraday/middleware.rb +0 -86
- data/lib/ddtrace/contrib/faraday/patcher.rb +0 -54
- data/lib/ddtrace/contrib/faraday/rack_builder.rb +0 -19
- data/lib/ddtrace/contrib/grape/configuration/settings.rb +0 -39
- data/lib/ddtrace/contrib/grape/endpoint.rb +0 -246
- data/lib/ddtrace/contrib/grape/ext.rb +0 -24
- data/lib/ddtrace/contrib/grape/instrumentation.rb +0 -34
- data/lib/ddtrace/contrib/grape/integration.rb +0 -40
- data/lib/ddtrace/contrib/grape/patcher.rb +0 -32
- data/lib/ddtrace/contrib/graphql/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/graphql/ext.rb +0 -17
- data/lib/ddtrace/contrib/graphql/integration.rb +0 -40
- data/lib/ddtrace/contrib/graphql/patcher.rb +0 -61
- data/lib/ddtrace/contrib/grpc/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +0 -59
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +0 -80
- data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +0 -79
- data/lib/ddtrace/contrib/grpc/ext.rb +0 -19
- data/lib/ddtrace/contrib/grpc/integration.rb +0 -39
- data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +0 -50
- data/lib/ddtrace/contrib/grpc/patcher.rb +0 -34
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +0 -38
- data/lib/ddtrace/contrib/http/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/http/ext.rb +0 -18
- data/lib/ddtrace/contrib/http/instrumentation.rb +0 -180
- data/lib/ddtrace/contrib/http/integration.rb +0 -46
- data/lib/ddtrace/contrib/http/patcher.rb +0 -27
- data/lib/ddtrace/contrib/http_annotation_helper.rb +0 -11
- data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/httpclient/ext.rb +0 -18
- data/lib/ddtrace/contrib/httpclient/instrumentation.rb +0 -148
- data/lib/ddtrace/contrib/httpclient/integration.rb +0 -44
- data/lib/ddtrace/contrib/httpclient/patcher.rb +0 -39
- data/lib/ddtrace/contrib/httprb/configuration/settings.rb +0 -33
- data/lib/ddtrace/contrib/httprb/ext.rb +0 -18
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +0 -158
- data/lib/ddtrace/contrib/httprb/integration.rb +0 -44
- data/lib/ddtrace/contrib/httprb/patcher.rb +0 -39
- data/lib/ddtrace/contrib/integration.rb +0 -17
- data/lib/ddtrace/contrib/kafka/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/kafka/consumer_event.rb +0 -15
- data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +0 -15
- data/lib/ddtrace/contrib/kafka/event.rb +0 -52
- data/lib/ddtrace/contrib/kafka/events/connection/request.rb +0 -35
- data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +0 -42
- data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +0 -40
- data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +0 -40
- data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +0 -30
- data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +0 -33
- data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +0 -36
- data/lib/ddtrace/contrib/kafka/events.rb +0 -45
- data/lib/ddtrace/contrib/kafka/ext.rb +0 -42
- data/lib/ddtrace/contrib/kafka/integration.rb +0 -40
- data/lib/ddtrace/contrib/kafka/patcher.rb +0 -27
- data/lib/ddtrace/contrib/lograge/configuration/settings.rb +0 -19
- data/lib/ddtrace/contrib/lograge/ext.rb +0 -11
- data/lib/ddtrace/contrib/lograge/instrumentation.rb +0 -39
- data/lib/ddtrace/contrib/lograge/integration.rb +0 -46
- data/lib/ddtrace/contrib/lograge/patcher.rb +0 -26
- data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/mongodb/ext.rb +0 -24
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +0 -70
- data/lib/ddtrace/contrib/mongodb/integration.rb +0 -44
- data/lib/ddtrace/contrib/mongodb/parsers.rb +0 -69
- data/lib/ddtrace/contrib/mongodb/patcher.rb +0 -32
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +0 -112
- data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/mysql2/ext.rb +0 -19
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +0 -65
- data/lib/ddtrace/contrib/mysql2/integration.rb +0 -39
- data/lib/ddtrace/contrib/mysql2/patcher.rb +0 -28
- data/lib/ddtrace/contrib/patchable.rb +0 -71
- data/lib/ddtrace/contrib/patcher.rb +0 -66
- data/lib/ddtrace/contrib/presto/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/presto/ext.rb +0 -29
- data/lib/ddtrace/contrib/presto/instrumentation.rb +0 -111
- data/lib/ddtrace/contrib/presto/integration.rb +0 -39
- data/lib/ddtrace/contrib/presto/patcher.rb +0 -34
- data/lib/ddtrace/contrib/qless/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/qless/ext.rb +0 -21
- data/lib/ddtrace/contrib/qless/integration.rb +0 -39
- data/lib/ddtrace/contrib/qless/patcher.rb +0 -35
- data/lib/ddtrace/contrib/qless/qless_job.rb +0 -74
- data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +0 -34
- data/lib/ddtrace/contrib/que/configuration/settings.rb +0 -44
- data/lib/ddtrace/contrib/que/ext.rb +0 -31
- data/lib/ddtrace/contrib/que/integration.rb +0 -43
- data/lib/ddtrace/contrib/que/patcher.rb +0 -25
- data/lib/ddtrace/contrib/que/tracer.rb +0 -58
- data/lib/ddtrace/contrib/racecar/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/racecar/event.rb +0 -77
- data/lib/ddtrace/contrib/racecar/events/batch.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events/consume.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events/message.rb +0 -28
- data/lib/ddtrace/contrib/racecar/events.rb +0 -33
- data/lib/ddtrace/contrib/racecar/ext.rb +0 -26
- data/lib/ddtrace/contrib/racecar/integration.rb +0 -40
- data/lib/ddtrace/contrib/racecar/patcher.rb +0 -27
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +0 -47
- data/lib/ddtrace/contrib/rack/ext.rb +0 -22
- data/lib/ddtrace/contrib/rack/integration.rb +0 -46
- data/lib/ddtrace/contrib/rack/middlewares.rb +0 -288
- data/lib/ddtrace/contrib/rack/patcher.rb +0 -106
- data/lib/ddtrace/contrib/rack/request_queue.rb +0 -45
- data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +0 -10
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +0 -101
- data/lib/ddtrace/contrib/rails/ext.rb +0 -18
- data/lib/ddtrace/contrib/rails/framework.rb +0 -172
- data/lib/ddtrace/contrib/rails/integration.rb +0 -45
- data/lib/ddtrace/contrib/rails/log_injection.rb +0 -42
- data/lib/ddtrace/contrib/rails/middlewares.rb +0 -44
- data/lib/ddtrace/contrib/rails/patcher.rb +0 -119
- data/lib/ddtrace/contrib/rails/railtie.rb +0 -18
- data/lib/ddtrace/contrib/rails/utils.rb +0 -25
- data/lib/ddtrace/contrib/rake/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/rake/ext.rb +0 -22
- data/lib/ddtrace/contrib/rake/instrumentation.rb +0 -91
- data/lib/ddtrace/contrib/rake/integration.rb +0 -39
- data/lib/ddtrace/contrib/rake/patcher.rb +0 -31
- data/lib/ddtrace/contrib/redis/configuration/resolver.rb +0 -46
- data/lib/ddtrace/contrib/redis/configuration/settings.rb +0 -36
- data/lib/ddtrace/contrib/redis/ext.rb +0 -23
- data/lib/ddtrace/contrib/redis/instrumentation.rb +0 -90
- data/lib/ddtrace/contrib/redis/integration.rb +0 -43
- data/lib/ddtrace/contrib/redis/patcher.rb +0 -33
- data/lib/ddtrace/contrib/redis/quantize.rb +0 -76
- data/lib/ddtrace/contrib/redis/tags.rb +0 -47
- data/lib/ddtrace/contrib/redis/vendor/resolver.rb +0 -159
- data/lib/ddtrace/contrib/registerable.rb +0 -33
- data/lib/ddtrace/contrib/registry.rb +0 -43
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +0 -49
- data/lib/ddtrace/contrib/resque/ext.rb +0 -18
- data/lib/ddtrace/contrib/resque/integration.rb +0 -44
- data/lib/ddtrace/contrib/resque/patcher.rb +0 -30
- data/lib/ddtrace/contrib/resque/resque_job.rb +0 -104
- data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/rest_client/ext.rb +0 -18
- data/lib/ddtrace/contrib/rest_client/integration.rb +0 -39
- data/lib/ddtrace/contrib/rest_client/patcher.rb +0 -25
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +0 -92
- data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +0 -19
- data/lib/ddtrace/contrib/semantic_logger/ext.rb +0 -11
- data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +0 -43
- data/lib/ddtrace/contrib/semantic_logger/integration.rb +0 -48
- data/lib/ddtrace/contrib/semantic_logger/patcher.rb +0 -26
- data/lib/ddtrace/contrib/sequel/configuration/settings.rb +0 -29
- data/lib/ddtrace/contrib/sequel/database.rb +0 -64
- data/lib/ddtrace/contrib/sequel/dataset.rb +0 -64
- data/lib/ddtrace/contrib/sequel/ext.rb +0 -20
- data/lib/ddtrace/contrib/sequel/integration.rb +0 -39
- data/lib/ddtrace/contrib/sequel/patcher.rb +0 -34
- data/lib/ddtrace/contrib/sequel/utils.rb +0 -75
- data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +0 -32
- data/lib/ddtrace/contrib/shoryuken/ext.rb +0 -22
- data/lib/ddtrace/contrib/shoryuken/integration.rb +0 -40
- data/lib/ddtrace/contrib/shoryuken/patcher.rb +0 -25
- data/lib/ddtrace/contrib/shoryuken/tracer.rb +0 -56
- data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +0 -44
- data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +0 -38
- data/lib/ddtrace/contrib/sidekiq/ext.rb +0 -31
- data/lib/ddtrace/contrib/sidekiq/integration.rb +0 -49
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +0 -68
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +0 -30
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +0 -30
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +0 -29
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +0 -66
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -45
- data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +0 -40
- data/lib/ddtrace/contrib/sinatra/env.rb +0 -59
- data/lib/ddtrace/contrib/sinatra/ext.rb +0 -28
- data/lib/ddtrace/contrib/sinatra/headers.rb +0 -30
- data/lib/ddtrace/contrib/sinatra/integration.rb +0 -39
- data/lib/ddtrace/contrib/sinatra/patcher.rb +0 -30
- data/lib/ddtrace/contrib/sinatra/tracer.rb +0 -150
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +0 -112
- data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +0 -34
- data/lib/ddtrace/contrib/sneakers/ext.rb +0 -23
- data/lib/ddtrace/contrib/sneakers/integration.rb +0 -42
- data/lib/ddtrace/contrib/sneakers/patcher.rb +0 -25
- data/lib/ddtrace/contrib/sneakers/tracer.rb +0 -54
- data/lib/ddtrace/contrib/status_code_matcher.rb +0 -70
- data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +0 -31
- data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +0 -25
- data/lib/ddtrace/contrib/sucker_punch/ext.rb +0 -22
- data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +0 -89
- data/lib/ddtrace/contrib/sucker_punch/integration.rb +0 -39
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +0 -44
- data/lib/ddtrace/correlation.rb +0 -40
- data/lib/ddtrace/diagnostics/environment_logger.rb +0 -280
- data/lib/ddtrace/diagnostics/health.rb +0 -34
- data/lib/ddtrace/distributed_tracing/headers/b3.rb +0 -45
- data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +0 -57
- data/lib/ddtrace/distributed_tracing/headers/datadog.rb +0 -43
- data/lib/ddtrace/distributed_tracing/headers/headers.rb +0 -72
- data/lib/ddtrace/distributed_tracing/headers/helpers.rb +0 -44
- data/lib/ddtrace/encoding.rb +0 -72
- data/lib/ddtrace/error.rb +0 -97
- data/lib/ddtrace/event.rb +0 -53
- data/lib/ddtrace/ext/analytics.rb +0 -13
- data/lib/ddtrace/ext/app_types.rb +0 -12
- data/lib/ddtrace/ext/correlation.rb +0 -12
- data/lib/ddtrace/ext/diagnostics.rb +0 -37
- data/lib/ddtrace/ext/distributed.rb +0 -40
- data/lib/ddtrace/ext/environment.rb +0 -24
- data/lib/ddtrace/ext/errors.rb +0 -11
- data/lib/ddtrace/ext/forced_tracing.rb +0 -26
- data/lib/ddtrace/ext/git.rb +0 -32
- data/lib/ddtrace/ext/http.rb +0 -47
- data/lib/ddtrace/ext/integration.rb +0 -9
- data/lib/ddtrace/ext/manual_tracing.rb +0 -10
- data/lib/ddtrace/ext/metrics.rb +0 -16
- data/lib/ddtrace/ext/net.rb +0 -11
- data/lib/ddtrace/ext/priority.rb +0 -19
- data/lib/ddtrace/ext/profiling.rb +0 -53
- 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 -297
- data/lib/ddtrace/profiling/encoding/profile.rb +0 -46
- data/lib/ddtrace/profiling/event.rb +0 -14
- data/lib/ddtrace/profiling/events/stack.rb +0 -81
- data/lib/ddtrace/profiling/exporter.rb +0 -24
- data/lib/ddtrace/profiling/ext/forking.rb +0 -98
- data/lib/ddtrace/profiling/flush.rb +0 -44
- data/lib/ddtrace/profiling/native_extension.rb +0 -40
- data/lib/ddtrace/profiling/pprof/builder.rb +0 -126
- data/lib/ddtrace/profiling/pprof/converter.rb +0 -103
- data/lib/ddtrace/profiling/pprof/message_set.rb +0 -15
- data/lib/ddtrace/profiling/pprof/payload.rb +0 -19
- data/lib/ddtrace/profiling/pprof/pprof_pb.rb +0 -82
- data/lib/ddtrace/profiling/pprof/stack_sample.rb +0 -140
- data/lib/ddtrace/profiling/pprof/string_table.rb +0 -11
- data/lib/ddtrace/profiling/pprof/template.rb +0 -119
- data/lib/ddtrace/profiling/profiler.rb +0 -31
- data/lib/ddtrace/profiling/recorder.rb +0 -96
- data/lib/ddtrace/profiling/scheduler.rb +0 -150
- data/lib/ddtrace/profiling/tasks/setup.rb +0 -90
- data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +0 -42
- data/lib/ddtrace/profiling/trace_identifiers/helper.rb +0 -46
- data/lib/ddtrace/profiling/transport/client.rb +0 -15
- data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +0 -94
- data/lib/ddtrace/profiling/transport/http/api/instance.rb +0 -37
- data/lib/ddtrace/profiling/transport/http/api/spec.rb +0 -41
- data/lib/ddtrace/profiling/transport/http/api.rb +0 -44
- data/lib/ddtrace/profiling/transport/http/builder.rb +0 -29
- data/lib/ddtrace/profiling/transport/http/client.rb +0 -34
- data/lib/ddtrace/profiling/transport/http/response.rb +0 -22
- data/lib/ddtrace/profiling/transport/http.rb +0 -111
- data/lib/ddtrace/profiling/transport/io/client.rb +0 -28
- data/lib/ddtrace/profiling/transport/io/response.rb +0 -17
- data/lib/ddtrace/profiling/transport/io.rb +0 -31
- data/lib/ddtrace/profiling/transport/parcel.rb +0 -18
- data/lib/ddtrace/profiling/transport/request.rb +0 -16
- data/lib/ddtrace/profiling/transport/response.rb +0 -9
- data/lib/ddtrace/profiling.rb +0 -149
- data/lib/ddtrace/propagation/grpc_propagator.rb +0 -75
- data/lib/ddtrace/propagation/http_propagator.rb +0 -91
- data/lib/ddtrace/quantization/hash.rb +0 -104
- data/lib/ddtrace/quantization/http.rb +0 -90
- data/lib/ddtrace/runtime/metrics.rb +0 -135
- data/lib/ddtrace/sampler.rb +0 -303
- data/lib/ddtrace/sampling/matcher.rb +0 -58
- data/lib/ddtrace/sampling/rate_limiter.rb +0 -177
- data/lib/ddtrace/sampling/rule.rb +0 -62
- data/lib/ddtrace/sampling/rule_sampler.rb +0 -133
- data/lib/ddtrace/sampling.rb +0 -3
- data/lib/ddtrace/span.rb +0 -445
- data/lib/ddtrace/sync_writer.rb +0 -69
- data/lib/ddtrace/tasks/exec.rb +0 -47
- data/lib/ddtrace/tasks/help.rb +0 -15
- data/lib/ddtrace/tracer.rb +0 -449
- data/lib/ddtrace/utils/compression.rb +0 -28
- data/lib/ddtrace/utils/database.rb +0 -26
- data/lib/ddtrace/utils/forking.rb +0 -53
- data/lib/ddtrace/utils/object_set.rb +0 -40
- data/lib/ddtrace/utils/only_once.rb +0 -41
- data/lib/ddtrace/utils/sequence.rb +0 -18
- data/lib/ddtrace/utils/string_table.rb +0 -46
- data/lib/ddtrace/utils/time.rb +0 -51
- data/lib/ddtrace/utils.rb +0 -80
- data/lib/ddtrace/vendor/active_record/connection_specification.rb +0 -302
- data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +0 -117
- data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +0 -58
- data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +0 -136
- data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +0 -10
- data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +0 -9
- data/lib/ddtrace/vendor/multipart-post/multipart.rb +0 -13
- data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +0 -33
- data/lib/ddtrace/worker.rb +0 -21
- data/lib/ddtrace/workers/async.rb +0 -175
- data/lib/ddtrace/workers/interval_loop.rb +0 -116
- data/lib/ddtrace/workers/polling.rb +0 -56
- data/lib/ddtrace/workers/queue.rb +0 -41
- data/lib/ddtrace/workers/runtime_metrics.rb +0 -65
- data/lib/ddtrace/workers/trace_writer.rb +0 -200
- data/lib/ddtrace/workers.rb +0 -123
- data/lib/ddtrace/writer.rb +0 -200
- /data/lib/{ddtrace → datadog/core}/vendor/multipart-post/LICENSE +0 -0
- /data/lib/{ddtrace → datadog}/profiling/pprof/pprof.proto +0 -0
- /data/lib/{ddtrace/vendor/active_record → datadog/tracing/contrib/active_record/vendor}/MIT-LICENSE +0 -0
- /data/lib/{ddtrace → datadog/tracing}/contrib/redis/vendor/LICENSE +0 -0
data/docs/GettingStarted.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
***Version 1.0.0 has been released. Check out our [upgrade guide](https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide.md#from-0x-to-10) for more details.***
|
2
|
+
|
1
3
|
# Datadog Ruby Trace Client
|
2
4
|
|
3
5
|
`ddtrace` is Datadog’s tracing client for Ruby. It is used to trace requests as they flow across web servers,
|
@@ -9,6 +11,8 @@ For the general APM documentation, see our [setup documentation][setup docs].
|
|
9
11
|
|
10
12
|
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
13
|
|
14
|
+
For the library API documentation, see our [YARD documentation][yard docs].
|
15
|
+
|
12
16
|
To contribute, check out the [contribution guidelines][contribution docs] and [development guide][development docs].
|
13
17
|
|
14
18
|
[setup docs]: https://docs.datadoghq.com/tracing/
|
@@ -16,22 +20,27 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
16
20
|
[visualization docs]: https://docs.datadoghq.com/tracing/visualization/
|
17
21
|
[contribution docs]: https://github.com/DataDog/dd-trace-rb/blob/master/CONTRIBUTING.md
|
18
22
|
[development docs]: https://github.com/DataDog/dd-trace-rb/blob/master/docs/DevelopmentGuide.md
|
23
|
+
[yard docs]: https://www.rubydoc.info/gems/ddtrace/
|
19
24
|
|
20
25
|
## Table of Contents
|
21
26
|
|
22
27
|
- [Compatibility](#compatibility)
|
23
28
|
- [Installation](#installation)
|
24
|
-
- [
|
25
|
-
- [
|
26
|
-
|
29
|
+
- [Setup the Datadog Agent for tracing](#setup-the-datadog-agent-for-tracing)
|
30
|
+
- [Instrument your application](#instrument-your-application)
|
31
|
+
- [Rails applications](#rails-applications)
|
32
|
+
- [Ruby applications](#ruby-applications)
|
33
|
+
- [Configuring OpenTracing](#configuring-opentracing)
|
34
|
+
- [Configuring OpenTelemetry](#configuring-opentelemetry)
|
35
|
+
- [Connect your application to the Datadog Agent](#connect-your-application-to-the-datadog-agent)
|
27
36
|
- [Manual instrumentation](#manual-instrumentation)
|
28
37
|
- [Integration instrumentation](#integration-instrumentation)
|
29
38
|
- [Action Cable](#action-cable)
|
30
|
-
- [Action View](#action-view)
|
31
39
|
- [Action Mailer](#action-mailer)
|
32
|
-
- [Active Model Serializers](#active-model-serializers)
|
33
40
|
- [Action Pack](#action-pack)
|
41
|
+
- [Action View](#action-view)
|
34
42
|
- [Active Job](#active-job)
|
43
|
+
- [Active Model Serializers](#active-model-serializers)
|
35
44
|
- [Active Record](#active-record)
|
36
45
|
- [Active Support](#active-support)
|
37
46
|
- [AWS](#aws)
|
@@ -49,9 +58,11 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
49
58
|
- [http.rb](#httprb)
|
50
59
|
- [httpclient](#httpclient)
|
51
60
|
- [httpx](#httpx)
|
61
|
+
- [Kafka](#kafka)
|
52
62
|
- [MongoDB](#mongodb)
|
53
63
|
- [MySQL2](#mysql2)
|
54
64
|
- [Net/HTTP](#nethttp)
|
65
|
+
- [Postgres](#postgres)
|
55
66
|
- [Presto](#presto)
|
56
67
|
- [Qless](#qless)
|
57
68
|
- [Que](#que)
|
@@ -60,20 +71,19 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
60
71
|
- [Rails](#rails)
|
61
72
|
- [Rake](#rake)
|
62
73
|
- [Redis](#redis)
|
63
|
-
- [Rest Client](#rest-client)
|
64
74
|
- [Resque](#resque)
|
75
|
+
- [Rest Client](#rest-client)
|
65
76
|
- [RSpec](#rspec)
|
66
|
-
- [Shoryuken](#shoryuken)
|
67
77
|
- [Sequel](#sequel)
|
78
|
+
- [Shoryuken](#shoryuken)
|
68
79
|
- [Sidekiq](#sidekiq)
|
69
80
|
- [Sinatra](#sinatra)
|
70
81
|
- [Sneakers](#sneakers)
|
71
82
|
- [Sucker Punch](#sucker-punch)
|
72
|
-
- [
|
73
|
-
- [Tracer settings](#tracer-settings)
|
83
|
+
- [Additional configuration](#additional-configuration)
|
74
84
|
- [Custom logging](#custom-logging)
|
75
85
|
- [Environment and tags](#environment-and-tags)
|
76
|
-
- [
|
86
|
+
- [Debugging and diagnostics](#debugging-and-diagnostics)
|
77
87
|
- [Sampling](#sampling)
|
78
88
|
- [Application-side sampling](#application-side-sampling)
|
79
89
|
- [Priority sampling](#priority-sampling)
|
@@ -96,11 +106,18 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
96
106
|
|
97
107
|
## Compatibility
|
98
108
|
|
109
|
+
<!--
|
110
|
+
Note: Please replicate any changes to this section also to
|
111
|
+
https://github.com/datadog/documentation/blob/master/content/en/tracing/setup_overview/compatibility_requirements/ruby.md
|
112
|
+
so that they remain in sync.
|
113
|
+
-->
|
114
|
+
|
99
115
|
**Supported Ruby interpreters**:
|
100
116
|
|
101
117
|
| Type | Documentation | Version | Support type | Gem version support |
|
102
118
|
| ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
|
103
|
-
| MRI | https://www.ruby-lang.org/ | 3.
|
119
|
+
| MRI | https://www.ruby-lang.org/ | 3.1 | Full | Latest |
|
120
|
+
| | | 3.0 | Full | Latest |
|
104
121
|
| | | 2.7 | Full | Latest |
|
105
122
|
| | | 2.6 | Full | Latest |
|
106
123
|
| | | 2.5 | Full | Latest |
|
@@ -111,7 +128,8 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
111
128
|
| | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
|
112
129
|
| | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
|
113
130
|
| | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
|
114
|
-
| JRuby | https://www.jruby.org | 9.
|
131
|
+
| JRuby | https://www.jruby.org | 9.3 | Full | Latest |
|
132
|
+
| | | 9.2 | Full | Latest |
|
115
133
|
|
116
134
|
**Supported web servers**:
|
117
135
|
|
@@ -146,66 +164,95 @@ but will consider them as having low priority.
|
|
146
164
|
|
147
165
|
## Installation
|
148
166
|
|
149
|
-
|
167
|
+
Adding tracing to your Ruby application only takes a few quick steps:
|
150
168
|
|
151
|
-
|
169
|
+
1. Setup the Datadog Agent for tracing
|
170
|
+
2. Instrument your application
|
171
|
+
3. Connect your application to the Datadog Agent
|
152
172
|
|
153
|
-
|
173
|
+
### Setup the Datadog Agent for tracing
|
154
174
|
|
155
|
-
|
175
|
+
Before installing `ddtrace`, [install the Datadog Agent](https://docs.datadoghq.com/agent/), to which `ddtrace` will send trace data.
|
156
176
|
|
157
|
-
|
177
|
+
Then configure the Datadog Agent to accept traces. To do this, either:
|
158
178
|
|
159
|
-
|
179
|
+
- Set `DD_APM_ENABLED=true` in the agent's environment
|
160
180
|
|
161
|
-
|
181
|
+
OR
|
162
182
|
|
163
|
-
|
183
|
+
- Add `apm_enabled: true` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
|
164
184
|
|
185
|
+
*Additionally, in containerized environments...*
|
165
186
|
|
166
|
-
|
187
|
+
- Set `DD_APM_NON_LOCAL_TRAFFIC=true` in the agent's environment
|
167
188
|
|
168
|
-
|
189
|
+
OR
|
169
190
|
|
170
|
-
|
191
|
+
- Add `apm_non_local_traffic: true` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file).
|
171
192
|
|
172
|
-
|
173
|
-
source 'https://rubygems.org'
|
174
|
-
gem 'ddtrace', require: 'ddtrace/auto_instrument'
|
175
|
-
```
|
193
|
+
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.
|
176
194
|
|
177
|
-
|
195
|
+
#### Configuring trace data ingestion
|
196
|
+
|
197
|
+
The Datadog agent will listen for traces via HTTP on port `8126` by default.
|
178
198
|
|
179
|
-
|
199
|
+
You may change the protocol or port the agent listens for trace data using the following:
|
180
200
|
|
181
|
-
|
201
|
+
**For HTTP over TCP**:
|
202
|
+
|
203
|
+
- Set `DD_APM_RECEIVER_PORT=<port>` in the agent's environment
|
204
|
+
|
205
|
+
OR
|
206
|
+
|
207
|
+
- Add `apm_config: receiver_port: <port>` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
|
208
|
+
|
209
|
+
**For Unix Domain Socket (UDS)**:
|
210
|
+
|
211
|
+
- Set `DD_APM_RECEIVER_SOCKET=<path-to-socket-file>`
|
212
|
+
|
213
|
+
OR
|
214
|
+
|
215
|
+
- Add `apm_config: receiver_socket: <path-to-socket-file>` to the [agent's configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/?tab=agentv6v7#agent-main-configuration-file)
|
216
|
+
|
217
|
+
### Instrument your application
|
218
|
+
|
219
|
+
#### Rails applications
|
182
220
|
|
183
221
|
1. Add the `ddtrace` gem to your Gemfile:
|
184
222
|
|
185
223
|
```ruby
|
186
224
|
source 'https://rubygems.org'
|
187
|
-
gem 'ddtrace'
|
225
|
+
gem 'ddtrace', require: 'ddtrace/auto_instrument'
|
188
226
|
```
|
189
227
|
|
190
228
|
2. Install the gem with `bundle install`
|
229
|
+
|
191
230
|
3. Create a `config/initializers/datadog.rb` file containing:
|
192
231
|
|
193
232
|
```ruby
|
194
233
|
Datadog.configure do |c|
|
195
|
-
#
|
196
|
-
|
234
|
+
# Add additional configuration here.
|
235
|
+
# Activate integrations, change tracer settings, etc...
|
197
236
|
end
|
198
237
|
```
|
199
238
|
|
200
|
-
|
239
|
+
Using this block you can:
|
201
240
|
|
202
|
-
|
241
|
+
- [Add additional configuration settings](#additional-configuration)
|
242
|
+
- [Activate or reconfigure instrumentation](#integration-instrumentation)
|
203
243
|
|
204
|
-
####
|
244
|
+
#### Ruby applications
|
205
245
|
|
206
|
-
1.
|
207
|
-
|
208
|
-
|
246
|
+
1. Add the `ddtrace` gem to your Gemfile:
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
source 'https://rubygems.org'
|
250
|
+
gem 'ddtrace'
|
251
|
+
```
|
252
|
+
|
253
|
+
2. Install the gem with `bundle install`
|
254
|
+
3. `require` any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
|
255
|
+
4. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
|
209
256
|
|
210
257
|
```ruby
|
211
258
|
# Example frameworks and libraries
|
@@ -216,41 +263,42 @@ Install and configure the Datadog Agent to receive traces from your now instrume
|
|
216
263
|
require 'ddtrace/auto_instrument'
|
217
264
|
```
|
218
265
|
|
219
|
-
|
220
|
-
|
221
|
-
#### Manual instrumentation
|
222
|
-
|
223
|
-
1. Install the gem with `gem install ddtrace`
|
224
|
-
2. Add a configuration block to your Ruby application:
|
266
|
+
5. Add a configuration block to your application:
|
225
267
|
|
226
268
|
```ruby
|
227
|
-
require 'ddtrace'
|
228
269
|
Datadog.configure do |c|
|
229
|
-
#
|
270
|
+
# Add additional configuration here.
|
230
271
|
# Activate integrations, change tracer settings, etc...
|
231
|
-
# By default without additional configuration, nothing will be traced.
|
232
272
|
end
|
233
273
|
```
|
234
274
|
|
235
|
-
|
236
|
-
|
237
|
-
|
275
|
+
Using this block you can:
|
276
|
+
|
277
|
+
- [Add additional configuration settings](#additional-configuration)
|
278
|
+
- [Activate or reconfigure instrumentation](#integration-instrumentation)
|
238
279
|
|
239
|
-
|
280
|
+
#### Configuring OpenTracing
|
240
281
|
|
241
|
-
1.
|
242
|
-
|
282
|
+
1. Add the `ddtrace` gem to your Gemfile:
|
283
|
+
|
284
|
+
```ruby
|
285
|
+
source 'https://rubygems.org'
|
286
|
+
gem 'ddtrace'
|
287
|
+
```
|
288
|
+
|
289
|
+
2. Install the gem with `bundle install`
|
290
|
+
3. To your OpenTracing configuration file, add the following:
|
243
291
|
|
244
292
|
```ruby
|
245
293
|
require 'opentracing'
|
246
|
-
require '
|
247
|
-
require '
|
294
|
+
require 'datadog/tracing'
|
295
|
+
require 'datadog/opentracer'
|
248
296
|
|
249
297
|
# Activate the Datadog tracer for OpenTracing
|
250
298
|
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new
|
251
299
|
```
|
252
300
|
|
253
|
-
|
301
|
+
4. Add a configuration block to your application:
|
254
302
|
|
255
303
|
```ruby
|
256
304
|
Datadog.configure do |c|
|
@@ -262,9 +310,29 @@ Install and configure the Datadog Agent to receive traces from your now instrume
|
|
262
310
|
end
|
263
311
|
```
|
264
312
|
|
265
|
-
|
266
|
-
|
267
|
-
|
313
|
+
Using this block you can:
|
314
|
+
|
315
|
+
- [Add additional Datadog configuration settings](#additional-configuration)
|
316
|
+
- [Activate or reconfigure Datadog instrumentation](#integration-instrumentation)
|
317
|
+
|
318
|
+
#### Configuring OpenTelemetry
|
319
|
+
|
320
|
+
You can send OpenTelemetry traces directly to the Datadog agent (without `ddtrace`) by using OTLP. Check out our documentation on [OTLP ingest in the Datadog Agent](https://docs.datadoghq.com/tracing/setup_overview/open_standards/#otlp-ingest-in-datadog-agent) for details.
|
321
|
+
|
322
|
+
### Connect your application to the Datadog Agent
|
323
|
+
|
324
|
+
By default, `ddtrace` will connect to the agent using the first available settings in the listed priority:
|
325
|
+
|
326
|
+
1. Via any explicitly provided configuration settings (hostname/port/transport)
|
327
|
+
2. Via Unix Domain Socket (UDS) located at `/var/run/datadog/apm.socket`
|
328
|
+
3. Via HTTP over TCP to `127.0.0.1:8126`
|
329
|
+
|
330
|
+
If your Datadog Agent is listening at any of these locations, no further configuration should be required.
|
331
|
+
|
332
|
+
If your agent runs on a different host or container than your application, or you would like to send traces via a different protocol, you will need to configure your application accordingly.
|
333
|
+
|
334
|
+
- [How to send trace data via HTTP over TCP to agent](#changing-default-agent-hostname-and-port)
|
335
|
+
- [How to send trace data via Unix Domain Socket (UDS) to agent](#using-the-unix-domain-socket-uds-adapter)
|
268
336
|
|
269
337
|
### Final steps for installation
|
270
338
|
|
@@ -274,10 +342,10 @@ After setting up, your services will appear on the [APM services page](https://a
|
|
274
342
|
|
275
343
|
If you aren't using a supported framework instrumentation, you may want to manually instrument your code.
|
276
344
|
|
277
|
-
To trace any Ruby code, you can use the `Datadog.
|
345
|
+
To trace any Ruby code, you can use the `Datadog::Tracing.trace` method:
|
278
346
|
|
279
347
|
```ruby
|
280
|
-
Datadog.
|
348
|
+
Datadog::Tracing.trace(name, options) do |span, trace|
|
281
349
|
# Wrap this block around the code you want to instrument
|
282
350
|
# Additionally, you can modify the span here.
|
283
351
|
# e.g. Change the resource name, set tags, etc...
|
@@ -289,14 +357,15 @@ Where `name` should be a `String` that describes the generic kind of operation b
|
|
289
357
|
And `options` is an optional `Hash` that accepts the following parameters:
|
290
358
|
|
291
359
|
| Key | Type | Description | Default |
|
292
|
-
|
|
293
|
-
| `
|
294
|
-
| `
|
295
|
-
| `
|
296
|
-
| `
|
297
|
-
| `
|
298
|
-
| `
|
299
|
-
| `
|
360
|
+
| --------------- | ----------------------- | --- | --- |
|
361
|
+
| `autostart` | `Bool` | Whether the time measurement should be started automatically. If `false`, user must call `span.start`. | `true` |
|
362
|
+
| `continue_from` | `Datadog::TraceDigest` | Continues a trace that originated from another execution context. TraceDigest describes the continuation point. | `nil` |
|
363
|
+
| `on_error` | `Proc` | Overrides error handling behavior, when a span 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? }` |
|
364
|
+
| `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. |
|
365
|
+
| `service` | `String` | The service name which this span belongs (e.g. `'my-web-service'`) | Tracer `default-service`, `$PROGRAM_NAME` or `'ruby'` |
|
366
|
+
| `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
|
367
|
+
| `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
|
368
|
+
| `type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
|
300
369
|
|
301
370
|
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.
|
302
371
|
|
@@ -304,9 +373,9 @@ Example of manual instrumentation in action:
|
|
304
373
|
|
305
374
|
```ruby
|
306
375
|
get '/posts' do
|
307
|
-
Datadog.
|
376
|
+
Datadog::Tracing.trace('web.request', service: 'my-blog', resource: 'GET /posts') do |span|
|
308
377
|
# Trace the activerecord call
|
309
|
-
Datadog.
|
378
|
+
Datadog::Tracing.trace('posts.fetch') do
|
310
379
|
@posts = Posts.order(created_at: :desc).limit(10)
|
311
380
|
end
|
312
381
|
|
@@ -315,7 +384,7 @@ get '/posts' do
|
|
315
384
|
span.set_tag('posts.count', @posts.length)
|
316
385
|
|
317
386
|
# Trace the template rendering
|
318
|
-
Datadog.
|
387
|
+
Datadog::Tracing.trace('template.render') do
|
319
388
|
erb :index
|
320
389
|
end
|
321
390
|
end
|
@@ -324,37 +393,36 @@ end
|
|
324
393
|
|
325
394
|
### Asynchronous tracing
|
326
395
|
|
327
|
-
It might not always be possible to wrap `Datadog.
|
396
|
+
It might not always be possible to wrap `Datadog::Tracing.trace` around a block of code. Some event or notification based instrumentation might only notify you when an event begins or ends.
|
328
397
|
|
329
|
-
To trace these operations, you can trace code asynchronously by calling `Datadog.
|
398
|
+
To trace these operations, you can trace code asynchronously by calling `Datadog::Tracing.trace` without a block:
|
330
399
|
|
331
400
|
```ruby
|
332
401
|
# Some instrumentation framework calls this after an event finishes...
|
333
402
|
def db_query(start, finish, query)
|
334
|
-
span = Datadog.
|
403
|
+
span = Datadog::Tracing.trace('database.query', start_time: start)
|
335
404
|
span.resource = query
|
336
|
-
span.start_time = start
|
337
405
|
span.finish(finish)
|
338
406
|
end
|
339
407
|
```
|
340
408
|
|
341
|
-
Calling `Datadog.
|
409
|
+
Calling `Datadog::Tracing.trace` without a block will cause the function to return a `Datadog::SpanOperation` that is started, but not finished. You can then modify this span however you wish, then close it `finish`.
|
342
410
|
|
343
411
|
*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.
|
344
412
|
|
345
|
-
To avoid this scenario when handling start/finish events, you can use `Datadog.
|
413
|
+
To avoid this scenario when handling start/finish events, you can use `Datadog::Tracing.active_span` to get the current active span.
|
346
414
|
|
347
415
|
```ruby
|
348
416
|
# e.g. ActiveSupport::Notifications calls this when an event starts
|
349
417
|
def start(name, id, payload)
|
350
418
|
# Start a span
|
351
|
-
Datadog.
|
419
|
+
Datadog::Tracing.trace(name)
|
352
420
|
end
|
353
421
|
|
354
422
|
# e.g. ActiveSupport::Notifications calls this when an event finishes
|
355
423
|
def finish(name, id, payload)
|
356
424
|
# Retrieve current active span (thread-safe)
|
357
|
-
current_span = Datadog.
|
425
|
+
current_span = Datadog::Tracing.active_span
|
358
426
|
unless current_span.nil?
|
359
427
|
current_span.resource = payload[:query]
|
360
428
|
current_span.finish
|
@@ -368,17 +436,16 @@ You can tag additional information to the current active span from any method. N
|
|
368
436
|
```ruby
|
369
437
|
# e.g. adding tag to active span
|
370
438
|
|
371
|
-
current_span = Datadog.
|
439
|
+
current_span = Datadog::Tracing.active_span
|
372
440
|
current_span.set_tag('my_tag', 'my_value') unless current_span.nil?
|
373
441
|
```
|
374
442
|
|
375
|
-
You can also get the
|
443
|
+
You can also get the current active trace using the `active_trace` method. This method will return `nil` if there is no active trace.
|
376
444
|
|
377
445
|
```ruby
|
378
|
-
# e.g.
|
446
|
+
# e.g. accessing active trace
|
379
447
|
|
380
|
-
|
381
|
-
current_root_span.set_tag('my_tag', 'my_value') unless current_root_span.nil?
|
448
|
+
current_trace = Datadog::Tracing.active_trace
|
382
449
|
```
|
383
450
|
|
384
451
|
## Integration instrumentation
|
@@ -388,7 +455,7 @@ Many popular libraries and frameworks are supported out-of-the-box, which can be
|
|
388
455
|
```ruby
|
389
456
|
Datadog.configure do |c|
|
390
457
|
# Activates and configures an integration
|
391
|
-
c.
|
458
|
+
c.tracing.instrument :integration_name, options
|
392
459
|
end
|
393
460
|
```
|
394
461
|
|
@@ -396,94 +463,93 @@ end
|
|
396
463
|
|
397
464
|
For a list of available integrations, and their configuration options, please refer to the following:
|
398
465
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
466
|
+
<!--
|
467
|
+
Note: Please replicate any changes to this section also to
|
468
|
+
https://github.com/datadog/documentation/blob/master/content/en/tracing/setup_overview/compatibility_requirements/ruby.md
|
469
|
+
so that they remain in sync.
|
470
|
+
-->
|
471
|
+
|
472
|
+
| Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
|
473
|
+
| -------------------------- | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
|
474
|
+
| Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
|
475
|
+
| Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
|
476
|
+
| Action Pack | `action_pack` | `>= 3.2` | `>= 3.2` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
|
477
|
+
| Action View | `action_view` | `>= 3.2` | `>= 3.2` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
|
478
|
+
| Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
|
479
|
+
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
480
|
+
| Active Record | `active_record` | `>= 3.2` | `>= 3.2` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
481
|
+
| Active Support | `active_support` | `>= 3.2` | `>= 3.2` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
|
482
|
+
| AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
483
|
+
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
484
|
+
| Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
485
|
+
| DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
486
|
+
| Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
487
|
+
| Ethon | `ethon` | `>= 0.11` | `>= 0.11` | *[Link](#ethon)* | *[Link](https://github.com/typhoeus/ethon)* |
|
488
|
+
| Excon | `excon` | `>= 0.50` | `>= 0.50` | *[Link](#excon)* | *[Link](https://github.com/excon/excon)* |
|
489
|
+
| Faraday | `faraday` | `>= 0.14` | `>= 0.14` | *[Link](#faraday)* | *[Link](https://github.com/lostisland/faraday)* |
|
490
|
+
| Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
491
|
+
| GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
492
|
+
| gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
493
|
+
| http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
|
494
|
+
| httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
|
495
|
+
| httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
|
496
|
+
| Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
|
497
|
+
| Makara (via Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
|
498
|
+
| MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
499
|
+
| MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
500
|
+
| 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)* |
|
501
|
+
| Postgres | `pg` | `>= 0.18.4` | *gem not available* | *[Link](#postgres)* | *[Link](https://github.com/ged/ruby-pg)* |
|
502
|
+
| Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
|
503
|
+
| Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
|
504
|
+
| Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
|
505
|
+
| Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
|
506
|
+
| Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
|
507
|
+
| Rails | `rails` | `>= 3.2` | `>= 3.2` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
|
508
|
+
| Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
|
509
|
+
| Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
|
510
|
+
| Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
|
511
|
+
| Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
|
512
|
+
| Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
|
513
|
+
| Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
|
514
|
+
| Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
|
515
|
+
| Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
|
516
|
+
| Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
|
517
|
+
| Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
|
518
|
+
|
519
|
+
#### CI Visibility
|
520
|
+
|
521
|
+
For Datadog CI Visibility, library instrumentation can be activated and configured by using the following `Datadog.configure` API:
|
452
522
|
|
453
523
|
```ruby
|
454
|
-
require 'ddtrace'
|
455
|
-
|
456
524
|
Datadog.configure do |c|
|
457
|
-
|
525
|
+
# Activates and configures an integration
|
526
|
+
c.ci.instrument :integration_name, options
|
458
527
|
end
|
459
528
|
```
|
460
529
|
|
461
|
-
|
530
|
+
`options` is a `Hash` of integration-specific configuration settings.
|
462
531
|
|
463
|
-
|
464
|
-
| --- | ----------- | ------- |
|
465
|
-
| `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
|
532
|
+
These are the available CI Visibility integrations:
|
466
533
|
|
467
|
-
|
534
|
+
| Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
|
535
|
+
|-----------|------------|-------------------------|---------------------------|---------------------|-----------------------------------------------------|
|
536
|
+
| Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
|
537
|
+
| RSpec | `rspec` | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)* | *[Link](https://github.com/rspec/rspec)* |
|
468
538
|
|
469
|
-
|
539
|
+
### Action Cable
|
540
|
+
|
541
|
+
The Action Cable integration traces broadcast messages and channel actions.
|
542
|
+
|
543
|
+
You can enable it through `Datadog.configure`:
|
470
544
|
|
471
545
|
```ruby
|
472
|
-
require 'actionview'
|
473
546
|
require 'ddtrace'
|
474
547
|
|
475
548
|
Datadog.configure do |c|
|
476
|
-
c.
|
549
|
+
c.tracing.instrument :action_cable
|
477
550
|
end
|
478
551
|
```
|
479
552
|
|
480
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
481
|
-
|
482
|
-
| Key | Description | Default |
|
483
|
-
| ---| --- | --- |
|
484
|
-
| `service_name` | Service name used for rendering instrumentation. | `action_view` |
|
485
|
-
| `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/'` |
|
486
|
-
|
487
553
|
### Action Mailer
|
488
554
|
|
489
555
|
The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
|
@@ -492,8 +558,8 @@ You can enable it through `Datadog.configure`:
|
|
492
558
|
|
493
559
|
```ruby
|
494
560
|
require 'ddtrace'
|
495
|
-
|
496
|
-
c.
|
561
|
+
Datadog.configure do |c|
|
562
|
+
c.tracing.instrument :action_mailer, options
|
497
563
|
end
|
498
564
|
```
|
499
565
|
|
@@ -502,39 +568,31 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
502
568
|
| Key | Description | Default |
|
503
569
|
| --- | ----------- | ------- |
|
504
570
|
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
505
|
-
| `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
|
506
571
|
| `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` |
|
507
572
|
|
508
|
-
###
|
573
|
+
### Action Pack
|
509
574
|
|
510
|
-
|
575
|
+
Most of the time, Action Pack is set up as part of Rails, but it can be activated separately:
|
511
576
|
|
512
577
|
```ruby
|
513
|
-
require '
|
578
|
+
require 'actionpack'
|
514
579
|
require 'ddtrace'
|
515
580
|
|
516
581
|
Datadog.configure do |c|
|
517
|
-
c.
|
582
|
+
c.tracing.instrument :action_pack
|
518
583
|
end
|
519
|
-
|
520
|
-
my_object = MyModel.new(name: 'my object')
|
521
|
-
ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
522
584
|
```
|
523
585
|
|
524
|
-
|
525
|
-
| --- | ----------- | ------- |
|
526
|
-
| `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
|
527
|
-
|
528
|
-
### Action Pack
|
586
|
+
### Action View
|
529
587
|
|
530
|
-
Most of the time, Action
|
588
|
+
Most of the time, Action View is set up as part of Rails, but it can be activated separately:
|
531
589
|
|
532
590
|
```ruby
|
533
|
-
require '
|
591
|
+
require 'actionview'
|
534
592
|
require 'ddtrace'
|
535
593
|
|
536
594
|
Datadog.configure do |c|
|
537
|
-
c.
|
595
|
+
c.tracing.instrument :action_view, options
|
538
596
|
end
|
539
597
|
```
|
540
598
|
|
@@ -542,7 +600,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
542
600
|
|
543
601
|
| Key | Description | Default |
|
544
602
|
| ---| --- | --- |
|
545
|
-
| `
|
603
|
+
| `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/'` |
|
546
604
|
|
547
605
|
### Active Job
|
548
606
|
|
@@ -553,18 +611,27 @@ require 'active_job'
|
|
553
611
|
require 'ddtrace'
|
554
612
|
|
555
613
|
Datadog.configure do |c|
|
556
|
-
c.
|
614
|
+
c.tracing.instrument :active_job
|
557
615
|
end
|
558
616
|
|
559
617
|
ExampleJob.perform_later
|
560
618
|
```
|
561
619
|
|
562
|
-
|
620
|
+
### Active Model Serializers
|
563
621
|
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
622
|
+
The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
|
623
|
+
|
624
|
+
```ruby
|
625
|
+
require 'active_model_serializers'
|
626
|
+
require 'ddtrace'
|
627
|
+
|
628
|
+
Datadog.configure do |c|
|
629
|
+
c.tracing.instrument :active_model_serializers
|
630
|
+
end
|
631
|
+
|
632
|
+
my_object = MyModel.new(name: 'my object')
|
633
|
+
ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
634
|
+
```
|
568
635
|
|
569
636
|
### Active Record
|
570
637
|
|
@@ -577,7 +644,7 @@ require 'active_record'
|
|
577
644
|
require 'ddtrace'
|
578
645
|
|
579
646
|
Datadog.configure do |c|
|
580
|
-
c.
|
647
|
+
c.tracing.instrument :active_record, options
|
581
648
|
end
|
582
649
|
|
583
650
|
Dir::Tmpname.create(['test', '.sqlite']) do |db|
|
@@ -591,7 +658,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
591
658
|
|
592
659
|
| Key | Description | Default |
|
593
660
|
| ---| --- | --- |
|
594
|
-
| `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'`) |
|
595
661
|
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
596
662
|
|
597
663
|
**Configuring trace settings per database**
|
@@ -607,22 +673,22 @@ You can configure trace settings per database connection by using the `describes
|
|
607
673
|
Datadog.configure do |c|
|
608
674
|
# Symbol matching your database connection in config/database.yml
|
609
675
|
# Only available if you are using Rails with ActiveRecord.
|
610
|
-
c.
|
676
|
+
c.tracing.instrument :active_record, describes: :secondary_database, service_name: 'secondary-db'
|
611
677
|
|
612
678
|
# Block configuration pattern.
|
613
|
-
c.
|
679
|
+
c.tracing.instrument :active_record, describes: :secondary_database do |second_db|
|
614
680
|
second_db.service_name = 'secondary-db'
|
615
681
|
end
|
616
682
|
|
617
683
|
# Connection string with the following connection settings:
|
618
684
|
# adapter, username, host, port, database
|
619
685
|
# Other fields are ignored.
|
620
|
-
c.
|
686
|
+
c.tracing.instrument :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
|
621
687
|
|
622
688
|
# Hash with following connection settings:
|
623
689
|
# adapter, username, host, port, database
|
624
690
|
# Other fields are ignored.
|
625
|
-
c.
|
691
|
+
c.tracing.instrument :active_record, describes: {
|
626
692
|
adapter: 'mysql2',
|
627
693
|
host: '127.0.0.1',
|
628
694
|
port: '3306',
|
@@ -632,8 +698,8 @@ Datadog.configure do |c|
|
|
632
698
|
service_name: 'secondary-db'
|
633
699
|
|
634
700
|
# If using the `makara` gem, it's possible to match on connection `role`:
|
635
|
-
c.
|
636
|
-
c.
|
701
|
+
c.tracing.instrument :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
|
702
|
+
c.tracing.instrument :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
|
637
703
|
end
|
638
704
|
```
|
639
705
|
|
@@ -642,23 +708,23 @@ You can also create configurations based on partial matching of database connect
|
|
642
708
|
```ruby
|
643
709
|
Datadog.configure do |c|
|
644
710
|
# Matches any connection on host `127.0.0.1`.
|
645
|
-
c.
|
711
|
+
c.tracing.instrument :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
|
646
712
|
|
647
713
|
# Matches any `mysql2` connection.
|
648
|
-
c.
|
714
|
+
c.tracing.instrument :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
|
649
715
|
|
650
716
|
# Matches any `mysql2` connection to the `reports` database.
|
651
717
|
#
|
652
718
|
# In case of multiple matching `describe` configurations, the latest one applies.
|
653
719
|
# In this case a connection with both adapter `mysql` and database `reports`
|
654
720
|
# will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
|
655
|
-
c.
|
721
|
+
c.tracing.instrument :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
|
656
722
|
end
|
657
723
|
```
|
658
724
|
|
659
725
|
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
660
726
|
|
661
|
-
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.
|
727
|
+
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.tracing.instrument :active_record` instead.
|
662
728
|
|
663
729
|
### Active Support
|
664
730
|
|
@@ -669,7 +735,7 @@ require 'activesupport'
|
|
669
735
|
require 'ddtrace'
|
670
736
|
|
671
737
|
Datadog.configure do |c|
|
672
|
-
c.
|
738
|
+
c.tracing.instrument :active_support, options
|
673
739
|
end
|
674
740
|
|
675
741
|
cache = ActiveSupport::Cache::MemoryStore.new
|
@@ -691,7 +757,7 @@ require 'aws-sdk'
|
|
691
757
|
require 'ddtrace'
|
692
758
|
|
693
759
|
Datadog.configure do |c|
|
694
|
-
c.
|
760
|
+
c.tracing.instrument :aws, options
|
695
761
|
end
|
696
762
|
|
697
763
|
# Perform traced call
|
@@ -715,21 +781,15 @@ To activate your integration, use the `Datadog.configure` method:
|
|
715
781
|
# Inside Rails initializer or equivalent
|
716
782
|
Datadog.configure do |c|
|
717
783
|
# Patches ::Concurrent::Future to use ExecutorService that propagates context
|
718
|
-
c.
|
784
|
+
c.tracing.instrument :concurrent_ruby
|
719
785
|
end
|
720
786
|
|
721
787
|
# Pass context into code executed within Concurrent::Future
|
722
|
-
Datadog.
|
723
|
-
Concurrent::Future.execute { Datadog.
|
788
|
+
Datadog::Tracing.trace('outer') do
|
789
|
+
Concurrent::Future.execute { Datadog::Tracing.trace('inner') { } }.wait
|
724
790
|
end
|
725
791
|
```
|
726
792
|
|
727
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
728
|
-
|
729
|
-
| Key | Description | Default |
|
730
|
-
| --- | ----------- | ------- |
|
731
|
-
| `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
|
732
|
-
|
733
793
|
### Cucumber
|
734
794
|
|
735
795
|
Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
|
@@ -742,7 +802,7 @@ require 'ddtrace'
|
|
742
802
|
|
743
803
|
# Configure default Cucumber integration
|
744
804
|
Datadog.configure do |c|
|
745
|
-
c.
|
805
|
+
c.ci.instrument :cucumber, options
|
746
806
|
end
|
747
807
|
|
748
808
|
# Example of how to attach tags from scenario to active span
|
@@ -775,7 +835,7 @@ require 'ddtrace'
|
|
775
835
|
|
776
836
|
# Configure default Dalli tracing behavior
|
777
837
|
Datadog.configure do |c|
|
778
|
-
c.
|
838
|
+
c.tracing.instrument :dalli, options
|
779
839
|
end
|
780
840
|
|
781
841
|
# Configure Dalli tracing behavior for single client
|
@@ -799,7 +859,7 @@ You can enable it through `Datadog.configure`:
|
|
799
859
|
require 'ddtrace'
|
800
860
|
|
801
861
|
Datadog.configure do |c|
|
802
|
-
c.
|
862
|
+
c.tracing.instrument :delayed_job, options
|
803
863
|
end
|
804
864
|
```
|
805
865
|
|
@@ -807,8 +867,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
807
867
|
|
808
868
|
| Key | Description | Default |
|
809
869
|
| --- | ----------- | ------- |
|
810
|
-
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
811
|
-
| `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
|
812
870
|
| `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? }` |
|
813
871
|
|
814
872
|
### Elasticsearch
|
@@ -820,12 +878,15 @@ require 'elasticsearch/transport'
|
|
820
878
|
require 'ddtrace'
|
821
879
|
|
822
880
|
Datadog.configure do |c|
|
823
|
-
c.
|
881
|
+
c.tracing.instrument :elasticsearch, options
|
824
882
|
end
|
825
883
|
|
826
884
|
# Perform a query to Elasticsearch
|
827
885
|
client = Elasticsearch::Client.new url: 'http://127.0.0.1:9200'
|
828
886
|
response = client.perform_request 'GET', '_cluster/health'
|
887
|
+
|
888
|
+
# In case you want to override the global configuration for a certain client instance
|
889
|
+
Datadog.configure_onto(client.transport, **options)
|
829
890
|
```
|
830
891
|
|
831
892
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
@@ -843,10 +904,10 @@ The `ethon` integration will trace any HTTP request through `Easy` or `Multi` ob
|
|
843
904
|
require 'ddtrace'
|
844
905
|
|
845
906
|
Datadog.configure do |c|
|
846
|
-
c.
|
907
|
+
c.tracing.instrument :ethon, options
|
847
908
|
|
848
909
|
# optionally, specify a different service name for hostnames matching a regex
|
849
|
-
c.
|
910
|
+
c.tracing.instrument :ethon, describes: /user-[^.]+\.example\.com/ do |ethon|
|
850
911
|
ethon.service_name = 'user.example.com'
|
851
912
|
ethon.split_by_domain = false # Only necessary if split_by_domain is true by default
|
852
913
|
end
|
@@ -871,10 +932,10 @@ require 'ddtrace'
|
|
871
932
|
|
872
933
|
# Configure default Excon tracing behavior
|
873
934
|
Datadog.configure do |c|
|
874
|
-
c.
|
935
|
+
c.tracing.instrument :excon, options
|
875
936
|
|
876
937
|
# optionally, specify a different service name for hostnames matching a regex
|
877
|
-
c.
|
938
|
+
c.tracing.instrument :excon, describes: /user-[^.]+\.example\.com/ do |excon|
|
878
939
|
excon.service_name = 'user.example.com'
|
879
940
|
excon.split_by_domain = false # Only necessary if split_by_domain is true by default
|
880
941
|
end
|
@@ -901,7 +962,7 @@ If you use multiple connections with Excon, you can give each of them different
|
|
901
962
|
# Wrap the Datadog tracing middleware around the default middleware stack
|
902
963
|
Excon.new(
|
903
964
|
'http://example.com',
|
904
|
-
middlewares: Datadog::Contrib::Excon::Middleware.with(options).around_default_stack
|
965
|
+
middlewares: Datadog::Tracing::Contrib::Excon::Middleware.with(options).around_default_stack
|
905
966
|
)
|
906
967
|
|
907
968
|
# Insert the middleware into a custom middleware stack.
|
@@ -910,7 +971,7 @@ Excon.new(
|
|
910
971
|
'http://example.com',
|
911
972
|
middlewares: [
|
912
973
|
Excon::Middleware::ResponseParser,
|
913
|
-
Datadog::Contrib::Excon::Middleware.with(options),
|
974
|
+
Datadog::Tracing::Contrib::Excon::Middleware.with(options),
|
914
975
|
Excon::Middleware::Idempotent
|
915
976
|
]
|
916
977
|
)
|
@@ -928,10 +989,10 @@ require 'ddtrace'
|
|
928
989
|
|
929
990
|
# Configure default Faraday tracing behavior
|
930
991
|
Datadog.configure do |c|
|
931
|
-
c.
|
992
|
+
c.tracing.instrument :faraday, options
|
932
993
|
|
933
994
|
# optionally, specify a different service name for hostnames matching a regex
|
934
|
-
c.
|
995
|
+
c.tracing.instrument :faraday, describes: /user-[^.]+\.example\.com/ do |faraday|
|
935
996
|
faraday.service_name = 'user.example.com'
|
936
997
|
faraday.split_by_domain = false # Only necessary if split_by_domain is true by default
|
937
998
|
end
|
@@ -967,7 +1028,7 @@ require 'grape'
|
|
967
1028
|
require 'ddtrace'
|
968
1029
|
|
969
1030
|
Datadog.configure do |c|
|
970
|
-
c.
|
1031
|
+
c.tracing.instrument :grape, options
|
971
1032
|
end
|
972
1033
|
|
973
1034
|
# Then define your application
|
@@ -984,7 +1045,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
984
1045
|
| Key | Description | Default |
|
985
1046
|
| --- | ----------- | ------- |
|
986
1047
|
| `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
987
|
-
| `service_name` | Service name used for `grape` instrumentation | `'grape'` |
|
988
1048
|
| `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` |
|
989
1049
|
|
990
1050
|
### GraphQL
|
@@ -996,7 +1056,7 @@ To activate your integration, use the `Datadog.configure` method:
|
|
996
1056
|
```ruby
|
997
1057
|
# Inside Rails initializer or equivalent
|
998
1058
|
Datadog.configure do |c|
|
999
|
-
c.
|
1059
|
+
c.tracing.instrument :graphql, schemas: [YourSchema], options
|
1000
1060
|
end
|
1001
1061
|
|
1002
1062
|
# Then run a GraphQL query
|
@@ -1007,7 +1067,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
|
|
1007
1067
|
|
1008
1068
|
| Key | Description | Default |
|
1009
1069
|
| --- | ----------- | ------- |
|
1010
|
-
| `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
|
1011
1070
|
| `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. | `[]` |
|
1012
1071
|
|
1013
1072
|
**Manually configuring GraphQL schemas**
|
@@ -1067,7 +1126,7 @@ require 'grpc'
|
|
1067
1126
|
require 'ddtrace'
|
1068
1127
|
|
1069
1128
|
Datadog.configure do |c|
|
1070
|
-
c.
|
1129
|
+
c.tracing.instrument :grpc, options
|
1071
1130
|
end
|
1072
1131
|
|
1073
1132
|
# Server side
|
@@ -1085,6 +1144,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1085
1144
|
|
1086
1145
|
| Key | Description | Default |
|
1087
1146
|
| --- | ----------- | ------- |
|
1147
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1088
1148
|
| `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
|
1089
1149
|
| `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? }` |
|
1090
1150
|
|
@@ -1093,7 +1153,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1093
1153
|
In situations where you have multiple clients calling multiple distinct services, you may pass the Datadog interceptor directly, like so
|
1094
1154
|
|
1095
1155
|
```ruby
|
1096
|
-
configured_interceptor = Datadog::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
|
1156
|
+
configured_interceptor = Datadog::Tracing::Contrib::GRPC::DatadogInterceptor::Client.new do |c|
|
1097
1157
|
c.service_name = "Alternate"
|
1098
1158
|
end
|
1099
1159
|
|
@@ -1114,9 +1174,9 @@ The http.rb integration will trace any HTTP call using the Http.rb gem.
|
|
1114
1174
|
require 'http'
|
1115
1175
|
require 'ddtrace'
|
1116
1176
|
Datadog.configure do |c|
|
1117
|
-
c.
|
1177
|
+
c.tracing.instrument :httprb, options
|
1118
1178
|
# optionally, specify a different service name for hostnames matching a regex
|
1119
|
-
c.
|
1179
|
+
c.tracing.instrument :httprb, describes: /user-[^.]+\.example\.com/ do |httprb|
|
1120
1180
|
httprb.service_name = 'user.example.com'
|
1121
1181
|
httprb.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1122
1182
|
end
|
@@ -1139,9 +1199,9 @@ The httpclient integration will trace any HTTP call using the httpclient gem.
|
|
1139
1199
|
require 'httpclient'
|
1140
1200
|
require 'ddtrace'
|
1141
1201
|
Datadog.configure do |c|
|
1142
|
-
c.
|
1202
|
+
c.tracing.instrument :httpclient, options
|
1143
1203
|
# optionally, specify a different service name for hostnames matching a regex
|
1144
|
-
c.
|
1204
|
+
c.tracing.instrument :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
|
1145
1205
|
httpclient.service_name = 'user.example.com'
|
1146
1206
|
httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1147
1207
|
end
|
@@ -1165,10 +1225,10 @@ require "ddtrace"
|
|
1165
1225
|
require "httpx/adapters/datadog"
|
1166
1226
|
|
1167
1227
|
Datadog.configure do |c|
|
1168
|
-
c.
|
1228
|
+
c.tracing.instrument :httpx
|
1169
1229
|
|
1170
1230
|
# optionally, specify a different service name for hostnames matching a regex
|
1171
|
-
c.
|
1231
|
+
c.tracing.instrument :httpx, describes: /user-[^.]+\.example\.com/ do |http|
|
1172
1232
|
http.service_name = 'user.example.com'
|
1173
1233
|
http.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1174
1234
|
end
|
@@ -1187,17 +1247,10 @@ require 'kafka'
|
|
1187
1247
|
require 'ddtrace'
|
1188
1248
|
|
1189
1249
|
Datadog.configure do |c|
|
1190
|
-
c.
|
1250
|
+
c.tracing.instrument :kafka
|
1191
1251
|
end
|
1192
1252
|
```
|
1193
1253
|
|
1194
|
-
Where `options` is an optional `Hash` that accepts the following parameters:
|
1195
|
-
|
1196
|
-
| Key | Description | Default |
|
1197
|
-
| --- | ----------- | ------- |
|
1198
|
-
| `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
|
1199
|
-
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
1200
|
-
|
1201
1254
|
### MongoDB
|
1202
1255
|
|
1203
1256
|
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:
|
@@ -1207,7 +1260,7 @@ require 'mongo'
|
|
1207
1260
|
require 'ddtrace'
|
1208
1261
|
|
1209
1262
|
Datadog.configure do |c|
|
1210
|
-
c.
|
1263
|
+
c.tracing.instrument :mongo, options
|
1211
1264
|
end
|
1212
1265
|
|
1213
1266
|
# Create a MongoDB client and use it as usual
|
@@ -1216,7 +1269,7 @@ collection = client[:people]
|
|
1216
1269
|
collection.insert_one({ name: 'Steve' })
|
1217
1270
|
|
1218
1271
|
# In case you want to override the global configuration for a certain client instance
|
1219
|
-
Datadog.
|
1272
|
+
Datadog.configure_onto(client, **options)
|
1220
1273
|
```
|
1221
1274
|
|
1222
1275
|
Where `options` is an optional `Hash` that accepts the following parameters:
|
@@ -1238,10 +1291,10 @@ You can configure trace settings per connection by using the `describes` option:
|
|
1238
1291
|
|
1239
1292
|
Datadog.configure do |c|
|
1240
1293
|
# Network connection string
|
1241
|
-
c.
|
1294
|
+
c.tracing.instrument :mongo, describes: '127.0.0.1:27017', service_name: 'mongo-primary'
|
1242
1295
|
|
1243
1296
|
# Network connection regular expression
|
1244
|
-
c.
|
1297
|
+
c.tracing.instrument :mongo, describes: /localhost.*/, service_name: 'mongo-secondary'
|
1245
1298
|
end
|
1246
1299
|
|
1247
1300
|
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
|
@@ -1266,7 +1319,7 @@ require 'mysql2'
|
|
1266
1319
|
require 'ddtrace'
|
1267
1320
|
|
1268
1321
|
Datadog.configure do |c|
|
1269
|
-
c.
|
1322
|
+
c.tracing.instrument :mysql2, options
|
1270
1323
|
end
|
1271
1324
|
|
1272
1325
|
client = Mysql2::Client.new(:host => "localhost", :username => "root")
|
@@ -1288,10 +1341,10 @@ require 'net/http'
|
|
1288
1341
|
require 'ddtrace'
|
1289
1342
|
|
1290
1343
|
Datadog.configure do |c|
|
1291
|
-
c.
|
1344
|
+
c.tracing.instrument :http, options
|
1292
1345
|
|
1293
1346
|
# optionally, specify a different service name for hostnames matching a regex
|
1294
|
-
c.
|
1347
|
+
c.tracing.instrument :http, describes: /user-[^.]+\.example\.com/ do |http|
|
1295
1348
|
http.service_name = 'user.example.com'
|
1296
1349
|
http.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1297
1350
|
end
|
@@ -1313,13 +1366,34 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1313
1366
|
| `service_name` | Service name used for `http` instrumentation | `'net/http'` |
|
1314
1367
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1315
1368
|
|
1316
|
-
If you wish to configure each connection object individually, you may use the `Datadog.
|
1369
|
+
If you wish to configure each connection object individually, you may use the `Datadog.configure_onto` as it follows:
|
1317
1370
|
|
1318
1371
|
```ruby
|
1319
1372
|
client = Net::HTTP.new(host, port)
|
1320
|
-
Datadog.
|
1373
|
+
Datadog.configure_onto(client, **options)
|
1374
|
+
```
|
1375
|
+
### Postgres
|
1376
|
+
|
1377
|
+
The PG integration traces SQL commands sent through the `pg` gem via:
|
1378
|
+
* `exec`, `exec_params`, `exec_prepared`;
|
1379
|
+
* `async_exec`, `async_exec_params`, `async_exec_prepared`; or,
|
1380
|
+
* `sync_exec`, `sync_exec_params`, `sync_exec_prepared`
|
1381
|
+
|
1382
|
+
```ruby
|
1383
|
+
require 'pg'
|
1384
|
+
require 'ddtrace'
|
1385
|
+
|
1386
|
+
Datadog.configure do |c|
|
1387
|
+
c.tracing.instrument :pg, options
|
1388
|
+
end
|
1321
1389
|
```
|
1322
1390
|
|
1391
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1392
|
+
|
1393
|
+
| Key | Description | Default |
|
1394
|
+
| --- | ----------- | ------- |
|
1395
|
+
| `service_name` | Service name used for `pg` instrumentation | `'pg'` |
|
1396
|
+
|
1323
1397
|
### Presto
|
1324
1398
|
|
1325
1399
|
The Presto integration traces any SQL command sent through `presto-client` gem.
|
@@ -1329,7 +1403,7 @@ require 'presto-client'
|
|
1329
1403
|
require 'ddtrace'
|
1330
1404
|
|
1331
1405
|
Datadog.configure do |c|
|
1332
|
-
c.
|
1406
|
+
c.tracing.instrument :presto, options
|
1333
1407
|
end
|
1334
1408
|
|
1335
1409
|
client = Presto::Client.new(
|
@@ -1361,7 +1435,7 @@ To add tracing to a Qless job:
|
|
1361
1435
|
require 'ddtrace'
|
1362
1436
|
|
1363
1437
|
Datadog.configure do |c|
|
1364
|
-
c.
|
1438
|
+
c.tracing.instrument :qless, options
|
1365
1439
|
end
|
1366
1440
|
```
|
1367
1441
|
|
@@ -1369,7 +1443,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1369
1443
|
|
1370
1444
|
| Key | Description | Default |
|
1371
1445
|
| --- | ----------- | ------- |
|
1372
|
-
| `service_name` | Service name used for `qless` instrumentation | `'qless'` |
|
1373
1446
|
| `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
|
1374
1447
|
| `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
|
1375
1448
|
|
@@ -1383,7 +1456,7 @@ You can enable it through `Datadog.configure`:
|
|
1383
1456
|
require 'ddtrace'
|
1384
1457
|
|
1385
1458
|
Datadog.configure do |c|
|
1386
|
-
c.
|
1459
|
+
c.tracing.instrument :que, options
|
1387
1460
|
end
|
1388
1461
|
```
|
1389
1462
|
|
@@ -1392,7 +1465,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1392
1465
|
| Key | Description | Default |
|
1393
1466
|
| --- | ----------- | ------- |
|
1394
1467
|
| `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1395
|
-
| `service_name` | Service name used for `que` instrumentation | `'que'` |
|
1396
1468
|
| `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
|
1397
1469
|
| `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
|
1398
1470
|
| `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? }` |
|
@@ -1407,7 +1479,7 @@ You can enable it through `Datadog.configure`:
|
|
1407
1479
|
require 'ddtrace'
|
1408
1480
|
|
1409
1481
|
Datadog.configure do |c|
|
1410
|
-
c.
|
1482
|
+
c.tracing.instrument :racecar, options
|
1411
1483
|
end
|
1412
1484
|
```
|
1413
1485
|
|
@@ -1428,10 +1500,10 @@ This integration is automatically activated with web frameworks like Rails. If y
|
|
1428
1500
|
require 'ddtrace'
|
1429
1501
|
|
1430
1502
|
Datadog.configure do |c|
|
1431
|
-
c.
|
1503
|
+
c.tracing.instrument :rack, options
|
1432
1504
|
end
|
1433
1505
|
|
1434
|
-
use Datadog::Contrib::Rack::TraceMiddleware
|
1506
|
+
use Datadog::Tracing::Contrib::Rack::TraceMiddleware
|
1435
1507
|
|
1436
1508
|
app = proc do |env|
|
1437
1509
|
[ 200, {'Content-Type' => 'text/plain'}, ['OK'] ]
|
@@ -1454,7 +1526,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1454
1526
|
| `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` |
|
1455
1527
|
| `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` |
|
1456
1528
|
| `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` |
|
1457
|
-
| `service_name` | Service name used for `rack` instrumentation | `'rack'` |
|
1458
1529
|
| `web_service_name` | Service name for frontend server request queuing spans. (e.g. `'nginx'`) | `'web-server'` |
|
1459
1530
|
|
1460
1531
|
**Configuring URL quantization behavior**
|
@@ -1467,23 +1538,23 @@ Datadog.configure do |c|
|
|
1467
1538
|
|
1468
1539
|
# Show values for any query string parameter matching 'category_id' exactly
|
1469
1540
|
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by
|
1470
|
-
c.
|
1541
|
+
c.tracing.instrument :rack, quantize: { query: { show: ['category_id'] } }
|
1471
1542
|
|
1472
1543
|
# Show all values for all query string parameters
|
1473
1544
|
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id=1&sort_by=asc
|
1474
|
-
c.
|
1545
|
+
c.tracing.instrument :rack, quantize: { query: { show: :all } }
|
1475
1546
|
|
1476
1547
|
# Totally exclude any query string parameter matching 'sort_by' exactly
|
1477
1548
|
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id
|
1478
|
-
c.
|
1549
|
+
c.tracing.instrument :rack, quantize: { query: { exclude: ['sort_by'] } }
|
1479
1550
|
|
1480
1551
|
# Remove the query string entirely
|
1481
1552
|
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path
|
1482
|
-
c.
|
1553
|
+
c.tracing.instrument :rack, quantize: { query: { exclude: :all } }
|
1483
1554
|
|
1484
1555
|
# Show URL fragments
|
1485
1556
|
# http://example.com/path?category_id=1&sort_by=asc#featured --> http://example.com/path?category_id&sort_by#featured
|
1486
|
-
c.
|
1557
|
+
c.tracing.instrument :rack, quantize: { fragment: :show }
|
1487
1558
|
end
|
1488
1559
|
```
|
1489
1560
|
|
@@ -1498,7 +1569,7 @@ To enable the Rails instrumentation, create an initializer file in your `config/
|
|
1498
1569
|
require 'ddtrace'
|
1499
1570
|
|
1500
1571
|
Datadog.configure do |c|
|
1501
|
-
c.
|
1572
|
+
c.tracing.instrument :rails, options
|
1502
1573
|
end
|
1503
1574
|
```
|
1504
1575
|
|
@@ -1507,23 +1578,21 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1507
1578
|
| Key | Description | Default |
|
1508
1579
|
| --- | ----------- | ------- |
|
1509
1580
|
| `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
|
1510
|
-
| `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
|
1511
1581
|
| `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
|
1512
1582
|
| `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` |
|
1583
|
+
| `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` |
|
1513
1584
|
| `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` |
|
1514
|
-
| `job_service` | Service name used when tracing ActiveJob activity. | `<app_name>-active_job` |
|
1515
1585
|
| `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
|
1516
1586
|
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
|
1517
1587
|
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
1518
1588
|
| `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/'` |
|
1519
|
-
| `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` |
|
1520
1589
|
|
1521
1590
|
**Supported versions**
|
1522
1591
|
|
1523
1592
|
| MRI Versions | JRuby Versions | Rails Versions |
|
1524
1593
|
| ------------- | -------------- | -------------- |
|
1525
|
-
| 2.1 | | 3.
|
1526
|
-
| 2.2 - 2.3 | | 3.
|
1594
|
+
| 2.1 | | 3.2 - 4.2 |
|
1595
|
+
| 2.2 - 2.3 | | 3.2 - 5.2 |
|
1527
1596
|
| 2.4 | | 4.2.8 - 5.2 |
|
1528
1597
|
| 2.5 | | 4.2.8 - 6.1 |
|
1529
1598
|
| 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
|
@@ -1541,7 +1610,7 @@ require 'rake'
|
|
1541
1610
|
require 'ddtrace'
|
1542
1611
|
|
1543
1612
|
Datadog.configure do |c|
|
1544
|
-
c.
|
1613
|
+
c.tracing.instrument :rake, options
|
1545
1614
|
end
|
1546
1615
|
|
1547
1616
|
task :my_task do
|
@@ -1569,27 +1638,27 @@ Datadog.configure do |c|
|
|
1569
1638
|
# Default behavior: all arguments are quantized.
|
1570
1639
|
# `rake.invoke.args` tag --> ['?']
|
1571
1640
|
# `rake.execute.args` tag --> { one: '?', two: '?', three: '?' }
|
1572
|
-
c.
|
1641
|
+
c.tracing.instrument :rake
|
1573
1642
|
|
1574
1643
|
# Show values for any argument matching :two exactly
|
1575
1644
|
# `rake.invoke.args` tag --> ['?']
|
1576
1645
|
# `rake.execute.args` tag --> { one: '?', two: 'bar', three: '?' }
|
1577
|
-
c.
|
1646
|
+
c.tracing.instrument :rake, quantize: { args: { show: [:two] } }
|
1578
1647
|
|
1579
1648
|
# Show all values for all arguments.
|
1580
1649
|
# `rake.invoke.args` tag --> ['foo', 'bar', 'baz']
|
1581
1650
|
# `rake.execute.args` tag --> { one: 'foo', two: 'bar', three: 'baz' }
|
1582
|
-
c.
|
1651
|
+
c.tracing.instrument :rake, quantize: { args: { show: :all } }
|
1583
1652
|
|
1584
1653
|
# Totally exclude any argument matching :three exactly
|
1585
1654
|
# `rake.invoke.args` tag --> ['?']
|
1586
1655
|
# `rake.execute.args` tag --> { one: '?', two: '?' }
|
1587
|
-
c.
|
1656
|
+
c.tracing.instrument :rake, quantize: { args: { exclude: [:three] } }
|
1588
1657
|
|
1589
1658
|
# Remove the arguments entirely
|
1590
1659
|
# `rake.invoke.args` tag --> ['?']
|
1591
1660
|
# `rake.execute.args` tag --> {}
|
1592
|
-
c.
|
1661
|
+
c.tracing.instrument :rake, quantize: { args: { exclude: :all } }
|
1593
1662
|
end
|
1594
1663
|
```
|
1595
1664
|
|
@@ -1602,7 +1671,7 @@ require 'redis'
|
|
1602
1671
|
require 'ddtrace'
|
1603
1672
|
|
1604
1673
|
Datadog.configure do |c|
|
1605
|
-
c.
|
1674
|
+
c.tracing.instrument :redis, options
|
1606
1675
|
end
|
1607
1676
|
|
1608
1677
|
# Perform Redis commands
|
@@ -1624,14 +1693,14 @@ require 'redis'
|
|
1624
1693
|
require 'ddtrace'
|
1625
1694
|
|
1626
1695
|
Datadog.configure do |c|
|
1627
|
-
c.
|
1696
|
+
c.tracing.instrument :redis # Enabling integration instrumentation is still required
|
1628
1697
|
end
|
1629
1698
|
|
1630
1699
|
customer_cache = Redis.new
|
1631
1700
|
invoice_cache = Redis.new
|
1632
1701
|
|
1633
|
-
Datadog.
|
1634
|
-
Datadog.
|
1702
|
+
Datadog.configure_onto(customer_cache, service_name: 'customer-cache')
|
1703
|
+
Datadog.configure_onto(invoice_cache, service_name: 'invoice-cache')
|
1635
1704
|
|
1636
1705
|
# Traced call will belong to `customer-cache` service
|
1637
1706
|
customer_cache.get(...)
|
@@ -1651,23 +1720,23 @@ You can configure trace settings per connection by using the `describes` option:
|
|
1651
1720
|
|
1652
1721
|
Datadog.configure do |c|
|
1653
1722
|
# The default configuration for any redis client
|
1654
|
-
c.
|
1723
|
+
c.tracing.instrument :redis, service_name: 'redis-default'
|
1655
1724
|
|
1656
1725
|
# The configuration matching a given unix socket.
|
1657
|
-
c.
|
1726
|
+
c.tracing.instrument :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
|
1658
1727
|
|
1659
1728
|
# For network connections, only these fields are considered during matching:
|
1660
1729
|
# scheme, host, port, db
|
1661
1730
|
# Other fields are ignored.
|
1662
1731
|
|
1663
1732
|
# Network connection string
|
1664
|
-
c.
|
1665
|
-
c.
|
1733
|
+
c.tracing.instrument :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
|
1734
|
+
c.tracing.instrument :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
|
1666
1735
|
# Network client hash
|
1667
|
-
c.
|
1736
|
+
c.tracing.instrument :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
|
1668
1737
|
# Only a subset of the connection hash
|
1669
|
-
c.
|
1670
|
-
c.
|
1738
|
+
c.tracing.instrument :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
|
1739
|
+
c.tracing.instrument :redis, describes: { host: ENV['SIDEKIQ_CACHE_HOST'] }, service_name: 'redis-sidekiq'
|
1671
1740
|
end
|
1672
1741
|
```
|
1673
1742
|
|
@@ -1684,7 +1753,7 @@ require 'resque'
|
|
1684
1753
|
require 'ddtrace'
|
1685
1754
|
|
1686
1755
|
Datadog.configure do |c|
|
1687
|
-
c.
|
1756
|
+
c.tracing.instrument :resque, **options
|
1688
1757
|
end
|
1689
1758
|
```
|
1690
1759
|
|
@@ -1692,9 +1761,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1692
1761
|
|
1693
1762
|
| Key | Description | Default |
|
1694
1763
|
| --- | ----------- | ------- |
|
1695
|
-
| `service_name` | Service name used for `resque` instrumentation | `'resque'` |
|
1696
1764
|
| `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? }` |
|
1697
|
-
| `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
|
1698
1765
|
|
1699
1766
|
### Rest Client
|
1700
1767
|
|
@@ -1705,7 +1772,7 @@ require 'rest_client'
|
|
1705
1772
|
require 'ddtrace'
|
1706
1773
|
|
1707
1774
|
Datadog.configure do |c|
|
1708
|
-
c.
|
1775
|
+
c.tracing.instrument :rest_client, options
|
1709
1776
|
end
|
1710
1777
|
```
|
1711
1778
|
|
@@ -1715,6 +1782,7 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1715
1782
|
| --- | ----------- | ------- |
|
1716
1783
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1717
1784
|
| `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
|
1785
|
+
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1718
1786
|
|
1719
1787
|
### RSpec
|
1720
1788
|
|
@@ -1728,7 +1796,7 @@ require 'ddtrace'
|
|
1728
1796
|
|
1729
1797
|
# Configure default RSpec integration
|
1730
1798
|
Datadog.configure do |c|
|
1731
|
-
c.
|
1799
|
+
c.ci.instrument :rspec, options
|
1732
1800
|
end
|
1733
1801
|
```
|
1734
1802
|
|
@@ -1758,7 +1826,7 @@ database.create_table :articles do
|
|
1758
1826
|
end
|
1759
1827
|
|
1760
1828
|
Datadog.configure do |c|
|
1761
|
-
c.
|
1829
|
+
c.tracing.instrument :sequel, options
|
1762
1830
|
end
|
1763
1831
|
|
1764
1832
|
# Perform a query
|
@@ -1781,8 +1849,8 @@ sqlite_database = Sequel.sqlite
|
|
1781
1849
|
postgres_database = Sequel.connect('postgres://user:password@host:port/database_name')
|
1782
1850
|
|
1783
1851
|
# Configure each database with different service names
|
1784
|
-
Datadog.
|
1785
|
-
Datadog.
|
1852
|
+
Datadog.configure_onto(sqlite_database, service_name: 'my-sqlite-db')
|
1853
|
+
Datadog.configure_onto(postgres_database, service_name: 'my-postgres-db')
|
1786
1854
|
```
|
1787
1855
|
|
1788
1856
|
### Shoryuken
|
@@ -1795,7 +1863,7 @@ You can enable it through `Datadog.configure`:
|
|
1795
1863
|
require 'ddtrace'
|
1796
1864
|
|
1797
1865
|
Datadog.configure do |c|
|
1798
|
-
c.
|
1866
|
+
c.tracing.instrument :shoryuken, options
|
1799
1867
|
end
|
1800
1868
|
```
|
1801
1869
|
|
@@ -1803,7 +1871,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1803
1871
|
|
1804
1872
|
| Key | Description | Default |
|
1805
1873
|
| --- | ----------- | ------- |
|
1806
|
-
| `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
|
1807
1874
|
| `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
|
1808
1875
|
| `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? }` |
|
1809
1876
|
|
@@ -1817,7 +1884,7 @@ You can enable it through `Datadog.configure`:
|
|
1817
1884
|
require 'ddtrace'
|
1818
1885
|
|
1819
1886
|
Datadog.configure do |c|
|
1820
|
-
c.
|
1887
|
+
c.tracing.instrument :sidekiq, options
|
1821
1888
|
end
|
1822
1889
|
```
|
1823
1890
|
|
@@ -1825,10 +1892,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1825
1892
|
|
1826
1893
|
| Key | Description | Default |
|
1827
1894
|
| --- | ----------- | ------- |
|
1828
|
-
| `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
|
1829
|
-
| `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
|
1830
1895
|
| `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
|
1831
|
-
| `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 {
|
1896
|
+
| `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? }` |
|
1897
|
+
| `quantize` | Hash containing options for quantization of job arguments. | `{}` |
|
1832
1898
|
|
1833
1899
|
### Sinatra
|
1834
1900
|
|
@@ -1843,7 +1909,7 @@ require 'sinatra'
|
|
1843
1909
|
require 'ddtrace'
|
1844
1910
|
|
1845
1911
|
Datadog.configure do |c|
|
1846
|
-
c.
|
1912
|
+
c.tracing.instrument :sinatra, options
|
1847
1913
|
end
|
1848
1914
|
|
1849
1915
|
get '/' do
|
@@ -1858,11 +1924,11 @@ require 'sinatra/base'
|
|
1858
1924
|
require 'ddtrace'
|
1859
1925
|
|
1860
1926
|
Datadog.configure do |c|
|
1861
|
-
c.
|
1927
|
+
c.tracing.instrument :sinatra, options
|
1862
1928
|
end
|
1863
1929
|
|
1864
1930
|
class NestedApp < Sinatra::Base
|
1865
|
-
register Datadog::Contrib::Sinatra::Tracer
|
1931
|
+
register Datadog::Tracing::Contrib::Sinatra::Tracer
|
1866
1932
|
|
1867
1933
|
get '/nested' do
|
1868
1934
|
'Hello from nested app!'
|
@@ -1870,7 +1936,7 @@ class NestedApp < Sinatra::Base
|
|
1870
1936
|
end
|
1871
1937
|
|
1872
1938
|
class App < Sinatra::Base
|
1873
|
-
register Datadog::Contrib::Sinatra::Tracer
|
1939
|
+
register Datadog::Tracing::Contrib::Sinatra::Tracer
|
1874
1940
|
|
1875
1941
|
use NestedApp
|
1876
1942
|
|
@@ -1880,7 +1946,7 @@ class App < Sinatra::Base
|
|
1880
1946
|
end
|
1881
1947
|
```
|
1882
1948
|
|
1883
|
-
Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
|
1949
|
+
Ensure you register `Datadog::Tracing::Contrib::Sinatra::Tracer` as a middleware before you mount your nested applications.
|
1884
1950
|
|
1885
1951
|
#### Instrumentation options
|
1886
1952
|
|
@@ -1891,7 +1957,6 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
|
|
1891
1957
|
| `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` |
|
1892
1958
|
| `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'] }` |
|
1893
1959
|
| `resource_script_names` | Prepend resource names with script name | `false` |
|
1894
|
-
| `service_name` | Service name used for `sinatra` instrumentation | `'sinatra'` |
|
1895
1960
|
|
1896
1961
|
### Sneakers
|
1897
1962
|
|
@@ -1903,7 +1968,7 @@ You can enable it through `Datadog.configure`:
|
|
1903
1968
|
require 'ddtrace'
|
1904
1969
|
|
1905
1970
|
Datadog.configure do |c|
|
1906
|
-
c.
|
1971
|
+
c.tracing.instrument :sneakers, options
|
1907
1972
|
end
|
1908
1973
|
```
|
1909
1974
|
|
@@ -1912,7 +1977,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1912
1977
|
| Key | Description | Default |
|
1913
1978
|
| --- | ----------- | ------- |
|
1914
1979
|
| `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1915
|
-
| `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
|
1916
1980
|
| `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
|
1917
1981
|
| `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? }` |
|
1918
1982
|
|
@@ -1924,63 +1988,57 @@ The `sucker_punch` integration traces all scheduled jobs:
|
|
1924
1988
|
require 'ddtrace'
|
1925
1989
|
|
1926
1990
|
Datadog.configure do |c|
|
1927
|
-
c.
|
1991
|
+
c.tracing.instrument :sucker_punch
|
1928
1992
|
end
|
1929
1993
|
|
1930
1994
|
# Execution of this job is traced
|
1931
1995
|
LogJob.perform_async('login')
|
1932
1996
|
```
|
1933
1997
|
|
1934
|
-
|
1935
|
-
|
1936
|
-
| Key | Description | Default |
|
1937
|
-
| --- | ----------- | ------- |
|
1938
|
-
| `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
|
1939
|
-
|
1940
|
-
## Advanced configuration
|
1941
|
-
|
1942
|
-
### Tracer settings
|
1998
|
+
## Additional configuration
|
1943
1999
|
|
1944
|
-
To change the default behavior of
|
2000
|
+
To change the default behavior of Datadog tracing, you can set environment variables, or provide custom options inside a `Datadog.configure` block, e.g.:
|
1945
2001
|
|
1946
2002
|
```ruby
|
1947
|
-
# config/initializers/datadog-tracer.rb
|
1948
|
-
|
1949
2003
|
Datadog.configure do |c|
|
1950
|
-
c.
|
1951
|
-
c.
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
2004
|
+
c.service = 'billing-api'
|
2005
|
+
c.env = ENV['RACK_ENV']
|
2006
|
+
|
2007
|
+
c.tracing.report_hostname = true
|
2008
|
+
c.tracing.test_mode.enabled = (ENV['RACK_ENV'] == 'test')
|
2009
|
+
end
|
2010
|
+
```
|
2011
|
+
|
2012
|
+
**Available configuration options:**
|
2013
|
+
|
2014
|
+
| Setting | Env Var | Default | Description |
|
2015
|
+
|---------------------------------------------------------|--------------------------------|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
2016
|
+
| **Global** | | | |
|
2017
|
+
| `agent.host` | `DD_AGENT_HOST` | `127.0.0.1` | Hostname of agent to where trace data will be sent. |
|
2018
|
+
| `agent.port` | `DD_TRACE_AGENT_PORT` | `8126` | Port of agent host to where trace data will be sent. |
|
2019
|
+
| | `DD_TRACE_AGENT_URL` | `nil` | Sets the URL endpoint where traces are sent. Has priority over `agent.host` and `agent.port`. |
|
2020
|
+
| `diagnostics.debug` | `DD_TRACE_DEBUG` | `false` | Enables or disables debug mode. Prints verbose logs. **NOT recommended for production or other sensitive environments.** See [Debugging and diagnostics](#debugging-and-diagnostics) for more details. |
|
2021
|
+
| `diagnostics.startup_logs.enabled` | `DD_TRACE_STARTUP_LOGS` | `nil` | Prints startup configuration and diagnostics to log. For assessing state of tracing at application startup. See [Debugging and diagnostics](#debugging-and-diagnostics) for more details. |
|
2022
|
+
| `env` | `DD_ENV` | `nil` | Your application environment. (e.g. `production`, `staging`, etc.) This value is set as a tag on all traces. |
|
2023
|
+
| `service` | `DD_SERVICE` | *Ruby filename* | Your application's default service name. (e.g. `billing-api`) This value is set as a tag on all traces. |
|
2024
|
+
| `tags` | `DD_TAGS` | `nil` | Custom tags in value pairs separated by `,` (e.g. `layer:api,team:intake`) These tags are set on all traces. See [Environment and tags](#environment-and-tags) for more details. |
|
2025
|
+
| `time_now_provider` | | `->{ Time.now }` | Changes how time is retrieved. See [Setting the time provider](#Setting the time provider) for more details. |
|
2026
|
+
| `version` | `DD_VERSION` | `nil` | Your application version (e.g. `2.5`, `202003181415`, `1.3-alpha`, etc.) This value is set as a tag on all traces. |
|
2027
|
+
| **Tracing** | | | |
|
2028
|
+
| `tracing.analytics.enabled` | `DD_TRACE_ANALYTICS_ENABLED` | `nil` | Enables or disables trace analytics. See [Sampling](#sampling) for more details. |
|
2029
|
+
| `tracing.distributed_tracing.propagation_extract_style` | `DD_PROPAGATION_STYLE_EXTRACT` | `['Datadog','B3','B3 single header']` | Distributed tracing header formats to extract. See [Distributed Tracing](#distributed-tracing) for more details. |
|
2030
|
+
| `tracing.distributed_tracing.propagation_inject_style` | `DD_PROPAGATION_STYLE_INJECT` | `['Datadog']` | Distributed tracing header formats to inject. See [Distributed Tracing](#distributed-tracing) for more details. |
|
2031
|
+
| `tracing.enabled` | `DD_TRACE_ENABLED` | `true` | Enables or disables tracing. If set to `false` instrumentation will still run, but no traces are sent to the trace agent. |
|
2032
|
+
| `tracing.instrument(<integration-name>, <options...>)` | | | Activates instrumentation for a specific library. See [Integration instrumentation](#integration-instrumentation) for more details. |
|
2033
|
+
| `tracing.log_injection` | `DD_LOGS_INJECTION` | `true` | Injects [Trace Correlation](#trace-correlation) information into Rails logs if present. Supports the default logger (`ActiveSupport::TaggedLogging`), `lograge`, and `semantic_logger`. |
|
2034
|
+
| `tracing.partial_flush.enabled` | | `false` | Enables or disables partial flushing. Partial flushing submits completed portions of a trace to the agent. Used when tracing instruments long running tasks (e.g. jobs) with many spans. |
|
2035
|
+
| `tracing.partial_flush.min_spans_threshold` | | `500` | The number of spans that must be completed in a trace before partial flushing submits those completed spans. |
|
2036
|
+
| `tracing.sampler` | | `nil` | Advanced usage only. Sets a custom `Datadog::Tracing::Sampling::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior. See [Application-side sampling](#application-side-sampling) for details. |
|
2037
|
+
| `tracing.sampling.default_rate` | `DD_TRACE_SAMPLE_RATE` | `nil` | Sets the trace sampling rate between `0.0` (0%) and `1.0` (100%). See [Application-side sampling](#application-side-sampling) for details. |
|
2038
|
+
| `tracing.sampling.rate_limit` | `DD_TRACE_RATE_LIMIT` | `100` (per second) | Sets a maximum number of traces per second to sample. Set a rate limit to avoid the ingestion volume overages in the case of traffic spikes. |
|
2039
|
+
| `tracing.report_hostname` | `DD_TRACE_REPORT_HOSTNAME` | `false` | Adds hostname tag to traces. |
|
2040
|
+
| `tracing.test_mode.enabled` | `DD_TRACE_TEST_MODE_ENABLED` | `false` | Enables or disables test mode, for use of tracing in test suites. |
|
2041
|
+
| `tracing.test_mode.trace_flush` | | `nil` | Object that determines trace flushing behavior. |
|
1984
2042
|
|
1985
2043
|
#### Custom logging
|
1986
2044
|
|
@@ -1993,18 +2051,16 @@ Additionally, it is possible to override the default logger and replace it by a
|
|
1993
2051
|
```ruby
|
1994
2052
|
f = File.new("my-custom.log", "w+") # Log messages should go there
|
1995
2053
|
Datadog.configure do |c|
|
1996
|
-
c.logger = Logger.new(f) # Overriding the default logger
|
2054
|
+
c.logger.instance = Logger.new(f) # Overriding the default logger
|
1997
2055
|
c.logger.level = ::Logger::INFO
|
1998
2056
|
end
|
1999
2057
|
|
2000
2058
|
Datadog.logger.info { "this is typically called by tracing code" }
|
2001
2059
|
```
|
2002
2060
|
|
2003
|
-
|
2004
|
-
|
2005
|
-
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.
|
2061
|
+
#### Environment and tags
|
2006
2062
|
|
2007
|
-
You can configure the application to automatically tag your traces and metrics, using the following environment variables:
|
2063
|
+
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. You can configure the application to automatically tag your traces and metrics, using the following environment variables:
|
2008
2064
|
|
2009
2065
|
- `DD_ENV`: Your application environment (e.g. `production`, `staging`, etc.)
|
2010
2066
|
- `DD_SERVICE`: Your application's default service name (e.g. `billing-api`)
|
@@ -2028,69 +2084,100 @@ This enables you to set this value on a per application basis, so you can have f
|
|
2028
2084
|
|
2029
2085
|
Tags can also be set directly on individual spans, which will supersede any conflicting tags defined at the application level.
|
2030
2086
|
|
2031
|
-
|
2087
|
+
#### Debugging and diagnostics
|
2032
2088
|
|
2033
|
-
|
2089
|
+
There are two different suggested means of producing diagnostics for tracing:
|
2034
2090
|
|
2035
|
-
|
2036
|
-
- `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.
|
2037
|
-
- `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.
|
2038
|
-
- `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`.
|
2091
|
+
##### Enabling debug mode
|
2039
2092
|
|
2040
|
-
|
2093
|
+
Switching the library into debug mode will produce verbose, detailed logs about tracing activity, including any suppressed errors. This output can be helpful in identifying errors, or confirming trace output to the agent.
|
2094
|
+
|
2095
|
+
You can enable this via `diagnostics.debug = true` or `DD_TRACE_DEBUG`.
|
2096
|
+
|
2097
|
+
```ruby
|
2098
|
+
Datadog.configure { |c| c.diagnostics.debug = true }
|
2099
|
+
```
|
2100
|
+
|
2101
|
+
**We do NOT recommend use of this feature in production or other sensitive environments**, as it can be very verbose under load. It's best to use this in a controlled environment where you can control application load.
|
2041
2102
|
|
2042
|
-
|
2103
|
+
##### Enabling startup logs
|
2043
2104
|
|
2044
|
-
|
2105
|
+
Startup logs produce a report of tracing state when the application is initially configured. This can be helpful for confirming that configuration and instrumentation is activated correctly.
|
2045
2106
|
|
2046
|
-
|
2107
|
+
You can enable this via `diagnostics.startup_logs.enabled = true` or `DD_TRACE_STARTUP_LOGS`.
|
2108
|
+
|
2109
|
+
```ruby
|
2110
|
+
Datadog.configure { |c| c.diagnostics.startup_logs.enabled = true }
|
2111
|
+
```
|
2112
|
+
|
2113
|
+
By default, this will be activated whenever `ddtrace` detects the application is running in a non-development environment.
|
2114
|
+
|
2115
|
+
### Sampling
|
2047
2116
|
|
2048
2117
|
#### Application-side sampling
|
2049
2118
|
|
2050
2119
|
While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
|
2051
2120
|
|
2052
|
-
|
2121
|
+
The default sampling rate can be set between `0.0` (0%) and `1.0` (100%). Configure the rate in order to control the volume of traces sent to Datadog. When this configuration is not set, the Datadog agent will distribute a default sampling rate of 10 traces per second.
|
2122
|
+
|
2123
|
+
Set this value via `DD_TRACE_SAMPLE_RATE` or `Datadog.configure { |c| c.tracing.sampling.default_rate = <value> }`.
|
2053
2124
|
|
2054
|
-
`Datadog::RateSampler` samples a ratio of the traces. For example:
|
2125
|
+
Alternatively, you may provide your own sampler. The `Datadog::Tracing::Sampling::RateSampler` samples a ratio of the traces. For example:
|
2055
2126
|
|
2056
2127
|
```ruby
|
2057
2128
|
# Sample rate is between 0 (nothing sampled) to 1 (everything sampled).
|
2058
|
-
sampler = Datadog::RateSampler.new(0.5) # sample 50% of the traces
|
2129
|
+
sampler = Datadog::Tracing::Sampling::RateSampler.new(0.5) # sample 50% of the traces
|
2059
2130
|
|
2060
2131
|
Datadog.configure do |c|
|
2061
|
-
c.
|
2132
|
+
c.tracing.sampler = sampler
|
2062
2133
|
end
|
2063
2134
|
```
|
2064
2135
|
|
2136
|
+
See [Additional Configuration](#additional-configuration) for more details about these settings.
|
2137
|
+
|
2065
2138
|
#### Priority sampling
|
2066
2139
|
|
2067
2140
|
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.
|
2068
2141
|
|
2069
2142
|
The sampler can set the priority to the following values:
|
2070
2143
|
|
2071
|
-
- `Datadog::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
|
2072
|
-
- `Datadog::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
|
2144
|
+
- `Datadog::Tracing::Sampling::Ext::Priority::AUTO_REJECT`: the sampler automatically decided to reject the trace.
|
2145
|
+
- `Datadog::Tracing::Sampling::Ext::Priority::AUTO_KEEP`: the sampler automatically decided to keep the trace.
|
2073
2146
|
|
2074
2147
|
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.
|
2075
2148
|
|
2076
|
-
You can also set this priority manually to either drop a non-interesting trace or to keep an important one. For that, set the `
|
2149
|
+
You can also set this priority manually to either drop a non-interesting trace or to keep an important one. For that, set the `TraceOperation#sampling_priority` to:
|
2077
2150
|
|
2078
|
-
- `Datadog::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
|
2079
|
-
- `Datadog::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
|
2151
|
+
- `Datadog::Tracing::Sampling::Ext::Priority::USER_REJECT`: the user asked to reject the trace.
|
2152
|
+
- `Datadog::Tracing::Sampling::Ext::Priority::USER_KEEP`: the user asked to keep the trace.
|
2080
2153
|
|
2081
2154
|
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.
|
2082
2155
|
|
2083
|
-
|
2156
|
+
For this reason, if you change the priority, we recommend you do it as early as possible.
|
2157
|
+
|
2158
|
+
To change the sampling priority, you can use the following methods:
|
2159
|
+
|
2160
|
+
```ruby
|
2161
|
+
# Rejects the active trace
|
2162
|
+
Datadog::Tracing.reject!
|
2163
|
+
|
2164
|
+
# Keeps the active trace
|
2165
|
+
Datadog::Tracing.keep!
|
2166
|
+
```
|
2167
|
+
|
2168
|
+
It's safe to use `Datadog::Tracing.reject!` and `Datadog::Tracing.keep!` when no trace is active.
|
2169
|
+
|
2170
|
+
You can also reject a specific trace instance:
|
2084
2171
|
|
2085
2172
|
```ruby
|
2086
2173
|
# First, grab the active span
|
2087
|
-
|
2174
|
+
trace = Datadog::Tracing.active_trace
|
2088
2175
|
|
2089
|
-
#
|
2090
|
-
|
2176
|
+
# Rejects the trace
|
2177
|
+
trace.reject!
|
2091
2178
|
|
2092
|
-
#
|
2093
|
-
|
2179
|
+
# Keeps the trace
|
2180
|
+
trace.keep!
|
2094
2181
|
```
|
2095
2182
|
|
2096
2183
|
### Distributed Tracing
|
@@ -2195,6 +2282,33 @@ Service C:
|
|
2195
2282
|
Priority: 1
|
2196
2283
|
```
|
2197
2284
|
|
2285
|
+
**Distributed header formats**
|
2286
|
+
|
2287
|
+
Tracing supports the following distributed trace formats:
|
2288
|
+
|
2289
|
+
- `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG` (Default)
|
2290
|
+
- `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3`
|
2291
|
+
- `Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER`
|
2292
|
+
|
2293
|
+
You can enable/disable the use of these formats via `Datadog.configure`:
|
2294
|
+
|
2295
|
+
```ruby
|
2296
|
+
Datadog.configure do |c|
|
2297
|
+
# List of header formats that should be extracted
|
2298
|
+
c.tracing.distributed_tracing.propagation_extract_style = [
|
2299
|
+
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG,
|
2300
|
+
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3,
|
2301
|
+
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_B3_SINGLE_HEADER
|
2302
|
+
|
2303
|
+
]
|
2304
|
+
|
2305
|
+
# List of header formats that should be injected
|
2306
|
+
c.tracing.distributed_tracing.propagation_inject_style = [
|
2307
|
+
Datadog::Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_DATADOG
|
2308
|
+
]
|
2309
|
+
end
|
2310
|
+
```
|
2311
|
+
|
2198
2312
|
**Activating distributed tracing for integrations**
|
2199
2313
|
|
2200
2314
|
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.
|
@@ -2218,24 +2332,24 @@ For more details on how to activate distributed tracing for integrations, see th
|
|
2218
2332
|
|
2219
2333
|
**Using the HTTP propagator**
|
2220
2334
|
|
2221
|
-
To make the process of propagating this metadata easier, you can use the `Datadog::
|
2335
|
+
To make the process of propagating this metadata easier, you can use the `Datadog::Tracing::Propagation::HTTP` module.
|
2222
2336
|
|
2223
2337
|
On the client:
|
2224
2338
|
|
2225
2339
|
```ruby
|
2226
|
-
Datadog.
|
2227
|
-
# Inject
|
2228
|
-
Datadog::
|
2340
|
+
Datadog::Tracing.trace('web.call') do |span, trace|
|
2341
|
+
# Inject trace headers into request headers (`env` must be a Hash)
|
2342
|
+
Datadog::Tracing::Propagation::HTTP.inject!(trace.to_digest, env)
|
2229
2343
|
end
|
2230
2344
|
```
|
2231
2345
|
|
2232
2346
|
On the server:
|
2233
2347
|
|
2234
2348
|
```ruby
|
2235
|
-
Datadog.
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2349
|
+
trace_digest = Datadog::Tracing::Propagation::HTTP.extract(request.env)
|
2350
|
+
|
2351
|
+
Datadog::Tracing.trace('web.work', continue_from: trace_digest) do |span|
|
2352
|
+
# Do web work...
|
2239
2353
|
end
|
2240
2354
|
```
|
2241
2355
|
|
@@ -2261,147 +2375,87 @@ Then you must enable the request queuing feature, by setting `request_queuing: t
|
|
2261
2375
|
|
2262
2376
|
### Processing Pipeline
|
2263
2377
|
|
2264
|
-
Some applications might require that traces be altered or filtered out before they are sent
|
2265
|
-
|
2266
|
-
Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
|
2267
|
-
|
2268
|
-
For example:
|
2269
|
-
|
2270
|
-
```ruby
|
2271
|
-
lambda_processor = ->(trace) do
|
2272
|
-
# Processing logic...
|
2273
|
-
trace
|
2274
|
-
end
|
2275
|
-
|
2276
|
-
class MyCustomProcessor
|
2277
|
-
def call(trace)
|
2278
|
-
# Processing logic...
|
2279
|
-
trace
|
2280
|
-
end
|
2281
|
-
end
|
2282
|
-
custom_processor = MyFancyProcessor.new
|
2283
|
-
```
|
2284
|
-
|
2285
|
-
`#call` blocks of processors *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
|
2286
|
-
|
2287
|
-
These processors must then be added to the pipeline via `Datadog::Pipeline.before_flush`:
|
2288
|
-
|
2289
|
-
```ruby
|
2290
|
-
Datadog::Pipeline.before_flush(lambda_processor, custom_processor)
|
2291
|
-
```
|
2292
|
-
|
2293
|
-
You can also define processors using the short-hand block syntax for `Datadog::Pipeline.before_flush`:
|
2294
|
-
|
2295
|
-
```ruby
|
2296
|
-
Datadog::Pipeline.before_flush do |trace|
|
2297
|
-
trace.delete_if { |span| span.name =~ /forbidden/ }
|
2298
|
-
end
|
2299
|
-
```
|
2378
|
+
Some applications might require that traces be altered or filtered out before they are sent to Datadog. The processing pipeline allows you to create *processors* to define such behavior.
|
2300
2379
|
|
2301
2380
|
#### Filtering
|
2302
2381
|
|
2303
|
-
You can use the `Datadog::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
|
2382
|
+
You can use the `Datadog::Tracing::Pipeline::SpanFilter` processor to remove spans, when the block evaluates as truthy:
|
2304
2383
|
|
2305
2384
|
```ruby
|
2306
|
-
Datadog::
|
2385
|
+
Datadog::Tracing.before_flush(
|
2307
2386
|
# Remove spans that match a particular resource
|
2308
|
-
Datadog::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
|
2387
|
+
Datadog::Tracing::Pipeline::SpanFilter.new { |span| span.resource =~ /PingController/ },
|
2309
2388
|
# Remove spans that are trafficked to localhost
|
2310
|
-
Datadog::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
|
2389
|
+
Datadog::Tracing::Pipeline::SpanFilter.new { |span| span.get_tag('host') == 'localhost' }
|
2311
2390
|
)
|
2312
2391
|
```
|
2313
2392
|
|
2314
2393
|
#### Processing
|
2315
2394
|
|
2316
|
-
You can use the `Datadog::Pipeline::SpanProcessor` processor to modify spans:
|
2395
|
+
You can use the `Datadog::Tracing::Pipeline::SpanProcessor` processor to modify spans:
|
2317
2396
|
|
2318
2397
|
```ruby
|
2319
|
-
Datadog::
|
2398
|
+
Datadog::Tracing.before_flush(
|
2320
2399
|
# Strip matching text from the resource field
|
2321
|
-
Datadog::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
|
2400
|
+
Datadog::Tracing::Pipeline::SpanProcessor.new { |span| span.resource.gsub!(/password=.*/, '') }
|
2322
2401
|
)
|
2323
2402
|
```
|
2324
2403
|
|
2325
|
-
|
2404
|
+
#### Custom processor
|
2326
2405
|
|
2327
|
-
|
2328
|
-
|
2329
|
-
#### For logging in Rails applications
|
2330
|
-
|
2331
|
-
##### Automatic
|
2406
|
+
Processors can be any object that responds to `#call` accepting `trace` as an argument (which is an `Array` of `Datadog::Span`s.)
|
2332
2407
|
|
2333
|
-
For
|
2408
|
+
For example, using the short-hand block syntax:
|
2334
2409
|
|
2335
2410
|
```ruby
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
Datadog.configure do |c|
|
2340
|
-
c.use :rails, log_injection: true
|
2411
|
+
Datadog::Tracing.before_flush do |trace|
|
2412
|
+
# Processing logic...
|
2413
|
+
trace
|
2341
2414
|
end
|
2342
2415
|
```
|
2343
2416
|
|
2344
|
-
|
2345
|
-
|
2346
|
-
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.
|
2417
|
+
For a custom processor class:
|
2347
2418
|
|
2348
2419
|
```ruby
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
# Adds IDs as tags to log output
|
2355
|
-
:dd => {
|
2356
|
-
# To preserve precision during JSON serialization, use strings for large numbers
|
2357
|
-
:trace_id => correlation.trace_id.to_s,
|
2358
|
-
:span_id => correlation.span_id.to_s,
|
2359
|
-
:env => correlation.env.to_s,
|
2360
|
-
:service => correlation.service.to_s,
|
2361
|
-
:version => correlation.version.to_s
|
2362
|
-
},
|
2363
|
-
:ddsource => ["ruby"],
|
2364
|
-
:params => event.payload[:params].reject { |k| %w(controller action).include? k }
|
2365
|
-
}
|
2420
|
+
class MyCustomProcessor
|
2421
|
+
def call(trace)
|
2422
|
+
# Processing logic...
|
2423
|
+
trace
|
2424
|
+
end
|
2366
2425
|
end
|
2426
|
+
|
2427
|
+
Datadog::Tracing.before_flush(MyCustomProcessor.new)
|
2367
2428
|
```
|
2368
2429
|
|
2369
|
-
|
2430
|
+
In both cases, the processor method *must* return the `trace` object; this return value will be passed to the next processor in the pipeline.
|
2370
2431
|
|
2371
|
-
|
2432
|
+
### Trace correlation
|
2372
2433
|
|
2373
|
-
|
2374
|
-
Rails.application.configure do
|
2375
|
-
config.log_tags = [proc { Datadog.tracer.active_correlation.to_s }]
|
2376
|
-
end
|
2434
|
+
In many cases, such as logging, it may be useful to correlate trace IDs to other events or data streams, for easier cross-referencing.
|
2377
2435
|
|
2378
|
-
|
2379
|
-
# DD_ENV = 'production' (The name of the environment your application is running in.)
|
2380
|
-
# DD_SERVICE = 'billing-api' (Default service name of your application.)
|
2381
|
-
# DD_VERSION = '2.5.17' (The version of your application.)
|
2436
|
+
#### For logging in Rails applications
|
2382
2437
|
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
```
|
2438
|
+
##### Automatic
|
2439
|
+
|
2440
|
+
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `lograge` or `semantic_logger`, trace correlation injection is enabled by default.
|
2441
|
+
|
2442
|
+
It can be disabled by setting the environment variable `DD_LOGS_INJECTION=false`.
|
2389
2443
|
|
2390
2444
|
#### For logging in Ruby applications
|
2391
2445
|
|
2392
|
-
To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog.
|
2446
|
+
To add correlation IDs to your logger, add a log formatter which retrieves the correlation IDs with `Datadog::Tracing.correlation`, then add them to the message.
|
2393
2447
|
|
2394
2448
|
To properly correlate with Datadog logging, be sure the following is present in the log message, in order as they appear:
|
2395
2449
|
|
2396
|
-
- `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog.
|
2397
|
-
- `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog.
|
2398
|
-
- `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog.
|
2399
|
-
- `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog.
|
2400
|
-
- `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog.
|
2450
|
+
- `dd.env=<ENV>`: Where `<ENV>` is equal to `Datadog::Tracing.correlation.env`. Omit if no environment is configured.
|
2451
|
+
- `dd.service=<SERVICE>`: Where `<SERVICE>` is equal to `Datadog::Tracing.correlation.service`. Omit if no default service name is configured.
|
2452
|
+
- `dd.version=<VERSION>`: Where `<VERSION>` is equal to `Datadog::Tracing.correlation.version`. Omit if no application version is configured.
|
2453
|
+
- `dd.trace_id=<TRACE_ID>`: Where `<TRACE_ID>` is equal to `Datadog::Tracing.correlation.trace_id` or `0` if no trace is active during logging.
|
2454
|
+
- `dd.span_id=<SPAN_ID>`: Where `<SPAN_ID>` is equal to `Datadog::Tracing.correlation.span_id` or `0` if no trace is active during logging.
|
2401
2455
|
|
2402
|
-
|
2456
|
+
`Datadog::Tracing.log_correlation` will return `dd.env=<ENV> dd.service=<SERVICE> dd.version=<VERSION> dd.trace_id=<TRACE_ID> dd.span_id=<SPAN_ID>`.
|
2403
2457
|
|
2404
|
-
If a trace is not active and the application environment & version is not configured, it will return `dd.
|
2458
|
+
If a trace is not active and the application environment & version is not configured, it will return `dd.env= dd.service= dd.version= dd.trace_id=0 dd.span_id=0`.
|
2405
2459
|
|
2406
2460
|
An example of this in practice:
|
2407
2461
|
|
@@ -2416,7 +2470,7 @@ ENV['DD_VERSION'] = '2.5.17'
|
|
2416
2470
|
logger = Logger.new(STDOUT)
|
2417
2471
|
logger.progname = 'my_app'
|
2418
2472
|
logger.formatter = proc do |severity, datetime, progname, msg|
|
2419
|
-
"[#{datetime}][#{progname}][#{severity}][#{Datadog.
|
2473
|
+
"[#{datetime}][#{progname}][#{severity}][#{Datadog::Tracing.log_correlation}] #{msg}\n"
|
2420
2474
|
end
|
2421
2475
|
|
2422
2476
|
# When no trace is active
|
@@ -2424,17 +2478,34 @@ logger.warn('This is an untraced operation.')
|
|
2424
2478
|
# [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.
|
2425
2479
|
|
2426
2480
|
# When a trace is active
|
2427
|
-
Datadog.
|
2481
|
+
Datadog::Tracing.trace('my.operation') { logger.warn('This is a traced operation.') }
|
2428
2482
|
# [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.
|
2429
2483
|
```
|
2430
2484
|
|
2431
2485
|
### Configuring the transport layer
|
2432
2486
|
|
2433
|
-
By default,
|
2487
|
+
By default, `ddtrace` will connect to the agent using the first available settings in the listed priority:
|
2488
|
+
|
2489
|
+
1. Via any explicitly provided configuration settings (hostname/port/transport)
|
2490
|
+
2. Via Unix Domain Socket (UDS) located at `/var/run/datadog/apm.socket`
|
2491
|
+
3. Via HTTP over TCP to `127.0.0.1:8126`
|
2434
2492
|
|
2435
2493
|
However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
|
2436
2494
|
|
2437
|
-
|
2495
|
+
#### Changing default agent hostname and port
|
2496
|
+
|
2497
|
+
To change the agent host or port, provide `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`.
|
2498
|
+
|
2499
|
+
OR within a `Datadog.configure` block, provide the following settings:
|
2500
|
+
|
2501
|
+
```ruby
|
2502
|
+
Datadog.configure do |c|
|
2503
|
+
c.agent.host = '127.0.0.1'
|
2504
|
+
c.agent.port = 8126
|
2505
|
+
end
|
2506
|
+
```
|
2507
|
+
|
2508
|
+
See [Additional Configuration](#additional-configuration) for more details.
|
2438
2509
|
|
2439
2510
|
#### Using the Net::HTTP adapter
|
2440
2511
|
|
@@ -2442,14 +2513,14 @@ The `Net` adapter submits traces using `Net::HTTP` over TCP. It is the default t
|
|
2442
2513
|
|
2443
2514
|
```ruby
|
2444
2515
|
Datadog.configure do |c|
|
2445
|
-
c.
|
2516
|
+
c.tracing.transport_options = proc { |t|
|
2446
2517
|
# Hostname, port, and additional options. :timeout is in seconds.
|
2447
2518
|
t.adapter :net_http, '127.0.0.1', 8126, { timeout: 1 }
|
2448
2519
|
}
|
2449
2520
|
end
|
2450
2521
|
```
|
2451
2522
|
|
2452
|
-
#### Using the Unix
|
2523
|
+
#### Using the Unix Domain Socket (UDS) adapter
|
2453
2524
|
|
2454
2525
|
The `UnixSocket` adapter submits traces using `Net::HTTP` over Unix socket.
|
2455
2526
|
|
@@ -2457,7 +2528,7 @@ To use, first configure your trace agent to listen by Unix socket, then configur
|
|
2457
2528
|
|
2458
2529
|
```ruby
|
2459
2530
|
Datadog.configure do |c|
|
2460
|
-
c.
|
2531
|
+
c.tracing.transport_options = proc { |t|
|
2461
2532
|
# Provide local path to trace agent Unix socket
|
2462
2533
|
t.adapter :unix, '/tmp/ddagent/trace.sock'
|
2463
2534
|
}
|
@@ -2470,7 +2541,7 @@ The `Test` adapter is a no-op transport that can optionally buffer requests. For
|
|
2470
2541
|
|
2471
2542
|
```ruby
|
2472
2543
|
Datadog.configure do |c|
|
2473
|
-
c.
|
2544
|
+
c.tracing.transport_options = proc { |t|
|
2474
2545
|
# Set transport to no-op mode. Does not retain traces.
|
2475
2546
|
t.adapter :test
|
2476
2547
|
|
@@ -2487,7 +2558,7 @@ Custom adapters can be configured with:
|
|
2487
2558
|
|
2488
2559
|
```ruby
|
2489
2560
|
Datadog.configure do |c|
|
2490
|
-
c.
|
2561
|
+
c.tracing.transport_options = proc { |t|
|
2491
2562
|
# Initialize and pass an instance of the adapter
|
2492
2563
|
custom_adapter = CustomAdapter.new
|
2493
2564
|
t.adapter custom_adapter
|
@@ -2495,6 +2566,23 @@ Datadog.configure do |c|
|
|
2495
2566
|
end
|
2496
2567
|
```
|
2497
2568
|
|
2569
|
+
### Setting the time provider
|
2570
|
+
|
2571
|
+
By default, tracing uses a monotonic clock to measure the duration of spans, and timestamps (`->{ Time.now }`) for the start and end time.
|
2572
|
+
|
2573
|
+
When testing, it might be helpful to use a different time provider.
|
2574
|
+
|
2575
|
+
To change the function that provides timestamps, configure the following:
|
2576
|
+
|
2577
|
+
```ruby
|
2578
|
+
Datadog.configure do |c|
|
2579
|
+
# For Timecop, for example, `->{ Time.now_without_mock_time }` allows the tracer to use the real wall time.
|
2580
|
+
c.time_now_provider = -> { Time.now_without_mock_time }
|
2581
|
+
end
|
2582
|
+
```
|
2583
|
+
|
2584
|
+
Span duration calculation will still use the system monotonic clock when available, thus not being affected by this setting.
|
2585
|
+
|
2498
2586
|
### Metrics
|
2499
2587
|
|
2500
2588
|
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.
|
@@ -2548,7 +2636,7 @@ In addition, all metrics include the following tags:
|
|
2548
2636
|
|
2549
2637
|
### OpenTracing
|
2550
2638
|
|
2551
|
-
For setting up Datadog with OpenTracing, see
|
2639
|
+
For setting up Datadog with OpenTracing, see our [Configuring OpenTracing](#configuring-opentracing) section for details.
|
2552
2640
|
|
2553
2641
|
**Configuring Datadog tracer settings**
|
2554
2642
|
|
@@ -2556,10 +2644,10 @@ The underlying Datadog tracer can be configured by passing options (which match
|
|
2556
2644
|
|
2557
2645
|
```ruby
|
2558
2646
|
# Where `options` is a Hash of options provided to Datadog::Tracer
|
2559
|
-
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(options)
|
2647
|
+
OpenTracing.global_tracer = Datadog::OpenTracer::Tracer.new(**options)
|
2560
2648
|
```
|
2561
2649
|
|
2562
|
-
It can also be configured by using `Datadog.configure` described in the [
|
2650
|
+
It can also be configured by using `Datadog.configure` described in the [Additional Configuration](#additional-configuration) section.
|
2563
2651
|
|
2564
2652
|
**Activating and configuring integrations**
|
2565
2653
|
|
@@ -2577,8 +2665,6 @@ However, additional instrumentation provided by Datadog can be activated alongsi
|
|
2577
2665
|
|
2578
2666
|
### Profiling
|
2579
2667
|
|
2580
|
-
*Currently available as BETA feature.*
|
2581
|
-
|
2582
2668
|
`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.
|
2583
2669
|
|
2584
2670
|
**Setup**
|
@@ -2601,11 +2687,11 @@ Without this flag, profiles for short-lived Resque jobs will not be available as
|
|
2601
2687
|
|
2602
2688
|
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.
|
2603
2689
|
|
2604
|
-
If traces are missing, enable [debug mode](#
|
2690
|
+
If traces are missing, enable [debug mode](#debugging-and-diagnostics) to check if messages containing `"Dropping trace. Payload too large"` are logged.
|
2605
2691
|
|
2606
|
-
Since debug mode is verbose, Datadog does not recommend leaving this enabled or enabling this in production
|
2692
|
+
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.
|
2607
2693
|
|
2608
|
-
If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#
|
2694
|
+
If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#additional-configuration) setting to break down large traces into smaller chunks.
|
2609
2695
|
|
2610
2696
|
### Stack level too deep
|
2611
2697
|
|
@@ -2615,7 +2701,7 @@ In Ruby version 1.9.3 and earlier, "monkey-patching" often involved the use of [
|
|
2615
2701
|
|
2616
2702
|
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.
|
2617
2703
|
|
2618
|
-
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.
|
2704
|
+
Datadog instrumentation almost exclusively uses the `Module#prepend` feature to add instrumentation non-destructively. However, some other 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.
|
2619
2705
|
|
2620
2706
|
As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
|
2621
2707
|
|