StatsManager

public class StatsManager extends Object

Object used to manage operation execution statistics.

Logically structured to look like (in RESTful representation):

   /                                   - list of components
   /:component
   /:component/:operation              - long (counter)
   /:component/:event
                    |success           - long (counter)
                    |failure           - long (counter)
                    |latency           - map of 
              /:operationWithVariants  - map of 
  
Example:
   /requests/SendFeeds    - returns {CODE_OK: 155, CODE_404: 105}
  

Nested Class Summary

class StatsManager.OperationStats Object used to log events, operations, and actions  
class StatsManager.ResetStatsRule TestRule to reset static StatsManager object for unit tests. 

Public Method Summary

static StatsManager.OperationStats
getComponent(String component)
Retrieves the StatsManager.OperationStats instance for the desired component.
static List<String>
static StatsManager
getInstance()
Returns a singleton reference to this object.
synchronized boolean
isRunning()
Determines whether the statistic capture is active.
synchronized void
mergeWithSnapshot(Object snapshot)
String
printStats()
Builds human-readable statistics string to write in logs.
synchronized void
resume()
Starts/resumes capturing statistics.
synchronized void
startFromSnapshot(Object snapshot)
synchronized void
stop()
Stops capturing all statistics.
synchronized Object

Inherited Method Summary

Public Methods

public static StatsManager.OperationStats getComponent (String component)

Retrieves the StatsManager.OperationStats instance for the desired component.

Parameters
component - name of component that defines the name space of its statistics
Returns
  • OperationStats object for specified component (create instance if needed)

public static List<String> getComponentNames ()

public static StatsManager getInstance ()

Returns a singleton reference to this object.

public synchronized boolean isRunning ()

Determines whether the statistic capture is active.

public synchronized void mergeWithSnapshot (Object snapshot)

Parameters
snapshot

public String printStats ()

Builds human-readable statistics string to write in logs.

public synchronized void resume ()

Starts/resumes capturing statistics.

public synchronized void startFromSnapshot (Object snapshot)

Parameters
snapshot

public synchronized void stop ()

Stops capturing all statistics.

public synchronized Object takeSnapshot ()

Send feedback about...

Cloud Search
Cloud Search