All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.kristofa.flume.SlidingWindowHistogramBuilder Maven / Gradle / Ivy

Go to download

Flume Sink that will get application submitted annotations with duration from Zipkin spans and submit them to Metrics. Metrics can be configured to send metrics to several back-ends. Today this sink supports Graphite as back-end.

There is a newer version: 2.4.2
Show newest version
package com.github.kristofa.flume;

import com.codahale.metrics.Histogram;
import com.codahale.metrics.SlidingWindowReservoir;

/**
 * {@link HistogramBuilder} that builds histogram using {@link SlidingWindowReservoir}.
 * 
 * @author adriaens
 */
class SlidingWindowHistogramBuilder implements HistogramBuilder {

    private final int nrOfMeasurements;

    /**
     * Creates a new instance.
     * 
     * @param nrOfMeasurements Number of measurements we should keep into account.
     */
    public SlidingWindowHistogramBuilder(final int nrOfMeasurements) {
        this.nrOfMeasurements = nrOfMeasurements;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Histogram buildHistogram() {

        final SlidingWindowReservoir slidingWindowReservoir = new SlidingWindowReservoir(nrOfMeasurements);
        return new Histogram(slidingWindowReservoir);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy