mirror of https://github.com/apache/nifi.git
NIFI-9222 allow ControllerStatusReportingTask to log details even when there are no Counters present on Processors (#5573)
This commit is contained in:
parent
d783e10e68
commit
b0b1a57b98
|
@ -204,27 +204,29 @@ public class ControllerStatusReportingTask extends AbstractReportingTask {
|
||||||
for (final ProcessorStatus processorStatus : processorStatuses) {
|
for (final ProcessorStatus processorStatus : processorStatuses) {
|
||||||
final Map<String, Long> counters = processorStatus.getCounters();
|
final Map<String, Long> counters = processorStatus.getCounters();
|
||||||
|
|
||||||
for (final Map.Entry<String, Long> entry : counters.entrySet()) {
|
if (counters != null && !counters.isEmpty()){
|
||||||
final String counterName = entry.getKey();
|
for (final Map.Entry<String, Long> entry : counters.entrySet()) {
|
||||||
final Long counterValue = entry.getValue() / divisor;
|
final String counterName = entry.getKey();
|
||||||
|
final Long counterValue = entry.getValue() / divisor;
|
||||||
|
|
||||||
final String counterId = processorStatus.getId() + "_" + counterName;
|
final String counterId = processorStatus.getId() + "_" + counterName;
|
||||||
final Long lastValue = lastCounterValues.getOrDefault(counterId, 0L);
|
final Long lastValue = lastCounterValues.getOrDefault(counterId, 0L);
|
||||||
|
|
||||||
lastCounterValues.put(counterId, counterValue);
|
lastCounterValues.put(counterId, counterValue);
|
||||||
|
|
||||||
if (showDeltas) {
|
if (showDeltas) {
|
||||||
final String diff = toDiff(lastValue, counterValue);
|
final String diff = toDiff(lastValue, counterValue);
|
||||||
|
|
||||||
builder.append(String.format(COUNTER_LINE_FORMAT,
|
builder.append(String.format(COUNTER_LINE_FORMAT,
|
||||||
processorStatus.getName() + "(" + processorStatus.getId() + ")",
|
processorStatus.getName() + "(" + processorStatus.getId() + ")",
|
||||||
counterName,
|
counterName,
|
||||||
counterValue + diff));
|
counterValue + diff));
|
||||||
} else {
|
} else {
|
||||||
builder.append(String.format(COUNTER_LINE_FORMAT,
|
builder.append(String.format(COUNTER_LINE_FORMAT,
|
||||||
processorStatus.getName() + "(" + processorStatus.getId() + ")",
|
processorStatus.getName() + "(" + processorStatus.getId() + ")",
|
||||||
counterName,
|
counterName,
|
||||||
counterValue));
|
counterValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue