Class: Nexaas::Auditor::StatisticsTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/nexaas/auditor/statistics_tracker.rb

Constant Summary collapse

VALID_SERVICES =
%w(log stathat)

Class Method Summary collapse

Class Method Details

.setup(service, namespace = nil) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/nexaas/auditor/statistics_tracker.rb', line 7

def self.setup(service, namespace=nil)
  raise ArgumentError,
    "unknown statistics service '#{service}'" unless VALID_SERVICES.include?(service)
  tracker = if service == 'stathat'
    key = Nexaas::Auditor.configuration.stathat_settings[:key]
    StatisticsTrackers::Stathat.new(key, namespace)
  else
    logger = Nexaas::Auditor.configuration.logger
    StatisticsTrackers::Log.new(logger, namespace)
  end
  tracker
end