Add default DistributionFitter implementation to EventMetric

This DistributionFitter is suitable for tracking the latency of network calls.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132400538
This commit is contained in:
shikhman 2016-09-06 22:59:09 -07:00 committed by Ben McIlwain
parent 42a39b0ddc
commit 4652688585

View file

@ -41,6 +41,13 @@ import org.joda.time.Instant;
*/ */
public final class EventMetric extends AbstractMetric<Distribution> { public final class EventMetric extends AbstractMetric<Distribution> {
/**
* Default {@link DistributionFitter} suitable for latency measurements.
*
* <p>The finite range of this fitter is from 1 to 4^16 (4294967296).
*/
public static final DistributionFitter DEFAULT_FITTER = ExponentialFitter.create(16, 4.0, 1.0);
private final ConcurrentHashMap<ImmutableList<String>, Instant> valueStartTimestamps = private final ConcurrentHashMap<ImmutableList<String>, Instant> valueStartTimestamps =
newConcurrentHashMap(DEFAULT_CONCURRENCY_LEVEL); newConcurrentHashMap(DEFAULT_CONCURRENCY_LEVEL);
private final ConcurrentHashMap<ImmutableList<String>, MutableDistribution> values = private final ConcurrentHashMap<ImmutableList<String>, MutableDistribution> values =