Class: Appsignal::Minutely::ProbeCollection
- Defined in:
 - lib/appsignal/minutely.rb
 
Instance Method Summary collapse
- 
  
    
      #[](key)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Fetch a probe using its name.
 - 
  
    
      #clear  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    
Clears all probes from the list.
 - 
  
    
      #count  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Number of probes that are registered.
 - #each(&block) ⇒ Object private
 - 
  
    
      #initialize  ⇒ ProbeCollection 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ProbeCollection.
 - 
  
    
      #register(name, probe)  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    
Register a new minutely probe.
 
Constructor Details
#initialize ⇒ ProbeCollection
Returns a new instance of ProbeCollection.
      6 7 8  | 
    
      # File 'lib/appsignal/minutely.rb', line 6 def initialize @probes = {} end  | 
  
Instance Method Details
#[](key) ⇒ Object
Fetch a probe using its name.
      24 25 26  | 
    
      # File 'lib/appsignal/minutely.rb', line 24 def [](key) probes[key] end  | 
  
#clear ⇒ void
This method returns an undefined value.
Clears all probes from the list.
      17 18 19  | 
    
      # File 'lib/appsignal/minutely.rb', line 17 def clear probes.clear end  | 
  
#count ⇒ Integer
Returns Number of probes that are registered.
      11 12 13  | 
    
      # File 'lib/appsignal/minutely.rb', line 11 def count probes.count end  | 
  
#each(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      102 103 104  | 
    
      # File 'lib/appsignal/minutely.rb', line 102 def each(&block) probes.each(&block) end  | 
  
#register(name, probe) ⇒ void
This method returns an undefined value.
Register a new minutely probe.
Supported probe types are:
- Lambda - A lambda is an object that listens to a 
callmethod call. Thiscallmethod is called every minute. - Class - A class object is an object that listens to a 
newandcallmethod call. Thenewmethod is called when the Minutely probe thread is started to initialize all probes. This allows probes to load dependencies once beforehand. Theircallmethod is called every minute. - Class instance - A class instance object is an object that listens to
a 
callmethod call. Thecallmethod is called every minute. 
      93 94 95 96 97 98 99  | 
    
      # File 'lib/appsignal/minutely.rb', line 93 def register(name, probe) if probes.key?(name) logger.debug "A probe with the name `#{name}` is already " \ "registered. Overwriting the entry with the new probe." end probes[name] = probe end  |