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

com.github.kristofa.flume.UniformHistogramBuilder 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.UniformReservoir;

/**
 * Creates histograms with the {@link UniformReservoir}.
 * 
 * @author kristof
 */
class UniformHistogramBuilder implements HistogramBuilder {

    private int nrOfSamples;

    /**
     * Creates Histograms using {@link UniformReservoir} with default number of samples.
     */
    public UniformHistogramBuilder() {

    }

    /**
     * Creates Histograms using {@link UniformReservoir} with custom number of samples.
     * 
     * @param nrOfSamples
     */
    public UniformHistogramBuilder(final int nrOfSamples) {
        this.nrOfSamples = nrOfSamples;
    }

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

        UniformReservoir reservoir;
        if (nrOfSamples == 0) {
            reservoir = new UniformReservoir();
        } else {
            reservoir = new UniformReservoir(nrOfSamples);
        }
        return new Histogram(reservoir);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy