@Override public Long value() { final ProcessGroupStatus status = latestStatus.get(); if (status == null) { return 0L; } final Long value = status.getQueuedContentSize(); return (value == null) ? 0L : value; } });
public Map<String, Double> getDataFlowMetrics(ProcessGroupStatus status) { final Map<String, Double> metrics = new HashMap<>(); metrics.put(MetricNames.FLOW_FILES_RECEIVED, new Double(status.getFlowFilesReceived())); metrics.put(MetricNames.BYTES_RECEIVED, new Double(status.getBytesReceived())); metrics.put(MetricNames.FLOW_FILES_SENT, new Double(status.getFlowFilesSent())); metrics.put(MetricNames.BYTES_SENT, new Double(status.getBytesSent())); metrics.put(MetricNames.FLOW_FILES_QUEUED, new Double(status.getQueuedCount())); metrics.put(MetricNames.BYTES_QUEUED, new Double(status.getQueuedContentSize())); metrics.put(MetricNames.BYTES_READ, new Double(status.getBytesRead())); metrics.put(MetricNames.BYTES_WRITTEN, new Double(status.getBytesWritten())); metrics.put(MetricNames.ACTIVE_THREADS, new Double(status.getActiveThreadCount())); metrics.put(MetricNames.TOTAL_TASK_DURATION, new Double(calculateProcessingNanos(status))); status.getOutputPortStatus(); return metrics; }
/** * Create a map of {@link Gauge}s for the {@link #currentStatusReference}. This methods reports the metrics as * found in the reference. * * @return map between the metric name and a {@link Gauge} to it's value. */ @Override public Map<String, Metric> getMetrics() { Map<String, Metric> metrics = new HashMap<>(); metrics.put(MetricNames.ACTIVE_THREADS, (Gauge<Integer>) () -> currentStatusReference.get().getActiveThreadCount()); metrics.put(MetricNames.BYTES_QUEUED, (Gauge<Long>) () -> currentStatusReference.get().getQueuedContentSize()); metrics.put(MetricNames.BYTES_READ, (Gauge<Long>) () -> currentStatusReference.get().getBytesRead()); metrics.put(MetricNames.BYTES_RECEIVED, (Gauge<Long>) () -> currentStatusReference.get().getBytesReceived()); metrics.put(MetricNames.BYTES_SENT, (Gauge<Long>) () -> currentStatusReference.get().getBytesSent()); metrics.put(MetricNames.BYTES_WRITTEN, (Gauge<Long>) () -> currentStatusReference.get().getBytesWritten()); metrics.put(MetricNames.FLOW_FILES_RECEIVED, (Gauge<Integer>) () -> currentStatusReference.get().getFlowFilesReceived()); metrics.put(MetricNames.FLOW_FILES_QUEUED, (Gauge<Integer>) () -> currentStatusReference.get().getQueuedCount()); metrics.put(MetricNames.FLOW_FILES_SENT, (Gauge<Integer>) () -> currentStatusReference.get().getFlowFilesSent()); metrics.put(MetricNames.TOTAL_TASK_DURATION_NANOS, (Gauge<Long>) () -> calculateProcessingNanos(currentStatusReference.get())); return metrics; }
private Map<String,Long> getLongMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String,Long> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.BYTES_RECEIVED, status, appendPgId), status.getBytesReceived()); metrics.put(appendPgId(MetricNames.BYTES_SENT, status, appendPgId), status.getBytesSent()); metrics.put(appendPgId(MetricNames.BYTES_QUEUED, status, appendPgId), status.getQueuedContentSize()); metrics.put(appendPgId(MetricNames.BYTES_READ, status, appendPgId), status.getBytesRead()); metrics.put(appendPgId(MetricNames.BYTES_WRITTEN, status, appendPgId), status.getBytesWritten()); final long durationNanos = calculateProcessingNanos(status); metrics.put(appendPgId(MetricNames.TOTAL_TASK_DURATION_NANOS, status, appendPgId), durationNanos); final long durationSeconds = TimeUnit.SECONDS.convert(durationNanos, TimeUnit.NANOSECONDS); metrics.put(appendPgId(MetricNames.TOTAL_TASK_DURATION_SECONDS, status, appendPgId), durationSeconds); return metrics; }
target.setOutputContentSize(target.getOutputContentSize() + toMerge.getOutputContentSize()); target.setQueuedCount(target.getQueuedCount() + toMerge.getQueuedCount()); target.setQueuedContentSize(target.getQueuedContentSize() + toMerge.getQueuedContentSize()); target.setBytesRead(target.getBytesRead() + toMerge.getBytesRead()); target.setBytesWritten(target.getBytesWritten() + toMerge.getBytesWritten());
snapshot.setBytesQueued(processGroupStatus.getQueuedContentSize()); snapshot.setBytesRead(processGroupStatus.getBytesRead()); snapshot.setBytesWritten(processGroupStatus.getBytesWritten());
bytesWritten += childGroupStatus.getBytesWritten(); queuedCount += childGroupStatus.getQueuedCount(); queuedContentSize += childGroupStatus.getQueuedContentSize();
addField(builder, "outputContentSize", status.getOutputContentSize()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "queuedContentSize", status.getQueuedContentSize()); addField(builder, "activeThreadCount", status.getActiveThreadCount()); addField(builder, "queuedCount", status.getQueuedCount());
instanceHealth.setQueuedContentSize(rootGroupStatus.getQueuedContentSize()); instanceHealth.setHasBulletins(!bulletinList.isEmpty()); instanceHealth.setActiveThreads(rootGroupStatus.getActiveThreadCount());
addField(builder, "outputContentSize", status.getOutputContentSize()); addField(builder, "outputCount", status.getOutputCount()); addField(builder, "queuedContentSize", status.getQueuedContentSize()); addField(builder, "activeThreadCount", status.getActiveThreadCount()); addField(builder, "queuedCount", status.getQueuedCount());