* 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.
16 lines
439 B
Ruby
16 lines
439 B
Ruby
class ForemStatsDriver
|
|
def initialize(*_args)
|
|
@driver = select_driver.new
|
|
end
|
|
|
|
delegate(:count, :increment, :time, :gauge, to: :@driver)
|
|
|
|
private
|
|
|
|
def select_driver
|
|
# Currently, this only supports the default Datadog driver.
|
|
# Logic will be added here for selecting the correct driver based on
|
|
# the existence of configuration files for the desired stats recipient.
|
|
ForemStatsDrivers::DatadogDriver
|
|
end
|
|
end
|