docbrown/app/lib/forem_stats_drivers/datadog_driver.rb
Jamie Gaskins c15120b902
Fix ddtrace warnings at app start (#12941)
* Load HTTPClient before Datadog

The instrumentation needs it to be loaded before it can patch the
request methods.

* Don't split HTTPClient traces on domains yet

After the service explosion in Datadog APM last time, let's take a more
cautious approach.

* Turns out, we aren't even using the aws-sdk gems

This was added because we use Fog's AWS adapter, but Fog uses Excon
(which we're already instrumenting) instead of the AWS SDK directly.
2021-03-08 16:27:33 -05:00

29 lines
1,012 B
Ruby

require "httpclient"
module ForemStatsDrivers
class DatadogDriver
include ActsAsForemStatsDriver
setup_driver do
Datadog.configure do |c|
c.tracer env: Rails.env
c.tracer enabled: ENV["DD_API_KEY"].present?
c.tracer partial_flush: true
c.tracer priority_sampling: true
c.use :elasticsearch
c.use :sidekiq
c.use :redis, service_name: "redis", describes: { url: ENV["REDIS_URL"] }
c.use :redis, service_name: "redis-sessions", describes: { url: ENV["REDIS_SESSIONS_URL"] }
c.use :redis, service_name: "redis-sidekiq", describes: { url: ENV["REDIS_SIDEKIQ_URL"] }
c.use :rails
c.use :http, split_by_domain: false
c.use :faraday, split_by_domain: true
c.use :excon, split_by_domain: true
c.use :httpclient, split_by_domain: false
c.use :httprb, split_by_domain: true
c.use :rest_client
c.use :concurrent_ruby
end
Datadog::Statsd.new
end
end
end