Search in sources :

Example 1 with PortInfo

use of com.datatorrent.stram.webapp.PortInfo in project apex-core by apache.

the class StreamingContainerManager method fillPhysicalOperatorInfo.

private OperatorInfo fillPhysicalOperatorInfo(PTOperator operator) {
    OperatorInfo oi = new OperatorInfo();
    oi.container = operator.getContainer().getExternalId();
    oi.host = operator.getContainer().host;
    oi.id = Integer.toString(operator.getId());
    oi.name = operator.getName();
    oi.className = operator.getOperatorMeta().getOperator().getClass().getName();
    oi.status = operator.getState().toString();
    if (operator.isUnifier()) {
        oi.unifierClass = operator.getUnifierClass().getName();
    }
    oi.logicalName = operator.getOperatorMeta().getName();
    OperatorStatus os = operator.stats;
    oi.recordingId = os.recordingId;
    oi.totalTuplesProcessed = os.totalTuplesProcessed.get();
    oi.totalTuplesEmitted = os.totalTuplesEmitted.get();
    oi.tuplesProcessedPSMA = os.tuplesProcessedPSMA.get();
    oi.tuplesEmittedPSMA = os.tuplesEmittedPSMA.get();
    oi.cpuPercentageMA = os.cpuNanosPMSMA.getAvg() / 10000;
    oi.latencyMA = os.latencyMA.getAvg();
    oi.failureCount = operator.failureCount;
    oi.recoveryWindowId = toWsWindowId(operator.getRecoveryCheckpoint().windowId);
    oi.currentWindowId = toWsWindowId(os.currentWindowId.get());
    if (os.lastHeartbeat != null) {
        oi.lastHeartbeat = os.lastHeartbeat.getGeneratedTms();
    }
    if (os.checkpointStats != null) {
        oi.checkpointTime = os.checkpointStats.checkpointTime;
        oi.checkpointStartTime = os.checkpointStats.checkpointStartTime;
    }
    oi.checkpointTimeMA = os.checkpointTimeMA.getAvg();
    for (PortStatus ps : os.inputPortStatusList.values()) {
        PortInfo pinfo = new PortInfo();
        pinfo.name = ps.portName;
        pinfo.type = "input";
        pinfo.totalTuples = ps.totalTuples;
        pinfo.tuplesPSMA = Math.round(ps.tuplesPMSMA.getAvg() * 1000);
        pinfo.bufferServerBytesPSMA = Math.round(ps.bufferServerBytesPMSMA.getAvg() * 1000);
        pinfo.queueSizeMA = ps.queueSizeMA.getAvg();
        pinfo.recordingId = ps.recordingId;
        oi.addPort(pinfo);
    }
    for (PortStatus ps : os.outputPortStatusList.values()) {
        PortInfo pinfo = new PortInfo();
        pinfo.name = ps.portName;
        pinfo.type = "output";
        pinfo.totalTuples = ps.totalTuples;
        pinfo.tuplesPSMA = Math.round(ps.tuplesPMSMA.getAvg() * 1000);
        pinfo.bufferServerBytesPSMA = Math.round(ps.bufferServerBytesPMSMA.getAvg() * 1000);
        pinfo.recordingId = ps.recordingId;
        oi.addPort(pinfo);
    }
    oi.counters = os.getLastWindowedStats().size() > 0 ? os.getLastWindowedStats().get(os.getLastWindowedStats().size() - 1).counters : null;
    oi.metrics = os.getLastWindowedStats().size() > 0 ? os.getLastWindowedStats().get(os.getLastWindowedStats().size() - 1).metrics : null;
    return oi;
}
Also used : PortInfo(com.datatorrent.stram.webapp.PortInfo) OperatorStatus(com.datatorrent.stram.plan.physical.OperatorStatus) LogicalOperatorStatus(com.datatorrent.stram.plan.logical.LogicalOperatorStatus) PortStatus(com.datatorrent.stram.plan.physical.OperatorStatus.PortStatus) LogicalOperatorInfo(com.datatorrent.stram.webapp.LogicalOperatorInfo) OperatorInfo(com.datatorrent.stram.webapp.OperatorInfo)

Aggregations

LogicalOperatorStatus (com.datatorrent.stram.plan.logical.LogicalOperatorStatus)1 OperatorStatus (com.datatorrent.stram.plan.physical.OperatorStatus)1 PortStatus (com.datatorrent.stram.plan.physical.OperatorStatus.PortStatus)1 LogicalOperatorInfo (com.datatorrent.stram.webapp.LogicalOperatorInfo)1 OperatorInfo (com.datatorrent.stram.webapp.OperatorInfo)1 PortInfo (com.datatorrent.stram.webapp.PortInfo)1