Sha256: e70d73849253d36cd885ccc68b0aac595541bc8ad1f4a87c200e1b1079becc34
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'instrumental/agent' require 'instrumental/configuration' require 'instrumental/intervalometer' module Instrumental @config = Configuration.new def self.configure yield @config end def self.boot! if @config.enabled? if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do @config.logger.debug('Starting a new worker process') Agent.instance.setup_and_run end PhusionPassenger.on_event(:stopping_worker_process) do @config.logger.debug('Killing worker process') Agent.instance.stop end else @config.logger.debug('Starting a new worker process') Agent.instance.setup_and_run end end end def self.config @config end def self.count(name, value=1) Agent.instance.report(:count, name, value) end def self.measure(name, value) Agent.instance.report(:measure, name, value) end def self.timer(name) start_time = Time.now yield self.measure(name, (Time.now - start_time) * 1000) # milliseconds end def self.milestone(name) Agent.instance.milestone(name) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
instrumental-0.1.7 | lib/instrumental.rb |
instrumental-0.1.6 | lib/instrumental.rb |