use of com.creditease.monitor.captureframework.spi.MonitorElemCapHandler in project uavstack by uavorg.
the class StandardMonitor method doCapture.
@Override
public void doCapture(String captureId, CaptureContext context, CapturePhase capPhase) {
if (captureId == null) {
return;
}
// step 1: see if it is a valid captureId
MonitorElement[] elems = mr.getElementByCapId(captureId);
for (MonitorElement elem : elems) {
// if the monitor element is not enabled, just skip it
if (elem.isEnabled() == false)
continue;
// step 2: get capture class
String capClassName = elem.getCapClass();
// step 3: check if there is one handler exists, if not new one
MonitorElemCapHandler caphandler = selectHandler(capClassName);
// step 4: invoke handler
if (caphandler != null) {
try {
invokeCaphandler(context, capPhase, elem, caphandler);
} catch (Exception e) {
log.error("captureHandler[" + capClassName + "] execution [" + capPhase + "] fails ", e);
// ignore
}
}
}
}
use of com.creditease.monitor.captureframework.spi.MonitorElemCapHandler in project uavstack by uavorg.
the class StandardMonitor method doPreStore.
@Override
public void doPreStore() {
MonitorRepository cmr = getRepository();
MonitorElement[] elems = cmr.getElements();
for (MonitorElement elem : elems) {
MonitorElemCapHandler caphandler = selectHandler(elem.getCapClass());
if (caphandler == null)
continue;
MonitorElementInstance[] instances = elem.getInstances();
for (MonitorElementInstance instance : instances) {
try {
caphandler.preStore(instance);
} catch (Exception e) {
log.error("captureHandler[" + caphandler.getClass().getName() + "] execution [preStore] fails ", e);
// ignore
}
}
}
}
Aggregations