Sha256: 8a266b32c4a558e47fa03ef9969175508336289fe5c386c0584d3ac0b8888f20
Contents?: true
Size: 730 Bytes
Versions: 13
Compression:
Stored size: 730 Bytes
Contents
module Tronprint # Tronprint::CPUMonitor is a thread that monitors aggregate CPU usage. class TrafficMonitor attr_accessor :aggregator, :application_name # Parameters: # +aggregator+:: A Tronprint::Aggregator instance. # +application_name+:: A unique application name. def initialize(aggregator, application_name) self.aggregator = aggregator self.application_name = application_name end # The key used to store number of requests in the Aggregator. def key [application_name, 'requests'].join('/') end # Increment the total number of requests def increment aggregator.update key, 1 end def requests aggregator[key] || 0 end end end
Version data entries
13 entries across 13 versions & 1 rubygems