Class AbstractActionStatsCollector<E extends Enum<E>>
- java.lang.Object
-
- org.pipecraft.infra.monitoring.collectors.AbstractActionStatsCollector<E>
-
- Type Parameters:
E- The enum describing the different categories to be tracked
- All Implemented Interfaces:
ActionStatsCollector<E>,JsonMonitorable
- Direct Known Subclasses:
BlockingActionStatsCollector,NonBlockingActionStatsCollector
public abstract class AbstractActionStatsCollector<E extends Enum<E>> extends Object implements ActionStatsCollector<E>
A baseline for statistics collector implementations.- Author:
- Eyal Schneider
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<E>categoriesEnumClass
-
Constructor Summary
Constructors Constructor Description AbstractActionStatsCollector(Class<E> categoriesEnumClass)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longduration()longend(E category)Indicates that an action has terminated.longend(E category, long startTime)Map<String,? extends JsonMonitorable>getChildren()net.minidev.json.JSONObjectgetOwnMetrics()protected abstract voidinnerEnd(E category, long duration)The specific implementation of the "end" operationprotected abstract voidinnerStart()The specific implementation of the "start" operationvoidstart()Indicates that an action has started.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pipecraft.infra.monitoring.collectors.ActionStatsCollector
clear, getAll, getCompletedCount, getRunning, getTotalDurationMicros, startAndEnd
-
Methods inherited from interface org.pipecraft.infra.monitoring.JsonMonitorable
getFullMetrics
-
-
-
-
Method Detail
-
start
public void start()
Description copied from interface:ActionStatsCollectorIndicates that an action has started. Must be followed by end(category).- Specified by:
startin interfaceActionStatsCollector<E extends Enum<E>>
-
duration
public long duration()
- Specified by:
durationin interfaceActionStatsCollector<E extends Enum<E>>- Returns:
- The current duration (in microseconds) of the started action. Returns an undefined value if no action has been started yet.
-
end
public long end(E category)
Description copied from interface:ActionStatsCollectorIndicates that an action has terminated.- Specified by:
endin interfaceActionStatsCollector<E extends Enum<E>>- Parameters:
category- The category to place the action stats into- Returns:
- The duration, in microseconds, of the action
-
end
public long end(E category, long startTime)
-
innerStart
protected abstract void innerStart()
The specific implementation of the "start" operation
-
innerEnd
protected abstract void innerEnd(E category, long duration)
The specific implementation of the "end" operation- Parameters:
category- The action categoryduration- The measured action duration, in micros
-
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.
-
-