ddtrace 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
data/lib/ddtrace/ext/test.rb
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
module Datadog
|
|
2
2
|
module Ext
|
|
3
|
-
# Defines constants for test
|
|
3
|
+
# Defines constants for test behavior
|
|
4
4
|
module Test
|
|
5
|
-
|
|
6
|
-
TAG_FRAMEWORK = 'test.framework'.freeze
|
|
7
|
-
TAG_NAME = 'test.name'.freeze
|
|
8
|
-
TAG_SKIP_REASON = 'test.skip_reason'.freeze
|
|
9
|
-
TAG_STATUS = 'test.status'.freeze
|
|
10
|
-
TAG_SUITE = 'test.suite'.freeze
|
|
11
|
-
TAG_TRAITS = 'test.traits'.freeze
|
|
12
|
-
TAG_TYPE = 'test.type'.freeze
|
|
13
|
-
|
|
14
|
-
# TODO: is there a better place for SPAN_KIND?
|
|
15
|
-
TAG_SPAN_KIND = 'span.kind'.freeze
|
|
16
|
-
|
|
17
|
-
module Status
|
|
18
|
-
PASS = 'pass'.freeze
|
|
19
|
-
FAIL = 'fail'.freeze
|
|
20
|
-
SKIP = 'skip'.freeze
|
|
21
|
-
end
|
|
5
|
+
ENV_MODE_ENABLED = 'DD_TRACE_TEST_MODE_ENABLED'.freeze
|
|
22
6
|
end
|
|
23
7
|
end
|
|
24
8
|
end
|
data/lib/ddtrace/metrics.rb
CHANGED
|
@@ -3,8 +3,9 @@ require 'ddtrace/ext/metrics'
|
|
|
3
3
|
require 'set'
|
|
4
4
|
require 'logger'
|
|
5
5
|
require 'ddtrace/environment'
|
|
6
|
-
require 'ddtrace/utils/time'
|
|
7
6
|
require 'ddtrace/runtime/identity'
|
|
7
|
+
require 'ddtrace/utils/only_once'
|
|
8
|
+
require 'ddtrace/utils/time'
|
|
8
9
|
|
|
9
10
|
module Datadog
|
|
10
11
|
# Acts as client for sending metrics (via Statsd)
|
|
@@ -18,8 +19,14 @@ module Datadog
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def supported?
|
|
21
|
-
version =
|
|
22
|
-
|
|
22
|
+
version = (
|
|
23
|
+
defined?(Datadog::Statsd::VERSION) &&
|
|
24
|
+
Datadog::Statsd::VERSION &&
|
|
25
|
+
Gem::Version.new(Datadog::Statsd::VERSION)
|
|
26
|
+
) || (
|
|
27
|
+
Gem.loaded_specs['dogstatsd-ruby'] &&
|
|
28
|
+
Gem.loaded_specs['dogstatsd-ruby'].version
|
|
29
|
+
)
|
|
23
30
|
|
|
24
31
|
!version.nil? && (version >= Gem::Version.new('3.3.0'))
|
|
25
32
|
end
|
|
@@ -43,6 +50,8 @@ module Datadog
|
|
|
43
50
|
def default_statsd_client
|
|
44
51
|
require 'datadog/statsd'
|
|
45
52
|
|
|
53
|
+
incompatible_statsd_warning
|
|
54
|
+
|
|
46
55
|
# Create a StatsD client that points to the agent.
|
|
47
56
|
Datadog::Statsd.new(default_hostname, default_port)
|
|
48
57
|
end
|
|
@@ -226,5 +235,21 @@ module Datadog
|
|
|
226
235
|
include Options
|
|
227
236
|
extend Options
|
|
228
237
|
extend Helpers
|
|
238
|
+
|
|
239
|
+
private
|
|
240
|
+
|
|
241
|
+
INCOMPATIBLE_STATSD_ONLY_ONCE = Datadog::Utils::OnlyOnce.new
|
|
242
|
+
private_constant :INCOMPATIBLE_STATSD_ONLY_ONCE
|
|
243
|
+
|
|
244
|
+
def incompatible_statsd_warning
|
|
245
|
+
return if Gem.loaded_specs['dogstatsd-ruby'].version < Gem::Version.new('5.0')
|
|
246
|
+
|
|
247
|
+
INCOMPATIBLE_STATSD_ONLY_ONCE.run do
|
|
248
|
+
Datadog.logger.warn(
|
|
249
|
+
'This version of `ddtrace` is incompatible with `dogstastd-ruby` version >= 5.0 and can ' \
|
|
250
|
+
'cause unbounded memory usage. Please use `dogstastd-ruby` version < 5.0 instead.'
|
|
251
|
+
)
|
|
252
|
+
end
|
|
253
|
+
end
|
|
229
254
|
end
|
|
230
255
|
end
|
data/lib/ddtrace/opentracer.rb
CHANGED
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
require 'opentracing'
|
|
2
|
+
require 'opentracing/carrier'
|
|
3
|
+
require 'ddtrace'
|
|
4
|
+
require 'ddtrace/opentracer/carrier'
|
|
5
|
+
require 'ddtrace/opentracer/tracer'
|
|
6
|
+
require 'ddtrace/opentracer/span'
|
|
7
|
+
require 'ddtrace/opentracer/span_context'
|
|
8
|
+
require 'ddtrace/opentracer/span_context_factory'
|
|
9
|
+
require 'ddtrace/opentracer/scope'
|
|
10
|
+
require 'ddtrace/opentracer/scope_manager'
|
|
11
|
+
require 'ddtrace/opentracer/thread_local_scope'
|
|
12
|
+
require 'ddtrace/opentracer/thread_local_scope_manager'
|
|
13
|
+
require 'ddtrace/opentracer/distributed_headers'
|
|
14
|
+
require 'ddtrace/opentracer/propagator'
|
|
15
|
+
require 'ddtrace/opentracer/text_map_propagator'
|
|
16
|
+
require 'ddtrace/opentracer/binary_propagator'
|
|
17
|
+
require 'ddtrace/opentracer/rack_propagator'
|
|
18
|
+
require 'ddtrace/opentracer/global_tracer'
|
|
5
19
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def load_opentracer
|
|
11
|
-
require 'opentracing'
|
|
12
|
-
require 'opentracing/carrier'
|
|
13
|
-
require 'ddtrace'
|
|
14
|
-
require 'ddtrace/opentracer/carrier'
|
|
15
|
-
require 'ddtrace/opentracer/tracer'
|
|
16
|
-
require 'ddtrace/opentracer/span'
|
|
17
|
-
require 'ddtrace/opentracer/span_context'
|
|
18
|
-
require 'ddtrace/opentracer/span_context_factory'
|
|
19
|
-
require 'ddtrace/opentracer/scope'
|
|
20
|
-
require 'ddtrace/opentracer/scope_manager'
|
|
21
|
-
require 'ddtrace/opentracer/thread_local_scope'
|
|
22
|
-
require 'ddtrace/opentracer/thread_local_scope_manager'
|
|
23
|
-
require 'ddtrace/opentracer/distributed_headers'
|
|
24
|
-
require 'ddtrace/opentracer/propagator'
|
|
25
|
-
require 'ddtrace/opentracer/text_map_propagator'
|
|
26
|
-
require 'ddtrace/opentracer/binary_propagator'
|
|
27
|
-
require 'ddtrace/opentracer/rack_propagator'
|
|
28
|
-
require 'ddtrace/opentracer/global_tracer'
|
|
29
|
-
|
|
30
|
-
# Modify the OpenTracing module functions
|
|
31
|
-
OpenTracing.module_eval do
|
|
32
|
-
class << self
|
|
33
|
-
prepend Datadog::OpenTracer::GlobalTracer
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
load_opentracer if supported?
|
|
39
|
-
end
|
|
40
|
-
end
|
|
20
|
+
# Modify the OpenTracing module functions
|
|
21
|
+
::OpenTracing.singleton_class.prepend(Datadog::OpenTracer::GlobalTracer)
|
data/lib/ddtrace/patcher.rb
CHANGED
data/lib/ddtrace/profiling.rb
CHANGED
|
@@ -14,8 +14,7 @@ module Datadog
|
|
|
14
14
|
# NOTE: Only the first matching reason is returned, so try to keep a nice order on reasons -- e.g. tell users
|
|
15
15
|
# first that they can't use this on JRuby before telling them that they are missing protobuf
|
|
16
16
|
|
|
17
|
-
ruby_engine_unsupported? ||
|
|
18
|
-
protobuf_gem_unavailable? || protobuf_version_unsupported? || protobuf_failed_to_load?
|
|
17
|
+
ruby_engine_unsupported? || protobuf_gem_unavailable? || protobuf_version_unsupported? || protobuf_failed_to_load?
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
def self.ruby_engine_unsupported?
|
|
@@ -23,20 +22,21 @@ module Datadog
|
|
|
23
22
|
end
|
|
24
23
|
private_class_method :ruby_engine_unsupported?
|
|
25
24
|
|
|
26
|
-
def self.ruby_version_unsupported?
|
|
27
|
-
'Ruby >= 2.1 is required' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
|
|
28
|
-
end
|
|
29
|
-
private_class_method :ruby_version_unsupported?
|
|
30
|
-
|
|
31
25
|
def self.protobuf_gem_unavailable?
|
|
32
|
-
|
|
26
|
+
# NOTE: On environments where protobuf is already loaded, we skip the check. This allows us to support environments
|
|
27
|
+
# where no Gem.loaded_version is NOT available but customers are able to load protobuf; see for instance
|
|
28
|
+
# https://github.com/teamcapybara/capybara/commit/caf3bcd7664f4f2691d0ca9ef3be9a2a954fecfb
|
|
29
|
+
if !defined?(::Google::Protobuf) && Gem.loaded_specs['google-protobuf'].nil?
|
|
33
30
|
"Missing google-protobuf dependency; please add `gem 'google-protobuf', '~> 3.0'` to your Gemfile or gems.rb file"
|
|
34
31
|
end
|
|
35
32
|
end
|
|
36
33
|
private_class_method :protobuf_gem_unavailable?
|
|
37
34
|
|
|
38
35
|
def self.protobuf_version_unsupported?
|
|
39
|
-
|
|
36
|
+
# See above for why we skip the check when protobuf is already loaded; note that when protobuf was already loaded
|
|
37
|
+
# we skip the version check to avoid the call to Gem.loaded_specs. Unfortunately, protobuf does not seem to
|
|
38
|
+
# expose the gem version constant elsewhere, so in that setup we are not able to check the version.
|
|
39
|
+
if !defined?(::Google::Protobuf) && Gem.loaded_specs['google-protobuf'].version < GOOGLE_PROTOBUF_MINIMUM_VERSION
|
|
40
40
|
'Your google-protobuf is too old; ensure that you have google-protobuf >= 3.0 by ' \
|
|
41
41
|
"adding `gem 'google-protobuf', '~> 3.0'` to your Gemfile or gems.rb file"
|
|
42
42
|
end
|
|
@@ -66,6 +66,8 @@ module Datadog
|
|
|
66
66
|
require 'google/protobuf'
|
|
67
67
|
@protobuf_loaded = true
|
|
68
68
|
rescue LoadError => e
|
|
69
|
+
# NOTE: We use Kernel#warn here because this code gets run BEFORE Datadog.logger is actually set up.
|
|
70
|
+
# In the future it'd be nice to shuffle the logger startup to happen first to avoid this special case.
|
|
69
71
|
Kernel.warn(
|
|
70
72
|
"[DDTRACE] Error while loading google-protobuf gem. Cause: '#{e.message}' Location: '#{e.backtrace.first}'. " \
|
|
71
73
|
'This can happen when google-protobuf is missing its native components. ' \
|
|
@@ -122,7 +122,7 @@ module Datadog
|
|
|
122
122
|
# Convert backtrace locations into structs
|
|
123
123
|
locations = convert_backtrace_locations(locations)
|
|
124
124
|
|
|
125
|
-
thread_id = thread.respond_to?(:
|
|
125
|
+
thread_id = thread.respond_to?(:pthread_thread_id) ? thread.pthread_thread_id : thread.object_id
|
|
126
126
|
trace_id, span_id = get_trace_identifiers(thread)
|
|
127
127
|
cpu_time = get_cpu_time_interval!(thread)
|
|
128
128
|
|
|
@@ -224,6 +224,7 @@ module Datadog
|
|
|
224
224
|
# In this case, the fix is to make sure ddtrace gets loaded before any other parts of the application.
|
|
225
225
|
#
|
|
226
226
|
# b) The thread was started using the Ruby native APIs (e.g. from a C extension such as ffi).
|
|
227
|
+
# Known cases right now that trigger this are the ethon/typhoeus gems.
|
|
227
228
|
# We currently have no solution for this case; these threads will always be missing our CPU instrumentation.
|
|
228
229
|
#
|
|
229
230
|
# c) The thread was started with `Thread.start`/`Thread.fork` and hasn't yet enabled the instrumentation.
|
|
@@ -232,7 +233,9 @@ module Datadog
|
|
|
232
233
|
# it to run and our instrumentation to be applied.
|
|
233
234
|
#
|
|
234
235
|
if thread_api.current.respond_to?(:cpu_time) && thread_api.current.cpu_time
|
|
235
|
-
Datadog.logger.debug(
|
|
236
|
+
Datadog.logger.debug(
|
|
237
|
+
"Thread ('#{thread}') is missing profiling instrumentation; other threads should be unaffected"
|
|
238
|
+
)
|
|
236
239
|
end
|
|
237
240
|
end
|
|
238
241
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'set'
|
|
2
|
+
require 'time'
|
|
2
3
|
|
|
3
4
|
require 'ddtrace/profiling/flush'
|
|
4
5
|
require 'ddtrace/profiling/pprof/template'
|
|
@@ -21,6 +22,11 @@ module Datadog
|
|
|
21
22
|
# Add all events to the pprof
|
|
22
23
|
flush.event_groups.each { |event_group| template.add_events!(event_group.event_class, event_group.events) }
|
|
23
24
|
|
|
25
|
+
Datadog.logger.debug do
|
|
26
|
+
"Encoding profile covering #{flush.start.iso8601} to #{flush.finish.iso8601}, " \
|
|
27
|
+
"events: #{flush.event_count} (#{template.debug_statistics})"
|
|
28
|
+
end
|
|
29
|
+
|
|
24
30
|
# Build the profile and encode it
|
|
25
31
|
template.to_pprof
|
|
26
32
|
end
|
|
@@ -24,8 +24,8 @@ module Datadog
|
|
|
24
24
|
# Applying CThread to Thread will ensure any new threads
|
|
25
25
|
# will provide a thread/clock ID for CPU timing.
|
|
26
26
|
require 'ddtrace/profiling/ext/cthread'
|
|
27
|
-
::Thread.
|
|
28
|
-
::Thread.singleton_class.
|
|
27
|
+
::Thread.prepend(Profiling::Ext::CThread)
|
|
28
|
+
::Thread.singleton_class.prepend(Datadog::Profiling::Ext::WrapThreadStartFork)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def self.unsupported_reason
|
|
@@ -16,9 +16,9 @@ module Datadog
|
|
|
16
16
|
attach_function :pthread_getcpuclockid, [:ulong, CClockId], :int
|
|
17
17
|
|
|
18
18
|
# NOTE: Only returns thread ID for thread that evaluates this call.
|
|
19
|
-
# a.k.a. evaluating `
|
|
19
|
+
# a.k.a. evaluating `get_pthread_thread_id(thread_a)` from within
|
|
20
20
|
# `thread_b` will return `thread_b`'s thread ID, not `thread_a`'s.
|
|
21
|
-
def self.
|
|
21
|
+
def self.get_pthread_thread_id(thread)
|
|
22
22
|
return unless ::Thread.current == thread
|
|
23
23
|
|
|
24
24
|
pthread_self
|
|
@@ -65,16 +65,16 @@ module Datadog
|
|
|
65
65
|
# it looks like there's some lazily-created structure that is missing and did not get created).
|
|
66
66
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3') &&
|
|
67
67
|
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
|
|
68
|
-
attr_reader :
|
|
68
|
+
attr_reader :pthread_thread_id
|
|
69
69
|
else
|
|
70
|
-
def
|
|
71
|
-
defined?(@
|
|
70
|
+
def pthread_thread_id
|
|
71
|
+
defined?(@pthread_thread_id) && @pthread_thread_id
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def initialize(*args)
|
|
76
76
|
@pid = ::Process.pid
|
|
77
|
-
@
|
|
77
|
+
@pthread_thread_id = nil
|
|
78
78
|
@clock_id = nil
|
|
79
79
|
|
|
80
80
|
# Wrap the work block with our own
|
|
@@ -91,9 +91,7 @@ module Datadog
|
|
|
91
91
|
ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
|
|
92
92
|
|
|
93
93
|
def cpu_time(unit = :float_second)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
::Process.clock_gettime(clock_id, unit)
|
|
94
|
+
::Process.clock_gettime(clock_id, unit) if clock_id
|
|
97
95
|
end
|
|
98
96
|
|
|
99
97
|
def cpu_time_instrumentation_installed?
|
|
@@ -122,8 +120,8 @@ module Datadog
|
|
|
122
120
|
return unless ::Thread.current == self
|
|
123
121
|
|
|
124
122
|
@pid = ::Process.pid
|
|
125
|
-
@
|
|
126
|
-
@clock_id = NativePthread.get_clock_id(self, @
|
|
123
|
+
@pthread_thread_id = NativePthread.get_pthread_thread_id(self)
|
|
124
|
+
@clock_id = NativePthread.get_clock_id(self, @pthread_thread_id)
|
|
127
125
|
end
|
|
128
126
|
end
|
|
129
127
|
|
|
@@ -24,13 +24,13 @@ module Datadog
|
|
|
24
24
|
# It could also have collisions with other libraries that patch.
|
|
25
25
|
# Opt to modify the inheritance of each relevant target instead.
|
|
26
26
|
modules.each do |mod|
|
|
27
|
-
if mod.class <= Module
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
clazz = if mod.class <= Module
|
|
28
|
+
mod.singleton_class
|
|
29
|
+
else
|
|
30
|
+
mod.class
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
clazz.prepend(Kernel)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -18,7 +18,8 @@ module Datadog
|
|
|
18
18
|
:runtime_engine,
|
|
19
19
|
:runtime_platform,
|
|
20
20
|
:runtime_version,
|
|
21
|
-
:profiler_version
|
|
21
|
+
:profiler_version,
|
|
22
|
+
:tags
|
|
22
23
|
) do
|
|
23
24
|
def initialize(*args)
|
|
24
25
|
super
|
|
@@ -32,6 +33,7 @@ module Datadog
|
|
|
32
33
|
self.runtime_platform = runtime_platform || Datadog::Runtime::Identity.lang_platform
|
|
33
34
|
self.runtime_version = runtime_version || Datadog::Runtime::Identity.lang_version
|
|
34
35
|
self.profiler_version = profiler_version || Datadog::Runtime::Identity.tracer_version
|
|
36
|
+
self.tags = tags || Datadog.configuration.tags
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'ddtrace/profiling/flush'
|
|
2
4
|
require 'ddtrace/profiling/pprof/message_set'
|
|
3
5
|
require 'ddtrace/profiling/pprof/string_table'
|
|
@@ -7,9 +9,9 @@ module Datadog
|
|
|
7
9
|
module Pprof
|
|
8
10
|
# Accumulates profile data and produces a Perftools::Profiles::Profile
|
|
9
11
|
class Builder
|
|
10
|
-
DEFAULT_ENCODING = 'UTF-8'
|
|
11
|
-
DESC_FRAME_OMITTED = 'frame omitted'
|
|
12
|
-
DESC_FRAMES_OMITTED = 'frames omitted'
|
|
12
|
+
DEFAULT_ENCODING = 'UTF-8'
|
|
13
|
+
DESC_FRAME_OMITTED = 'frame omitted'
|
|
14
|
+
DESC_FRAMES_OMITTED = 'frames omitted'
|
|
13
15
|
|
|
14
16
|
attr_reader \
|
|
15
17
|
:functions,
|
|
@@ -21,11 +23,23 @@ module Datadog
|
|
|
21
23
|
|
|
22
24
|
def initialize
|
|
23
25
|
@functions = MessageSet.new(1)
|
|
24
|
-
@locations =
|
|
26
|
+
@locations = initialize_locations_hash
|
|
25
27
|
@mappings = MessageSet.new(1)
|
|
26
28
|
@sample_types = MessageSet.new
|
|
27
29
|
@samples = []
|
|
28
30
|
@string_table = StringTable.new
|
|
31
|
+
|
|
32
|
+
# Cache this proc, since it's pretty expensive to keep recreating it
|
|
33
|
+
@build_function = method(:build_function).to_proc
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# The locations hash maps unique BacktraceLocation instances to their corresponding pprof Location objects;
|
|
37
|
+
# there's a 1:1 correspondence, since BacktraceLocations were already deduped
|
|
38
|
+
def initialize_locations_hash
|
|
39
|
+
sequence = Utils::Sequence.new(1)
|
|
40
|
+
Hash.new do |locations_hash, backtrace_location|
|
|
41
|
+
locations_hash[backtrace_location] = build_location(sequence.next, backtrace_location)
|
|
42
|
+
end
|
|
29
43
|
end
|
|
30
44
|
|
|
31
45
|
def encode_profile(profile)
|
|
@@ -37,7 +51,7 @@ module Datadog
|
|
|
37
51
|
sample_type: @sample_types.messages,
|
|
38
52
|
sample: @samples,
|
|
39
53
|
mapping: @mappings.messages,
|
|
40
|
-
location: @locations.
|
|
54
|
+
location: @locations.values,
|
|
41
55
|
function: @functions.messages,
|
|
42
56
|
string_table: @string_table.strings
|
|
43
57
|
)
|
|
@@ -51,45 +65,29 @@ module Datadog
|
|
|
51
65
|
end
|
|
52
66
|
|
|
53
67
|
def build_locations(backtrace_locations, length)
|
|
54
|
-
locations = backtrace_locations.collect
|
|
55
|
-
@locations.fetch(
|
|
56
|
-
# Filename
|
|
57
|
-
backtrace_location.path,
|
|
58
|
-
# Line number
|
|
59
|
-
backtrace_location.lineno,
|
|
60
|
-
# Function name
|
|
61
|
-
backtrace_location.base_label,
|
|
62
|
-
# Build function
|
|
63
|
-
&method(:build_location)
|
|
64
|
-
)
|
|
65
|
-
end
|
|
68
|
+
locations = backtrace_locations.collect { |backtrace_location| @locations[backtrace_location] }
|
|
66
69
|
|
|
67
70
|
omitted = length - backtrace_locations.length
|
|
68
71
|
|
|
69
72
|
# Add placeholder stack frame if frames were truncated
|
|
70
73
|
if omitted > 0
|
|
71
74
|
desc = omitted == 1 ? DESC_FRAME_OMITTED : DESC_FRAMES_OMITTED
|
|
72
|
-
locations << @locations.
|
|
73
|
-
''.freeze,
|
|
74
|
-
0,
|
|
75
|
-
"#{omitted} #{desc}",
|
|
76
|
-
&method(:build_location)
|
|
77
|
-
)
|
|
75
|
+
locations << @locations[Profiling::BacktraceLocation.new('', 0, "#{omitted} #{desc}")]
|
|
78
76
|
end
|
|
79
77
|
|
|
80
78
|
locations
|
|
81
79
|
end
|
|
82
80
|
|
|
83
|
-
def build_location(id,
|
|
81
|
+
def build_location(id, backtrace_location)
|
|
84
82
|
Perftools::Profiles::Location.new(
|
|
85
83
|
id: id,
|
|
86
84
|
line: [build_line(
|
|
87
85
|
@functions.fetch(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
backtrace_location.path,
|
|
87
|
+
backtrace_location.base_label,
|
|
88
|
+
&@build_function
|
|
91
89
|
).id,
|
|
92
|
-
|
|
90
|
+
backtrace_location.lineno
|
|
93
91
|
)]
|
|
94
92
|
)
|
|
95
93
|
end
|