ddtrace 0.49.0 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +49 -73
- data/.circleci/images/primary/{Dockerfile-truffleruby-21.0.0 → Dockerfile-truffleruby-21.1.0} +1 -1
- data/.gitignore +0 -2
- data/.rubocop.yml +0 -8
- data/.rubocop_todo.yml +7 -7
- data/Appraisals +1 -107
- data/CHANGELOG.md +47 -0
- data/Rakefile +278 -333
- data/benchmarks/data/profiler-submission-marshal.gz +0 -0
- data/benchmarks/profiler_submission.rb +93 -0
- data/ddtrace.gemspec +1 -1
- data/docker-compose.yml +4 -34
- data/docs/GettingStarted.md +24 -9
- data/gemfiles/jruby_9.2.0.0_contrib.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_contrib_old.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_core_old.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_cucumber3.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_cucumber4.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_cucumber5.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails6_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails6_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails6_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_rails6_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.0.0_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_contrib.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_contrib_old.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_core_old.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_cucumber3.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_cucumber4.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_cucumber5.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails6_mysql2.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails6_postgres.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails6_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_rails6_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/jruby_9.2.11.1_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails30_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails30_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails32_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails32_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails32_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails32_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails4_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails4_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.1.10_rails4_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails30_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails30_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails32_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails32_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails32_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails32_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails4_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails4_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails4_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails4_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.2.10_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails30_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails30_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails32_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails32_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails32_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails32_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails4_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails4_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails4_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails4_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.3.8_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.4.6_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_cucumber5.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails6_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails6_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails6_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails6_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_rails6_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.5.6_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_cucumber5.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails6_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails6_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails6_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails6_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_rails6_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.6.4_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_contrib.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_contrib_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_cucumber5.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails5_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails5_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails5_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails5_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails5_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails6_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails6_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails6_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails6_postgres_redis_activesupport.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_rails6_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_2.7.0_resque2_redis4.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_contrib.gemfile +1 -0
- data/gemfiles/ruby_3.0.0_contrib.gemfile.lock +7 -1
- data/gemfiles/ruby_3.0.0_core_old.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_cucumber3.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_cucumber4.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_cucumber5.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_rails61_mysql2.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_rails61_postgres.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_rails61_postgres_redis.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_rails61_postgres_sidekiq.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_resque2_redis3.gemfile.lock +1 -1
- data/gemfiles/ruby_3.0.0_resque2_redis4.gemfile.lock +1 -1
- data/integration/apps/rack/README.md +2 -2
- data/integration/apps/rack/script/ci +2 -1
- data/integration/apps/rails-five/README.md +2 -2
- data/integration/apps/rails-five/script/ci +2 -1
- data/integration/apps/rspec/.dockerignore +1 -0
- data/integration/apps/rspec/.envrc.sample +1 -0
- data/integration/apps/rspec/.gitignore +2 -0
- data/integration/apps/rspec/.rspec +1 -0
- data/integration/apps/rspec/Dockerfile +25 -0
- data/integration/apps/rspec/Dockerfile-ci +11 -0
- data/integration/apps/rspec/Gemfile +14 -0
- data/integration/apps/rspec/README.md +70 -0
- data/integration/apps/rspec/agent.yaml +3 -0
- data/integration/apps/rspec/app/datadog.rb +13 -0
- data/integration/apps/rspec/app/fibonacci.rb +30 -0
- data/integration/apps/rspec/bin/run +20 -0
- data/integration/apps/rspec/bin/setup +17 -0
- data/integration/apps/rspec/bin/test +21 -0
- data/integration/apps/rspec/docker-compose.ci.yml +51 -0
- data/integration/apps/rspec/docker-compose.yml +63 -0
- data/integration/apps/rspec/script/build-images +37 -0
- data/integration/apps/rspec/script/ci +53 -0
- data/integration/apps/rspec/spec/fibonacci_spec.rb +16 -0
- data/integration/apps/rspec/spec/rspec_spec.rb +58 -0
- data/integration/apps/rspec/spec/spec_helper.rb +24 -0
- data/integration/apps/ruby/README.md +2 -2
- data/integration/apps/ruby/script/ci +2 -1
- data/lib/datadog/ci.rb +16 -0
- data/lib/datadog/ci/configuration/components.rb +30 -0
- data/lib/datadog/ci/configuration/settings.rb +36 -0
- data/lib/datadog/ci/context_flush.rb +28 -0
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +30 -0
- data/lib/datadog/ci/contrib/cucumber/ext.rb +19 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +97 -0
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +26 -0
- data/lib/datadog/ci/contrib/cucumber/integration.rb +47 -0
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +25 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +30 -0
- data/lib/datadog/ci/contrib/rspec/example.rb +73 -0
- data/lib/datadog/ci/contrib/rspec/ext.rb +18 -0
- data/lib/datadog/ci/contrib/rspec/integration.rb +48 -0
- data/lib/datadog/ci/contrib/rspec/patcher.rb +25 -0
- data/lib/datadog/ci/ext/app_types.rb +9 -0
- data/lib/datadog/ci/ext/environment.rb +303 -0
- data/lib/datadog/ci/ext/settings.rb +10 -0
- data/lib/datadog/ci/ext/test.rb +28 -0
- data/lib/datadog/ci/extensions.rb +17 -0
- data/lib/datadog/ci/test.rb +63 -0
- data/lib/ddtrace.rb +0 -2
- data/lib/ddtrace/configuration.rb +1 -23
- data/lib/ddtrace/configuration/agent_settings_resolver.rb +8 -19
- data/lib/ddtrace/configuration/base.rb +6 -9
- data/lib/ddtrace/configuration/components.rb +33 -10
- data/lib/ddtrace/configuration/options.rb +2 -2
- data/lib/ddtrace/configuration/settings.rb +49 -1
- data/lib/ddtrace/context.rb +17 -14
- data/lib/ddtrace/context_flush.rb +14 -2
- data/lib/ddtrace/contrib/action_cable/event.rb +4 -4
- data/lib/ddtrace/contrib/action_pack/action_controller/patcher.rb +1 -1
- data/lib/ddtrace/contrib/action_view/event.rb +2 -2
- data/lib/ddtrace/contrib/action_view/patcher.rb +4 -4
- data/lib/ddtrace/contrib/active_model_serializers/event.rb +2 -2
- data/lib/ddtrace/contrib/active_record/event.rb +2 -2
- data/lib/ddtrace/contrib/active_support/cache/patcher.rb +7 -7
- data/lib/ddtrace/contrib/active_support/cache/redis.rb +1 -5
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +2 -2
- data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +1 -1
- data/lib/ddtrace/contrib/auto_instrument.rb +1 -1
- data/lib/ddtrace/contrib/aws/instrumentation.rb +29 -0
- data/lib/ddtrace/contrib/aws/patcher.rb +4 -0
- data/lib/ddtrace/contrib/concurrent_ruby/patcher.rb +1 -1
- data/lib/ddtrace/contrib/configurable.rb +1 -1
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/dalli/patcher.rb +1 -1
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +1 -1
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +1 -1
- data/lib/ddtrace/contrib/ethon/patcher.rb +2 -2
- data/lib/ddtrace/contrib/extensions.rb +3 -3
- data/lib/ddtrace/contrib/faraday/patcher.rb +2 -2
- data/lib/ddtrace/contrib/grape/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/grape/patcher.rb +1 -1
- data/lib/ddtrace/contrib/grpc/patcher.rb +1 -1
- data/lib/ddtrace/contrib/http/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/http/patcher.rb +1 -1
- data/lib/ddtrace/contrib/httpclient/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/httpclient/patcher.rb +1 -1
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/httprb/patcher.rb +1 -1
- data/lib/ddtrace/contrib/integration.rb +3 -3
- data/lib/ddtrace/contrib/kafka/event.rb +2 -2
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +2 -2
- data/lib/ddtrace/contrib/mongodb/patcher.rb +2 -2
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/mysql2/patcher.rb +1 -1
- data/lib/ddtrace/contrib/patchable.rb +2 -2
- data/lib/ddtrace/contrib/patcher.rb +2 -2
- data/lib/ddtrace/contrib/presto/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/presto/patcher.rb +1 -1
- data/lib/ddtrace/contrib/qless/patcher.rb +3 -5
- data/lib/ddtrace/contrib/racecar/event.rb +2 -2
- data/lib/ddtrace/contrib/rake/instrumentation.rb +1 -1
- data/lib/ddtrace/contrib/rake/patcher.rb +1 -1
- data/lib/ddtrace/contrib/registerable.rb +2 -2
- data/lib/ddtrace/contrib/resque/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rest_client/patcher.rb +1 -1
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +1 -1
- data/lib/ddtrace/contrib/sequel/database.rb +1 -1
- data/lib/ddtrace/contrib/sequel/dataset.rb +1 -1
- data/lib/ddtrace/contrib/sequel/patcher.rb +2 -2
- data/lib/ddtrace/contrib/sinatra/patcher.rb +1 -1
- data/lib/ddtrace/contrib/sucker_punch/exception_handler.rb +4 -6
- data/lib/ddtrace/diagnostics/environment_logger.rb +2 -2
- data/lib/ddtrace/error.rb +52 -61
- data/lib/ddtrace/ext/app_types.rb +0 -1
- data/lib/ddtrace/ext/test.rb +2 -18
- data/lib/ddtrace/metrics.rb +28 -3
- data/lib/ddtrace/opentelemetry/extensions.rb +1 -1
- data/lib/ddtrace/opentracer.rb +20 -39
- data/lib/ddtrace/patcher.rb +2 -2
- data/lib/ddtrace/profiling.rb +11 -9
- data/lib/ddtrace/profiling/collectors/stack.rb +5 -2
- data/lib/ddtrace/profiling/encoding/profile.rb +6 -0
- data/lib/ddtrace/profiling/ext/cpu.rb +2 -2
- data/lib/ddtrace/profiling/ext/cthread.rb +9 -11
- data/lib/ddtrace/profiling/ext/forking.rb +7 -7
- data/lib/ddtrace/profiling/flush.rb +3 -1
- data/lib/ddtrace/profiling/pprof/builder.rb +26 -28
- data/lib/ddtrace/profiling/pprof/converter.rb +4 -0
- data/lib/ddtrace/profiling/pprof/stack_sample.rb +17 -1
- data/lib/ddtrace/profiling/pprof/template.rb +4 -0
- data/lib/ddtrace/profiling/scheduler.rb +12 -1
- data/lib/ddtrace/profiling/tasks/setup.rb +13 -13
- data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +11 -2
- data/lib/ddtrace/runtime/metrics.rb +3 -5
- data/lib/ddtrace/sync_writer.rb +2 -1
- data/lib/ddtrace/tracer.rb +8 -4
- data/lib/ddtrace/transport/http/statistics.rb +2 -2
- data/lib/ddtrace/transport/http/traces.rb +3 -3
- data/lib/ddtrace/transport/io/traces.rb +1 -1
- data/lib/ddtrace/utils/forking.rb +1 -1
- data/lib/ddtrace/utils/object_set.rb +3 -5
- data/lib/ddtrace/utils/time.rb +1 -3
- data/lib/ddtrace/version.rb +2 -4
- data/lib/ddtrace/workers.rb +1 -1
- data/lib/ddtrace/workers/async.rb +3 -2
- data/lib/ddtrace/workers/loop.rb +1 -1
- data/lib/ddtrace/workers/polling.rb +11 -5
- data/lib/ddtrace/workers/queue.rb +1 -1
- metadata +48 -34
- data/.circleci/images/primary/Dockerfile-2.0.0 +0 -83
- data/gemfiles/ruby_2.0.0_contrib_old.gemfile +0 -64
- data/gemfiles/ruby_2.0.0_contrib_old.gemfile.lock +0 -290
- data/gemfiles/ruby_2.0.0_core_old.gemfile +0 -33
- data/gemfiles/ruby_2.0.0_core_old.gemfile.lock +0 -118
- data/gemfiles/ruby_2.0.0_rails30_postgres.gemfile +0 -39
- data/gemfiles/ruby_2.0.0_rails30_postgres.gemfile.lock +0 -196
- data/gemfiles/ruby_2.0.0_rails30_postgres_sidekiq.gemfile +0 -40
- data/gemfiles/ruby_2.0.0_rails30_postgres_sidekiq.gemfile.lock +0 -205
- data/gemfiles/ruby_2.0.0_rails32_mysql2.gemfile +0 -43
- data/gemfiles/ruby_2.0.0_rails32_mysql2.gemfile.lock +0 -217
- data/gemfiles/ruby_2.0.0_rails32_postgres.gemfile +0 -39
- data/gemfiles/ruby_2.0.0_rails32_postgres.gemfile.lock +0 -204
- data/gemfiles/ruby_2.0.0_rails32_postgres_redis.gemfile +0 -41
- data/gemfiles/ruby_2.0.0_rails32_postgres_redis.gemfile.lock +0 -223
- data/gemfiles/ruby_2.0.0_rails32_postgres_sidekiq.gemfile +0 -40
- data/gemfiles/ruby_2.0.0_rails32_postgres_sidekiq.gemfile.lock +0 -213
- data/integration/images/ruby/2.0/Dockerfile +0 -54
- data/lib/ddtrace/contrib/cucumber/configuration/settings.rb +0 -28
- data/lib/ddtrace/contrib/cucumber/ext.rb +0 -17
- data/lib/ddtrace/contrib/cucumber/formatter.rb +0 -98
- data/lib/ddtrace/contrib/cucumber/instrumentation.rb +0 -24
- data/lib/ddtrace/contrib/cucumber/integration.rb +0 -45
- data/lib/ddtrace/contrib/cucumber/patcher.rb +0 -23
- data/lib/ddtrace/contrib/rspec/configuration/settings.rb +0 -28
- data/lib/ddtrace/contrib/rspec/example.rb +0 -75
- data/lib/ddtrace/contrib/rspec/ext.rb +0 -16
- data/lib/ddtrace/contrib/rspec/integration.rb +0 -46
- data/lib/ddtrace/contrib/rspec/patcher.rb +0 -23
- data/lib/ddtrace/ext/ci.rb +0 -297
@@ -0,0 +1,28 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
module Ext
|
4
|
+
# Defines constants for test tags
|
5
|
+
module Test
|
6
|
+
CONTEXT_ORIGIN = 'ciapp-test'.freeze
|
7
|
+
|
8
|
+
TAG_ARGUMENTS = 'test.arguments'.freeze
|
9
|
+
TAG_FRAMEWORK = 'test.framework'.freeze
|
10
|
+
TAG_NAME = 'test.name'.freeze
|
11
|
+
TAG_SKIP_REASON = 'test.skip_reason'.freeze
|
12
|
+
TAG_STATUS = 'test.status'.freeze
|
13
|
+
TAG_SUITE = 'test.suite'.freeze
|
14
|
+
TAG_TRAITS = 'test.traits'.freeze
|
15
|
+
TAG_TYPE = 'test.type'.freeze
|
16
|
+
|
17
|
+
# TODO: is there a better place for SPAN_KIND?
|
18
|
+
TAG_SPAN_KIND = 'span.kind'.freeze
|
19
|
+
|
20
|
+
module Status
|
21
|
+
PASS = 'pass'.freeze
|
22
|
+
FAIL = 'fail'.freeze
|
23
|
+
SKIP = 'skip'.freeze
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'ddtrace/configuration/settings'
|
2
|
+
require 'ddtrace/configuration/components'
|
3
|
+
|
4
|
+
require 'datadog/ci/configuration/settings'
|
5
|
+
require 'datadog/ci/configuration/components'
|
6
|
+
|
7
|
+
module Datadog
|
8
|
+
module CI
|
9
|
+
# Extends Datadog tracing with CI features
|
10
|
+
module Extensions
|
11
|
+
def self.activate!
|
12
|
+
Datadog::Configuration::Settings.extend(CI::Configuration::Settings)
|
13
|
+
Datadog::Configuration::Components.prepend(CI::Configuration::Components)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'ddtrace/contrib/analytics'
|
2
|
+
|
3
|
+
require 'datadog/ci/ext/app_types'
|
4
|
+
require 'datadog/ci/ext/test'
|
5
|
+
|
6
|
+
module Datadog
|
7
|
+
module CI
|
8
|
+
# Common behavior for CI tests
|
9
|
+
module Test
|
10
|
+
# Creates a new span for a CI test
|
11
|
+
def self.trace(tracer, span_name, options = {})
|
12
|
+
span_options = {
|
13
|
+
span_type: Ext::AppTypes::TEST
|
14
|
+
}.merge(options[:span_options] || {})
|
15
|
+
|
16
|
+
if block_given?
|
17
|
+
tracer.trace(span_name, span_options) do |span|
|
18
|
+
set_tags!(span, options)
|
19
|
+
yield(span)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
span = tracer.trace(span_name, span_options)
|
23
|
+
set_tags!(span, options)
|
24
|
+
span
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Adds tags to a CI test span.
|
29
|
+
def self.set_tags!(span, tags = {})
|
30
|
+
tags ||= {}
|
31
|
+
|
32
|
+
# Set default tags
|
33
|
+
span.context.origin = Ext::Test::CONTEXT_ORIGIN if span.context
|
34
|
+
Datadog::Contrib::Analytics.set_measured(span)
|
35
|
+
span.set_tag(Ext::Test::TAG_SPAN_KIND, Ext::AppTypes::TEST)
|
36
|
+
Ext::Environment.tags(ENV).each { |k, v| span.set_tag(k, v) }
|
37
|
+
|
38
|
+
# Set contextual tags
|
39
|
+
span.set_tag(Ext::Test::TAG_FRAMEWORK, tags[:framework]) if tags[:framework]
|
40
|
+
span.set_tag(Ext::Test::TAG_NAME, tags[:test_name]) if tags[:test_name]
|
41
|
+
span.set_tag(Ext::Test::TAG_SUITE, tags[:test_suite]) if tags[:test_suite]
|
42
|
+
span.set_tag(Ext::Test::TAG_TYPE, tags[:test_type]) if tags[:test_type]
|
43
|
+
|
44
|
+
span
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.passed!(span)
|
48
|
+
span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::PASS)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.failed!(span, exception = nil)
|
52
|
+
span.status = 1
|
53
|
+
span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::FAIL)
|
54
|
+
span.set_error(exception) unless exception.nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.skipped!(span, exception = nil)
|
58
|
+
span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::SKIP)
|
59
|
+
span.set_error(exception) unless exception.nil?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/ddtrace.rb
CHANGED
@@ -48,7 +48,6 @@ require 'ddtrace/contrib/active_record/integration'
|
|
48
48
|
require 'ddtrace/contrib/active_support/integration'
|
49
49
|
require 'ddtrace/contrib/aws/integration'
|
50
50
|
require 'ddtrace/contrib/concurrent_ruby/integration'
|
51
|
-
require 'ddtrace/contrib/cucumber/integration'
|
52
51
|
require 'ddtrace/contrib/dalli/integration'
|
53
52
|
require 'ddtrace/contrib/delayed_job/integration'
|
54
53
|
require 'ddtrace/contrib/elasticsearch/integration'
|
@@ -75,7 +74,6 @@ require 'ddtrace/contrib/rake/integration'
|
|
75
74
|
require 'ddtrace/contrib/redis/integration'
|
76
75
|
require 'ddtrace/contrib/resque/integration'
|
77
76
|
require 'ddtrace/contrib/rest_client/integration'
|
78
|
-
require 'ddtrace/contrib/rspec/integration'
|
79
77
|
require 'ddtrace/contrib/sequel/integration'
|
80
78
|
require 'ddtrace/contrib/shoryuken/integration'
|
81
79
|
require 'ddtrace/contrib/sidekiq/integration'
|
@@ -2,11 +2,10 @@ require 'forwardable'
|
|
2
2
|
require 'ddtrace/configuration/pin_setup'
|
3
3
|
require 'ddtrace/configuration/settings'
|
4
4
|
require 'ddtrace/configuration/components'
|
5
|
-
require 'ddtrace/utils/only_once'
|
6
5
|
|
7
6
|
module Datadog
|
8
7
|
# Configuration provides a unique access point for configurations
|
9
|
-
module Configuration
|
8
|
+
module Configuration
|
10
9
|
extend Forwardable
|
11
10
|
|
12
11
|
# Used to ensure that @components initialization/reconfiguration is performed one-at-a-time, by a single thread.
|
@@ -43,8 +42,6 @@ module Datadog
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def configure(target = configuration, opts = {})
|
46
|
-
ruby_version_deprecation_warning
|
47
|
-
|
48
45
|
if target.is_a?(Settings)
|
49
46
|
yield(target) if block_given?
|
50
47
|
|
@@ -175,24 +172,5 @@ module Datadog
|
|
175
172
|
logger
|
176
173
|
end
|
177
174
|
end
|
178
|
-
|
179
|
-
# Perform version check only once
|
180
|
-
DEPRECATED_RUBY_VERSION = Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
|
181
|
-
private_constant :DEPRECATED_RUBY_VERSION
|
182
|
-
|
183
|
-
RUBY_VERSION_DEPRECATION_ONLY_ONCE = Datadog::Utils::OnlyOnce.new
|
184
|
-
private_constant :RUBY_VERSION_DEPRECATION_ONLY_ONCE
|
185
|
-
|
186
|
-
def ruby_version_deprecation_warning
|
187
|
-
return unless DEPRECATED_RUBY_VERSION
|
188
|
-
|
189
|
-
RUBY_VERSION_DEPRECATION_ONLY_ONCE.run do
|
190
|
-
Datadog.logger.warn(
|
191
|
-
"Support for Ruby versions < 2.1 in dd-trace-rb is DEPRECATED.\n" \
|
192
|
-
"Last version to support Ruby < 2.1 will be 0.49.x, which will only receive critical bugfixes.\n" \
|
193
|
-
'Support for Ruby versions < 2.1 will be REMOVED in version 0.50.0.'
|
194
|
-
)
|
195
|
-
end
|
196
|
-
end
|
197
175
|
end
|
198
176
|
end
|
@@ -27,15 +27,12 @@ module Datadog
|
|
27
27
|
:deprecated_for_removal_transport_configuration_options
|
28
28
|
) do
|
29
29
|
def initialize(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
raise(ArgumentError, 'missing keyword :deprecated_for_removal_transport_configuration_proc'),
|
37
|
-
deprecated_for_removal_transport_configuration_options: \
|
38
|
-
raise(ArgumentError, 'missing keyword :deprecated_for_removal_transport_configuration_options')
|
30
|
+
ssl:,
|
31
|
+
hostname:,
|
32
|
+
port:,
|
33
|
+
timeout_seconds:,
|
34
|
+
deprecated_for_removal_transport_configuration_proc:,
|
35
|
+
deprecated_for_removal_transport_configuration_options:
|
39
36
|
)
|
40
37
|
super(ssl, hostname, port, timeout_seconds, deprecated_for_removal_transport_configuration_proc, \
|
41
38
|
deprecated_for_removal_transport_configuration_options)
|
@@ -179,11 +176,7 @@ module Datadog
|
|
179
176
|
@unparsed_url_from_env ||= ENV[Datadog::Ext::Transport::HTTP::ENV_DEFAULT_URL]
|
180
177
|
end
|
181
178
|
|
182
|
-
def pick_from(
|
183
|
-
# Hacky required kw args, we can get rid of this when we drop Ruby 2.0
|
184
|
-
configurations_in_priority_order: raise(ArgumentError, 'missing keyword :configurations'),
|
185
|
-
or_use_default: raise(ArgumentError, 'missing keyword :or_use_default')
|
186
|
-
)
|
179
|
+
def pick_from(configurations_in_priority_order:, or_use_default:)
|
187
180
|
detected_configurations_in_priority_order = configurations_in_priority_order.select(&:value?)
|
188
181
|
|
189
182
|
if detected_configurations_in_priority_order.any?
|
@@ -213,11 +206,7 @@ module Datadog
|
|
213
206
|
end
|
214
207
|
|
215
208
|
DetectedConfiguration = Struct.new(:friendly_name, :value) do
|
216
|
-
def initialize(
|
217
|
-
# Hacky required kw args, we can get rid of this when we drop Ruby 2.0
|
218
|
-
friendly_name: raise(ArgumentError, 'missing keyword :friendly_name'),
|
219
|
-
value: raise(ArgumentError, 'missing keyword :value')
|
220
|
-
)
|
209
|
+
def initialize(friendly_name:, value:)
|
221
210
|
super(friendly_name, value)
|
222
211
|
freeze
|
223
212
|
end
|
@@ -6,12 +6,12 @@ module Datadog
|
|
6
6
|
# Basic configuration behavior
|
7
7
|
module Base
|
8
8
|
def self.included(base)
|
9
|
-
base.
|
10
|
-
base.
|
11
|
-
base.
|
9
|
+
base.extend(Datadog::Environment::Helpers)
|
10
|
+
base.include(Datadog::Environment::Helpers)
|
11
|
+
base.include(Options)
|
12
12
|
|
13
|
-
base.
|
14
|
-
base.
|
13
|
+
base.extend(ClassMethods)
|
14
|
+
base.include(InstanceMethods)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Class methods for configuration
|
@@ -53,10 +53,7 @@ module Datadog
|
|
53
53
|
ordering = self.class.options.dependency_order
|
54
54
|
sorted_opts = opts.sort_by do |name, _value|
|
55
55
|
ordering.index(name) || (ordering.length + 1)
|
56
|
-
end
|
57
|
-
|
58
|
-
# Ruby 2.0 doesn't support Array#to_h
|
59
|
-
sorted_opts = Hash[*sorted_opts.flatten]
|
56
|
+
end.to_h
|
60
57
|
|
61
58
|
# Apply options in sort order
|
62
59
|
sorted_opts.each do |name, value|
|
@@ -4,11 +4,13 @@ require 'ddtrace/logger'
|
|
4
4
|
require 'ddtrace/profiling'
|
5
5
|
require 'ddtrace/runtime/metrics'
|
6
6
|
require 'ddtrace/tracer'
|
7
|
+
require 'ddtrace/sync_writer'
|
7
8
|
require 'ddtrace/workers/runtime_metrics'
|
8
9
|
|
9
10
|
module Datadog
|
10
11
|
module Configuration
|
11
12
|
# Global components for the trace library.
|
13
|
+
# rubocop:disable Metrics/ClassLength
|
12
14
|
# rubocop:disable Layout/LineLength
|
13
15
|
class Components
|
14
16
|
class << self
|
@@ -63,7 +65,7 @@ module Datadog
|
|
63
65
|
# tracer initialization for now. Just reconfigure using the
|
64
66
|
# existing mutable #configure function. Remove when these components
|
65
67
|
# are extracted.
|
66
|
-
tracer.configure(agent_settings: agent_settings, **build_tracer_options(settings))
|
68
|
+
tracer.configure(agent_settings: agent_settings, **build_tracer_options(settings, agent_settings))
|
67
69
|
|
68
70
|
tracer
|
69
71
|
end
|
@@ -93,16 +95,37 @@ module Datadog
|
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
96
|
-
def build_tracer_options(settings)
|
97
|
-
|
98
|
+
def build_tracer_options(settings, agent_settings)
|
99
|
+
tracer_options = {}.tap do |opts|
|
100
|
+
tset = settings.tracer
|
101
|
+
opts[:min_spans_before_partial_flush] = tset.partial_flush.min_spans_threshold unless tset.partial_flush.min_spans_threshold.nil?
|
102
|
+
opts[:partial_flush] = tset.partial_flush.enabled unless tset.partial_flush.enabled.nil?
|
103
|
+
opts[:priority_sampling] = tset.priority_sampling unless tset.priority_sampling.nil?
|
104
|
+
opts[:sampler] = tset.sampler unless tset.sampler.nil?
|
105
|
+
opts[:writer] = tset.writer unless tset.writer.nil?
|
106
|
+
opts[:writer_options] = tset.writer_options if tset.writer.nil?
|
107
|
+
end
|
108
|
+
|
109
|
+
# Apply test mode settings if test mode is activated
|
110
|
+
if settings.test_mode.enabled
|
111
|
+
build_tracer_test_mode_options(tracer_options, settings, agent_settings)
|
112
|
+
else
|
113
|
+
tracer_options
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_tracer_test_mode_options(tracer_options, settings, agent_settings)
|
118
|
+
tracer_options.tap do |opts|
|
119
|
+
# Do not sample any spans for tests; all must be preserved.
|
120
|
+
opts[:sampler] = Datadog::AllSampler.new
|
121
|
+
|
122
|
+
# If context flush behavior is provided, use it instead.
|
123
|
+
opts[:context_flush] = settings.test_mode.context_flush if settings.test_mode.context_flush
|
98
124
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
opts[:
|
103
|
-
opts[:sampler] = settings.sampler unless settings.sampler.nil?
|
104
|
-
opts[:writer] = settings.writer unless settings.writer.nil?
|
105
|
-
opts[:writer_options] = settings.writer_options if settings.writer.nil?
|
125
|
+
# Flush traces synchronously, to guarantee they are written.
|
126
|
+
writer_options = settings.test_mode.writer_options || {}
|
127
|
+
writer_options[:agent_settings] = agent_settings if agent_settings
|
128
|
+
opts[:writer] = Datadog::SyncWriter.new(writer_options)
|
106
129
|
end
|
107
130
|
end
|
108
131
|
|
@@ -7,8 +7,8 @@ module Datadog
|
|
7
7
|
# Behavior for a configuration object that has options
|
8
8
|
module Options
|
9
9
|
def self.included(base)
|
10
|
-
base.
|
11
|
-
base.
|
10
|
+
base.extend(ClassMethods)
|
11
|
+
base.include(InstanceMethods)
|
12
12
|
end
|
13
13
|
|
14
14
|
# Class behavior for a configuration object with options
|
@@ -6,6 +6,7 @@ require 'ddtrace/ext/distributed'
|
|
6
6
|
require 'ddtrace/ext/profiling'
|
7
7
|
require 'ddtrace/ext/runtime'
|
8
8
|
require 'ddtrace/ext/sampling'
|
9
|
+
require 'ddtrace/ext/test'
|
9
10
|
|
10
11
|
module Datadog
|
11
12
|
module Configuration
|
@@ -14,6 +15,32 @@ module Datadog
|
|
14
15
|
class Settings
|
15
16
|
include Base
|
16
17
|
|
18
|
+
def initialize(*_)
|
19
|
+
super
|
20
|
+
|
21
|
+
# WORKAROUND: The values for services, version, and env can get set either directly OR as a side effect of
|
22
|
+
# accessing tags (reading or writing). This is of course really confusing and error-prone, e.g. in an app
|
23
|
+
# WITHOUT this workaround where you define `DD_TAGS=env:envenvtag,service:envservicetag,version:envversiontag`
|
24
|
+
# and do:
|
25
|
+
#
|
26
|
+
# puts Datadog.configuration.instance_exec { "#{service} #{env} #{version}" }
|
27
|
+
# Datadog.configuration.tags
|
28
|
+
# puts Datadog.configuration.instance_exec { "#{service} #{env} #{version}" }
|
29
|
+
#
|
30
|
+
# the output will be:
|
31
|
+
#
|
32
|
+
# [empty]
|
33
|
+
# envservicetag envenvtag envversiontag
|
34
|
+
#
|
35
|
+
# That is -- the proper values for service/env/version are only set AFTER something accidentally or not triggers
|
36
|
+
# the resolution of the tags.
|
37
|
+
# This is really confusing, error prone, etc, so calling tags here is a really hacky but effective way to
|
38
|
+
# avoid this. I could not think of a better way of fixing this issue without massive refactoring of tags parsing
|
39
|
+
# (so that the individual service/env/version get correctly set even from their tags values, not as a side
|
40
|
+
# effect). Sorry :(
|
41
|
+
tags
|
42
|
+
end
|
43
|
+
|
17
44
|
settings :analytics do
|
18
45
|
option :enabled do |o|
|
19
46
|
o.default { env_to_bool(Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED, nil) }
|
@@ -90,6 +117,7 @@ module Datadog
|
|
90
117
|
end
|
91
118
|
|
92
119
|
option :env do |o|
|
120
|
+
# NOTE: env also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
|
93
121
|
o.default { ENV.fetch(Ext::Environment::ENV_ENVIRONMENT, nil) }
|
94
122
|
o.lazy
|
95
123
|
end
|
@@ -197,6 +225,7 @@ module Datadog
|
|
197
225
|
end
|
198
226
|
|
199
227
|
option :service do |o|
|
228
|
+
# NOTE: service also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
|
200
229
|
o.default { ENV.fetch(Ext::Environment::ENV_SERVICE, nil) }
|
201
230
|
o.lazy
|
202
231
|
end
|
@@ -225,9 +254,10 @@ module Datadog
|
|
225
254
|
|
226
255
|
o.setter do |new_value, old_value|
|
227
256
|
# Coerce keys to strings
|
228
|
-
string_tags =
|
257
|
+
string_tags = new_value.collect { |k, v| [k.to_s, v] }.to_h
|
229
258
|
|
230
259
|
# Cross-populate tag values with other settings
|
260
|
+
|
231
261
|
self.env = string_tags[Ext::Environment::TAG_ENV] if env.nil? && string_tags.key?(Ext::Environment::TAG_ENV)
|
232
262
|
|
233
263
|
if version.nil? && string_tags.key?(Ext::Environment::TAG_VERSION)
|
@@ -245,6 +275,23 @@ module Datadog
|
|
245
275
|
o.lazy
|
246
276
|
end
|
247
277
|
|
278
|
+
settings :test_mode do
|
279
|
+
option :enabled do |o|
|
280
|
+
o.default { env_to_bool(Ext::Test::ENV_MODE_ENABLED, false) }
|
281
|
+
o.lazy
|
282
|
+
end
|
283
|
+
|
284
|
+
option :context_flush do |o|
|
285
|
+
o.default { nil }
|
286
|
+
o.lazy
|
287
|
+
end
|
288
|
+
|
289
|
+
option :writer_options do |o|
|
290
|
+
o.default { {} }
|
291
|
+
o.lazy
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
248
295
|
option :time_now_provider do |o|
|
249
296
|
o.default { ::Time.now }
|
250
297
|
|
@@ -332,6 +379,7 @@ module Datadog
|
|
332
379
|
end
|
333
380
|
|
334
381
|
option :version do |o|
|
382
|
+
# NOTE: version also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
|
335
383
|
o.default { ENV.fetch(Ext::Environment::ENV_VERSION, nil) }
|
336
384
|
o.lazy
|
337
385
|
end
|