* This change abstracts the DatadogStatsClient into a ForemStatsClient. The purpose of this abstraction is to set the foundation for a subsequent PR that will allow one to use New Relic for recording Forem stats, instead of Datadog, if there is a New Relic configuration found. This specific change creates an abstraction layer that can be built upon, without changing any actual default behavior. All specs still pass. * Use delegate instead of explicit methods. * Delegate instead of explicit methods. * Fix the error. * Refactor according to the suggestions in the comments. * Ooops. Stats work better when all of the code is committed. * Removing the alias of count to increment since that was done in error.
19 lines
464 B
Ruby
19 lines
464 B
Ruby
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
|
|
c.use :rails
|
|
c.use :http
|
|
end
|
|
Datadog::Statsd.new
|
|
end
|
|
end
|
|
end
|