Example usage for java.util LongSummaryStatistics getCount

List of usage examples for java.util LongSummaryStatistics getCount

Introduction

In this page you can find the example usage for java.util LongSummaryStatistics getCount.

Prototype

public final long getCount() 

Source Link

Document

Returns the count of values recorded.

Usage

From source file:org.apache.metron.profiler.storm.ProfileBuilderBolt.java

/**
 * Logs information about the {@link TupleWindow}.
 *
 * @param window The tuple window./*from   ww w .  ja  va 2  s. c  o  m*/
 */
private void log(TupleWindow window) {
    // summarize the newly received tuples
    LongSummaryStatistics received = window.get().stream()
            .map(tuple -> getField(TIMESTAMP_TUPLE_FIELD, tuple, Long.class))
            .collect(Collectors.summarizingLong(Long::longValue));

    LOG.debug("Tuple(s) received; count={}, min={}, max={}, range={} ms", received.getCount(),
            received.getMin(), received.getMax(), received.getMax() - received.getMin());

    if (window.getExpired().size() > 0) {
        // summarize the expired tuples
        LongSummaryStatistics expired = window.getExpired().stream()
                .map(tuple -> getField(TIMESTAMP_TUPLE_FIELD, tuple, Long.class))
                .collect(Collectors.summarizingLong(Long::longValue));

        LOG.debug("Tuple(s) expired; count={}, min={}, max={}, range={} ms, lag={} ms", expired.getCount(),
                expired.getMin(), expired.getMax(), expired.getMax() - expired.getMin(),
                received.getMin() - expired.getMin());
    }
}