diff --git a/Gemfile3 b/Gemfile3 index 3e13228eb8..f6bc22bdd8 100644 --- a/Gemfile3 +++ b/Gemfile3 @@ -70,3 +70,4 @@ gem "rack-contrib", :git => 'https://github.com/rack/rack-contrib.git', :ref => gem "timecop", "~> 0.9.5" +gem 'ddtrace', require: 'ddtrace/auto_instrument' diff --git a/Gemfile3.lock b/Gemfile3.lock index f2c275aca3..bdbb0eb198 100644 --- a/Gemfile3.lock +++ b/Gemfile3.lock @@ -37,6 +37,15 @@ GEM bigdecimal rexml dalli (3.2.8) + datadog-ci (0.8.3) + msgpack + ddtrace (1.21.1) + datadog-ci (~> 0.8.1) + debase-ruby_core_source (= 3.3.1) + libdatadog (~> 6.0.0.2.0) + libddwaf (~> 1.14.0.0.0) + msgpack + debase-ruby_core_source (3.3.1) delayed_job (4.1.11) activesupport (>= 3.0, < 8.0) delayed_job_mongoid (3.0.0) @@ -107,6 +116,15 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) kgio (2.11.4) + libdatadog (6.0.0.2.0) + libdatadog (6.0.0.2.0-aarch64-linux) + libdatadog (6.0.0.2.0-x86_64-linux) + libddwaf (1.14.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-arm64-darwin) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -128,6 +146,7 @@ GEM mongoid_magic_counter_cache (1.1.1) mongoid rake + msgpack (1.7.2) multi_json (1.15.0) multipart-post (2.4.0) mustermann (3.0.0) @@ -235,6 +254,7 @@ DEPENDENCIES bundler codecov dalli + ddtrace delayed_job delayed_job_mongoid elasticsearch (~> 7.8.0) diff --git a/config.ru b/config.ru index 3dc94df19d..2e079ec769 100644 --- a/config.ru +++ b/config.ru @@ -20,3 +20,4 @@ use Mongoid::QueryCache::Middleware require './app' run Sinatra::Application + diff --git a/config/unicorn_tcp.rb b/config/unicorn_tcp.rb index 120ce58a52..e873d1d1d8 100644 --- a/config/unicorn_tcp.rb +++ b/config/unicorn_tcp.rb @@ -10,6 +10,15 @@ timeout 25 preload_app true +service_name = 'forum' + +require 'ddtrace' +# Add Datadog APM configuration +Datadog.configure do |c| + c.tracing.instrument :rails, service_name: service_name + c.tracing.instrument :sinatra, service_name: service_name +end + listen_host = ENV['LISTEN_HOST'] || '0.0.0.0' listen_port = ENV['LISTEN_PORT'] || '4567' listen "#{listen_host}:#{listen_port}", :tcp_nopush => true, :backlog => 512