Search in sources :

Example 1 with StandardRepositoryStatusReport

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();
}
Also used : FlowFileEvent(org.apache.nifi.controller.repository.FlowFileEvent) StandardRepositoryStatusReport(org.apache.nifi.controller.repository.StandardRepositoryStatusReport) RingBufferEventRepository(org.apache.nifi.controller.repository.metrics.RingBufferEventRepository) Test(org.junit.Test)

Example 2 with StandardRepositoryStatusReport

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;
}
Also used : StandardRepositoryStatusReport(org.apache.nifi.controller.repository.StandardRepositoryStatusReport) FlowFileEventRepository(org.apache.nifi.controller.repository.FlowFileEventRepository) FlowFileEvent(org.apache.nifi.controller.repository.FlowFileEvent) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IOException(java.io.IOException) ConcurrentMap(java.util.concurrent.ConcurrentMap) StandardRepositoryStatusReport(org.apache.nifi.controller.repository.StandardRepositoryStatusReport)

Aggregations

FlowFileEvent (org.apache.nifi.controller.repository.FlowFileEvent)2 StandardRepositoryStatusReport (org.apache.nifi.controller.repository.StandardRepositoryStatusReport)2 IOException (java.io.IOException)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 FlowFileEventRepository (org.apache.nifi.controller.repository.FlowFileEventRepository)1 RingBufferEventRepository (org.apache.nifi.controller.repository.metrics.RingBufferEventRepository)1 Test (org.junit.Test)1