Search in sources :

Example 1 with ProcessorStatusSnapshotDTO

use of org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO in project nifi by apache.

the class DtoFactory method createProcessorStatusDto.

public ProcessorStatusDTO createProcessorStatusDto(final ProcessorStatus procStatus) {
    final ProcessorStatusDTO dto = new ProcessorStatusDTO();
    dto.setId(procStatus.getId());
    dto.setGroupId(procStatus.getGroupId());
    dto.setName(procStatus.getName());
    dto.setStatsLastRefreshed(new Date());
    dto.setRunStatus(procStatus.getRunStatus().toString());
    final ProcessorStatusSnapshotDTO snapshot = new ProcessorStatusSnapshotDTO();
    dto.setAggregateSnapshot(snapshot);
    snapshot.setId(procStatus.getId());
    snapshot.setGroupId(procStatus.getGroupId());
    snapshot.setName(procStatus.getName());
    snapshot.setFlowFilesOut(procStatus.getOutputCount());
    snapshot.setBytesOut(procStatus.getOutputBytes());
    snapshot.setFlowFilesIn(procStatus.getInputCount());
    snapshot.setBytesIn(procStatus.getInputBytes());
    snapshot.setBytesRead(procStatus.getBytesRead());
    snapshot.setBytesWritten(procStatus.getBytesWritten());
    snapshot.setTaskCount(procStatus.getInvocations());
    snapshot.setTasksDurationNanos(procStatus.getProcessingNanos());
    snapshot.setTasksDuration(FormatUtils.formatHoursMinutesSeconds(procStatus.getProcessingNanos(), TimeUnit.NANOSECONDS));
    // determine the run status
    snapshot.setRunStatus(procStatus.getRunStatus().toString());
    snapshot.setExecutionNode(procStatus.getExecutionNode().toString());
    snapshot.setActiveThreadCount(procStatus.getActiveThreadCount());
    snapshot.setType(procStatus.getType());
    StatusMerger.updatePrettyPrintedFields(snapshot);
    return dto;
}
Also used : ProcessorStatusDTO(org.apache.nifi.web.api.dto.status.ProcessorStatusDTO) ProcessorStatusSnapshotDTO(org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 ProcessorStatusDTO (org.apache.nifi.web.api.dto.status.ProcessorStatusDTO)1 ProcessorStatusSnapshotDTO (org.apache.nifi.web.api.dto.status.ProcessorStatusSnapshotDTO)1