ddtrace 0.40.0 → 0.54.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +22 -0
- data/.gitignore +7 -1
- data/CHANGELOG.md +1667 -350
- data/CONTRIBUTING.md +3 -7
- data/LICENSE-3rdparty.csv +2 -0
- data/README.md +1 -0
- data/bin/ddtracerb +15 -0
- data/ddtrace.gemspec +21 -37
- data/docs/DevelopmentGuide.md +56 -8
- data/docs/GettingStarted.md +438 -92
- data/docs/ProfilingDevelopment.md +107 -0
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +86 -0
- data/ext/ddtrace_profiling_native_extension/clock_id.h +4 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +52 -0
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +14 -0
- data/ext/ddtrace_profiling_native_extension/extconf.rb +166 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +35 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +3 -0
- data/ext/ddtrace_profiling_native_extension/profiling.c +22 -0
- data/lib/datadog/ci/configuration/components.rb +31 -0
- data/lib/datadog/ci/configuration/settings.rb +37 -0
- data/lib/datadog/ci/context_flush.rb +29 -0
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +31 -0
- data/lib/datadog/ci/contrib/cucumber/ext.rb +20 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +99 -0
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +27 -0
- data/lib/datadog/ci/contrib/cucumber/integration.rb +48 -0
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +26 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +31 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +75 -0
- data/lib/datadog/ci/contrib/rspec/ext.rb +19 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +49 -0
- data/lib/datadog/ci/contrib/rspec/patcher.rb +26 -0
- data/lib/datadog/ci/ext/app_types.rb +10 -0
- data/lib/datadog/ci/ext/environment.rb +485 -0
- data/lib/datadog/ci/ext/settings.rb +11 -0
- data/lib/datadog/ci/ext/test.rb +36 -0
- data/lib/datadog/ci/extensions.rb +18 -0
- data/lib/datadog/ci/test.rb +81 -0
- data/lib/datadog/ci.rb +17 -0
- data/lib/datadog/contrib.rb +71 -0
- data/lib/datadog/core/environment/cgroup.rb +52 -0
- data/lib/datadog/core/environment/class_count.rb +20 -0
- data/lib/datadog/core/environment/container.rb +91 -0
- data/lib/datadog/core/environment/ext.rb +27 -0
- data/lib/datadog/core/environment/gc.rb +19 -0
- data/lib/datadog/core/environment/identity.rb +51 -0
- data/lib/datadog/core/environment/socket.rb +17 -0
- data/lib/datadog/core/environment/thread_count.rb +19 -0
- data/lib/datadog/core/environment/variable_helpers.rb +42 -0
- data/lib/datadog/core/environment/vm_cache.rb +46 -0
- data/lib/ddtrace/analytics.rb +3 -0
- data/lib/ddtrace/auto_instrument.rb +5 -0
- data/lib/ddtrace/auto_instrument_base.rb +7 -0
- data/lib/ddtrace/buffer.rb +278 -57
- data/lib/ddtrace/chunker.rb +1 -0
- data/lib/ddtrace/configuration/agent_settings_resolver.rb +309 -0
- data/lib/ddtrace/configuration/base.rb +9 -11
- data/lib/ddtrace/configuration/components.rb +167 -26
- data/lib/ddtrace/configuration/dependency_resolver.rb +1 -0
- data/lib/ddtrace/configuration/option.rb +1 -0
- data/lib/ddtrace/configuration/option_definition.rb +2 -3
- data/lib/ddtrace/configuration/option_definition_set.rb +1 -0
- data/lib/ddtrace/configuration/option_set.rb +1 -0
- data/lib/ddtrace/configuration/options.rb +10 -10
- data/lib/ddtrace/configuration/pin_setup.rb +1 -0
- data/lib/ddtrace/configuration/settings.rb +147 -13
- data/lib/ddtrace/configuration.rb +133 -22
- data/lib/ddtrace/context.rb +51 -22
- data/lib/ddtrace/context_flush.rb +15 -2
- data/lib/ddtrace/context_provider.rb +17 -5
- data/lib/ddtrace/contrib/action_cable/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/event.rb +6 -4
- data/lib/ddtrace/contrib/action_cable/events/broadcast.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/events/perform_action.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/events/transmit.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/events.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/ext.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/instrumentation.rb +47 -0
- data/lib/ddtrace/contrib/action_cable/integration.rb +8 -0
- data/lib/ddtrace/contrib/action_cable/patcher.rb +2 -0
- data/lib/ddtrace/contrib/action_mailer/configuration/settings.rb +32 -0
- data/lib/ddtrace/contrib/action_mailer/event.rb +50 -0
- data/lib/ddtrace/contrib/action_mailer/events/deliver.rb +54 -0
- data/lib/ddtrace/contrib/action_mailer/events/process.rb +41 -0
- data/lib/ddtrace/contrib/action_mailer/events.rb +31 -0
- data/lib/ddtrace/contrib/action_mailer/ext.rb +32 -0
- data/lib/ddtrace/contrib/action_mailer/integration.rb +45 -0
- data/lib/ddtrace/contrib/action_mailer/patcher.rb +27 -0
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +22 -13
- data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +2 -1
- data/lib/ddtrace/contrib/action_pack/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/action_pack/ext.rb +1 -0
- data/lib/ddtrace/contrib/action_pack/integration.rb +8 -0
- data/lib/ddtrace/contrib/action_pack/patcher.rb +1 -0
- data/lib/ddtrace/contrib/action_pack/utils.rb +2 -1
- data/lib/ddtrace/contrib/action_view/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/action_view/event.rb +4 -7
- data/lib/ddtrace/contrib/action_view/events/render_partial.rb +2 -0
- data/lib/ddtrace/contrib/action_view/events/render_template.rb +2 -0
- data/lib/ddtrace/contrib/action_view/events.rb +1 -0
- data/lib/ddtrace/contrib/action_view/ext.rb +1 -0
- data/lib/ddtrace/contrib/action_view/instrumentation/partial_renderer.rb +1 -0
- data/lib/ddtrace/contrib/action_view/instrumentation/template_renderer.rb +1 -0
- data/lib/ddtrace/contrib/action_view/integration.rb +8 -0
- data/lib/ddtrace/contrib/action_view/patcher.rb +5 -4
- data/lib/ddtrace/contrib/action_view/utils.rb +2 -1
- data/lib/ddtrace/contrib/active_job/configuration/settings.rb +33 -0
- data/lib/ddtrace/contrib/active_job/event.rb +54 -0
- data/lib/ddtrace/contrib/active_job/events/discard.rb +46 -0
- data/lib/ddtrace/contrib/active_job/events/enqueue.rb +45 -0
- data/lib/ddtrace/contrib/active_job/events/enqueue_at.rb +45 -0
- data/lib/ddtrace/contrib/active_job/events/enqueue_retry.rb +47 -0
- data/lib/ddtrace/contrib/active_job/events/perform.rb +45 -0
- data/lib/ddtrace/contrib/active_job/events/retry_stopped.rb +46 -0
- data/lib/ddtrace/contrib/active_job/events.rb +39 -0
- data/lib/ddtrace/contrib/active_job/ext.rb +32 -0
- data/lib/ddtrace/contrib/active_job/integration.rb +46 -0
- data/lib/ddtrace/contrib/active_job/log_injection.rb +21 -0
- data/lib/ddtrace/contrib/active_job/patcher.rb +33 -0
- data/lib/ddtrace/contrib/active_model_serializers/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/event.rb +3 -2
- data/lib/ddtrace/contrib/active_model_serializers/events/render.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/events/serialize.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/events.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/ext.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/integration.rb +1 -0
- data/lib/ddtrace/contrib/active_model_serializers/patcher.rb +1 -0
- data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +31 -0
- data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +108 -18
- data/lib/ddtrace/contrib/active_record/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/active_record/event.rb +3 -2
- data/lib/ddtrace/contrib/active_record/events/instantiation.rb +1 -0
- data/lib/ddtrace/contrib/active_record/events/sql.rb +5 -0
- data/lib/ddtrace/contrib/active_record/events.rb +1 -0
- data/lib/ddtrace/contrib/active_record/ext.rb +1 -0
- data/lib/ddtrace/contrib/active_record/integration.rb +8 -0
- data/lib/ddtrace/contrib/active_record/patcher.rb +1 -0
- data/lib/ddtrace/contrib/active_record/utils.rb +69 -21
- data/lib/ddtrace/contrib/active_support/cache/instrumentation.rb +105 -3
- data/lib/ddtrace/contrib/active_support/cache/patcher.rb +26 -4
- data/lib/ddtrace/contrib/active_support/cache/redis.rb +2 -5
- data/lib/ddtrace/contrib/active_support/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/active_support/ext.rb +4 -0
- data/lib/ddtrace/contrib/active_support/integration.rb +8 -1
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +15 -3
- data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +3 -1
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +12 -7
- data/lib/ddtrace/contrib/active_support/patcher.rb +1 -0
- data/lib/ddtrace/contrib/analytics.rb +1 -0
- data/lib/ddtrace/contrib/auto_instrument.rb +48 -0
- data/lib/ddtrace/contrib/aws/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/aws/ext.rb +1 -0
- data/lib/ddtrace/contrib/aws/instrumentation.rb +36 -1
- data/lib/ddtrace/contrib/aws/integration.rb +1 -0
- data/lib/ddtrace/contrib/aws/parsed_context.rb +1 -0
- data/lib/ddtrace/contrib/aws/patcher.rb +6 -1
- data/lib/ddtrace/contrib/aws/services.rb +4 -0
- data/lib/ddtrace/contrib/concurrent_ruby/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/concurrent_ruby/context_composite_executor_service.rb +1 -0
- data/lib/ddtrace/contrib/concurrent_ruby/ext.rb +1 -0
- data/lib/ddtrace/contrib/concurrent_ruby/future_patch.rb +1 -0
- data/lib/ddtrace/contrib/concurrent_ruby/integration.rb +1 -0
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +3 -1
- data/lib/ddtrace/contrib/configurable.rb +65 -38
- data/lib/ddtrace/contrib/configuration/resolver.rb +71 -5
- data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +21 -20
- data/lib/ddtrace/contrib/configuration/settings.rb +8 -6
- data/lib/ddtrace/contrib/dalli/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/dalli/ext.rb +1 -0
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +6 -1
- data/lib/ddtrace/contrib/dalli/integration.rb +1 -0
- data/lib/ddtrace/contrib/dalli/patcher.rb +2 -39
- data/lib/ddtrace/contrib/dalli/quantize.rb +1 -0
- data/lib/ddtrace/contrib/delayed_job/configuration/settings.rb +3 -0
- data/lib/ddtrace/contrib/delayed_job/ext.rb +3 -0
- data/lib/ddtrace/contrib/delayed_job/integration.rb +1 -0
- data/lib/ddtrace/contrib/delayed_job/patcher.rb +1 -0
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +40 -16
- data/lib/ddtrace/contrib/elasticsearch/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/elasticsearch/ext.rb +1 -0
- data/lib/ddtrace/contrib/elasticsearch/integration.rb +1 -0
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +6 -0
- data/lib/ddtrace/contrib/elasticsearch/quantize.rb +6 -2
- data/lib/ddtrace/contrib/ethon/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +15 -11
- data/lib/ddtrace/contrib/ethon/ext.rb +2 -0
- data/lib/ddtrace/contrib/ethon/integration.rb +1 -0
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +6 -1
- data/lib/ddtrace/contrib/ethon/patcher.rb +4 -2
- data/lib/ddtrace/contrib/excon/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/excon/ext.rb +1 -0
- data/lib/ddtrace/contrib/excon/integration.rb +1 -0
- data/lib/ddtrace/contrib/excon/middleware.rb +14 -7
- data/lib/ddtrace/contrib/excon/patcher.rb +1 -0
- data/lib/ddtrace/contrib/extensions.rb +90 -14
- data/lib/ddtrace/contrib/faraday/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/faraday/connection.rb +1 -0
- data/lib/ddtrace/contrib/faraday/ext.rb +1 -0
- data/lib/ddtrace/contrib/faraday/integration.rb +1 -0
- data/lib/ddtrace/contrib/faraday/middleware.rb +6 -3
- data/lib/ddtrace/contrib/faraday/patcher.rb +3 -38
- data/lib/ddtrace/contrib/faraday/rack_builder.rb +1 -0
- data/lib/ddtrace/contrib/grape/configuration/settings.rb +8 -0
- data/lib/ddtrace/contrib/grape/endpoint.rb +73 -35
- data/lib/ddtrace/contrib/grape/ext.rb +2 -0
- data/lib/ddtrace/contrib/grape/instrumentation.rb +4 -3
- data/lib/ddtrace/contrib/grape/integration.rb +1 -0
- data/lib/ddtrace/contrib/grape/patcher.rb +2 -43
- data/lib/ddtrace/contrib/graphql/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/graphql/ext.rb +1 -0
- data/lib/ddtrace/contrib/graphql/integration.rb +1 -0
- data/lib/ddtrace/contrib/graphql/patcher.rb +1 -0
- data/lib/ddtrace/contrib/grpc/configuration/settings.rb +2 -0
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +6 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +5 -1
- data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +13 -8
- data/lib/ddtrace/contrib/grpc/ext.rb +1 -0
- data/lib/ddtrace/contrib/grpc/integration.rb +1 -0
- data/lib/ddtrace/contrib/grpc/intercept_with_datadog.rb +1 -0
- data/lib/ddtrace/contrib/grpc/patcher.rb +3 -37
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +2 -3
- data/lib/ddtrace/contrib/http/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/http/ext.rb +1 -0
- data/lib/ddtrace/contrib/http/instrumentation.rb +13 -8
- data/lib/ddtrace/contrib/http/integration.rb +1 -0
- data/lib/ddtrace/contrib/http/patcher.rb +2 -1
- data/lib/ddtrace/contrib/http_annotation_helper.rb +1 -0
- data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +33 -0
- data/lib/ddtrace/contrib/httpclient/ext.rb +18 -0
- data/lib/ddtrace/contrib/httpclient/instrumentation.rb +148 -0
- data/lib/ddtrace/contrib/httpclient/integration.rb +44 -0
- data/lib/ddtrace/contrib/httpclient/patcher.rb +39 -0
- data/lib/ddtrace/contrib/httprb/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/httprb/ext.rb +1 -0
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +20 -22
- data/lib/ddtrace/contrib/httprb/integration.rb +1 -0
- data/lib/ddtrace/contrib/httprb/patcher.rb +8 -4
- data/lib/ddtrace/contrib/integration.rb +4 -3
- data/lib/ddtrace/contrib/kafka/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/kafka/consumer_event.rb +1 -0
- data/lib/ddtrace/contrib/kafka/consumer_group_event.rb +1 -0
- data/lib/ddtrace/contrib/kafka/event.rb +4 -3
- data/lib/ddtrace/contrib/kafka/events/connection/request.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer/process_batch.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer/process_message.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/join_group.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/leave_group.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/consumer_group/sync_group.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/produce_operation/send_messages.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events/producer/deliver_messages.rb +1 -0
- data/lib/ddtrace/contrib/kafka/events.rb +1 -0
- data/lib/ddtrace/contrib/kafka/ext.rb +1 -0
- data/lib/ddtrace/contrib/kafka/integration.rb +1 -0
- data/lib/ddtrace/contrib/kafka/patcher.rb +1 -0
- data/lib/ddtrace/contrib/lograge/configuration/settings.rb +19 -0
- data/lib/ddtrace/contrib/lograge/ext.rb +11 -0
- data/lib/ddtrace/contrib/lograge/instrumentation.rb +39 -0
- data/lib/ddtrace/contrib/lograge/integration.rb +46 -0
- data/lib/ddtrace/contrib/lograge/patcher.rb +26 -0
- data/lib/ddtrace/contrib/mongodb/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/mongodb/ext.rb +1 -0
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +6 -3
- data/lib/ddtrace/contrib/mongodb/integration.rb +6 -0
- data/lib/ddtrace/contrib/mongodb/parsers.rb +1 -0
- data/lib/ddtrace/contrib/mongodb/patcher.rb +3 -2
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +7 -3
- data/lib/ddtrace/contrib/mysql2/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/mysql2/ext.rb +1 -0
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +6 -1
- data/lib/ddtrace/contrib/mysql2/integration.rb +1 -0
- data/lib/ddtrace/contrib/mysql2/patcher.rb +2 -1
- data/lib/ddtrace/contrib/patchable.rb +21 -9
- data/lib/ddtrace/contrib/patcher.rb +12 -8
- data/lib/ddtrace/contrib/presto/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/presto/ext.rb +1 -0
- data/lib/ddtrace/contrib/presto/instrumentation.rb +5 -1
- data/lib/ddtrace/contrib/presto/integration.rb +1 -0
- data/lib/ddtrace/contrib/presto/patcher.rb +7 -3
- data/lib/ddtrace/contrib/qless/configuration/settings.rb +36 -0
- data/lib/ddtrace/contrib/qless/ext.rb +21 -0
- data/lib/ddtrace/contrib/qless/integration.rb +39 -0
- data/lib/ddtrace/contrib/qless/patcher.rb +35 -0
- data/lib/ddtrace/contrib/qless/qless_job.rb +74 -0
- data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +34 -0
- data/lib/ddtrace/contrib/que/configuration/settings.rb +2 -0
- data/lib/ddtrace/contrib/que/ext.rb +20 -19
- data/lib/ddtrace/contrib/que/integration.rb +1 -0
- data/lib/ddtrace/contrib/que/patcher.rb +1 -0
- data/lib/ddtrace/contrib/que/tracer.rb +4 -2
- data/lib/ddtrace/contrib/racecar/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/racecar/event.rb +8 -2
- data/lib/ddtrace/contrib/racecar/events/batch.rb +1 -0
- data/lib/ddtrace/contrib/racecar/events/consume.rb +1 -0
- data/lib/ddtrace/contrib/racecar/events/message.rb +1 -0
- data/lib/ddtrace/contrib/racecar/events.rb +1 -0
- data/lib/ddtrace/contrib/racecar/ext.rb +1 -0
- data/lib/ddtrace/contrib/racecar/integration.rb +1 -0
- data/lib/ddtrace/contrib/racecar/patcher.rb +1 -0
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +4 -3
- data/lib/ddtrace/contrib/rack/ext.rb +1 -0
- data/lib/ddtrace/contrib/rack/integration.rb +8 -0
- data/lib/ddtrace/contrib/rack/middlewares.rb +8 -12
- data/lib/ddtrace/contrib/rack/patcher.rb +2 -3
- data/lib/ddtrace/contrib/rack/request_queue.rb +7 -1
- data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +10 -0
- data/lib/ddtrace/contrib/rails/configuration/settings.rb +8 -0
- data/lib/ddtrace/contrib/rails/ext.rb +1 -0
- data/lib/ddtrace/contrib/rails/framework.rb +50 -2
- data/lib/ddtrace/contrib/rails/integration.rb +1 -0
- data/lib/ddtrace/contrib/rails/log_injection.rb +1 -40
- data/lib/ddtrace/contrib/rails/middlewares.rb +1 -0
- data/lib/ddtrace/contrib/rails/patcher.rb +47 -17
- data/lib/ddtrace/contrib/rails/railtie.rb +1 -0
- data/lib/ddtrace/contrib/rails/utils.rb +5 -0
- data/lib/ddtrace/contrib/rake/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/rake/ext.rb +1 -0
- data/lib/ddtrace/contrib/rake/instrumentation.rb +6 -3
- data/lib/ddtrace/contrib/rake/integration.rb +2 -1
- data/lib/ddtrace/contrib/rake/patcher.rb +2 -1
- data/lib/ddtrace/contrib/redis/configuration/resolver.rb +15 -5
- data/lib/ddtrace/contrib/redis/configuration/settings.rb +6 -0
- data/lib/ddtrace/contrib/redis/ext.rb +2 -0
- data/lib/ddtrace/contrib/redis/instrumentation.rb +90 -0
- data/lib/ddtrace/contrib/redis/integration.rb +1 -0
- data/lib/ddtrace/contrib/redis/patcher.rb +3 -67
- data/lib/ddtrace/contrib/redis/quantize.rb +29 -0
- data/lib/ddtrace/contrib/redis/tags.rb +10 -1
- data/lib/ddtrace/contrib/redis/vendor/LICENSE +20 -0
- data/lib/ddtrace/contrib/redis/vendor/resolver.rb +7 -7
- data/lib/ddtrace/contrib/registerable.rb +4 -4
- data/lib/ddtrace/contrib/registry.rb +3 -2
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +19 -1
- data/lib/ddtrace/contrib/resque/ext.rb +1 -0
- data/lib/ddtrace/contrib/resque/integration.rb +2 -5
- data/lib/ddtrace/contrib/resque/patcher.rb +5 -4
- data/lib/ddtrace/contrib/resque/resque_job.rb +26 -2
- data/lib/ddtrace/contrib/rest_client/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/rest_client/ext.rb +1 -0
- data/lib/ddtrace/contrib/rest_client/integration.rb +1 -0
- data/lib/ddtrace/contrib/rest_client/patcher.rb +3 -1
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +7 -4
- data/lib/ddtrace/contrib/semantic_logger/configuration/settings.rb +19 -0
- data/lib/ddtrace/contrib/semantic_logger/ext.rb +11 -0
- data/lib/ddtrace/contrib/semantic_logger/instrumentation.rb +43 -0
- data/lib/ddtrace/contrib/semantic_logger/integration.rb +48 -0
- data/lib/ddtrace/contrib/semantic_logger/patcher.rb +26 -0
- data/lib/ddtrace/contrib/sequel/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/sequel/database.rb +5 -2
- data/lib/ddtrace/contrib/sequel/dataset.rb +5 -3
- data/lib/ddtrace/contrib/sequel/ext.rb +2 -0
- data/lib/ddtrace/contrib/sequel/integration.rb +1 -0
- data/lib/ddtrace/contrib/sequel/patcher.rb +3 -2
- data/lib/ddtrace/contrib/sequel/utils.rb +16 -5
- data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +3 -0
- data/lib/ddtrace/contrib/shoryuken/ext.rb +1 -0
- data/lib/ddtrace/contrib/shoryuken/integration.rb +1 -0
- data/lib/ddtrace/contrib/shoryuken/patcher.rb +1 -0
- data/lib/ddtrace/contrib/shoryuken/tracer.rb +9 -2
- data/lib/ddtrace/contrib/sidekiq/client_tracer.rb +1 -0
- data/lib/ddtrace/contrib/sidekiq/configuration/settings.rb +2 -0
- data/lib/ddtrace/contrib/sidekiq/ext.rb +4 -0
- data/lib/ddtrace/contrib/sidekiq/integration.rb +11 -0
- data/lib/ddtrace/contrib/sidekiq/patcher.rb +27 -0
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/heartbeat.rb +30 -0
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/job_fetch.rb +30 -0
- data/lib/ddtrace/contrib/sidekiq/server_internal_tracer/scheduled_push.rb +29 -0
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +6 -7
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +1 -1
- data/lib/ddtrace/contrib/sinatra/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/env.rb +4 -4
- data/lib/ddtrace/contrib/sinatra/ext.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/headers.rb +2 -3
- data/lib/ddtrace/contrib/sinatra/integration.rb +1 -0
- data/lib/ddtrace/contrib/sinatra/patcher.rb +3 -1
- data/lib/ddtrace/contrib/sinatra/tracer.rb +28 -7
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +13 -6
- data/lib/ddtrace/contrib/sneakers/configuration/settings.rb +2 -0
- data/lib/ddtrace/contrib/sneakers/ext.rb +12 -11
- data/lib/ddtrace/contrib/sneakers/integration.rb +1 -0
- data/lib/ddtrace/contrib/sneakers/patcher.rb +1 -0
- data/lib/ddtrace/contrib/sneakers/tracer.rb +17 -21
- data/lib/ddtrace/contrib/status_code_matcher.rb +70 -0
- data/lib/ddtrace/contrib/sucker_punch/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +5 -6
- data/lib/ddtrace/contrib/sucker_punch/ext.rb +1 -0
- data/lib/ddtrace/contrib/sucker_punch/instrumentation.rb +5 -0
- data/lib/ddtrace/contrib/sucker_punch/integration.rb +1 -0
- data/lib/ddtrace/contrib/sucker_punch/patcher.rb +2 -0
- data/lib/ddtrace/correlation.rb +3 -1
- data/lib/ddtrace/diagnostics/environment_logger.rb +9 -7
- data/lib/ddtrace/diagnostics/health.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/b3.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/b3_single.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/datadog.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/headers.rb +2 -0
- data/lib/ddtrace/distributed_tracing/headers/helpers.rb +2 -3
- data/lib/ddtrace/encoding.rb +3 -0
- data/lib/ddtrace/error.rb +78 -8
- data/lib/ddtrace/event.rb +1 -0
- data/lib/ddtrace/ext/analytics.rb +1 -0
- data/lib/ddtrace/ext/app_types.rb +1 -0
- data/lib/ddtrace/ext/correlation.rb +1 -0
- data/lib/ddtrace/ext/diagnostics.rb +1 -0
- data/lib/ddtrace/ext/distributed.rb +9 -2
- data/lib/ddtrace/ext/environment.rb +8 -0
- data/lib/ddtrace/ext/errors.rb +1 -0
- data/lib/ddtrace/ext/forced_tracing.rb +1 -0
- data/lib/ddtrace/ext/git.rb +32 -0
- data/lib/ddtrace/ext/http.rb +2 -1
- data/lib/ddtrace/ext/integration.rb +9 -0
- data/lib/ddtrace/ext/manual_tracing.rb +1 -0
- data/lib/ddtrace/ext/metrics.rb +1 -0
- data/lib/ddtrace/ext/net.rb +1 -0
- data/lib/ddtrace/ext/priority.rb +7 -4
- data/lib/ddtrace/ext/profiling.rb +57 -0
- data/lib/ddtrace/ext/runtime.rb +5 -6
- data/lib/ddtrace/ext/sampling.rb +1 -0
- data/lib/ddtrace/ext/sql.rb +1 -0
- data/lib/ddtrace/ext/test.rb +9 -0
- data/lib/ddtrace/ext/transport.rb +14 -0
- data/lib/ddtrace/forced_tracing.rb +3 -0
- data/lib/ddtrace/logger.rb +2 -1
- data/lib/ddtrace/metrics.rb +84 -24
- data/lib/ddtrace/opentelemetry/extensions.rb +2 -1
- data/lib/ddtrace/opentelemetry/span.rb +1 -0
- data/lib/ddtrace/opentracer/binary_propagator.rb +1 -0
- data/lib/ddtrace/opentracer/carrier.rb +1 -0
- data/lib/ddtrace/opentracer/distributed_headers.rb +5 -1
- data/lib/ddtrace/opentracer/global_tracer.rb +1 -0
- data/lib/ddtrace/opentracer/propagator.rb +1 -0
- data/lib/ddtrace/opentracer/rack_propagator.rb +1 -0
- data/lib/ddtrace/opentracer/scope.rb +1 -0
- data/lib/ddtrace/opentracer/scope_manager.rb +1 -0
- data/lib/ddtrace/opentracer/span.rb +3 -6
- data/lib/ddtrace/opentracer/span_context.rb +1 -0
- data/lib/ddtrace/opentracer/span_context_factory.rb +1 -0
- data/lib/ddtrace/opentracer/text_map_propagator.rb +1 -0
- data/lib/ddtrace/opentracer/thread_local_scope.rb +2 -0
- data/lib/ddtrace/opentracer/thread_local_scope_manager.rb +1 -0
- data/lib/ddtrace/opentracer/tracer.rb +1 -0
- data/lib/ddtrace/opentracer.rb +21 -39
- data/lib/ddtrace/patcher.rb +28 -6
- data/lib/ddtrace/pin.rb +9 -61
- data/lib/ddtrace/pipeline/span_filter.rb +2 -1
- data/lib/ddtrace/pipeline/span_processor.rb +1 -0
- data/lib/ddtrace/pipeline.rb +1 -0
- data/lib/ddtrace/profiling/backtrace_location.rb +33 -0
- data/lib/ddtrace/profiling/buffer.rb +42 -0
- data/lib/ddtrace/profiling/collectors/stack.rb +301 -0
- data/lib/ddtrace/profiling/encoding/profile.rb +46 -0
- data/lib/ddtrace/profiling/event.rb +14 -0
- data/lib/ddtrace/profiling/events/stack.rb +81 -0
- data/lib/ddtrace/profiling/exporter.rb +24 -0
- data/lib/ddtrace/profiling/ext/forking.rb +98 -0
- data/lib/ddtrace/profiling/flush.rb +44 -0
- data/lib/ddtrace/profiling/native_extension.rb +40 -0
- data/lib/ddtrace/profiling/pprof/builder.rb +126 -0
- data/lib/ddtrace/profiling/pprof/converter.rb +103 -0
- data/lib/ddtrace/profiling/pprof/message_set.rb +15 -0
- data/lib/ddtrace/profiling/pprof/payload.rb +19 -0
- data/lib/ddtrace/profiling/pprof/pprof.proto +212 -0
- data/lib/ddtrace/profiling/pprof/pprof_pb.rb +82 -0
- data/lib/ddtrace/profiling/pprof/stack_sample.rb +140 -0
- data/lib/ddtrace/profiling/pprof/string_table.rb +11 -0
- data/lib/ddtrace/profiling/pprof/template.rb +119 -0
- data/lib/ddtrace/profiling/preload.rb +4 -0
- data/lib/ddtrace/profiling/profiler.rb +31 -0
- data/lib/ddtrace/profiling/recorder.rb +96 -0
- data/lib/ddtrace/profiling/scheduler.rb +134 -0
- data/lib/ddtrace/profiling/tasks/setup.rb +90 -0
- data/lib/ddtrace/profiling/trace_identifiers/ddtrace.rb +42 -0
- data/lib/ddtrace/profiling/trace_identifiers/helper.rb +46 -0
- data/lib/ddtrace/profiling/transport/client.rb +15 -0
- data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +101 -0
- data/lib/ddtrace/profiling/transport/http/api/instance.rb +37 -0
- data/lib/ddtrace/profiling/transport/http/api/spec.rb +41 -0
- data/lib/ddtrace/profiling/transport/http/api.rb +44 -0
- data/lib/ddtrace/profiling/transport/http/builder.rb +29 -0
- data/lib/ddtrace/profiling/transport/http/client.rb +34 -0
- data/lib/ddtrace/profiling/transport/http/response.rb +22 -0
- data/lib/ddtrace/profiling/transport/http.rb +111 -0
- data/lib/ddtrace/profiling/transport/io/client.rb +28 -0
- data/lib/ddtrace/profiling/transport/io/response.rb +17 -0
- data/lib/ddtrace/profiling/transport/io.rb +31 -0
- data/lib/ddtrace/profiling/transport/parcel.rb +18 -0
- data/lib/ddtrace/profiling/transport/request.rb +16 -0
- data/lib/ddtrace/profiling/transport/response.rb +9 -0
- data/lib/ddtrace/profiling.rb +149 -0
- data/lib/ddtrace/propagation/grpc_propagator.rb +20 -6
- data/lib/ddtrace/propagation/http_propagator.rb +18 -2
- data/lib/ddtrace/quantization/hash.rb +1 -0
- data/lib/ddtrace/quantization/http.rb +4 -0
- data/lib/ddtrace/runtime/metrics.rb +40 -15
- data/lib/ddtrace/sampler.rb +22 -11
- data/lib/ddtrace/sampling/matcher.rb +1 -0
- data/lib/ddtrace/sampling/rate_limiter.rb +66 -16
- data/lib/ddtrace/sampling/rule.rb +2 -1
- data/lib/ddtrace/sampling/rule_sampler.rb +19 -11
- data/lib/ddtrace/sampling.rb +1 -0
- data/lib/ddtrace/span.rb +174 -36
- data/lib/ddtrace/sync_writer.rb +17 -15
- data/lib/ddtrace/tasks/exec.rb +47 -0
- data/lib/ddtrace/tasks/help.rb +15 -0
- data/lib/ddtrace/tracer.rb +72 -62
- data/lib/ddtrace/transport/http/adapters/net.rb +48 -12
- data/lib/ddtrace/transport/http/adapters/registry.rb +2 -0
- data/lib/ddtrace/transport/http/adapters/test.rb +5 -2
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +26 -16
- 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 +1 -0
- data/lib/ddtrace/transport/http/builder.rb +21 -7
- data/lib/ddtrace/transport/http/client.rb +3 -1
- data/lib/ddtrace/transport/http/env.rb +9 -0
- data/lib/ddtrace/transport/http/response.rb +1 -0
- data/lib/ddtrace/transport/http/statistics.rb +17 -3
- data/lib/ddtrace/transport/http/traces.rb +6 -6
- data/lib/ddtrace/transport/http.rb +48 -41
- data/lib/ddtrace/transport/io/client.rb +17 -9
- data/lib/ddtrace/transport/io/response.rb +2 -3
- data/lib/ddtrace/transport/io/traces.rb +10 -1
- data/lib/ddtrace/transport/io.rb +2 -1
- data/lib/ddtrace/transport/parcel.rb +7 -0
- data/lib/ddtrace/transport/request.rb +1 -0
- data/lib/ddtrace/transport/response.rb +1 -0
- data/lib/ddtrace/transport/statistics.rb +1 -0
- data/lib/ddtrace/transport/traces.rb +28 -5
- data/lib/ddtrace/utils/compression.rb +28 -0
- data/lib/ddtrace/utils/database.rb +1 -0
- data/lib/ddtrace/utils/forking.rb +53 -0
- data/lib/ddtrace/utils/object_set.rb +40 -0
- data/lib/ddtrace/utils/only_once.rb +41 -0
- data/lib/ddtrace/utils/sequence.rb +18 -0
- data/lib/ddtrace/utils/string_table.rb +46 -0
- data/lib/ddtrace/utils/time.rb +40 -3
- data/lib/ddtrace/utils.rb +29 -14
- data/lib/ddtrace/vendor/active_record/MIT-LICENSE +20 -0
- data/lib/ddtrace/vendor/active_record/connection_specification.rb +1 -0
- data/lib/ddtrace/vendor/multipart-post/LICENSE +11 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +117 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +58 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +136 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +10 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +9 -0
- data/lib/ddtrace/vendor/multipart-post/multipart.rb +13 -0
- data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +33 -0
- data/lib/ddtrace/version.rb +16 -3
- data/lib/ddtrace/worker.rb +1 -0
- data/lib/ddtrace/workers/async.rb +15 -5
- data/lib/ddtrace/workers/loop.rb +32 -5
- data/lib/ddtrace/workers/polling.rb +13 -5
- data/lib/ddtrace/workers/queue.rb +3 -1
- data/lib/ddtrace/workers/runtime_metrics.rb +22 -4
- data/lib/ddtrace/workers/trace_writer.rb +14 -16
- data/lib/ddtrace/workers.rb +8 -2
- data/lib/ddtrace/writer.rb +33 -8
- data/lib/ddtrace.rb +22 -48
- metadata +180 -374
- data/.circleci/config.yml +0 -548
- data/.circleci/images/primary/Dockerfile-2.0.0 +0 -73
- data/.circleci/images/primary/Dockerfile-2.1.10 +0 -73
- data/.circleci/images/primary/Dockerfile-2.2.10 +0 -73
- data/.circleci/images/primary/Dockerfile-2.3.8 +0 -75
- data/.circleci/images/primary/Dockerfile-2.4.6 +0 -73
- data/.circleci/images/primary/Dockerfile-2.5.6 +0 -73
- data/.circleci/images/primary/Dockerfile-2.6.4 +0 -73
- data/.circleci/images/primary/Dockerfile-2.7.0 +0 -73
- data/.circleci/images/primary/Dockerfile-jruby-9.2 +0 -77
- data/.dockerignore +0 -1
- data/.env +0 -26
- data/.github/CODEOWNERS +0 -1
- data/.gitlab-ci.yml +0 -27
- data/.rspec +0 -1
- data/.rubocop.yml +0 -85
- data/.simplecov +0 -38
- data/Appraisals +0 -1071
- data/Gemfile +0 -7
- data/Rakefile +0 -791
- data/benchmarks/postgres_database.yml +0 -9
- data/benchmarks/sidekiq_test.rb +0 -154
- data/docker-compose.yml +0 -370
- data/lib/ddtrace/augmentation/method_wrapper.rb +0 -20
- data/lib/ddtrace/augmentation/method_wrapping.rb +0 -38
- data/lib/ddtrace/augmentation/shim.rb +0 -102
- data/lib/ddtrace/augmentation.rb +0 -13
- data/lib/ddtrace/environment.rb +0 -41
- data/lib/ddtrace/monkey.rb +0 -58
- data/lib/ddtrace/runtime/cgroup.rb +0 -44
- data/lib/ddtrace/runtime/class_count.rb +0 -17
- data/lib/ddtrace/runtime/container.rb +0 -73
- data/lib/ddtrace/runtime/gc.rb +0 -16
- data/lib/ddtrace/runtime/identity.rb +0 -41
- data/lib/ddtrace/runtime/object_space.rb +0 -19
- data/lib/ddtrace/runtime/socket.rb +0 -14
- data/lib/ddtrace/runtime/thread_count.rb +0 -16
- data/tasks/release_gem.rake +0 -28
data/docs/GettingStarted.md
CHANGED
@@ -28,12 +28,15 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
28
28
|
- [Integration instrumentation](#integration-instrumentation)
|
29
29
|
- [Action Cable](#action-cable)
|
30
30
|
- [Action View](#action-view)
|
31
|
+
- [Action Mailer](#action-mailer)
|
31
32
|
- [Active Model Serializers](#active-model-serializers)
|
32
33
|
- [Action Pack](#action-pack)
|
34
|
+
- [Active Job](#active-job)
|
33
35
|
- [Active Record](#active-record)
|
34
36
|
- [Active Support](#active-support)
|
35
37
|
- [AWS](#aws)
|
36
38
|
- [Concurrent Ruby](#concurrent-ruby)
|
39
|
+
- [Cucumber](#cucumber)
|
37
40
|
- [Dalli](#dalli)
|
38
41
|
- [DelayedJob](#delayedjob)
|
39
42
|
- [Elasticsearch](#elasticsearch)
|
@@ -43,11 +46,14 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
43
46
|
- [Grape](#grape)
|
44
47
|
- [GraphQL](#graphql)
|
45
48
|
- [gRPC](#grpc)
|
46
|
-
- [http.rb](#
|
49
|
+
- [http.rb](#httprb)
|
50
|
+
- [httpclient](#httpclient)
|
51
|
+
- [httpx](#httpx)
|
47
52
|
- [MongoDB](#mongodb)
|
48
53
|
- [MySQL2](#mysql2)
|
49
|
-
- [Net/HTTP](#
|
54
|
+
- [Net/HTTP](#nethttp)
|
50
55
|
- [Presto](#presto)
|
56
|
+
- [Qless](#qless)
|
51
57
|
- [Que](#que)
|
52
58
|
- [Racecar](#racecar)
|
53
59
|
- [Rack](#rack)
|
@@ -56,6 +62,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
56
62
|
- [Redis](#redis)
|
57
63
|
- [Rest Client](#rest-client)
|
58
64
|
- [Resque](#resque)
|
65
|
+
- [RSpec](#rspec)
|
59
66
|
- [Shoryuken](#shoryuken)
|
60
67
|
- [Sequel](#sequel)
|
61
68
|
- [Sidekiq](#sidekiq)
|
@@ -66,7 +73,9 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
66
73
|
- [Tracer settings](#tracer-settings)
|
67
74
|
- [Custom logging](#custom-logging)
|
68
75
|
- [Environment and tags](#environment-and-tags)
|
76
|
+
- [Environment variables](#environment-variables)
|
69
77
|
- [Sampling](#sampling)
|
78
|
+
- [Application-side sampling](#application-side-sampling)
|
70
79
|
- [Priority sampling](#priority-sampling)
|
71
80
|
- [Distributed tracing](#distributed-tracing)
|
72
81
|
- [HTTP request queuing](#http-request-queuing)
|
@@ -78,6 +87,12 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
78
87
|
- [Metrics](#metrics)
|
79
88
|
- [For application runtime](#for-application-runtime)
|
80
89
|
- [OpenTracing](#opentracing)
|
90
|
+
- [Profiling](#profiling)
|
91
|
+
- [Troubleshooting](#troubleshooting)
|
92
|
+
- [Profiling Resque jobs](#profiling-resque-jobs)
|
93
|
+
- [Known issues and suggested configurations](#known-issues-and-suggested-configurations)
|
94
|
+
- [Payload too large](#payload-too-large)
|
95
|
+
- [Stack level too deep](#stack-level-too-deep)
|
81
96
|
|
82
97
|
## Compatibility
|
83
98
|
|
@@ -85,14 +100,15 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
85
100
|
|
86
101
|
| Type | Documentation | Version | Support type | Gem version support |
|
87
102
|
| ----- | -------------------------- | ----- | ------------------------------------ | ------------------- |
|
88
|
-
| MRI | https://www.ruby-lang.org/ |
|
103
|
+
| MRI | https://www.ruby-lang.org/ | 3.0 | Full | Latest |
|
104
|
+
| | | 2.7 | Full | Latest |
|
89
105
|
| | | 2.6 | Full | Latest |
|
90
106
|
| | | 2.5 | Full | Latest |
|
91
107
|
| | | 2.4 | Full | Latest |
|
92
108
|
| | | 2.3 | Full | Latest |
|
93
109
|
| | | 2.2 | Full | Latest |
|
94
110
|
| | | 2.1 | Full | Latest |
|
95
|
-
| | | 2.0 |
|
111
|
+
| | | 2.0 | EOL since June 7th, 2021 | < 0.50.0 |
|
96
112
|
| | | 1.9.3 | EOL since August 6th, 2020 | < 0.27.0 |
|
97
113
|
| | | 1.9.1 | EOL since August 6th, 2020 | < 0.27.0 |
|
98
114
|
| JRuby | https://www.jruby.org | 9.2 | Full | Latest |
|
@@ -119,18 +135,47 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
|
|
119
135
|
|
120
136
|
*EOL* indicates support is no longer provided.
|
121
137
|
|
138
|
+
### Microsoft Windows support
|
139
|
+
|
140
|
+
Using `ddtrace ` on Microsoft Windows is currently unsupported. We'll still accept community contributions and issues,
|
141
|
+
but will consider them as having low priority.
|
142
|
+
|
122
143
|
## Installation
|
123
144
|
|
124
145
|
The following steps will help you quickly start tracing your Ruby application.
|
125
146
|
|
126
|
-
###
|
147
|
+
### Configure the Datadog Agent for APM
|
148
|
+
|
149
|
+
Before downloading tracing on your application, [install the Datadog Agent on the host](https://docs.datadoghq.com/agent/). The Ruby APM tracer sends trace data through the Datadog Agent.
|
150
|
+
|
151
|
+
Install and configure the Datadog Agent to receive traces from your now instrumented application. By default the Datadog Agent is enabled in your `datadog.yaml` file under `apm_enabled: true` and listens for trace traffic at `localhost:8126`. For containerized environments, follow the steps below to enable trace collection within the Datadog Agent.
|
127
152
|
|
128
|
-
|
153
|
+
#### Containers
|
154
|
+
|
155
|
+
1. Set `apm_non_local_traffic: true` in your main [`datadog.yaml` configuration file](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-main-configuration-file).
|
156
|
+
|
157
|
+
2. See the specific setup instructions for [Docker](https://docs.datadoghq.com/agent/docker/apm/?tab=ruby), [Kubernetes](https://docs.datadoghq.com/agent/kubernetes/apm/?tab=helm), [Amazon ECS](https://docs.datadoghq.com/agent/amazon_ecs/apm/?tab=ruby) or [Fargate](https://docs.datadoghq.com/integrations/ecs_fargate/#trace-collection) to ensure that the Agent is configured to receive traces in a containerized environment:
|
158
|
+
|
159
|
+
3. After having instrumented your application, the tracing client sends traces to `localhost:8126` by default. If this is not the correct host and port change it by setting the env variables `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`.
|
129
160
|
|
130
|
-
[Install and configure the Datadog Agent](https://docs.datadoghq.com/tracing/setup), see additional documentation for [tracing Docker applications](https://docs.datadoghq.com/tracing/setup/docker/).
|
131
161
|
|
132
162
|
### Quickstart for Rails applications
|
133
163
|
|
164
|
+
#### Automatic instrumentation
|
165
|
+
|
166
|
+
1. Add the `ddtrace` gem to your Gemfile:
|
167
|
+
|
168
|
+
```ruby
|
169
|
+
source 'https://rubygems.org'
|
170
|
+
gem 'ddtrace', require: 'ddtrace/auto_instrument'
|
171
|
+
```
|
172
|
+
|
173
|
+
2. Install the gem with `bundle install`
|
174
|
+
|
175
|
+
3. You can configure, override, or disable any specific integration settings by also adding a Rails manual instrumentation configuration file (next).
|
176
|
+
|
177
|
+
#### Manual instrumentation
|
178
|
+
|
134
179
|
1. Add the `ddtrace` gem to your Gemfile:
|
135
180
|
|
136
181
|
```ruby
|
@@ -152,6 +197,25 @@ Before downloading tracing on your application, install the Datadog Agent. The R
|
|
152
197
|
|
153
198
|
### Quickstart for Ruby applications
|
154
199
|
|
200
|
+
#### Automatic instrumentation
|
201
|
+
|
202
|
+
1. Install the gem with `gem install ddtrace`
|
203
|
+
2. Requiring any [supported libraries or frameworks](#integration-instrumentation) that should be instrumented.
|
204
|
+
3. Add `require 'ddtrace/auto_instrument'` to your application. _Note:_ This must be done _after_ requiring any supported libraries or frameworks.
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
# Example frameworks and libraries
|
208
|
+
require 'sinatra'
|
209
|
+
require 'faraday'
|
210
|
+
require 'redis'
|
211
|
+
|
212
|
+
require 'ddtrace/auto_instrument'
|
213
|
+
```
|
214
|
+
|
215
|
+
You can configure, override, or disable any specific integration settings by also adding a Ruby manual configuration block (next).
|
216
|
+
|
217
|
+
#### Manual instrumentation
|
218
|
+
|
155
219
|
1. Install the gem with `gem install ddtrace`
|
156
220
|
2. Add a configuration block to your Ruby application:
|
157
221
|
|
@@ -226,7 +290,7 @@ And `options` is an optional `Hash` that accepts the following parameters:
|
|
226
290
|
| `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. |
|
227
291
|
| `span_type` | `String` | The type of the span (such as `'http'`, `'db'`, etc.) | `nil` |
|
228
292
|
| `child_of` | `Datadog::Span` / `Datadog::Context` | Parent for this span. If not provided, will automatically become current active span. | `nil` |
|
229
|
-
| `start_time` | `
|
293
|
+
| `start_time` | `Time` | When the span actually starts. Useful when tracing events that have already happened. | `Time.now` |
|
230
294
|
| `tags` | `Hash` | Extra tags which should be added to the span. | `{}` |
|
231
295
|
| `on_error` | `Proc` | Handler invoked when a block is provided to trace, and it raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. | `proc { |span, error| span.set_error(error) unless span.nil? }` |
|
232
296
|
|
@@ -331,13 +395,16 @@ For a list of available integrations, and their configuration options, please re
|
|
331
395
|
| Name | Key | Versions Supported: MRI | Versions Supported: JRuby | How to configure | Gem source |
|
332
396
|
| ------------------------ | -------------------------- | ------------------------ | --------------------------| ----------------------------------- | ------------------------------------------------------------------------------ |
|
333
397
|
| Action Cable | `action_cable` | `>= 5.0` | `>= 5.0` | *[Link](#action-cable)* | *[Link](https://github.com/rails/rails/tree/master/actioncable)* |
|
398
|
+
| Action Mailer | `action_mailer` | `>= 5.0` | `>= 5.0` | *[Link](#action-mailer)* | *[Link](https://github.com/rails/rails/tree/master/actionmailer)* |
|
334
399
|
| Action View | `action_view` | `>= 3.0` | `>= 3.0` | *[Link](#action-view)* | *[Link](https://github.com/rails/rails/tree/master/actionview)* |
|
335
400
|
| Active Model Serializers | `active_model_serializers` | `>= 0.9` | `>= 0.9` | *[Link](#active-model-serializers)* | *[Link](https://github.com/rails-api/active_model_serializers)* |
|
336
401
|
| Action Pack | `action_pack` | `>= 3.0` | `>= 3.0` | *[Link](#action-pack)* | *[Link](https://github.com/rails/rails/tree/master/actionpack)* |
|
402
|
+
| Active Job | `active_job` | `>= 4.2` | `>= 4.2` | *[Link](#active-job)* | *[Link](https://github.com/rails/rails/tree/master/activejob)* |
|
337
403
|
| Active Record | `active_record` | `>= 3.0` | `>= 3.0` | *[Link](#active-record)* | *[Link](https://github.com/rails/rails/tree/master/activerecord)* |
|
338
404
|
| Active Support | `active_support` | `>= 3.0` | `>= 3.0` | *[Link](#active-support)* | *[Link](https://github.com/rails/rails/tree/master/activesupport)* |
|
339
405
|
| AWS | `aws` | `>= 2.0` | `>= 2.0` | *[Link](#aws)* | *[Link](https://github.com/aws/aws-sdk-ruby)* |
|
340
406
|
| Concurrent Ruby | `concurrent_ruby` | `>= 0.9` | `>= 0.9` | *[Link](#concurrent-ruby)* | *[Link](https://github.com/ruby-concurrency/concurrent-ruby)* |
|
407
|
+
| Cucumber | `cucumber` | `>= 3.0` | `>= 1.7.16` | *[Link](#cucumber)* | *[Link](https://github.com/cucumber/cucumber-ruby)* |
|
341
408
|
| Dalli | `dalli` | `>= 2.0` | `>= 2.0` | *[Link](#dalli)* | *[Link](https://github.com/petergoldstein/dalli)* |
|
342
409
|
| DelayedJob | `delayed_job` | `>= 4.1` | `>= 4.1` | *[Link](#delayedjob)* | *[Link](https://github.com/collectiveidea/delayed_job)* |
|
343
410
|
| Elasticsearch | `elasticsearch` | `>= 1.0` | `>= 1.0` | *[Link](#elasticsearch)* | *[Link](https://github.com/elastic/elasticsearch-ruby)* |
|
@@ -347,20 +414,25 @@ For a list of available integrations, and their configuration options, please re
|
|
347
414
|
| Grape | `grape` | `>= 1.0` | `>= 1.0` | *[Link](#grape)* | *[Link](https://github.com/ruby-grape/grape)* |
|
348
415
|
| GraphQL | `graphql` | `>= 1.7.9` | `>= 1.7.9` | *[Link](#graphql)* | *[Link](https://github.com/rmosolgo/graphql-ruby)* |
|
349
416
|
| gRPC | `grpc` | `>= 1.7` | *gem not available* | *[Link](#grpc)* | *[Link](https://github.com/grpc/grpc/tree/master/src/rubyc)* |
|
350
|
-
| http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#
|
417
|
+
| http.rb | `httprb` | `>= 2.0` | `>= 2.0` | *[Link](#httprb)* | *[Link](https://github.com/httprb/http)* |
|
418
|
+
| httpclient | `httpclient` | `>= 2.2` | `>= 2.2` | *[Link](#httpclient)* | *[Link](https://github.com/nahi/httpclient)* |
|
419
|
+
| httpx | `httpx` | `>= 0.11` | `>= 0.11` | *[Link](#httpx)* | *[Link](https://gitlab.com/honeyryderchuck/httpx)* |
|
351
420
|
| Kafka | `ruby-kafka` | `>= 0.7.10` | `>= 0.7.10` | *[Link](#kafka)* | *[Link](https://github.com/zendesk/ruby-kafka)* |
|
421
|
+
| Makara (through Active Record) | `makara` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#active-record)* | *[Link](https://github.com/instacart/makara)* |
|
352
422
|
| MongoDB | `mongo` | `>= 2.1` | `>= 2.1` | *[Link](#mongodb)* | *[Link](https://github.com/mongodb/mongo-ruby-driver)* |
|
353
423
|
| MySQL2 | `mysql2` | `>= 0.3.21` | *gem not available* | *[Link](#mysql2)* | *[Link](https://github.com/brianmario/mysql2)* |
|
354
424
|
| 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)* |
|
355
425
|
| Presto | `presto` | `>= 0.5.14` | `>= 0.5.14` | *[Link](#presto)* | *[Link](https://github.com/treasure-data/presto-client-ruby)* |
|
426
|
+
| Qless | `qless` | `>= 0.10.0` | `>= 0.10.0` | *[Link](#qless)* | *[Link](https://github.com/seomoz/qless)* |
|
356
427
|
| Que | `que` | `>= 1.0.0.beta2` | `>= 1.0.0.beta2` | *[Link](#que)* | *[Link](https://github.com/que-rb/que)* |
|
357
428
|
| Racecar | `racecar` | `>= 0.3.5` | `>= 0.3.5` | *[Link](#racecar)* | *[Link](https://github.com/zendesk/racecar)* |
|
358
429
|
| Rack | `rack` | `>= 1.1` | `>= 1.1` | *[Link](#rack)* | *[Link](https://github.com/rack/rack)* |
|
359
430
|
| Rails | `rails` | `>= 3.0` | `>= 3.0` | *[Link](#rails)* | *[Link](https://github.com/rails/rails)* |
|
360
431
|
| Rake | `rake` | `>= 12.0` | `>= 12.0` | *[Link](#rake)* | *[Link](https://github.com/ruby/rake)* |
|
361
432
|
| Redis | `redis` | `>= 3.2` | `>= 3.2` | *[Link](#redis)* | *[Link](https://github.com/redis/redis-rb)* |
|
362
|
-
| Resque | `resque` | `>= 1.0
|
433
|
+
| Resque | `resque` | `>= 1.0` | `>= 1.0` | *[Link](#resque)* | *[Link](https://github.com/resque/resque)* |
|
363
434
|
| Rest Client | `rest-client` | `>= 1.8` | `>= 1.8` | *[Link](#rest-client)* | *[Link](https://github.com/rest-client/rest-client)* |
|
435
|
+
| RSpec | `rspec`. | `>= 3.0.0` | `>= 3.0.0` | *[Link](#rspec)*. | *[Link](https://github.com/rspec/rspec)* |
|
364
436
|
| Sequel | `sequel` | `>= 3.41` | `>= 3.41` | *[Link](#sequel)* | *[Link](https://github.com/jeremyevans/sequel)* |
|
365
437
|
| Shoryuken | `shoryuken` | `>= 3.2` | `>= 3.2` | *[Link](#shoryuken)* | *[Link](https://github.com/phstc/shoryuken)* |
|
366
438
|
| Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
|
@@ -386,7 +458,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
386
458
|
|
387
459
|
| Key | Description | Default |
|
388
460
|
| --- | ----------- | ------- |
|
389
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
390
461
|
| `service_name` | Service name used for `action_cable` instrumentation | `'action_cable'` |
|
391
462
|
|
392
463
|
### Action View
|
@@ -406,10 +477,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
406
477
|
|
407
478
|
| Key | Description | Default |
|
408
479
|
| ---| --- | --- |
|
409
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
410
480
|
| `service_name` | Service name used for rendering instrumentation. | `action_view` |
|
411
481
|
| `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/'` |
|
412
482
|
|
483
|
+
### Action Mailer
|
484
|
+
|
485
|
+
The Action Mailer integration provides tracing for Rails 5 ActionMailer actions.
|
486
|
+
|
487
|
+
You can enable it through `Datadog.configure`:
|
488
|
+
|
489
|
+
```ruby
|
490
|
+
require 'ddtrace'
|
491
|
+
Datadog.configure do |c|
|
492
|
+
c.use :action_mailer, options
|
493
|
+
end
|
494
|
+
```
|
495
|
+
|
496
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
497
|
+
|
498
|
+
| Key | Description | Default |
|
499
|
+
| --- | ----------- | ------- |
|
500
|
+
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
501
|
+
| `service_name` | Service name used for `action_mailer` instrumentation | `'action_mailer'` |
|
502
|
+
| `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` |
|
503
|
+
|
413
504
|
### Active Model Serializers
|
414
505
|
|
415
506
|
The Active Model Serializers integration traces the `serialize` event for version 0.9+ and the `render` event for version 0.10+.
|
@@ -428,7 +519,6 @@ ActiveModelSerializers::SerializableResource.new(test_obj).serializable_hash
|
|
428
519
|
|
429
520
|
| Key | Description | Default |
|
430
521
|
| --- | ----------- | ------- |
|
431
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
432
522
|
| `service_name` | Service name used for `active_model_serializers` instrumentation. | `'active_model_serializers'` |
|
433
523
|
|
434
524
|
### Action Pack
|
@@ -448,9 +538,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
448
538
|
|
449
539
|
| Key | Description | Default |
|
450
540
|
| ---| --- | --- |
|
451
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
452
541
|
| `service_name` | Service name used for rendering instrumentation. | `action_pack` |
|
453
542
|
|
543
|
+
### Active Job
|
544
|
+
|
545
|
+
Most of the time, Active Job is set up as part of Rails, but it can be activated separately:
|
546
|
+
|
547
|
+
```ruby
|
548
|
+
require 'active_job'
|
549
|
+
require 'ddtrace'
|
550
|
+
|
551
|
+
Datadog.configure do |c|
|
552
|
+
c.use :active_job, options
|
553
|
+
end
|
554
|
+
|
555
|
+
ExampleJob.perform_later
|
556
|
+
```
|
557
|
+
|
558
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
559
|
+
|
560
|
+
| Key | Description | Default |
|
561
|
+
| --- | ----------- | ------- |
|
562
|
+
| `service_name` | Service name used for `active_job` instrumentation | `'active_job'` |
|
563
|
+
| `log_injection` | Automatically enables injection [Trace Correlation](#trace-correlation) information, such as `dd.trace_id`, into Active Job logs. Supports the default logger (`ActiveSupport::TaggedLogging`) and `Lograge`. Details on the format of Trace Correlation information can be found in the [Trace Correlation](#trace-correlation) section. | `false` |
|
564
|
+
|
454
565
|
### Active Record
|
455
566
|
|
456
567
|
Most of the time, Active Record is set up as part of a web framework (Rails, Sinatra...) however, it can be set up alone:
|
@@ -476,7 +587,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
476
587
|
|
477
588
|
| Key | Description | Default |
|
478
589
|
| ---| --- | --- |
|
479
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
480
590
|
| `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'`) |
|
481
591
|
| `service_name` | Service name used for database portion of `active_record` instrumentation. | Name of database adapter (e.g. `'mysql2'`) |
|
482
592
|
|
@@ -495,16 +605,19 @@ Datadog.configure do |c|
|
|
495
605
|
# Only available if you are using Rails with ActiveRecord.
|
496
606
|
c.use :active_record, describes: :secondary_database, service_name: 'secondary-db'
|
497
607
|
|
608
|
+
# Block configuration pattern.
|
498
609
|
c.use :active_record, describes: :secondary_database do |second_db|
|
499
610
|
second_db.service_name = 'secondary-db'
|
500
611
|
end
|
501
612
|
|
502
613
|
# Connection string with the following connection settings:
|
503
|
-
#
|
614
|
+
# adapter, username, host, port, database
|
615
|
+
# Other fields are ignored.
|
504
616
|
c.use :active_record, describes: 'mysql2://root@127.0.0.1:3306/mysql', service_name: 'secondary-db'
|
505
617
|
|
506
|
-
# Hash with following connection settings
|
507
|
-
#
|
618
|
+
# Hash with following connection settings:
|
619
|
+
# adapter, username, host, port, database
|
620
|
+
# Other fields are ignored.
|
508
621
|
c.use :active_record, describes: {
|
509
622
|
adapter: 'mysql2',
|
510
623
|
host: '127.0.0.1',
|
@@ -513,9 +626,34 @@ Datadog.configure do |c|
|
|
513
626
|
username: 'root'
|
514
627
|
},
|
515
628
|
service_name: 'secondary-db'
|
629
|
+
|
630
|
+
# If using the `makara` gem, it's possible to match on connection `role`:
|
631
|
+
c.use :active_record, describes: { makara_role: 'primary' }, service_name: 'primary-db'
|
632
|
+
c.use :active_record, describes: { makara_role: 'replica' }, service_name: 'secondary-db'
|
516
633
|
end
|
517
634
|
```
|
518
635
|
|
636
|
+
You can also create configurations based on partial matching of database connection fields:
|
637
|
+
|
638
|
+
```ruby
|
639
|
+
Datadog.configure do |c|
|
640
|
+
# Matches any connection on host `127.0.0.1`.
|
641
|
+
c.use :active_record, describes: { host: '127.0.0.1' }, service_name: 'local-db'
|
642
|
+
|
643
|
+
# Matches any `mysql2` connection.
|
644
|
+
c.use :active_record, describes: { adapter: 'mysql2'}, service_name: 'mysql-db'
|
645
|
+
|
646
|
+
# Matches any `mysql2` connection to the `reports` database.
|
647
|
+
#
|
648
|
+
# In case of multiple matching `describe` configurations, the latest one applies.
|
649
|
+
# In this case a connection with both adapter `mysql` and database `reports`
|
650
|
+
# will be configured `service_name: 'reports-db'`, not `service_name: 'mysql-db'`.
|
651
|
+
c.use :active_record, describes: { adapter: 'mysql2', database: 'reports'}, service_name: 'reports-db'
|
652
|
+
end
|
653
|
+
```
|
654
|
+
|
655
|
+
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
656
|
+
|
519
657
|
If ActiveRecord traces an event that uses a connection that matches a key defined by `describes`, it will use the trace settings assigned to that connection. If the connection does not match any of the described connections, it will use default settings defined by `c.use :active_record` instead.
|
520
658
|
|
521
659
|
### Active Support
|
@@ -538,7 +676,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
538
676
|
|
539
677
|
| Key | Description | Default |
|
540
678
|
| ---| --- | --- |
|
541
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
542
679
|
| `cache_service` | Service name used for caching with `active_support` instrumentation. | `active_support-cache` |
|
543
680
|
|
544
681
|
### AWS
|
@@ -561,7 +698,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
561
698
|
|
562
699
|
| Key | Description | Default |
|
563
700
|
| --- | ----------- | ------- |
|
564
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
565
701
|
| `service_name` | Service name used for `aws` instrumentation | `'aws'` |
|
566
702
|
|
567
703
|
### Concurrent Ruby
|
@@ -590,6 +726,41 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
590
726
|
| --- | ----------- | ------- |
|
591
727
|
| `service_name` | Service name used for `concurrent-ruby` instrumentation | `'concurrent-ruby'` |
|
592
728
|
|
729
|
+
### Cucumber
|
730
|
+
|
731
|
+
Cucumber integration will trace all executions of scenarios and steps when using `cucumber` framework.
|
732
|
+
|
733
|
+
To activate your integration, use the `Datadog.configure` method:
|
734
|
+
|
735
|
+
```ruby
|
736
|
+
require 'cucumber'
|
737
|
+
require 'ddtrace'
|
738
|
+
|
739
|
+
# Configure default Cucumber integration
|
740
|
+
Datadog.configure do |c|
|
741
|
+
c.use :cucumber, options
|
742
|
+
end
|
743
|
+
|
744
|
+
# Example of how to attach tags from scenario to active span
|
745
|
+
Around do |scenario, block|
|
746
|
+
active_span = Datadog.configuration[:cucumber][:tracer].active_span
|
747
|
+
unless active_span.nil?
|
748
|
+
scenario.tags.filter { |tag| tag.include? ':' }.each do |tag|
|
749
|
+
active_span.set_tag(*tag.name.split(':', 2))
|
750
|
+
end
|
751
|
+
end
|
752
|
+
block.call
|
753
|
+
end
|
754
|
+
```
|
755
|
+
|
756
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
757
|
+
|
758
|
+
| Key | Description | Default |
|
759
|
+
| --- | ----------- | ------- |
|
760
|
+
| `enabled` | Defines whether Cucumber tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
761
|
+
| `service_name` | Service name used for `cucumber` instrumentation. | `'cucumber'` |
|
762
|
+
| `operation_name` | Operation name used for `cucumber` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'cucumber.test'` |
|
763
|
+
|
593
764
|
### Dalli
|
594
765
|
|
595
766
|
Dalli integration will trace all calls to your `memcached` server:
|
@@ -612,12 +783,11 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
612
783
|
|
613
784
|
| Key | Description | Default |
|
614
785
|
| --- | ----------- | ------- |
|
615
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
616
786
|
| `service_name` | Service name used for `dalli` instrumentation | `'memcached'` |
|
617
787
|
|
618
788
|
### DelayedJob
|
619
789
|
|
620
|
-
The DelayedJob integration uses lifecycle hooks to trace the job executions.
|
790
|
+
The DelayedJob integration uses lifecycle hooks to trace the job executions and enqueues.
|
621
791
|
|
622
792
|
You can enable it through `Datadog.configure`:
|
623
793
|
|
@@ -633,8 +803,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
633
803
|
|
634
804
|
| Key | Description | Default |
|
635
805
|
| --- | ----------- | ------- |
|
636
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
637
806
|
| `service_name` | Service name used for `DelayedJob` instrumentation | `'delayed_job'` |
|
807
|
+
| `client_service_name` | Service name used for client-side `DelayedJob` instrumentation | `'delayed_job-client'` |
|
808
|
+
| `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? }` |
|
638
809
|
|
639
810
|
### Elasticsearch
|
640
811
|
|
@@ -657,7 +828,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
657
828
|
|
658
829
|
| Key | Description | Default |
|
659
830
|
| --- | ----------- | ------- |
|
660
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
661
831
|
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{}` |
|
662
832
|
| `service_name` | Service name used for `elasticsearch` instrumentation | `'elasticsearch'` |
|
663
833
|
|
@@ -683,7 +853,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
683
853
|
|
684
854
|
| Key | Description | Default |
|
685
855
|
| --- | ----------- | ------- |
|
686
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
687
856
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
688
857
|
| `service_name` | Service name for `ethon` instrumentation. | `'ethon'` |
|
689
858
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
@@ -715,7 +884,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
715
884
|
|
716
885
|
| Key | Description | Default |
|
717
886
|
| --- | ----------- | ------- |
|
718
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
719
887
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
720
888
|
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
721
889
|
| `service_name` | Service name for Excon instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'excon'` |
|
@@ -778,7 +946,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
778
946
|
|
779
947
|
| Key | Description | Default |
|
780
948
|
| --- | ----------- | ------- |
|
781
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
782
949
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
783
950
|
| `error_handler` | A `Proc` that accepts a `response` parameter. If it evaluates to a *truthy* value, the trace span is marked as an error. By default only sets 5XX responses as errors. | `nil` |
|
784
951
|
| `service_name` | Service name for Faraday instrumentation. When provided to middleware for a specific connection, it applies only to that connection object. | `'faraday'` |
|
@@ -812,9 +979,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
812
979
|
|
813
980
|
| Key | Description | Default |
|
814
981
|
| --- | ----------- | ------- |
|
815
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
816
982
|
| `enabled` | Defines whether Grape should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
817
983
|
| `service_name` | Service name used for `grape` instrumentation | `'grape'` |
|
984
|
+
| `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` |
|
818
985
|
|
819
986
|
### GraphQL
|
820
987
|
|
@@ -836,7 +1003,6 @@ The `use :graphql` method accepts the following parameters. Additional options c
|
|
836
1003
|
|
837
1004
|
| Key | Description | Default |
|
838
1005
|
| --- | ----------- | ------- |
|
839
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
840
1006
|
| `service_name` | Service name used for `graphql` instrumentation | `'ruby-graphql'` |
|
841
1007
|
| `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. | `[]` |
|
842
1008
|
|
@@ -915,8 +1081,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
915
1081
|
|
916
1082
|
| Key | Description | Default |
|
917
1083
|
| --- | ----------- | ------- |
|
918
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
919
1084
|
| `service_name` | Service name used for `grpc` instrumentation | `'grpc'` |
|
1085
|
+
| `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? }` |
|
920
1086
|
|
921
1087
|
**Configuring clients to use different settings**
|
922
1088
|
|
@@ -957,11 +1123,54 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
957
1123
|
|
958
1124
|
| Key | Description | Default |
|
959
1125
|
| --- | ----------- | ------- |
|
960
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
961
1126
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
962
1127
|
| `service_name` | Service name for `httprb` instrumentation. | `'httprb'` |
|
963
1128
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
964
1129
|
|
1130
|
+
### httpclient
|
1131
|
+
|
1132
|
+
The httpclient integration will trace any HTTP call using the httpclient gem.
|
1133
|
+
|
1134
|
+
```ruby
|
1135
|
+
require 'httpclient'
|
1136
|
+
require 'ddtrace'
|
1137
|
+
Datadog.configure do |c|
|
1138
|
+
c.use :httpclient, options
|
1139
|
+
# optionally, specify a different service name for hostnames matching a regex
|
1140
|
+
c.use :httpclient, describes: /user-[^.]+\.example\.com/ do |httpclient|
|
1141
|
+
httpclient.service_name = 'user.example.com'
|
1142
|
+
httpclient.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
```
|
1146
|
+
|
1147
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1148
|
+
|
1149
|
+
| Key | Description | Default |
|
1150
|
+
| --- | ----------- | ------- |
|
1151
|
+
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1152
|
+
| `service_name` | Service name for `httpclient` instrumentation. | `'httpclient'` |
|
1153
|
+
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
1154
|
+
|
1155
|
+
### httpx
|
1156
|
+
|
1157
|
+
`httpx` maintains its [own integration with `ddtrace`](https://honeyryderchuck.gitlab.io/httpx/wiki/Datadog-Adapter):
|
1158
|
+
|
1159
|
+
```ruby
|
1160
|
+
require "ddtrace"
|
1161
|
+
require "httpx/adapters/datadog"
|
1162
|
+
|
1163
|
+
Datadog.configure do |c|
|
1164
|
+
c.use :httpx
|
1165
|
+
|
1166
|
+
# optionally, specify a different service name for hostnames matching a regex
|
1167
|
+
c.use :httpx, describes: /user-[^.]+\.example\.com/ do |http|
|
1168
|
+
http.service_name = 'user.example.com'
|
1169
|
+
http.split_by_domain = false # Only necessary if split_by_domain is true by default
|
1170
|
+
end
|
1171
|
+
end
|
1172
|
+
```
|
1173
|
+
|
965
1174
|
### Kafka
|
966
1175
|
|
967
1176
|
The Kafka integration provides tracing of the `ruby-kafka` gem:
|
@@ -982,7 +1191,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
982
1191
|
|
983
1192
|
| Key | Description | Default |
|
984
1193
|
| --- | ----------- | ------- |
|
985
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
986
1194
|
| `service_name` | Service name used for `kafka` instrumentation | `'kafka'` |
|
987
1195
|
| `tracer` | `Datadog::Tracer` used to perform instrumentation. Usually you don't need to set this. | `Datadog.tracer` |
|
988
1196
|
|
@@ -1011,10 +1219,40 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1011
1219
|
|
1012
1220
|
| Key | Description | Default |
|
1013
1221
|
| --- | ----------- | ------- |
|
1014
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1015
1222
|
| `quantize` | Hash containing options for quantization. May include `:show` with an Array of keys to not quantize (or `:all` to skip quantization), or `:exclude` with Array of keys to exclude entirely. | `{ show: [:collection, :database, :operation] }` |
|
1016
1223
|
| `service_name` | Service name used for `mongo` instrumentation | `'mongodb'` |
|
1017
1224
|
|
1225
|
+
**Configuring trace settings per connection**
|
1226
|
+
|
1227
|
+
You can configure trace settings per connection by using the `describes` option:
|
1228
|
+
|
1229
|
+
```ruby
|
1230
|
+
# Provide a `:describes` option with a connection key.
|
1231
|
+
# Any of the following keys are acceptable and equivalent to one another.
|
1232
|
+
# If a block is provided, it yields a Settings object that
|
1233
|
+
# accepts any of the configuration options listed above.
|
1234
|
+
|
1235
|
+
Datadog.configure do |c|
|
1236
|
+
# Network connection string
|
1237
|
+
c.use :mongo, describes: '127.0.0.1:27017', service_name: 'mongo-primary'
|
1238
|
+
|
1239
|
+
# Network connection regular expression
|
1240
|
+
c.use :mongo, describes: /localhost.*/, service_name: 'mongo-secondary'
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'artists')
|
1244
|
+
collection = client[:people]
|
1245
|
+
collection.insert_one({ name: 'Steve' })
|
1246
|
+
# Traced call will belong to `mongo-primary` service
|
1247
|
+
|
1248
|
+
client = Mongo::Client.new([ 'localhost:27017' ], :database => 'artists')
|
1249
|
+
collection = client[:people]
|
1250
|
+
collection.insert_one({ name: 'Steve' })
|
1251
|
+
# Traced call will belong to `mongo-secondary` service
|
1252
|
+
```
|
1253
|
+
|
1254
|
+
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
1255
|
+
|
1018
1256
|
### MySQL2
|
1019
1257
|
|
1020
1258
|
The MySQL2 integration traces any SQL command sent through `mysql2` gem.
|
@@ -1035,7 +1273,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1035
1273
|
|
1036
1274
|
| Key | Description | Default |
|
1037
1275
|
| --- | ----------- | ------- |
|
1038
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1039
1276
|
| `service_name` | Service name used for `mysql2` instrumentation | `'mysql2'` |
|
1040
1277
|
|
1041
1278
|
### Net/HTTP
|
@@ -1068,7 +1305,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1068
1305
|
|
1069
1306
|
| Key | Description | Default |
|
1070
1307
|
| --- | ----------- | ------- |
|
1071
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1072
1308
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1073
1309
|
| `service_name` | Service name used for `http` instrumentation | `'net/http'` |
|
1074
1310
|
| `split_by_domain` | Uses the request domain as the service name when set to `true`. | `false` |
|
@@ -1109,9 +1345,30 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1109
1345
|
|
1110
1346
|
| Key | Description | Default |
|
1111
1347
|
| --- | ----------- | ------- |
|
1112
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1113
1348
|
| `service_name` | Service name used for `presto` instrumentation | `'presto'` |
|
1114
1349
|
|
1350
|
+
### Qless
|
1351
|
+
|
1352
|
+
The Qless integration uses lifecycle hooks to trace job executions.
|
1353
|
+
|
1354
|
+
To add tracing to a Qless job:
|
1355
|
+
|
1356
|
+
```ruby
|
1357
|
+
require 'ddtrace'
|
1358
|
+
|
1359
|
+
Datadog.configure do |c|
|
1360
|
+
c.use :qless, options
|
1361
|
+
end
|
1362
|
+
```
|
1363
|
+
|
1364
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1365
|
+
|
1366
|
+
| Key | Description | Default |
|
1367
|
+
| --- | ----------- | ------- |
|
1368
|
+
| `service_name` | Service name used for `qless` instrumentation | `'qless'` |
|
1369
|
+
| `tag_job_data` | Enable tagging with job arguments. true for on, false for off. | `false` |
|
1370
|
+
| `tag_job_tags` | Enable tagging with job tags. true for on, false for off. | `false` |
|
1371
|
+
|
1115
1372
|
### Que
|
1116
1373
|
|
1117
1374
|
The Que integration is a middleware which will trace job executions.
|
@@ -1130,11 +1387,11 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1130
1387
|
|
1131
1388
|
| Key | Description | Default |
|
1132
1389
|
| --- | ----------- | ------- |
|
1133
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1134
1390
|
| `enabled` | Defines whether Que should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1135
1391
|
| `service_name` | Service name used for `que` instrumentation | `'que'` |
|
1136
1392
|
| `tag_args` | Enable tagging of a job's args field. `true` for on, `false` for off. | `false` |
|
1137
1393
|
| `tag_data` | Enable tagging of a job's data field. `true` for on, `false` for off. | `false` |
|
1394
|
+
| `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? }` |
|
1138
1395
|
|
1139
1396
|
### Racecar
|
1140
1397
|
|
@@ -1154,7 +1411,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1154
1411
|
|
1155
1412
|
| Key | Description | Default |
|
1156
1413
|
| --- | ----------- | ------- |
|
1157
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1158
1414
|
| `service_name` | Service name used for `racecar` instrumentation | `'racecar'` |
|
1159
1415
|
|
1160
1416
|
### Rack
|
@@ -1184,11 +1440,10 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1184
1440
|
|
1185
1441
|
| Key | Description | Default |
|
1186
1442
|
| --- | ----------- | ------- |
|
1187
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
1188
1443
|
| `application` | Your Rack application. Required for `middleware_names`. | `nil` |
|
1189
1444
|
| `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` |
|
1190
1445
|
| `headers` | Hash of HTTP request or response headers to add as tags to the `rack.request`. Accepts `request` and `response` keys with Array values e.g. `['Last-Modified']`. Adds `http.request.headers.*` and `http.response.headers.*` tags respectively. | `{ response: ['Content-Type', 'X-Request-ID'] }` |
|
1191
|
-
| `middleware_names` | Enable this if you want to use the middleware
|
1446
|
+
| `middleware_names` | Enable this if you want to use the last executed middleware class as the resource name for the `rack` span. If enabled alongside the `rails` instrumention, `rails` takes precedence by setting the `rack` resource name to the active `rails` controller when applicable. Requires `application` option to use. | `false` |
|
1192
1447
|
| `quantize` | Hash containing options for quantization. May include `:query` or `:fragment`. | `{}` |
|
1193
1448
|
| `quantize.query` | Hash containing options for query portion of URL quantization. May include `:show` or `:exclude`. See options below. Option must be nested inside the `quantize` option. | `{}` |
|
1194
1449
|
| `quantize.query.show` | Defines which values should always be shown. Shows no values by default. May be an Array of strings, or `:all` to show all values. Option must be nested inside the `query` option. | `nil` |
|
@@ -1247,12 +1502,12 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1247
1502
|
|
1248
1503
|
| Key | Description | Default |
|
1249
1504
|
| --- | ----------- | ------- |
|
1250
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `nil` |
|
1251
1505
|
| `cache_service` | Cache service name used when tracing cache activity | `'<app_name>-cache'` |
|
1252
1506
|
| `controller_service` | Service name used when tracing a Rails action controller | `'<app_name>'` |
|
1253
1507
|
| `database_service` | Database service name used when tracing database activity | `'<app_name>-<adapter_name>'` |
|
1254
1508
|
| `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` |
|
1255
1509
|
| `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` |
|
1510
|
+
| `job_service` | Service name used when tracing ActiveJob activity. | `<app_name>-active_job` |
|
1256
1511
|
| `middleware` | Add the trace middleware to the Rails application. Set to `false` if you don't want the middleware to load. | `true` |
|
1257
1512
|
| `middleware_names` | Enables any short-circuited middleware requests to display the middleware name as a resource for the trace. | `false` |
|
1258
1513
|
| `service_name` | Service name used when tracing application requests (on the `rack` level) | `'<app_name>'` (inferred from your Rails application namespace) |
|
@@ -1263,12 +1518,12 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1263
1518
|
|
1264
1519
|
| MRI Versions | JRuby Versions | Rails Versions |
|
1265
1520
|
| ------------- | -------------- | -------------- |
|
1266
|
-
| 2.0 | | 3.0 - 3.2 |
|
1267
1521
|
| 2.1 | | 3.0 - 4.2 |
|
1268
1522
|
| 2.2 - 2.3 | | 3.0 - 5.2 |
|
1269
1523
|
| 2.4 | | 4.2.8 - 5.2 |
|
1270
|
-
| 2.5 | | 4.2.8 - 6.
|
1271
|
-
| 2.6 - 2.7 | 9.2 | 5.0 - 6.
|
1524
|
+
| 2.5 | | 4.2.8 - 6.1 |
|
1525
|
+
| 2.6 - 2.7 | 9.2 | 5.0 - 6.1 |
|
1526
|
+
| 3.0 | | 6.1 |
|
1272
1527
|
|
1273
1528
|
### Rake
|
1274
1529
|
|
@@ -1296,7 +1551,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1296
1551
|
|
1297
1552
|
| Key | Description | Default |
|
1298
1553
|
| --- | ----------- | ------- |
|
1299
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
1300
1554
|
| `enabled` | Defines whether Rake tasks should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1301
1555
|
| `quantize` | Hash containing options for quantization of task arguments. See below for more details and examples. | `{}` |
|
1302
1556
|
| `service_name` | Service name used for `rake` instrumentation | `'rake'` |
|
@@ -1356,8 +1610,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1356
1610
|
|
1357
1611
|
| Key | Description | Default |
|
1358
1612
|
| --- | ----------- | ------- |
|
1359
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1360
1613
|
| `service_name` | Service name used for `redis` instrumentation | `'redis'` |
|
1614
|
+
| `command_args` | Show the command arguments (e.g. `key` in `GET key`) as resource name and tag | true |
|
1361
1615
|
|
1362
1616
|
You can also set *per-instance* configuration as it follows:
|
1363
1617
|
|
@@ -1395,12 +1649,17 @@ Datadog.configure do |c|
|
|
1395
1649
|
# The default configuration for any redis client
|
1396
1650
|
c.use :redis, service_name: 'redis-default'
|
1397
1651
|
|
1398
|
-
# The configuration matching a given unix socket
|
1652
|
+
# The configuration matching a given unix socket.
|
1399
1653
|
c.use :redis, describes: { url: 'unix://path/to/file' }, service_name: 'redis-unix'
|
1400
1654
|
|
1401
|
-
#
|
1402
|
-
|
1403
|
-
#
|
1655
|
+
# For network connections, only these fields are considered during matching:
|
1656
|
+
# scheme, host, port, db
|
1657
|
+
# Other fields are ignored.
|
1658
|
+
|
1659
|
+
# Network connection string
|
1660
|
+
c.use :redis, describes: 'redis://127.0.0.1:6379/0', service_name: 'redis-connection-string'
|
1661
|
+
c.use :redis, describes: { url: 'redis://127.0.0.1:6379/1' }, service_name: 'redis-connection-url'
|
1662
|
+
# Network client hash
|
1404
1663
|
c.use :redis, describes: { host: 'my-host.com', port: 6379, db: 1, scheme: 'redis' }, service_name: 'redis-connection-hash'
|
1405
1664
|
# Only a subset of the connection hash
|
1406
1665
|
c.use :redis, describes: { host: ENV['APP_CACHE_HOST'], port: ENV['APP_CACHE_PORT'] }, service_name: 'redis-cache'
|
@@ -1408,6 +1667,8 @@ Datadog.configure do |c|
|
|
1408
1667
|
end
|
1409
1668
|
```
|
1410
1669
|
|
1670
|
+
When multiple `describes` configurations match a connection, the latest configured rule that matches will be applied.
|
1671
|
+
|
1411
1672
|
### Resque
|
1412
1673
|
|
1413
1674
|
The Resque integration uses Resque hooks that wraps the `perform` method.
|
@@ -1415,16 +1676,11 @@ The Resque integration uses Resque hooks that wraps the `perform` method.
|
|
1415
1676
|
To add tracing to a Resque job:
|
1416
1677
|
|
1417
1678
|
```ruby
|
1679
|
+
require 'resque'
|
1418
1680
|
require 'ddtrace'
|
1419
1681
|
|
1420
|
-
class MyJob
|
1421
|
-
def self.perform(*args)
|
1422
|
-
# do_something
|
1423
|
-
end
|
1424
|
-
end
|
1425
|
-
|
1426
1682
|
Datadog.configure do |c|
|
1427
|
-
c.use :resque, options
|
1683
|
+
c.use :resque, **options
|
1428
1684
|
end
|
1429
1685
|
```
|
1430
1686
|
|
@@ -1432,9 +1688,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1432
1688
|
|
1433
1689
|
| Key | Description | Default |
|
1434
1690
|
| --- | ----------- | ------- |
|
1435
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to the global setting, `false` for off. | `false` |
|
1436
1691
|
| `service_name` | Service name used for `resque` instrumentation | `'resque'` |
|
1437
|
-
| `
|
1692
|
+
| `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? }` |
|
1693
|
+
| `workers` | **[DEPRECATED]** Limits instrumented worker classes to only the ones specified in an array (e.g. `[MyJob]`). If not provided, instruments all workers. | `nil` |
|
1438
1694
|
|
1439
1695
|
### Rest Client
|
1440
1696
|
|
@@ -1453,10 +1709,33 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1453
1709
|
|
1454
1710
|
| Key | Description | Default |
|
1455
1711
|
| --- | ----------- | ------- |
|
1456
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1457
1712
|
| `distributed_tracing` | Enables [distributed tracing](#distributed-tracing) | `true` |
|
1458
1713
|
| `service_name` | Service name for `rest_client` instrumentation. | `'rest_client'` |
|
1459
1714
|
|
1715
|
+
### RSpec
|
1716
|
+
|
1717
|
+
RSpec integration will trace all executions of example groups and examples when using `rspec` test framework.
|
1718
|
+
|
1719
|
+
To activate your integration, use the `Datadog.configure` method:
|
1720
|
+
|
1721
|
+
```ruby
|
1722
|
+
require 'rspec'
|
1723
|
+
require 'ddtrace'
|
1724
|
+
|
1725
|
+
# Configure default RSpec integration
|
1726
|
+
Datadog.configure do |c|
|
1727
|
+
c.use :rspec, options
|
1728
|
+
end
|
1729
|
+
```
|
1730
|
+
|
1731
|
+
Where `options` is an optional `Hash` that accepts the following parameters:
|
1732
|
+
|
1733
|
+
| Key | Description | Default |
|
1734
|
+
| --- | ----------- | ------- |
|
1735
|
+
| `enabled` | Defines whether RSpec tests should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1736
|
+
| `service_name` | Service name used for `rspec` instrumentation. | `'rspec'` |
|
1737
|
+
| `operation_name` | Operation name used for `rspec` instrumentation. Useful if you want rename automatic trace metrics e.g. `trace.#{operation_name}.errors`. | `'rspec.example'` |
|
1738
|
+
|
1460
1739
|
### Sequel
|
1461
1740
|
|
1462
1741
|
The Sequel integration traces queries made to your database.
|
@@ -1487,11 +1766,8 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1487
1766
|
|
1488
1767
|
| Key | Description | Default |
|
1489
1768
|
| --- | ----------- | ------- |
|
1490
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1491
1769
|
| `service_name` | Service name for `sequel` instrumentation | Name of database adapter (e.g. `'mysql2'`) |
|
1492
1770
|
|
1493
|
-
Only Ruby 2.0+ is supported.
|
1494
|
-
|
1495
1771
|
**Configuring databases to use different settings**
|
1496
1772
|
|
1497
1773
|
If you use multiple databases with Sequel, you can give each of them different settings by configuring their respective `Sequel::Database` objects:
|
@@ -1523,8 +1799,9 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1523
1799
|
|
1524
1800
|
| Key | Description | Default |
|
1525
1801
|
| --- | ----------- | ------- |
|
1526
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1527
1802
|
| `service_name` | Service name used for `shoryuken` instrumentation | `'shoryuken'` |
|
1803
|
+
| `tag_body` | Tag spans with the SQS message body `true` or `false` | `false` |
|
1804
|
+
| `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? }` |
|
1528
1805
|
|
1529
1806
|
### Sidekiq
|
1530
1807
|
|
@@ -1544,10 +1821,10 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1544
1821
|
|
1545
1822
|
| Key | Description | Default |
|
1546
1823
|
| --- | ----------- | ------- |
|
1547
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1548
1824
|
| `client_service_name` | Service name used for client-side `sidekiq` instrumentation | `'sidekiq-client'` |
|
1549
1825
|
| `service_name` | Service name used for server-side `sidekiq` instrumentation | `'sidekiq'` |
|
1550
1826
|
| `tag_args` | Enable tagging of job arguments. `true` for on, `false` for off. | `false` |
|
1827
|
+
| `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? }` |
|
1551
1828
|
|
1552
1829
|
### Sinatra
|
1553
1830
|
|
@@ -1607,7 +1884,6 @@ Ensure you register `Datadog::Contrib::Sinatra::Tracer` as a middleware before y
|
|
1607
1884
|
|
1608
1885
|
| Key | Description | Default |
|
1609
1886
|
| --- | ----------- | ------- |
|
1610
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `nil` |
|
1611
1887
|
| `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` |
|
1612
1888
|
| `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'] }` |
|
1613
1889
|
| `resource_script_names` | Prepend resource names with script name | `false` |
|
@@ -1631,10 +1907,10 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1631
1907
|
|
1632
1908
|
| Key | Description | Default |
|
1633
1909
|
| --- | ----------- | ------- |
|
1634
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1635
1910
|
| `enabled` | Defines whether Sneakers should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |
|
1636
1911
|
| `service_name` | Service name used for `sneakers` instrumentation | `'sneakers'` |
|
1637
1912
|
| `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
|
1913
|
+
| `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? }` |
|
1638
1914
|
|
1639
1915
|
### Sucker Punch
|
1640
1916
|
|
@@ -1655,7 +1931,6 @@ Where `options` is an optional `Hash` that accepts the following parameters:
|
|
1655
1931
|
|
1656
1932
|
| Key | Description | Default |
|
1657
1933
|
| --- | ----------- | ------- |
|
1658
|
-
| `analytics_enabled` | Enable analytics for spans produced by this integration. `true` for on, `nil` to defer to global setting, `false` for off. | `false` |
|
1659
1934
|
| `service_name` | Service name used for `sucker_punch` instrumentation | `'sucker_punch'` |
|
1660
1935
|
|
1661
1936
|
## Advanced configuration
|
@@ -1671,13 +1946,20 @@ Datadog.configure do |c|
|
|
1671
1946
|
c.tracer.enabled = true
|
1672
1947
|
c.tracer.hostname = 'my-agent'
|
1673
1948
|
c.tracer.port = 8126
|
1674
|
-
|
1949
|
+
|
1950
|
+
# Ensure all traces are ingested by Datadog
|
1951
|
+
c.sampling.default_rate = 1.0 # Recommended
|
1952
|
+
c.sampling.rate_limit = 200
|
1953
|
+
# or provide a custom implementation (overrides c.sampling settings)
|
1675
1954
|
c.tracer.sampler = Datadog::AllSampler.new
|
1676
1955
|
|
1677
|
-
#
|
1956
|
+
# Breaks down very large traces into smaller batches
|
1957
|
+
c.tracer.partial_flush.enabled = false
|
1958
|
+
|
1959
|
+
# You can specify your own tracer
|
1678
1960
|
c.tracer.instance = Datadog::Tracer.new
|
1679
1961
|
|
1680
|
-
# To enable debug mode
|
1962
|
+
# To enable debug mode
|
1681
1963
|
c.diagnostics.debug = true
|
1682
1964
|
end
|
1683
1965
|
```
|
@@ -1689,9 +1971,12 @@ Available options are:
|
|
1689
1971
|
- `instance`: set to a custom `Datadog::Tracer` instance. If provided, other trace settings are ignored (you must configure it manually.)
|
1690
1972
|
- `partial_flush.enabled`: set to `true` to enable partial trace flushing (for long running traces.) Disabled by default. *Experimental.*
|
1691
1973
|
- `port`: set the port the trace agent is listening on.
|
1974
|
+
- `sampling.default_rate`: default tracer sampling rate, between `0.0` (0%) and `1.0` (100%, recommended). `1.0` or Tracing without Limits™, allows you to send all of your traffic and retention can be [configured within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/). When this configuration is not set, the Datadog agent will keep an intelligent assortment of diverse traces.
|
1975
|
+
- `sampling.rate_limit`: maximum number of traces per second to sample. Defaults to 100 per second.
|
1692
1976
|
- `sampler`: set to a custom `Datadog::Sampler` instance. If provided, the tracer will use this sampler to determine sampling behavior.
|
1693
1977
|
- `diagnostics.startup_logs.enabled`: Startup configuration and diagnostic log. Defaults to `true`. Can be configured through the `DD_TRACE_STARTUP_LOGS` environment variable.
|
1694
1978
|
- `diagnostics.debug`: set to true to enable debug logging. Can be configured through the `DD_TRACE_DEBUG` environment variable. Defaults to `false`.
|
1979
|
+
- `time_now_provider`: when testing, it might be helpful to use a different time provider. For Timecop, for example, `->{ Time.now_without_mock_time }` allows the tracer to use the real wall time. Span duration calculation will still use the system monotonic clock when available, thus not being affected by this setting. Defaults to `->{ Time.now }`.
|
1695
1980
|
|
1696
1981
|
#### Custom logging
|
1697
1982
|
|
@@ -1745,13 +2030,22 @@ Other Environment Variables:
|
|
1745
2030
|
|
1746
2031
|
- `DD_TRACE_AGENT_URL`: Sets the URL endpoint where traces are sent. Has priority over `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT` if set. e.g. `DD_TRACE_AGENT_URL=http://localhost:8126`.
|
1747
2032
|
- `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.
|
1748
|
-
- `
|
1749
|
-
- `DD_TRACE_<INTEGRATION>_ANALYTICS_SAMPLE_RATE`: Sets the App Analytics sampling rate for a specific integration. A floating number between 0.0 and 1.0 (default). e.g. `DD_TRACE_ACTION_CABLE_ANALYTICS_SAMPLE_RATE=0.5`.
|
2033
|
+
- `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.
|
1750
2034
|
- `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`.
|
1751
2035
|
|
1752
2036
|
### Sampling
|
1753
2037
|
|
1754
|
-
|
2038
|
+
Datadog's Tracing without Limits™ allows you to send all of your traffic and [configure retention within the Datadog app](https://docs.datadoghq.com/tracing/trace_retention_and_ingestion/).
|
2039
|
+
|
2040
|
+
We recommend setting the environment variable `DD_TRACE_SAMPLE_RATE=1.0` in all new applications using `ddtrace`.
|
2041
|
+
|
2042
|
+
App Analytics, previously configured with the `analytics_enabled` setting, is deprecated in favor of Tracing without Limits™. Documentation for this [deprecated configuration is still available](https://docs.datadoghq.com/tracing/legacy_app_analytics/).
|
2043
|
+
|
2044
|
+
#### Application-side sampling
|
2045
|
+
|
2046
|
+
While the trace agent can sample traces to reduce bandwidth usage, application-side sampling reduces the performance overhead.
|
2047
|
+
|
2048
|
+
This will **reduce visibility and is not recommended**. See [DD_TRACE_SAMPLE_RATE](#environment-variables) for the recommended sampling approach.
|
1755
2049
|
|
1756
2050
|
`Datadog::RateSampler` samples a ratio of the traces. For example:
|
1757
2051
|
|
@@ -1909,12 +2203,14 @@ For more details on how to activate distributed tracing for integrations, see th
|
|
1909
2203
|
|
1910
2204
|
- [Excon](#excon)
|
1911
2205
|
- [Faraday](#faraday)
|
1912
|
-
- [Rest Client](#
|
2206
|
+
- [Rest Client](#rest-client)
|
1913
2207
|
- [Net/HTTP](#nethttp)
|
1914
2208
|
- [Rack](#rack)
|
1915
2209
|
- [Rails](#rails)
|
1916
2210
|
- [Sinatra](#sinatra)
|
1917
|
-
- [http.rb](#
|
2211
|
+
- [http.rb](#httprb)
|
2212
|
+
- [httpclient](#httpclient)
|
2213
|
+
- [httpx](#httpx)
|
1918
2214
|
|
1919
2215
|
**Using the HTTP propagator**
|
1920
2216
|
|
@@ -1943,9 +2239,7 @@ end
|
|
1943
2239
|
|
1944
2240
|
Traces that originate from HTTP requests can be configured to include the time spent in a frontend web server or load balancer queue before the request reaches the Ruby application.
|
1945
2241
|
|
1946
|
-
This
|
1947
|
-
|
1948
|
-
To activate this feature, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
|
2242
|
+
This feature is disabled by default. To activate it, you must add an `X-Request-Start` or `X-Queue-Start` header from your web server (i.e., Nginx). The following is an Nginx configuration example:
|
1949
2243
|
|
1950
2244
|
```
|
1951
2245
|
# /etc/nginx/conf.d/ruby_service.conf
|
@@ -1959,9 +2253,7 @@ server {
|
|
1959
2253
|
}
|
1960
2254
|
```
|
1961
2255
|
|
1962
|
-
Then you must enable the request queuing feature in the integration handling the request.
|
1963
|
-
|
1964
|
-
For Rack-based applications, see the [documentation](#rack) for details for enabling this feature.
|
2256
|
+
Then you must enable the request queuing feature, by setting `request_queuing: true`, in the integration handling the request. For Rack-based applications, see the [documentation](#rack) for details.
|
1965
2257
|
|
1966
2258
|
### Processing Pipeline
|
1967
2259
|
|
@@ -2034,7 +2326,7 @@ In many cases, such as logging, it may be useful to correlate trace IDs to other
|
|
2034
2326
|
|
2035
2327
|
##### Automatic
|
2036
2328
|
|
2037
|
-
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`) or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
|
2329
|
+
For Rails applications using the default logger (`ActiveSupport::TaggedLogging`), `semantic_logger`, or `lograge`, you can automatically enable trace correlation injection by setting the `rails` instrumentation configuration option `log_injection` to `true` or by setting environment variable `DD_LOGS_INJECTION=true`:
|
2038
2330
|
|
2039
2331
|
```ruby
|
2040
2332
|
# config/initializers/datadog.rb
|
@@ -2047,7 +2339,7 @@ end
|
|
2047
2339
|
|
2048
2340
|
##### Manual (Lograge)
|
2049
2341
|
|
2050
|
-
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.
|
2342
|
+
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.
|
2051
2343
|
|
2052
2344
|
```ruby
|
2053
2345
|
config.lograge.custom_options = lambda do |event|
|
@@ -2134,7 +2426,9 @@ Datadog.tracer.trace('my.operation') { logger.warn('This is a traced operation.'
|
|
2134
2426
|
|
2135
2427
|
### Configuring the transport layer
|
2136
2428
|
|
2137
|
-
By default, the tracer submits trace data using
|
2429
|
+
By default, the tracer submits trace data using the Unix socket `/var/run/datadog/apm.socket`, if one is created by the Agent. Otherwise, it connects via HTTP to `127.0.0.1:8126`, the default TCP location the Agent listens on.
|
2430
|
+
|
2431
|
+
However, the tracer can be configured to send its trace data to alternative destinations, or by alternative protocols.
|
2138
2432
|
|
2139
2433
|
Some basic settings, such as hostname and port, can be configured using [tracer settings](#tracer-settings).
|
2140
2434
|
|
@@ -2160,7 +2454,7 @@ To use, first configure your trace agent to listen by Unix socket, then configur
|
|
2160
2454
|
```ruby
|
2161
2455
|
Datadog.configure do |c|
|
2162
2456
|
c.tracer.transport_options = proc { |t|
|
2163
|
-
# Provide
|
2457
|
+
# Provide local path to trace agent Unix socket
|
2164
2458
|
t.adapter :unix, '/tmp/ddagent/trace.sock'
|
2165
2459
|
}
|
2166
2460
|
end
|
@@ -2204,7 +2498,7 @@ The tracer and its integrations can produce some additional metrics that can pro
|
|
2204
2498
|
To configure your application for metrics collection:
|
2205
2499
|
|
2206
2500
|
1. [Configure your Datadog agent for StatsD](https://docs.datadoghq.com/developers/dogstatsd/#setup)
|
2207
|
-
2. Add `gem 'dogstatsd-ruby'` to your Gemfile
|
2501
|
+
2. Add `gem 'dogstatsd-ruby', '~> 5.3'` to your Gemfile
|
2208
2502
|
|
2209
2503
|
#### For application runtime
|
2210
2504
|
|
@@ -2233,11 +2527,13 @@ See the [Dogstatsd documentation](https://www.rubydoc.info/github/DataDog/dogsta
|
|
2233
2527
|
|
2234
2528
|
The stats are VM specific and will include:
|
2235
2529
|
|
2236
|
-
| Name | Type | Description |
|
2237
|
-
| -------------------------- | ------- | -------------------------------------------------------- |
|
2238
|
-
| `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. |
|
2239
|
-
| `runtime.ruby.
|
2240
|
-
| `runtime.ruby.
|
2530
|
+
| Name | Type | Description | Available on |
|
2531
|
+
| -------------------------- | ------- | -------------------------------------------------------- | ------------ |
|
2532
|
+
| `runtime.ruby.class_count` | `gauge` | Number of classes in memory space. | CRuby |
|
2533
|
+
| `runtime.ruby.gc.*` | `gauge` | Garbage collection statistics: collected from `GC.stat`. | All runtimes |
|
2534
|
+
| `runtime.ruby.thread_count` | `gauge` | Number of threads. | All runtimes |
|
2535
|
+
| `runtime.ruby.global_constant_state` | `gauge` | Global constant cache generation. | CRuby |
|
2536
|
+
| `runtime.ruby.global_method_state` | `gauge` | [Global method cache generation.](https://tenderlovemaking.com/2015/12/23/inline-caching-in-mri.html) | [CRuby < 3.0.0](https://docs.ruby-lang.org/en/3.0.0/NEWS_md.html#label-Implementation+improvements) |
|
2241
2537
|
|
2242
2538
|
In addition, all metrics include the following tags:
|
2243
2539
|
|
@@ -2274,3 +2570,53 @@ However, additional instrumentation provided by Datadog can be activated alongsi
|
|
2274
2570
|
| `OpenTracing::FORMAT_TEXT_MAP` | Yes | |
|
2275
2571
|
| `OpenTracing::FORMAT_RACK` | Yes | Because of the loss of resolution in the Rack format, please note that baggage items with names containing either upper case characters or `-` will be converted to lower case and `_` in a round-trip respectively. We recommend avoiding these characters or accommodating accordingly on the receiving end. |
|
2276
2572
|
| `OpenTracing::FORMAT_BINARY` | No | |
|
2573
|
+
|
2574
|
+
### Profiling
|
2575
|
+
|
2576
|
+
*Currently available as BETA feature.*
|
2577
|
+
|
2578
|
+
`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.
|
2579
|
+
|
2580
|
+
**Setup**
|
2581
|
+
|
2582
|
+
To get started with profiling, follow the [Enabling the Ruby Profiler](https://docs.datadoghq.com/tracing/profiler/enabling/ruby/) guide.
|
2583
|
+
|
2584
|
+
#### Troubleshooting
|
2585
|
+
|
2586
|
+
If you run into issues with profiling, please check the [Profiler Troubleshooting Guide](https://docs.datadoghq.com/tracing/profiler/profiler_troubleshooting/?code-lang=ruby).
|
2587
|
+
|
2588
|
+
#### Profiling Resque jobs
|
2589
|
+
|
2590
|
+
When profiling [Resque](https://github.com/resque/resque) jobs, you should set the `RUN_AT_EXIT_HOOKS=1` option described in the [Resque](https://github.com/resque/resque/blob/v2.0.0/docs/HOOKS.md#worker-hooks) documentation.
|
2591
|
+
|
2592
|
+
Without this flag, profiles for short-lived Resque jobs will not be available as Resque kills worker processes before they have a chance to submit this information.
|
2593
|
+
|
2594
|
+
## Known issues and suggested configurations
|
2595
|
+
|
2596
|
+
### Payload too large
|
2597
|
+
|
2598
|
+
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.
|
2599
|
+
|
2600
|
+
If traces are missing, enable [debug mode](#tracer-settings) to check if messages containing `"Dropping trace. Payload too large"` are logged.
|
2601
|
+
|
2602
|
+
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.
|
2603
|
+
|
2604
|
+
If you have confirmed that traces are dropped due to large payloads, then enable the [partial_flush](#tracer-settings) setting to break down large traces into smaller chunks.
|
2605
|
+
|
2606
|
+
### Stack level too deep
|
2607
|
+
|
2608
|
+
Datadog tracing collects trace data by adding instrumentation into other common libraries (e.g. Rails, Rack, etc.) Some libraries provide APIs to add this instrumentation, but some do not. In order to add instrumentation into libraries lacking an instrumentation API, Datadog uses a technique called "monkey-patching" to modify the code of that library.
|
2609
|
+
|
2610
|
+
In Ruby version 1.9.3 and earlier, "monkey-patching" often involved the use of [`alias_method`](https://ruby-doc.org/core-3.0.0/Module.html#method-i-alias_method), also known as *method rewriting*, to destructively replace existing Ruby methods. However, this practice would often create conflicts & errors if two libraries attempted to "rewrite" the same method. (e.g. two different APM packages trying to instrument the same method.)
|
2611
|
+
|
2612
|
+
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.
|
2613
|
+
|
2614
|
+
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.
|
2615
|
+
|
2616
|
+
As the implementation of `alias_method` exists within those libraries, Datadog generally cannot fix them. However, some libraries have known workarounds:
|
2617
|
+
|
2618
|
+
* `rack-mini-profiler`: [Net::HTTP stack level too deep errors](https://github.com/MiniProfiler/rack-mini-profiler#nethttp-stack-level-too-deep-errors).
|
2619
|
+
|
2620
|
+
For libraries without a known workaround, consider removing the library using `alias` or `Module#alias_method` or separating libraries into different environments for testing.
|
2621
|
+
|
2622
|
+
For any further questions or to report an occurence of this issue, please [reach out to Datadog support](https://docs.datadoghq.com/help)
|