Sha256: d82c5f49b8056eeb7cbc31fd7290e3189765ae28e3f8e9d8e18b2093cb565374
Contents?: true
Size: 1.21 KB
Versions: 5
Compression:
Stored size: 1.21 KB
Contents
require 'stathat' module Nexaas module Auditor module StatisticsTrackers class Stathat < Base attr_reader :logger def initialize(key, namespace=nil) @key = key.to_s @namespace = namespace.to_s @logger = Nexaas::Auditor.configuration.logger raise ArgumentError, "required Stathat EZ Key not found" if @key == '' end private # Regex to determine if the current process is a short lived kind of # script. ShortRunningProcessNamesRegex = /sidekiq|resque|delayed|rspec|rake/i def short_running_process? $0 =~ ShortRunningProcessNamesRegex end def send_track(type, full_name, value) # the default StatHat::API Ruby methods are asynchronous. If you are # using this gem in a script that is short-lived, you can use # StatHat::SyncAPI to make synchronous calls to StatHat. klass = (short_running_process? ? ::StatHat::SyncAPI : ::StatHat::API) logger.debug("[#{self.class}] calling #{klass}.ez_post_#{type}('#{full_name}', '#{@key}', #{value})") klass.send("ez_post_#{type}", full_name, @key, value) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems