use of org.apache.nifi.controller.repository.StandardRepositoryStatusReport in project nifi by apache.
the class TestRingBufferEventRepository method testAdd.
@Test
public void testAdd() throws IOException {
final RingBufferEventRepository repo = new RingBufferEventRepository(5);
long insertNanos = 0L;
for (int i = 0; i < 1000000; i++) {
final FlowFileEvent event = generateEvent();
final long insertStart = System.nanoTime();
repo.updateRepository(event);
insertNanos += System.nanoTime() - insertStart;
}
final long queryStart = System.nanoTime();
final StandardRepositoryStatusReport report = repo.reportTransferEvents(System.currentTimeMillis() - 2 * 60000);
final long queryNanos = System.nanoTime() - queryStart;
System.out.println(report);
System.out.println("Insert: " + TimeUnit.MILLISECONDS.convert(insertNanos, TimeUnit.NANOSECONDS));
System.out.println("Query: " + TimeUnit.MILLISECONDS.convert(queryNanos, TimeUnit.NANOSECONDS));
repo.close();
}
use of org.apache.nifi.controller.repository.StandardRepositoryStatusReport in project nifi by apache.
the class RingBufferEventRepository method reportTransferEvents.
@Override
public StandardRepositoryStatusReport reportTransferEvents(final long sinceEpochMillis) {
final StandardRepositoryStatusReport report = new StandardRepositoryStatusReport();
componentEventMap.entrySet().stream().map(entry -> entry.getValue().generateReport(entry.getKey(), sinceEpochMillis)).forEach(event -> report.addReportEntry(event));
return report;
}
Aggregations