com.github.kristofa.flume.SlidingWindowHistogramBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flume-zipkin-metrics-sink Show documentation
Show all versions of flume-zipkin-metrics-sink Show documentation
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.
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);
}
}