ddtrace 0.45.0 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +131 -12
- data/.circleci/images/primary/{Dockerfile-jruby-9.2 → Dockerfile-jruby-9.2-latest} +2 -1
- data/.circleci/images/primary/Dockerfile-jruby-9.2.0.0 +73 -0
- data/.circleci/images/primary/Dockerfile-truffleruby-21.0.0 +73 -0
- data/.github/workflows/create-next-milestone.yml +2 -2
- data/.rubocop.yml +250 -7
- data/.rubocop_todo.yml +397 -0
- data/.simplecov +6 -0
- data/Appraisals +16 -1
- data/CHANGELOG.md +150 -1
- data/Gemfile +53 -3
- data/LICENSE-3rdparty.csv +2 -0
- data/Rakefile +5 -23
- data/ddtrace.gemspec +6 -36
- data/docker-compose.yml +75 -7
- data/docs/DevelopmentGuide.md +28 -0
- data/docs/GettingStarted.md +69 -17
- data/integration/README.md +68 -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 +25 -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 +0 -5
- data/lib/ddtrace/analytics.rb +2 -0
- data/lib/ddtrace/buffer.rb +4 -4
- data/lib/ddtrace/configuration.rb +92 -23
- data/lib/ddtrace/configuration/base.rb +1 -1
- data/lib/ddtrace/configuration/components.rb +2 -2
- data/lib/ddtrace/configuration/option_definition.rb +1 -3
- data/lib/ddtrace/configuration/options.rb +4 -7
- data/lib/ddtrace/configuration/settings.rb +17 -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_pack/action_controller/instrumentation.rb +1 -3
- data/lib/ddtrace/contrib/action_view/event.rb +1 -1
- data/lib/ddtrace/contrib/action_view/utils.rb +1 -1
- data/lib/ddtrace/contrib/active_record/configuration/resolver.rb +101 -18
- data/lib/ddtrace/contrib/active_record/utils.rb +1 -0
- 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 +1 -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/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 +5 -5
- data/lib/ddtrace/contrib/excon/middleware.rb +2 -6
- data/lib/ddtrace/contrib/extensions.rb +27 -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/instrumentation.rb +14 -19
- data/lib/ddtrace/contrib/httpclient/patcher.rb +5 -2
- 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/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/middlewares.rb +5 -10
- data/lib/ddtrace/contrib/rack/patcher.rb +1 -3
- data/lib/ddtrace/contrib/rails/patcher.rb +6 -2
- data/lib/ddtrace/contrib/rake/instrumentation.rb +4 -2
- 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/integration.rb +1 -1
- data/lib/ddtrace/contrib/resque/resque_job.rb +2 -0
- 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 +1 -1
- data/lib/ddtrace/contrib/rspec/patcher.rb +0 -2
- data/lib/ddtrace/contrib/sequel/utils.rb +5 -6
- data/lib/ddtrace/contrib/shoryuken/tracer.rb +0 -1
- 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 +2 -1
- data/lib/ddtrace/distributed_tracing/headers/headers.rb +1 -0
- data/lib/ddtrace/distributed_tracing/headers/helpers.rb +1 -3
- data/lib/ddtrace/ext/ci.rb +2 -2
- data/lib/ddtrace/ext/distributed.rb +1 -1
- data/lib/ddtrace/ext/http.rb +1 -1
- data/lib/ddtrace/ext/runtime.rb +3 -1
- data/lib/ddtrace/forced_tracing.rb +2 -0
- data/lib/ddtrace/logger.rb +1 -1
- data/lib/ddtrace/metrics.rb +10 -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/propagation/grpc_propagator.rb +1 -0
- data/lib/ddtrace/quantization/http.rb +1 -0
- data/lib/ddtrace/runtime/cgroup.rb +2 -2
- data/lib/ddtrace/runtime/container.rb +27 -29
- data/lib/ddtrace/runtime/identity.rb +8 -0
- data/lib/ddtrace/sampler.rb +1 -1
- data/lib/ddtrace/sampling/rule_sampler.rb +1 -0
- data/lib/ddtrace/span.rb +7 -7
- data/lib/ddtrace/sync_writer.rb +12 -12
- data/lib/ddtrace/tracer.rb +7 -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/response.rb +1 -3
- data/lib/ddtrace/transport/io/traces.rb +6 -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 +1 -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/trace_writer.rb +10 -10
- data/lib/ddtrace/writer.rb +7 -4
- metadata +152 -402
- 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,43 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
19
|
+
}
|
20
|
+
|
21
|
+
# Show full error reports and disable caching.
|
22
|
+
config.consider_all_requests_local = true
|
23
|
+
config.action_controller.perform_caching = false
|
24
|
+
|
25
|
+
# Raise exceptions instead of rendering exception templates.
|
26
|
+
config.action_dispatch.show_exceptions = false
|
27
|
+
|
28
|
+
# Disable request forgery protection in test environment.
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
30
|
+
|
31
|
+
config.action_mailer.perform_caching = false
|
32
|
+
|
33
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
34
|
+
# The :test delivery method accumulates sent emails in the
|
35
|
+
# ActionMailer::Base.deliveries array.
|
36
|
+
config.action_mailer.delivery_method = :test
|
37
|
+
|
38
|
+
# Print deprecation notices to the stderr.
|
39
|
+
config.active_support.deprecation = :stderr
|
40
|
+
|
41
|
+
# Raises error for missing translations
|
42
|
+
# config.action_view.raise_on_missing_translations = true
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'ddtrace'
|
2
|
+
|
3
|
+
Datadog.configure do |c|
|
4
|
+
c.diagnostics.debug = true if Datadog::DemoEnv.feature?('debug')
|
5
|
+
c.analytics_enabled = true if Datadog::DemoEnv.feature?('analytics')
|
6
|
+
c.runtime_metrics.enabled = true if Datadog::DemoEnv.feature?('runtime_metrics')
|
7
|
+
|
8
|
+
if Datadog::DemoEnv.feature?('tracing')
|
9
|
+
c.use :rails, service_name: 'acme-rails-five'
|
10
|
+
c.use :redis, service_name: 'acme-redis'
|
11
|
+
c.use :resque, service_name: 'acme-resque'
|
12
|
+
end
|
13
|
+
|
14
|
+
if Datadog::DemoEnv.feature?('pprof_to_file')
|
15
|
+
# Reconfigure transport to write pprof to file
|
16
|
+
c.profiling.exporter.transport = Datadog::DemoEnv.profiler_file_transport
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
20
|
+
# the default I18n backend:
|
21
|
+
#
|
22
|
+
# true, false, on, off, yes, no
|
23
|
+
#
|
24
|
+
# Instead, surround them with single quotes.
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# 'true': 'foo'
|
28
|
+
#
|
29
|
+
# To learn more, please read the Rails Internationalization guide
|
30
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
31
|
+
|
32
|
+
en:
|
33
|
+
hello: "Hello world"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'datadog/demo_env'
|
2
|
+
|
3
|
+
Datadog::DemoEnv.print_env('Puma master environment')
|
4
|
+
|
5
|
+
workers Integer(ENV["WEB_CONCURRENCY"] || 1)
|
6
|
+
threads 2, Integer(ENV['RAILS_MAX_THREADS'] || 24)
|
7
|
+
|
8
|
+
preload_app!
|
9
|
+
|
10
|
+
bind 'tcp://0.0.0.0:80'
|
11
|
+
environment ENV['RAILS_ENV'] || 'development'
|
12
|
+
|
13
|
+
on_worker_boot do
|
14
|
+
ActiveSupport.on_load(:active_record) do
|
15
|
+
ActiveRecord::Base.establish_connection
|
16
|
+
end
|
17
|
+
|
18
|
+
Datadog::DemoEnv.print_env('Puma worker environment')
|
19
|
+
end
|
20
|
+
|
21
|
+
before_fork do
|
22
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
23
|
+
#$redis.pool_shutdown { |conn| conn.quit }
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
get '/', to: 'basic#default'
|
3
|
+
get 'health', to: 'health#check'
|
4
|
+
|
5
|
+
# Basic test scenarios
|
6
|
+
get 'basic/default', to: 'basic#default'
|
7
|
+
get 'basic/fibonacci', to: 'basic#fibonacci'
|
8
|
+
|
9
|
+
# Job test scenarios
|
10
|
+
post 'jobs', to: 'jobs#create'
|
11
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'datadog/demo_env'
|
2
|
+
|
3
|
+
# config/unicorn.rb
|
4
|
+
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
|
5
|
+
timeout 15
|
6
|
+
preload_app true
|
7
|
+
|
8
|
+
Datadog::DemoEnv.print_env('Unicorn master environment')
|
9
|
+
|
10
|
+
before_fork do |server, worker|
|
11
|
+
Signal.trap 'TERM' do
|
12
|
+
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
|
13
|
+
Process.kill 'QUIT', Process.pid
|
14
|
+
end
|
15
|
+
|
16
|
+
defined?(ActiveRecord::Base) and
|
17
|
+
ActiveRecord::Base.connection.disconnect!
|
18
|
+
end
|
19
|
+
|
20
|
+
after_fork do |server, worker|
|
21
|
+
Signal.trap 'TERM' do
|
22
|
+
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
|
23
|
+
end
|
24
|
+
|
25
|
+
defined?(ActiveRecord::Base) and
|
26
|
+
ActiveRecord::Base.establish_connection
|
27
|
+
|
28
|
+
Datadog::DemoEnv.print_env('Unicorn worker environment')
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 2019_09_27_215052) do
|
14
|
+
|
15
|
+
create_table "tests", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
16
|
+
t.integer "version"
|
17
|
+
t.string "data"
|
18
|
+
t.datetime "created_at", null: false
|
19
|
+
t.datetime "updated_at", null: false
|
20
|
+
t.index ["version"], name: "index_tests_on_version"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
@@ -0,0 +1,98 @@
|
|
1
|
+
version: '3.4'
|
2
|
+
services:
|
3
|
+
app:
|
4
|
+
# Build at dd-trace-rb level to copy in current code
|
5
|
+
# and use it as the `ddtrace` gem.
|
6
|
+
build:
|
7
|
+
context: ../../..
|
8
|
+
dockerfile: integration/apps/rails-five/Dockerfile-ci
|
9
|
+
args:
|
10
|
+
BASE_IMAGE: ${APP_IMAGE}
|
11
|
+
depends_on:
|
12
|
+
- ddagent
|
13
|
+
- mysql
|
14
|
+
- redis
|
15
|
+
environment:
|
16
|
+
- BUNDLE_GEMFILE=/app/Gemfile
|
17
|
+
- DATABASE_URL=mysql2://mysql:mysql@mysql:3306
|
18
|
+
- DATABASE_ROOT_USER=root
|
19
|
+
- DATABASE_ROOT_PASSWORD=root
|
20
|
+
- DD_AGENT_HOST=ddagent
|
21
|
+
- DD_METRIC_AGENT_PORT=8125
|
22
|
+
- DD_TRACE_AGENT_PORT=8126
|
23
|
+
- DD_HEALTH_METRICS_ENABLED=true
|
24
|
+
- DD_SERVICE=acme-rails-five
|
25
|
+
- RAILS_ENV=production
|
26
|
+
- REDIS_URL=redis://redis:6379
|
27
|
+
- SECRET_KEY_BASE=5ced2602472cdf650e2cfa5be40c7d0dffd4e1da1483e21fa9c776e338b363c8bf75144bc6e6c5177a0d7a208a899552f98b3f82d4ea74cf5f9b9d3accbb1537
|
28
|
+
# Use these to choose what is run
|
29
|
+
- DD_DEMO_ENV_PROCESS=puma
|
30
|
+
- DD_DEMO_ENV_FEATURES=tracing
|
31
|
+
expose:
|
32
|
+
- "80"
|
33
|
+
stdin_open: true
|
34
|
+
tty: true
|
35
|
+
ddagent:
|
36
|
+
image: datadog/dd-apm-demo:agent
|
37
|
+
environment:
|
38
|
+
- DD_APM_ENABLED=true
|
39
|
+
- DD_PROCESS_AGENT_ENABLED=false
|
40
|
+
- DD_BIND_HOST=0.0.0.0
|
41
|
+
- DD_API_KEY=invalid_api_key
|
42
|
+
- LOG_LEVEL=DEBUG
|
43
|
+
- DD_LOGS_STDOUT=yes
|
44
|
+
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
|
45
|
+
expose:
|
46
|
+
- "8125/udp"
|
47
|
+
- "8126"
|
48
|
+
mysql:
|
49
|
+
image: mysql:5.6
|
50
|
+
environment:
|
51
|
+
- MYSQL_DATABASE=acme_production
|
52
|
+
- MYSQL_ROOT_PASSWORD=root
|
53
|
+
- MYSQL_ROOT_HOST=%
|
54
|
+
- MYSQL_PASSWORD=mysql
|
55
|
+
- MYSQL_USER=mysql
|
56
|
+
expose:
|
57
|
+
- "3306"
|
58
|
+
healthcheck:
|
59
|
+
test: ["CMD", "mysqladmin", "ping", "--silent"]
|
60
|
+
interval: 5s
|
61
|
+
timeout: 5s
|
62
|
+
retries: 3
|
63
|
+
redis:
|
64
|
+
image: redis:3.0
|
65
|
+
expose:
|
66
|
+
- "6379"
|
67
|
+
# Build at dd-trace-rb level to copy in current code
|
68
|
+
# and use it as the `ddtrace` gem.
|
69
|
+
integration-tester:
|
70
|
+
build:
|
71
|
+
context: ../../..
|
72
|
+
dockerfile: integration/apps/rails-five/Dockerfile-ci
|
73
|
+
args:
|
74
|
+
BASE_IMAGE: ${APP_IMAGE}
|
75
|
+
command: bin/test
|
76
|
+
depends_on:
|
77
|
+
- app
|
78
|
+
environment:
|
79
|
+
- BUNDLE_GEMFILE=/app/Gemfile
|
80
|
+
- DATABASE_URL=mysql2://mysql:mysql@mysql:3306
|
81
|
+
- DD_AGENT_HOST=ddagent
|
82
|
+
- DD_METRIC_AGENT_PORT=8125
|
83
|
+
- DD_TRACE_AGENT_PORT=8126
|
84
|
+
- DD_HEALTH_METRICS_ENABLED=true
|
85
|
+
- DD_SERVICE=acme-rails-five-tester
|
86
|
+
- RAILS_ENV=test
|
87
|
+
- REDIS_URL=redis://redis:6379
|
88
|
+
- SECRET_KEY_BASE=5ced2602472cdf650e2cfa5be40c7d0dffd4e1da1483e21fa9c776e338b363c8bf75144bc6e6c5177a0d7a208a899552f98b3f82d4ea74cf5f9b9d3accbb1537
|
89
|
+
- HEALTH_CHECK_URL=http://app/health
|
90
|
+
- HEALTH_CHECK_INTERVAL=1
|
91
|
+
- HEALTH_CHECK_MAX_ATTEMPTS=60
|
92
|
+
- TEST_HOSTNAME=app
|
93
|
+
- TEST_PORT=80
|
94
|
+
- TEST_INTEGRATION=true
|
95
|
+
# volumes:
|
96
|
+
# - .:/app
|
97
|
+
# - ../../images/include:/vendor/dd-demo
|
98
|
+
# - ../../..:/vendor/dd-trace-rb
|
@@ -0,0 +1,100 @@
|
|
1
|
+
version: '3.4'
|
2
|
+
services:
|
3
|
+
app:
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
args:
|
7
|
+
BASE_IMAGE: datadog/dd-apm-demo:rb-2.7
|
8
|
+
depends_on:
|
9
|
+
- ddagent
|
10
|
+
- mysql
|
11
|
+
- redis
|
12
|
+
environment:
|
13
|
+
- BUNDLE_GEMFILE=/app/Gemfile
|
14
|
+
- DATABASE_URL=mysql2://mysql:mysql@mysql:3306
|
15
|
+
- DATABASE_ROOT_USER=root
|
16
|
+
- DATABASE_ROOT_PASSWORD=root
|
17
|
+
- DD_AGENT_HOST=ddagent
|
18
|
+
- DD_METRIC_AGENT_PORT=8125
|
19
|
+
- DD_TRACE_AGENT_PORT=8126
|
20
|
+
- DD_HEALTH_METRICS_ENABLED=true
|
21
|
+
- DD_SERVICE=acme-rails-five
|
22
|
+
- RAILS_ENV=production
|
23
|
+
- REDIS_URL=redis://redis:6379
|
24
|
+
- SECRET_KEY_BASE=5ced2602472cdf650e2cfa5be40c7d0dffd4e1da1483e21fa9c776e338b363c8bf75144bc6e6c5177a0d7a208a899552f98b3f82d4ea74cf5f9b9d3accbb1537
|
25
|
+
# Use these to choose what is run
|
26
|
+
- DD_DEMO_ENV_PROCESS=puma
|
27
|
+
- DD_DEMO_ENV_FEATURES=tracing
|
28
|
+
# Use this for a local version of ddtrace
|
29
|
+
- DD_DEMO_ENV_GEM_LOCAL_DDTRACE=/vendor/dd-trace-rb
|
30
|
+
# Use these for a specific revision of ddtrace
|
31
|
+
# - DD_DEMO_ENV_GEM_GIT_DDTRACE=https://github.com/DataDog/dd-trace-rb.git
|
32
|
+
# - DD_DEMO_ENV_GEM_REF_DDTRACE=f233336994315bfa04dac581387a8152bab8b85a
|
33
|
+
expose:
|
34
|
+
- "80"
|
35
|
+
stdin_open: true
|
36
|
+
tty: true
|
37
|
+
volumes:
|
38
|
+
- .:/app
|
39
|
+
- ./data/app:/data/app
|
40
|
+
- bundle:/usr/local/bundle
|
41
|
+
- ../../images/include:/vendor/dd-demo
|
42
|
+
- ../../..:/vendor/dd-trace-rb
|
43
|
+
ddagent:
|
44
|
+
image: datadog/dd-apm-demo:agent
|
45
|
+
environment:
|
46
|
+
- DD_APM_ENABLED=true
|
47
|
+
- DD_PROCESS_AGENT_ENABLED=false
|
48
|
+
- DD_BIND_HOST=0.0.0.0
|
49
|
+
- DD_API_KEY
|
50
|
+
- LOG_LEVEL=DEBUG
|
51
|
+
- DD_LOGS_STDOUT=yes
|
52
|
+
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
|
53
|
+
expose:
|
54
|
+
- "8125/udp"
|
55
|
+
- "8126"
|
56
|
+
volumes:
|
57
|
+
- ../../images/agent/agent.yaml:/etc/datadog-agent/datadog.yaml
|
58
|
+
# For monitoring performance of containers (e.g. CPU, Memory, etc...)
|
59
|
+
# - type: bind
|
60
|
+
# source: ../../config/agent.yaml
|
61
|
+
# target: /etc/datadog-agent/datadog.yaml
|
62
|
+
# - type: bind
|
63
|
+
# source: /var/run/docker.sock
|
64
|
+
# target: /var/run/docker.sock:ro
|
65
|
+
# - type: bind
|
66
|
+
# source: /proc/
|
67
|
+
# target: /host/proc/:ro
|
68
|
+
# - type: bind
|
69
|
+
# source: /sys/fs/cgroup/
|
70
|
+
# target: /host/sys/fs/cgroup:ro
|
71
|
+
mysql:
|
72
|
+
image: mysql:5.6
|
73
|
+
environment:
|
74
|
+
- MYSQL_DATABASE=acme_production
|
75
|
+
- MYSQL_ROOT_PASSWORD=root
|
76
|
+
- MYSQL_ROOT_HOST=%
|
77
|
+
- MYSQL_PASSWORD=mysql
|
78
|
+
- MYSQL_USER=mysql
|
79
|
+
expose:
|
80
|
+
- "3306"
|
81
|
+
redis:
|
82
|
+
image: redis:3.0
|
83
|
+
expose:
|
84
|
+
- "6379"
|
85
|
+
load-tester:
|
86
|
+
build:
|
87
|
+
context: ../../images
|
88
|
+
dockerfile: wrk/Dockerfile
|
89
|
+
command: -t10 -c10 -d43200s -s /scripts/scenarios/basic/default.lua http://app/basic/default
|
90
|
+
depends_on:
|
91
|
+
- app
|
92
|
+
environment:
|
93
|
+
- HEALTH_CHECK_URL=http://app/health
|
94
|
+
- HEALTH_CHECK_INTERVAL=1
|
95
|
+
- HEALTH_CHECK_MAX_ATTEMPTS=30
|
96
|
+
volumes:
|
97
|
+
- ./data/wrk:/data
|
98
|
+
- ../../images/wrk/scripts:/scripts
|
99
|
+
volumes:
|
100
|
+
bundle:
|