Class ActionStatsMap<E extends Enum<E>>
- java.lang.Object
-
- org.pipecraft.infra.monitoring.collectors.ActionStatsMap<E>
-
- Type Parameters:
E- The enum class representing all possible categories that stats are being gathered on
- All Implemented Interfaces:
JsonMonitorable
public class ActionStatsMap<E extends Enum<E>> extends Object implements JsonMonitorable
A collection of simple statistics gathered on multiple categories. Relevant for actions that have a duration and terminate with some outcome type, belonging to a predefined set of possible types. Not thread safe.- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description ActionStatsMap(Class<E> enumType)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<E,ActionStats>getCategoryStats()Map<String,? extends JsonMonitorable>getChildren()net.minidev.json.JSONObjectgetOwnMetrics()intgetRunningCount()ActionStatsgetStats(E category)intgetTotalCompletedCount()voidsetCategoryStats(E category, long completed, long totalDuration)Sets the statistics for a specific category.voidsetRunningCount(int runningCount)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pipecraft.infra.monitoring.JsonMonitorable
getFullMetrics
-
-
-
-
Method Detail
-
getRunningCount
public int getRunningCount()
- Returns:
- The number of running actions
-
getTotalCompletedCount
public int getTotalCompletedCount()
- Returns:
- The total number of completed actions
-
getStats
public ActionStats getStats(E category)
- Parameters:
category- A statistics category- Returns:
- the category statistics
-
getCategoryStats
public Map<E,ActionStats> getCategoryStats()
- Returns:
- the category statistics (read only)
-
setRunningCount
public void setRunningCount(int runningCount)
- Parameters:
runningCount- The number of running actions
-
setCategoryStats
public void setCategoryStats(E category, long completed, long totalDuration)
Sets the statistics for a specific category.- Parameters:
category- A stats categorycompleted- The number of completed actions in the given categorytotalDuration- The total duration, in microseconds, of the completed actions of the given category
-
getOwnMetrics
public net.minidev.json.JSONObject getOwnMetrics()
- Specified by:
getOwnMetricsin interfaceJsonMonitorable- Returns:
- The json string describing the entity, not including the child entities.
-
getChildren
public Map<String,? extends JsonMonitorable> getChildren()
- Specified by:
getChildrenin interfaceJsonMonitorable- Returns:
- The monitorable children of this entity, as [id, JsonExportable] pairs. Using this method, the framework can manage a complete tree to be monitored, where every entity has a unique path.
-
-