Parent

Rackamole::Stash::Collector

Caches perfs and faults. If either has been seen before update their respective counts. This is used by the mole to track if a perf or exception was previously recorded.

Constants

NEVER

Attributes

app_id[R]
faults[R]
perfs[R]
expiration[R]

Public Class Methods

new( app_name, environment, expiration=24*60*60 ) click to toggle source
    # File lib/rackamole/stash/collector.rb, line 11
11:     def initialize( app_name, environment, expiration=24*60*60 )
12:       @expiration = expiration
13:       @app_id     = app_name + "_" + environment.to_s
14:       @faults     = {}
15:       @perfs      = {}
16:     end

Public Instance Methods

expire!() click to toggle source

Remove all entries that have expired

    # File lib/rackamole/stash/collector.rb, line 19
19:     def expire!
20:       expire_faults!
21:       expire_perfs!
22:     end
expire_faults!() click to toggle source

Delete all faults older than expiration

    # File lib/rackamole/stash/collector.rb, line 25
25:     def expire_faults!
26:       now = Time.now
27:       faults.each_pair do |stack, fault|
28:         if (now - fault.timestamp) >= expiration
29:           faults.delete( stack )
30:         end
31:       end
32:     end
expire_perfs!() click to toggle source

Delete all perfs older than expiration

    # File lib/rackamole/stash/collector.rb, line 35
35:     def expire_perfs!
36:       now = Time.now.utc
37:       perfs.each_pair do |path, perf|
38:         if (now - perf.timestamp) >= expiration
39:           perfs.delete( path )
40:         end
41:       end
42:     end
stash_fault( path, stack, timestamp ) click to toggle source

Log or update fault if found... Returns true if updated or false if created

    # File lib/rackamole/stash/collector.rb, line 46
46:     def stash_fault( path, stack, timestamp )
47:       fault = find_fault( path, stack )
48:       if fault
49:         fault.update( timestamp )
50:         return true
51:       end
52:       fault = create_fault( path, stack, timestamp )
53:       faults[stack] = fault
54:       false
55:     end
stash_perf( path, elapsed, timestamp ) click to toggle source

Log or update performance issue if found... Returns true if updated or false if created

    # File lib/rackamole/stash/collector.rb, line 59
59:     def stash_perf( path, elapsed, timestamp )
60:       perf = find_perf( path )
61:       if perf
62:         perf.update( timestamp )
63:         return true
64:       end
65:       perf = create_perf( path, elapsed, timestamp )
66:       perfs[path] = perf
67:       false
68:     end

Private Instance Methods

create_fault( path, stack, timestamp ) click to toggle source
    # File lib/rackamole/stash/collector.rb, line 75
75:       def create_fault( path, stack, timestamp )
76:         faults[stack] = Rackamole::Stash::Fault.new( path, stack, timestamp )
77:       end
create_perf( path, elapsed, timestamp ) click to toggle source
    # File lib/rackamole/stash/collector.rb, line 79
79:       def create_perf( path, elapsed, timestamp )
80:         perfs[path] = Rackamole::Stash::Perf.new( path, elapsed, timestamp )
81:       end
find_fault( path, stack ) click to toggle source

Check if we’ve seen a similar fault on this application

    # File lib/rackamole/stash/collector.rb, line 84
84:       def find_fault( path, stack )
85:         faults[stack]
86:       end
find_perf( path ) click to toggle source

Check if we’ve seen this perf issue on this application

    # File lib/rackamole/stash/collector.rb, line 89
89:       def find_perf( path )
90:         perfs[path]
91:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.