use of org.openkilda.wfm.topology.flowmonitoring.fsm.FlowLatencyMonitoringFsm.Context in project open-kilda by telstra.
the class ActionService method processTick.
/**
* Process tick.
*/
public void processTick() {
Context context = Context.builder().carrier(this).build();
fsms.values().forEach(fsm -> fsmExecutor.fire(fsm, Event.TICK, context));
}
use of org.openkilda.wfm.topology.flowmonitoring.fsm.FlowLatencyMonitoringFsm.Context in project open-kilda by telstra.
the class ActionService method processFlowLatencyMeasurement.
/**
* Check flow SLA is violated.
*/
public void processFlowLatencyMeasurement(String flowId, FlowDirection direction, Duration latency) {
String key = getFsmKey(flowId, direction);
FlowLatencyMonitoringFsm fsm = fsms.get(key);
if (fsm == null) {
Flow flow = flowRepository.findById(flowId).orElseThrow(() -> new IllegalStateException(format("Flow %s not found.", flowId)));
long maxLatency = flow.getMaxLatency() == null || flow.getMaxLatency() == 0 ? Long.MAX_VALUE : flow.getMaxLatency();
long maxLatencyTier2 = flow.getMaxLatencyTier2() == null || flow.getMaxLatencyTier2() == 0 ? Long.MAX_VALUE : flow.getMaxLatencyTier2();
fsm = fsmFactory.produce(flowId, direction.name().toLowerCase(), maxLatency, maxLatencyTier2);
fsms.put(key, fsm);
}
Context context = Context.builder().latency(latency.toNanos()).carrier(this).build();
fsm.processLatencyMeasurement(context);
}
Aggregations