public Map<String, Double> getProcessorMetrics(ProcessorStatus status) { final Map<String, Double> metrics = new HashMap<>(); metrics.put(MetricNames.FLOW_FILES_RECEIVED, new Double(status.getInputCount())); metrics.put(MetricNames.FLOW_FILES_SENT, new Double(status.getOutputCount())); metrics.put(MetricNames.BYTES_READ, new Double(status.getInputBytes())); metrics.put(MetricNames.BYTES_WRITTEN, new Double(status.getOutputBytes())); metrics.put(MetricNames.ACTIVE_THREADS, new Double(status.getActiveThreadCount())); metrics.put(MetricNames.TOTAL_TASK_DURATION, new Double(status.getProcessingNanos())); return metrics; }
merged.setActiveThreadCount(merged.getActiveThreadCount() + statusToMerge.getActiveThreadCount()); merged.setTerminatedThreadCount(merged.getTerminatedThreadCount() + statusToMerge.getTerminatedThreadCount()); merged.setBytesRead(merged.getBytesRead() + statusToMerge.getBytesRead());
private void serializeProcessorStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ProcessorStatus status, final DateFormat df, final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate) { final JsonObjectBuilder builder = factory.createObjectBuilder(); final String componentType = "Processor"; final String componentName = status.getName(); if (componentMatchesFilters(componentType, componentName)) { addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate, componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "processorType", status.getType()); addField(builder, "averageLineageDurationMS", status.getAverageLineageDuration()); addField(builder, "bytesRead", status.getBytesRead()); addField(builder, "bytesWritten", status.getBytesWritten()); addField(builder, "bytesReceived", status.getBytesReceived()); addField(builder, "bytesSent", status.getBytesSent()); addField(builder, "flowFilesRemoved", status.getFlowFilesRemoved()); addField(builder, "flowFilesReceived", status.getFlowFilesReceived()); addField(builder, "flowFilesSent", status.getFlowFilesSent()); addField(builder, "inputCount", status.getInputCount()); addField(builder, "inputBytes", status.getInputBytes()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "outputBytes", status.getOutputBytes()); addField(builder, "activeThreadCount", status.getActiveThreadCount()); addField(builder, "invocations", status.getInvocations()); addField(builder, "processingNanos", status.getProcessingNanos()); arrayBuilder.add(builder.build()); } }
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.setTerminatedThreadCount(procStatus.getTerminatedThreadCount()); snapshot.setType(procStatus.getType()); StatusMerger.updatePrettyPrintedFields(snapshot); return dto; }
processorStatusCollection.add(procStat); activeGroupThreads += procStat.getActiveThreadCount(); terminatedGroupThreads += procStat.getTerminatedThreadCount(); bytesRead += procStat.getBytesRead();
ProcessorStats processorStats = new ProcessorStats(); processorStats.setActiveThreads(inputProcessorStatus.getActiveThreadCount()); processorStats.setFlowfilesReceived(inputProcessorStatus.getFlowFilesReceived()); processorStats.setBytesRead(inputProcessorStatus.getBytesRead());
private void serializeProcessorStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ProcessorStatus status, final DateFormat df, final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate) { final JsonObjectBuilder builder = factory.createObjectBuilder(); final String componentType = "Processor"; final String componentName = status.getName(); if (componentMatchesFilters(componentType, componentName)) { addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate, componentType, componentName); addField(builder, "componentId", status.getId()); addField(builder, "processorType", status.getType()); addField(builder, "averageLineageDurationMS", status.getAverageLineageDuration()); addField(builder, "bytesRead", status.getBytesRead()); addField(builder, "bytesWritten", status.getBytesWritten()); addField(builder, "bytesReceived", status.getBytesReceived()); addField(builder, "bytesSent", status.getBytesSent()); addField(builder, "flowFilesRemoved", status.getFlowFilesRemoved()); addField(builder, "flowFilesReceived", status.getFlowFilesReceived()); addField(builder, "flowFilesSent", status.getFlowFilesSent()); addField(builder, "inputCount", status.getInputCount()); addField(builder, "inputBytes", status.getInputBytes()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "outputBytes", status.getOutputBytes()); addField(builder, "activeThreadCount", status.getActiveThreadCount()); addField(builder, "invocations", status.getInvocations()); addField(builder, "processingNanos", status.getProcessingNanos()); arrayBuilder.add(builder.build()); } }