ddtrace 0.44.0 → 0.48.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 +183 -15
- data/.circleci/images/primary/Dockerfile-2.0.0 +11 -1
- data/.circleci/images/primary/Dockerfile-2.1.10 +11 -1
- data/.circleci/images/primary/Dockerfile-2.2.10 +11 -1
- data/.circleci/images/primary/Dockerfile-2.3.8 +10 -0
- data/.circleci/images/primary/Dockerfile-2.4.6 +10 -0
- data/.circleci/images/primary/Dockerfile-2.5.6 +10 -0
- data/.circleci/images/primary/Dockerfile-2.6.4 +10 -0
- data/.circleci/images/primary/Dockerfile-2.7.0 +10 -0
- data/.circleci/images/primary/Dockerfile-jruby-9.2-latest +88 -0
- data/.circleci/images/primary/{Dockerfile-jruby-9.2 → Dockerfile-jruby-9.2.0.0} +1 -5
- data/.circleci/images/primary/Dockerfile-truffleruby-21.0.0 +73 -0
- data/.github/workflows/create-next-milestone.yml +2 -2
- data/.gitlab-ci.yml +18 -18
- data/.rubocop.yml +269 -7
- data/.rubocop_todo.yml +438 -0
- data/.simplecov +6 -0
- data/Appraisals +87 -9
- data/CHANGELOG.md +238 -1
- data/Gemfile +63 -3
- data/LICENSE-3rdparty.csv +2 -0
- data/README.md +1 -0
- data/Rakefile +65 -25
- data/bin/ddtracerb +15 -0
- data/ddtrace.gemspec +9 -36
- data/docker-compose.yml +75 -7
- data/docs/DevelopmentGuide.md +28 -0
- data/docs/GettingStarted.md +162 -68
- data/docs/ProfilingDevelopment.md +88 -0
- data/integration/README.md +67 -0
- data/integration/apps/rack/.dockerignore +1 -0
- data/integration/apps/rack/.envrc.sample +1 -0
- data/integration/apps/rack/.gitignore +4 -0
- data/integration/apps/rack/.rspec +1 -0
- data/integration/apps/rack/Dockerfile +28 -0
- data/integration/apps/rack/Dockerfile-ci +11 -0
- data/integration/apps/rack/Gemfile +24 -0
- data/integration/apps/rack/README.md +93 -0
- data/integration/apps/rack/app/acme.rb +80 -0
- data/integration/apps/rack/app/datadog.rb +17 -0
- data/integration/apps/rack/bin/run +22 -0
- data/integration/apps/rack/bin/setup +17 -0
- data/integration/apps/rack/bin/test +24 -0
- data/integration/apps/rack/config.ru +6 -0
- data/integration/apps/rack/config/puma.rb +14 -0
- data/integration/apps/rack/config/unicorn.rb +23 -0
- data/integration/apps/rack/docker-compose.ci.yml +62 -0
- data/integration/apps/rack/docker-compose.yml +78 -0
- data/integration/apps/rack/script/build-images +38 -0
- data/integration/apps/rack/script/ci +50 -0
- data/integration/apps/rack/spec/integration/basic_spec.rb +10 -0
- data/integration/apps/rack/spec/spec_helper.rb +16 -0
- data/integration/apps/rack/spec/support/integration_helper.rb +22 -0
- data/integration/apps/rails-five/.dockerignore +1 -0
- data/integration/apps/rails-five/.env +3 -0
- data/integration/apps/rails-five/.envrc.sample +1 -0
- data/integration/apps/rails-five/.gitignore +30 -0
- data/integration/apps/rails-five/Dockerfile +25 -0
- data/integration/apps/rails-five/Dockerfile-ci +11 -0
- data/integration/apps/rails-five/Gemfile +104 -0
- data/integration/apps/rails-five/README.md +94 -0
- data/integration/apps/rails-five/Rakefile +6 -0
- data/integration/apps/rails-five/app/channels/application_cable/channel.rb +4 -0
- data/integration/apps/rails-five/app/channels/application_cable/connection.rb +4 -0
- data/integration/apps/rails-five/app/controllers/application_controller.rb +2 -0
- data/integration/apps/rails-five/app/controllers/basic_controller.rb +36 -0
- data/integration/apps/rails-five/app/controllers/concerns/.keep +0 -0
- data/integration/apps/rails-five/app/controllers/health_controller.rb +9 -0
- data/integration/apps/rails-five/app/controllers/jobs_controller.rb +12 -0
- data/integration/apps/rails-five/app/jobs/application_job.rb +2 -0
- data/integration/apps/rails-five/app/jobs/test_job.rb +12 -0
- data/integration/apps/rails-five/app/mailers/application_mailer.rb +4 -0
- data/integration/apps/rails-five/app/models/application_record.rb +3 -0
- data/integration/apps/rails-five/app/models/concerns/.keep +0 -0
- data/integration/apps/rails-five/app/models/test.rb +2 -0
- data/integration/apps/rails-five/app/views/layouts/mailer.html.erb +13 -0
- data/integration/apps/rails-five/app/views/layouts/mailer.text.erb +1 -0
- data/integration/apps/rails-five/bin/bundle +3 -0
- data/integration/apps/rails-five/bin/rails +9 -0
- data/integration/apps/rails-five/bin/rake +9 -0
- data/integration/apps/rails-five/bin/run +24 -0
- data/integration/apps/rails-five/bin/setup +27 -0
- data/integration/apps/rails-five/bin/spring +17 -0
- data/integration/apps/rails-five/bin/test +21 -0
- data/integration/apps/rails-five/bin/update +28 -0
- data/integration/apps/rails-five/config.ru +5 -0
- data/integration/apps/rails-five/config/application.rb +97 -0
- data/integration/apps/rails-five/config/boot.rb +4 -0
- data/integration/apps/rails-five/config/cable.yml +10 -0
- data/integration/apps/rails-five/config/credentials.yml.enc +1 -0
- data/integration/apps/rails-five/config/database.yml +28 -0
- data/integration/apps/rails-five/config/environment.rb +5 -0
- data/integration/apps/rails-five/config/environments/development.rb +51 -0
- data/integration/apps/rails-five/config/environments/production.rb +82 -0
- data/integration/apps/rails-five/config/environments/test.rb +43 -0
- data/integration/apps/rails-five/config/initializers/datadog.rb +18 -0
- data/integration/apps/rails-five/config/initializers/filter_parameter_logging.rb +4 -0
- data/integration/apps/rails-five/config/initializers/resque.rb +4 -0
- data/integration/apps/rails-five/config/initializers/rollbar.rb +5 -0
- data/integration/apps/rails-five/config/initializers/wrap_parameters.rb +14 -0
- data/integration/apps/rails-five/config/locales/en.yml +33 -0
- data/integration/apps/rails-five/config/puma.rb +24 -0
- data/integration/apps/rails-five/config/routes.rb +11 -0
- data/integration/apps/rails-five/config/spring.rb +6 -0
- data/integration/apps/rails-five/config/unicorn.rb +29 -0
- data/integration/apps/rails-five/db/migrate/20190927215052_create_tests.rb +11 -0
- data/integration/apps/rails-five/db/schema.rb +23 -0
- data/integration/apps/rails-five/db/seeds.rb +7 -0
- data/integration/apps/rails-five/docker-compose.ci.yml +98 -0
- data/integration/apps/rails-five/docker-compose.yml +100 -0
- data/integration/apps/rails-five/lib/tasks/.keep +0 -0
- data/integration/apps/rails-five/log/.keep +0 -0
- data/integration/apps/rails-five/public/robots.txt +1 -0
- data/integration/apps/rails-five/script/build-images +35 -0
- data/integration/apps/rails-five/script/ci +50 -0
- data/integration/apps/rails-five/spec/integration/basic_spec.rb +10 -0
- data/integration/apps/rails-five/spec/spec_helper.rb +16 -0
- data/integration/apps/rails-five/spec/support/integration_helper.rb +22 -0
- data/integration/apps/rails-five/storage/.keep +0 -0
- data/integration/apps/rails-five/tmp/.keep +0 -0
- data/integration/apps/rails-five/vendor/.keep +0 -0
- data/integration/apps/ruby/.dockerignore +1 -0
- data/integration/apps/ruby/.envrc.sample +1 -0
- data/integration/apps/ruby/.gitignore +2 -0
- data/integration/apps/ruby/Dockerfile +25 -0
- data/integration/apps/ruby/Dockerfile-ci +11 -0
- data/integration/apps/ruby/Gemfile +11 -0
- data/integration/apps/ruby/README.md +70 -0
- data/integration/apps/ruby/agent.yaml +3 -0
- data/integration/apps/ruby/app/datadog.rb +13 -0
- data/integration/apps/ruby/app/fibonacci.rb +58 -0
- data/integration/apps/ruby/bin/run +20 -0
- data/integration/apps/ruby/bin/setup +17 -0
- data/integration/apps/ruby/bin/test +21 -0
- data/integration/apps/ruby/docker-compose.ci.yml +51 -0
- data/integration/apps/ruby/docker-compose.yml +63 -0
- data/integration/apps/ruby/script/build-images +38 -0
- data/integration/apps/ruby/script/ci +50 -0
- data/integration/images/agent/Dockerfile +2 -0
- data/integration/images/agent/agent.yaml +3 -0
- data/integration/images/include/datadog/analyzer.rb +71 -0
- data/integration/images/include/datadog/demo_env.rb +101 -0
- data/integration/images/include/http-health-check +33 -0
- data/integration/images/ruby/2.0/Dockerfile +54 -0
- data/integration/images/ruby/2.1/Dockerfile +54 -0
- data/integration/images/ruby/2.2/Dockerfile +54 -0
- data/integration/images/ruby/2.3/Dockerfile +70 -0
- data/integration/images/ruby/2.4/Dockerfile +54 -0
- data/integration/images/ruby/2.5/Dockerfile +54 -0
- data/integration/images/ruby/2.6/Dockerfile +54 -0
- data/integration/images/ruby/2.7/Dockerfile +54 -0
- data/integration/images/ruby/3.0/Dockerfile +54 -0
- data/integration/images/wrk/Dockerfile +33 -0
- data/integration/images/wrk/scripts/entrypoint.sh +17 -0
- data/integration/images/wrk/scripts/scenarios/basic/default.lua +1 -0
- data/integration/images/wrk/scripts/scenarios/basic/fibonacci.lua +1 -0
- data/integration/script/build-images +43 -0
- data/lib/ddtrace.rb +8 -5
- data/lib/ddtrace/analytics.rb +2 -0
- data/lib/ddtrace/auto_instrument.rb +3 -0
- data/lib/ddtrace/auto_instrument_base.rb +6 -0
- data/lib/ddtrace/buffer.rb +4 -4
- data/lib/ddtrace/configuration.rb +121 -26
- data/lib/ddtrace/configuration/base.rb +1 -1
- data/lib/ddtrace/configuration/components.rb +87 -5
- data/lib/ddtrace/configuration/option_definition.rb +1 -3
- data/lib/ddtrace/configuration/options.rb +4 -7
- data/lib/ddtrace/configuration/settings.rb +48 -3
- data/lib/ddtrace/context.rb +5 -6
- data/lib/ddtrace/context_provider.rb +0 -1
- data/lib/ddtrace/contrib/action_cable/event.rb +1 -0
- data/lib/ddtrace/contrib/action_cable/integration.rb +7 -0
- data/lib/ddtrace/contrib/action_pack/action_controller/instrumentation.rb +1 -3
- data/lib/ddtrace/contrib/action_pack/integration.rb +7 -0
- data/lib/ddtrace/contrib/action_view/event.rb +1 -1
- data/lib/ddtrace/contrib/action_view/integration.rb +7 -0
- data/lib/ddtrace/contrib/action_view/utils.rb +1 -1
- data/lib/ddtrace/contrib/active_record/configuration/makara_resolver.rb +30 -0
- data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +107 -18
- data/lib/ddtrace/contrib/active_record/integration.rb +7 -0
- data/lib/ddtrace/contrib/active_record/utils.rb +57 -20
- data/lib/ddtrace/contrib/active_support/integration.rb +7 -1
- data/lib/ddtrace/contrib/active_support/notifications/event.rb +2 -1
- data/lib/ddtrace/contrib/active_support/notifications/subscriber.rb +1 -0
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +9 -5
- data/lib/ddtrace/contrib/auto_instrument.rb +49 -0
- data/lib/ddtrace/contrib/aws/patcher.rb +1 -0
- data/lib/ddtrace/contrib/aws/services.rb +2 -0
- data/lib/ddtrace/contrib/configurable.rb +63 -39
- data/lib/ddtrace/contrib/configuration/resolver.rb +70 -5
- data/lib/ddtrace/contrib/configuration/resolvers/pattern_resolver.rb +19 -20
- data/lib/ddtrace/contrib/configuration/settings.rb +7 -6
- data/lib/ddtrace/contrib/cucumber/configuration/settings.rb +0 -10
- data/lib/ddtrace/contrib/cucumber/ext.rb +0 -2
- data/lib/ddtrace/contrib/cucumber/formatter.rb +5 -11
- data/lib/ddtrace/contrib/cucumber/integration.rb +5 -0
- data/lib/ddtrace/contrib/dalli/patcher.rb +0 -38
- data/lib/ddtrace/contrib/delayed_job/plugin.rb +0 -1
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +1 -0
- data/lib/ddtrace/contrib/elasticsearch/quantize.rb +3 -2
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +10 -9
- data/lib/ddtrace/contrib/excon/middleware.rb +2 -6
- data/lib/ddtrace/contrib/extensions.rb +53 -3
- data/lib/ddtrace/contrib/faraday/middleware.rb +1 -3
- data/lib/ddtrace/contrib/faraday/patcher.rb +0 -36
- data/lib/ddtrace/contrib/grape/endpoint.rb +8 -15
- data/lib/ddtrace/contrib/grape/patcher.rb +0 -42
- data/lib/ddtrace/contrib/grpc/datadog_interceptor.rb +8 -8
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +1 -0
- data/lib/ddtrace/contrib/grpc/patcher.rb +0 -36
- data/lib/ddtrace/contrib/http/circuit_breaker.rb +1 -3
- data/lib/ddtrace/contrib/http/instrumentation.rb +5 -5
- data/lib/ddtrace/contrib/httpclient/configuration/settings.rb +32 -0
- data/lib/ddtrace/contrib/httpclient/ext.rb +17 -0
- data/lib/ddtrace/contrib/httpclient/instrumentation.rb +147 -0
- data/lib/ddtrace/contrib/httpclient/integration.rb +43 -0
- data/lib/ddtrace/contrib/httpclient/patcher.rb +38 -0
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +14 -20
- data/lib/ddtrace/contrib/httprb/patcher.rb +5 -2
- data/lib/ddtrace/contrib/mongodb/instrumentation.rb +2 -0
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +2 -3
- data/lib/ddtrace/contrib/patchable.rb +18 -7
- data/lib/ddtrace/contrib/patcher.rb +9 -6
- data/lib/ddtrace/contrib/presto/patcher.rb +5 -2
- data/lib/ddtrace/contrib/qless/qless_job.rb +1 -0
- data/lib/ddtrace/contrib/qless/tracer_cleaner.rb +1 -0
- data/lib/ddtrace/contrib/que/ext.rb +19 -19
- data/lib/ddtrace/contrib/que/tracer.rb +1 -1
- data/lib/ddtrace/contrib/racecar/event.rb +1 -0
- data/lib/ddtrace/contrib/rack/configuration/settings.rb +3 -3
- data/lib/ddtrace/contrib/rack/integration.rb +7 -0
- data/lib/ddtrace/contrib/rack/middlewares.rb +6 -11
- data/lib/ddtrace/contrib/rack/patcher.rb +1 -3
- data/lib/ddtrace/contrib/rack/request_queue.rb +6 -1
- data/lib/ddtrace/contrib/rails/auto_instrument_railtie.rb +10 -0
- data/lib/ddtrace/contrib/rails/patcher.rb +6 -2
- data/lib/ddtrace/contrib/rails/utils.rb +4 -0
- data/lib/ddtrace/contrib/rake/instrumentation.rb +4 -2
- data/lib/ddtrace/contrib/rake/integration.rb +1 -1
- data/lib/ddtrace/contrib/redis/configuration/resolver.rb +11 -4
- data/lib/ddtrace/contrib/redis/quantize.rb +1 -0
- data/lib/ddtrace/contrib/redis/vendor/LICENSE +20 -0
- data/lib/ddtrace/contrib/redis/vendor/resolver.rb +6 -7
- data/lib/ddtrace/contrib/registry.rb +2 -2
- data/lib/ddtrace/contrib/resque/configuration/settings.rb +17 -1
- data/lib/ddtrace/contrib/resque/integration.rb +1 -1
- data/lib/ddtrace/contrib/resque/patcher.rb +4 -4
- data/lib/ddtrace/contrib/resque/resque_job.rb +24 -1
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +1 -3
- data/lib/ddtrace/contrib/rspec/configuration/settings.rb +0 -10
- data/lib/ddtrace/contrib/rspec/example.rb +24 -10
- data/lib/ddtrace/contrib/rspec/ext.rb +0 -3
- data/lib/ddtrace/contrib/rspec/integration.rb +6 -1
- data/lib/ddtrace/contrib/rspec/patcher.rb +0 -2
- data/lib/ddtrace/contrib/sequel/utils.rb +5 -6
- data/lib/ddtrace/contrib/shoryuken/configuration/settings.rb +1 -0
- data/lib/ddtrace/contrib/shoryuken/tracer.rb +7 -4
- data/lib/ddtrace/contrib/sidekiq/server_tracer.rb +2 -7
- data/lib/ddtrace/contrib/sidekiq/tracing.rb +0 -1
- data/lib/ddtrace/contrib/sinatra/env.rb +1 -3
- data/lib/ddtrace/contrib/sinatra/headers.rb +1 -3
- data/lib/ddtrace/contrib/sinatra/tracer.rb +1 -3
- data/lib/ddtrace/contrib/sinatra/tracer_middleware.rb +3 -3
- data/lib/ddtrace/contrib/sneakers/ext.rb +11 -11
- data/lib/ddtrace/contrib/sneakers/tracer.rb +2 -4
- data/lib/ddtrace/contrib/status_code_matcher.rb +5 -3
- data/lib/ddtrace/correlation.rb +1 -0
- data/lib/ddtrace/diagnostics/environment_logger.rb +3 -2
- data/lib/ddtrace/distributed_tracing/headers/headers.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/helpers.rb +1 -3
- data/lib/ddtrace/error.rb +2 -0
- data/lib/ddtrace/ext/ci.rb +43 -10
- data/lib/ddtrace/ext/distributed.rb +1 -1
- data/lib/ddtrace/ext/git.rb +0 -1
- data/lib/ddtrace/ext/http.rb +1 -1
- data/lib/ddtrace/ext/profiling.rb +52 -0
- data/lib/ddtrace/ext/runtime.rb +3 -1
- data/lib/ddtrace/ext/transport.rb +1 -0
- data/lib/ddtrace/forced_tracing.rb +2 -0
- data/lib/ddtrace/logger.rb +1 -1
- data/lib/ddtrace/metrics.rb +14 -6
- data/lib/ddtrace/opentracer/distributed_headers.rb +3 -0
- data/lib/ddtrace/opentracer/span.rb +2 -6
- data/lib/ddtrace/opentracer/thread_local_scope.rb +1 -0
- data/lib/ddtrace/patcher.rb +25 -4
- data/lib/ddtrace/pin.rb +8 -61
- data/lib/ddtrace/pipeline/span_filter.rb +1 -1
- data/lib/ddtrace/profiling.rb +54 -0
- data/lib/ddtrace/profiling/backtrace_location.rb +32 -0
- data/lib/ddtrace/profiling/buffer.rb +41 -0
- data/lib/ddtrace/profiling/collectors/stack.rb +253 -0
- data/lib/ddtrace/profiling/encoding/profile.rb +31 -0
- data/lib/ddtrace/profiling/event.rb +13 -0
- data/lib/ddtrace/profiling/events/stack.rb +102 -0
- data/lib/ddtrace/profiling/exporter.rb +23 -0
- data/lib/ddtrace/profiling/ext/cpu.rb +54 -0
- data/lib/ddtrace/profiling/ext/cthread.rb +134 -0
- data/lib/ddtrace/profiling/ext/forking.rb +97 -0
- data/lib/ddtrace/profiling/flush.rb +41 -0
- data/lib/ddtrace/profiling/pprof/builder.rb +121 -0
- data/lib/ddtrace/profiling/pprof/converter.rb +85 -0
- data/lib/ddtrace/profiling/pprof/message_set.rb +12 -0
- data/lib/ddtrace/profiling/pprof/payload.rb +18 -0
- data/lib/ddtrace/profiling/pprof/pprof.proto +212 -0
- data/lib/ddtrace/profiling/pprof/pprof_pb.rb +81 -0
- data/lib/ddtrace/profiling/pprof/stack_sample.rb +90 -0
- data/lib/ddtrace/profiling/pprof/string_table.rb +10 -0
- data/lib/ddtrace/profiling/pprof/template.rb +114 -0
- data/lib/ddtrace/profiling/preload.rb +3 -0
- data/lib/ddtrace/profiling/profiler.rb +28 -0
- data/lib/ddtrace/profiling/recorder.rb +87 -0
- data/lib/ddtrace/profiling/scheduler.rb +84 -0
- data/lib/ddtrace/profiling/tasks/setup.rb +77 -0
- data/lib/ddtrace/profiling/transport/client.rb +12 -0
- data/lib/ddtrace/profiling/transport/http.rb +122 -0
- data/lib/ddtrace/profiling/transport/http/api.rb +43 -0
- data/lib/ddtrace/profiling/transport/http/api/endpoint.rb +90 -0
- data/lib/ddtrace/profiling/transport/http/api/instance.rb +36 -0
- data/lib/ddtrace/profiling/transport/http/api/spec.rb +40 -0
- data/lib/ddtrace/profiling/transport/http/builder.rb +28 -0
- data/lib/ddtrace/profiling/transport/http/client.rb +33 -0
- data/lib/ddtrace/profiling/transport/http/response.rb +21 -0
- data/lib/ddtrace/profiling/transport/io.rb +30 -0
- data/lib/ddtrace/profiling/transport/io/client.rb +27 -0
- data/lib/ddtrace/profiling/transport/io/response.rb +16 -0
- data/lib/ddtrace/profiling/transport/parcel.rb +17 -0
- data/lib/ddtrace/profiling/transport/request.rb +15 -0
- data/lib/ddtrace/profiling/transport/response.rb +8 -0
- data/lib/ddtrace/propagation/grpc_propagator.rb +1 -0
- data/lib/ddtrace/propagation/http_propagator.rb +17 -2
- data/lib/ddtrace/quantization/http.rb +1 -0
- data/lib/ddtrace/runtime/cgroup.rb +2 -2
- data/lib/ddtrace/runtime/container.rb +32 -26
- data/lib/ddtrace/runtime/identity.rb +8 -0
- data/lib/ddtrace/sampler.rb +1 -1
- data/lib/ddtrace/sampling/rule_sampler.rb +4 -9
- data/lib/ddtrace/span.rb +7 -7
- data/lib/ddtrace/sync_writer.rb +12 -12
- data/lib/ddtrace/tasks/exec.rb +48 -0
- data/lib/ddtrace/tasks/help.rb +14 -0
- data/lib/ddtrace/tracer.rb +28 -5
- data/lib/ddtrace/transport/http.rb +15 -8
- data/lib/ddtrace/transport/http/adapters/net.rb +27 -8
- data/lib/ddtrace/transport/http/adapters/registry.rb +1 -0
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +2 -4
- data/lib/ddtrace/transport/http/builder.rb +7 -1
- data/lib/ddtrace/transport/http/env.rb +8 -0
- data/lib/ddtrace/transport/http/traces.rb +2 -3
- data/lib/ddtrace/transport/io.rb +1 -1
- data/lib/ddtrace/transport/io/client.rb +15 -8
- data/lib/ddtrace/transport/io/response.rb +1 -3
- data/lib/ddtrace/transport/io/traces.rb +6 -0
- data/lib/ddtrace/transport/parcel.rb +4 -0
- data/lib/ddtrace/transport/traces.rb +18 -1
- data/lib/ddtrace/utils/compression.rb +27 -0
- data/lib/ddtrace/utils/object_set.rb +41 -0
- data/lib/ddtrace/utils/only_once.rb +40 -0
- data/lib/ddtrace/utils/sequence.rb +17 -0
- data/lib/ddtrace/utils/string_table.rb +45 -0
- data/lib/ddtrace/utils/time.rb +32 -1
- data/lib/ddtrace/vendor/active_record/MIT-LICENSE +20 -0
- data/lib/ddtrace/vendor/multipart-post/LICENSE +11 -0
- data/lib/ddtrace/vendor/multipart-post/multipart.rb +12 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post.rb +8 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/composite_read_io.rb +116 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/multipartable.rb +57 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/parts.rb +135 -0
- data/lib/ddtrace/vendor/multipart-post/multipart/post/version.rb +9 -0
- data/lib/ddtrace/vendor/multipart-post/net/http/post/multipart.rb +32 -0
- data/lib/ddtrace/version.rb +3 -1
- data/lib/ddtrace/workers.rb +5 -0
- data/lib/ddtrace/workers/async.rb +11 -3
- data/lib/ddtrace/workers/loop.rb +17 -3
- data/lib/ddtrace/workers/polling.rb +1 -0
- data/lib/ddtrace/workers/queue.rb +1 -0
- data/lib/ddtrace/workers/runtime_metrics.rb +14 -1
- data/lib/ddtrace/workers/trace_writer.rb +10 -10
- data/lib/ddtrace/writer.rb +7 -4
- metadata +213 -379
- data/lib/ddtrace/augmentation.rb +0 -13
- 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/contrib/rspec/example_group.rb +0 -61
- data/lib/ddtrace/monkey.rb +0 -58
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Select base image
|
|
2
|
+
ARG BASE_IMAGE
|
|
3
|
+
FROM ${BASE_IMAGE}
|
|
4
|
+
|
|
5
|
+
# Add gem
|
|
6
|
+
COPY . /vendor/dd-trace-rb
|
|
7
|
+
|
|
8
|
+
# Install dependencies
|
|
9
|
+
# Setup specific version of ddtrace, if specified.
|
|
10
|
+
ENV DD_DEMO_ENV_GEM_LOCAL_DDTRACE /vendor/dd-trace-rb
|
|
11
|
+
RUN bundle install
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
require 'datadog/demo_env'
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org' do
|
|
4
|
+
# Framework dependent gems
|
|
5
|
+
# gem 'rails', '5.2.2'
|
|
6
|
+
|
|
7
|
+
google_protobuf_versions = [
|
|
8
|
+
'~> 3.0',
|
|
9
|
+
'!= 3.7.0.rc.2',
|
|
10
|
+
'!= 3.7.0.rc.3',
|
|
11
|
+
'!= 3.7.0',
|
|
12
|
+
'!= 3.7.1',
|
|
13
|
+
'!= 3.8.0.rc.1'
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
# gem 'rack', '2.1.4' # Ruby 2.2 compatibility
|
|
17
|
+
gem 'actioncable', '5.2.2'
|
|
18
|
+
gem 'actionmailer', '5.2.2'
|
|
19
|
+
gem 'actionpack', '5.2.2'
|
|
20
|
+
gem 'actionview', '5.2.2'
|
|
21
|
+
gem 'activejob', '5.2.2'
|
|
22
|
+
gem 'activemodel', '5.2.2'
|
|
23
|
+
gem 'activerecord', '5.2.2'
|
|
24
|
+
gem 'railties', '5.2.2'
|
|
25
|
+
|
|
26
|
+
gem 'mysql2'
|
|
27
|
+
gem 'puma'
|
|
28
|
+
gem 'unicorn'
|
|
29
|
+
|
|
30
|
+
# Choose correct specs for 'ddtrace' demo environment
|
|
31
|
+
gem 'ddtrace', *Datadog::DemoEnv.gem_spec('ddtrace')
|
|
32
|
+
|
|
33
|
+
gem 'dogstatsd-ruby'
|
|
34
|
+
gem 'ffi'
|
|
35
|
+
gem 'google-protobuf', *google_protobuf_versions # Ruby 2.2 compatibility
|
|
36
|
+
# gem 'rbtrace'
|
|
37
|
+
# gem 'ruby-prof'
|
|
38
|
+
|
|
39
|
+
# Fixes conflict with profiling (patch overwrite in Thread)
|
|
40
|
+
# Upgrade this to latest when this patch is merged & released.
|
|
41
|
+
# https://github.com/rollbar/rollbar-gem/pull/1018
|
|
42
|
+
gem 'rollbar', git: 'https://github.com/rollbar/rollbar-gem.git', ref: '310a9d1743bb44031480b49e8e0cef79ddc870c3'
|
|
43
|
+
|
|
44
|
+
# Gems which give aide to higher performance
|
|
45
|
+
gem 'hiredis', '~> 0.6', platform: :ruby
|
|
46
|
+
gem 'multi_json'
|
|
47
|
+
gem 'oj', '3.3', platform: :ruby
|
|
48
|
+
|
|
49
|
+
gem 'active_model_serializers', '0.9.3'
|
|
50
|
+
gem 'activerecord-import' # Speeds up mass imports
|
|
51
|
+
gem 'aws-sdk', '< 2.0'
|
|
52
|
+
gem 'bcrypt-ruby', platform: :ruby
|
|
53
|
+
gem 'connection_pool'
|
|
54
|
+
gem 'devise'
|
|
55
|
+
gem 'faker', require: false # Make up fake data to put in models for load testing
|
|
56
|
+
gem 'geoip'
|
|
57
|
+
gem 'hawk-auth'
|
|
58
|
+
gem 'httparty'
|
|
59
|
+
gem 'ipaddress'
|
|
60
|
+
# gem 'i18n', '1.5.1' # Ruby 2.2 compatibility
|
|
61
|
+
# gem 'newrelic_rpm', platform: :ruby
|
|
62
|
+
gem 'rabl', platform: :ruby
|
|
63
|
+
gem 'rack-cors'
|
|
64
|
+
gem 'rake'
|
|
65
|
+
gem 'redis'
|
|
66
|
+
gem 'resque'
|
|
67
|
+
# gem 'resque-pool' # Incompatible with Redis 4.0+
|
|
68
|
+
gem 'resque-scheduler'
|
|
69
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
|
|
70
|
+
gem 'validates_timeliness', '~> 3.0.8' # Date comparisons
|
|
71
|
+
gem 'versionist'
|
|
72
|
+
gem 'warden'
|
|
73
|
+
|
|
74
|
+
group :development do
|
|
75
|
+
gem 'annotate'
|
|
76
|
+
gem 'awesome_print'
|
|
77
|
+
gem 'bullet'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
group :test do
|
|
81
|
+
gem 'ci_reporter_rspec'
|
|
82
|
+
gem 'database_cleaner'
|
|
83
|
+
gem 'factory_girl_rails', '4.5.0'
|
|
84
|
+
gem 'rspec'
|
|
85
|
+
gem 'rspec-collection_matchers'
|
|
86
|
+
gem 'rspec-rails'
|
|
87
|
+
gem 'shoulda-matchers', '4.0.1'
|
|
88
|
+
gem 'simplecov', require: false # Will install simplecov-html as a dependency
|
|
89
|
+
gem 'timecop'
|
|
90
|
+
gem 'webmock'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
group :test, :development do
|
|
94
|
+
# gem 'pry-rails', platform: :ruby
|
|
95
|
+
# gem 'pry-rescue', platform: :ruby
|
|
96
|
+
# gem 'pry-stack_explorer', platform: :ruby
|
|
97
|
+
# gem 'pry-byebug', platform: :ruby
|
|
98
|
+
gem 'byebug', platform: :ruby
|
|
99
|
+
gem 'mock_redis', '0.19.0'
|
|
100
|
+
gem 'parallel_tests'
|
|
101
|
+
|
|
102
|
+
gem 'listen'
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Rails 5: Demo application for Datadog APM
|
|
2
|
+
|
|
3
|
+
A generic Rails 5 web application with some common use scenarios.
|
|
4
|
+
|
|
5
|
+
For generating Datadog APM traces and profiles.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install [direnv](https://github.com/direnv/direnv) for applying local settings.
|
|
10
|
+
|
|
11
|
+
1. `cp .envrc.sample .envrc` and add your Datadog API key.
|
|
12
|
+
2. `direnv allow` to load the env var.
|
|
13
|
+
3. `cp docker-compose.yml.sample docker-compose.yml` and configure if necessary.
|
|
14
|
+
4. `docker-compose run --rm api bin/setup`
|
|
15
|
+
|
|
16
|
+
## Running the application
|
|
17
|
+
|
|
18
|
+
### To monitor performance of Docker containers with Datadog
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
docker run --rm --name dd-agent -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e API_KEY=$DD_API_KEY datadog/docker-dd-agent:latest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Starting the web server
|
|
25
|
+
|
|
26
|
+
Run `docker-compose up` to auto-start the webserver. It should bind to `localhost:80`.
|
|
27
|
+
|
|
28
|
+
Alternatively, you can run it manually with:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
docker-compose run --rm -p 80:80 api bin/dd-demo <process>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The `<process>` argument is optional, and will default to `DD_DEMO_ENV_PROCESS` if not provided. See [Processes](#processes) for more details.
|
|
35
|
+
|
|
36
|
+
##### Processes
|
|
37
|
+
|
|
38
|
+
Within the container, run `bin/dd-demo <process>` where `<process>` is one of the following values:
|
|
39
|
+
|
|
40
|
+
- `webrick`: WEBrick web server
|
|
41
|
+
- `console`: Rails console
|
|
42
|
+
- `irb`: IRB session
|
|
43
|
+
|
|
44
|
+
Alternatively, set `DD_DEMO_ENV_PROCESS` to run a particular process by default when `bin/dd-demo` is run.
|
|
45
|
+
|
|
46
|
+
##### Features
|
|
47
|
+
|
|
48
|
+
Set `DD_DEMO_ENV_PROCESS` to a comma-delimited list of any of the following values to activate the feature:
|
|
49
|
+
|
|
50
|
+
- `tracing`: Tracing instrumentation
|
|
51
|
+
- `profiling`: Profiling (NOTE: Must also set `DD_PROFILING_ENABLED` to match.)
|
|
52
|
+
- `debug`: Enable diagnostic debug mode
|
|
53
|
+
- `analytics`: Enable trace analytics
|
|
54
|
+
- `runtime_metrics`: Enable runtime metrics
|
|
55
|
+
- `pprof_to_file`: Dump profiling pprof to file instead of agent.
|
|
56
|
+
|
|
57
|
+
e.g. `DD_DEMO_ENV_PROCESS=tracing,profiling`
|
|
58
|
+
|
|
59
|
+
##### Routes
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
# Health check
|
|
63
|
+
curl -v localhost/health
|
|
64
|
+
|
|
65
|
+
# Basic test scenarios
|
|
66
|
+
curl -v localhost/basic/fibonacci
|
|
67
|
+
curl -v -XPOST localhost/basic/everything
|
|
68
|
+
|
|
69
|
+
# Job test scenarios
|
|
70
|
+
curl -v -XPOST localhost/jobs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Load tester
|
|
74
|
+
|
|
75
|
+
Docker configuration automatically creates and runs [Wrk](https://github.com/wg/wrk) load testing containers. By default it runs the `basic/everything` scenario described in the `wrk` image to give a baseload.
|
|
76
|
+
|
|
77
|
+
You can modify the `loadtester_a` container in `docker-compose.yml` to change the load type or scenario run. Set the container's `command` to any set of arguments `wrk` accepts.
|
|
78
|
+
|
|
79
|
+
You can also define your own custom scenario by creating a LUA file, mounting it into the container, and passing it as an argument via `command`.
|
|
80
|
+
|
|
81
|
+
### Running integration tests
|
|
82
|
+
|
|
83
|
+
You can run integration tests using the following and substituting for the Ruby major and minor version (e.g. `2.7`)
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
./bin/build-images -v <RUBY_VERSION>
|
|
87
|
+
./bin/ci -v <RUBY_VERSION>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or inside a running container:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
./bin/rspec
|
|
94
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "#{Rails.root}/app/jobs/test_job"
|
|
2
|
+
|
|
3
|
+
class BasicController < ApplicationController
|
|
4
|
+
# Reads & writes from cache, reads from DB, and queues a Resque job.
|
|
5
|
+
#
|
|
6
|
+
# Example trace:
|
|
7
|
+
#
|
|
8
|
+
# ----------------------- Rack -----------------------------
|
|
9
|
+
# -------------- ActionController --------------------
|
|
10
|
+
# --- ActiveSupport -- ActiveRecord -- Resque ---
|
|
11
|
+
# ----- Redis ---- -- Redis --
|
|
12
|
+
#
|
|
13
|
+
def default
|
|
14
|
+
# Read from the database
|
|
15
|
+
records = Test.where(version: 0)
|
|
16
|
+
|
|
17
|
+
# Queue job
|
|
18
|
+
Resque.enqueue(Jobs::Test, job_id: request.request_id, records: records.map(&:to_json))
|
|
19
|
+
|
|
20
|
+
# Return response
|
|
21
|
+
render json: { job_id: request.request_id }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Runs a recursive implementation of fibonacci.
|
|
25
|
+
# Provides a basic load on CPU, stack frames, response time.
|
|
26
|
+
def fibonacci
|
|
27
|
+
fib(rand(25..35))
|
|
28
|
+
head :ok
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def fib(n)
|
|
34
|
+
n <= 1 ? n : fib(n-1) + fib(n-2)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "#{Rails.root}/app/jobs/test_job"
|
|
2
|
+
|
|
3
|
+
class JobsController < ApplicationController
|
|
4
|
+
def create
|
|
5
|
+
# Queue job
|
|
6
|
+
job_id = SecureRandom.uuid
|
|
7
|
+
Resque.enqueue(Jobs::Test, job_id: job_id)
|
|
8
|
+
|
|
9
|
+
# Return response
|
|
10
|
+
render json: { job_id: job_id }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= yield %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
begin
|
|
3
|
+
load File.expand_path('spring', __dir__)
|
|
4
|
+
rescue LoadError => e
|
|
5
|
+
raise unless e.message.include?('spring')
|
|
6
|
+
end
|
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
|
8
|
+
require_relative '../config/boot'
|
|
9
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# Start demo process
|
|
4
|
+
puts "\n== Starting demo process =="
|
|
5
|
+
|
|
6
|
+
profiling = Datadog::DemoEnv.feature?('profiling') ? 'DD_PROFILING_ENABLED=true ddtracerb exec ' : ''
|
|
7
|
+
process = (ARGV[0] || Datadog::DemoEnv.process)
|
|
8
|
+
command = case process
|
|
9
|
+
when 'puma'
|
|
10
|
+
"bundle exec #{profiling}puma -C /app/config/puma.rb"
|
|
11
|
+
when 'unicorn'
|
|
12
|
+
"bundle exec #{profiling}unicorn -c /app/config/unicorn.rb"
|
|
13
|
+
when 'console'
|
|
14
|
+
"bundle exec #{profiling}rails c"
|
|
15
|
+
when 'irb'
|
|
16
|
+
"bundle exec #{profiling}irb"
|
|
17
|
+
when nil, ''
|
|
18
|
+
abort("\n== ERROR: Must specify a demo process! ==")
|
|
19
|
+
else
|
|
20
|
+
abort("\n== ERROR: Unknown demo process '#{process}' ==")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
puts "Run: #{command}"
|
|
24
|
+
Kernel.exec(command)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'uri'
|
|
4
|
+
include FileUtils
|
|
5
|
+
|
|
6
|
+
# path to your application root.
|
|
7
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
|
8
|
+
|
|
9
|
+
def system!(*args)
|
|
10
|
+
puts "Run: #{args.join(' ')}"
|
|
11
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
chdir APP_ROOT do
|
|
15
|
+
puts "\n== Installing dependencies =="
|
|
16
|
+
system! 'gem install bundler --conservative'
|
|
17
|
+
system('bundle check') || system!('bundle install')
|
|
18
|
+
|
|
19
|
+
puts "\n== Preparing database =="
|
|
20
|
+
database_uri = URI(ENV['DATABASE_URL'])
|
|
21
|
+
system! 'until wget mysql:3306 > /dev/null 2>&1; do : sleep 1; done'
|
|
22
|
+
system! 'bin/rails db:create'
|
|
23
|
+
system! 'bin/rails db:migrate'
|
|
24
|
+
|
|
25
|
+
puts "\n== Removing old logs and tempfiles =="
|
|
26
|
+
system! 'bin/rails log:clear tmp:clear'
|
|
27
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# This file loads Spring without using Bundler, in order to be fast.
|
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
|
5
|
+
|
|
6
|
+
unless defined?(Spring)
|
|
7
|
+
require 'rubygems'
|
|
8
|
+
require 'bundler'
|
|
9
|
+
|
|
10
|
+
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
|
11
|
+
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
|
|
12
|
+
if spring
|
|
13
|
+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
|
14
|
+
gem 'spring', spring.version
|
|
15
|
+
require 'spring/binstub'
|
|
16
|
+
end
|
|
17
|
+
end
|