public void recordFailure(Exception exception) { recentFailures.add(1); lastResponseTime.set(new DateTime()); lastFailureException.set(exception); Throwable cause = exception; while (cause.getClass() == RuntimeException.class && cause.getCause() != null) { cause = cause.getCause(); } synchronized (this) { DecayCounter counter = failureCountByType.get(cause.getClass()); if (counter == null) { counter = new DecayCounter(ExponentialDecay.oneMinute()); failureCountByType.put(cause.getClass(), counter); } counter.add(1); } }
public Distribution(double alpha) { digest = new QuantileDigest(MAX_ERROR, alpha); total = new DecayCounter(alpha); }
public Distribution(double alpha) { digest = new QuantileDigest(MAX_ERROR, alpha); total = new DecayCounter(alpha); }
public Distribution() { digest = new QuantileDigest(MAX_ERROR); total = new DecayCounter(0); }
public TimeDistribution(double alpha, TimeUnit unit) { requireNonNull(unit, "unit is null"); digest = new QuantileDigest(MAX_ERROR, alpha); total = new DecayCounter(alpha); this.unit = unit; }
public TimeDistribution(double alpha, TimeUnit unit) { requireNonNull(unit, "unit is null"); digest = new QuantileDigest(MAX_ERROR, alpha); total = new DecayCounter(alpha); this.unit = unit; }
public TimeDistribution(TimeUnit unit) { requireNonNull(unit, "unit is null"); digest = new QuantileDigest(MAX_ERROR); total = new DecayCounter(0); this.unit = unit; }
public Distribution() { digest = new QuantileDigest(MAX_ERROR); total = new DecayCounter(0); }
public TimeDistribution(TimeUnit unit) { requireNonNull(unit, "unit is null"); digest = new QuantileDigest(MAX_ERROR); total = new DecayCounter(0); this.unit = unit; }
public void recordFailure(Exception exception) { recentFailures.add(1); lastResponseTime.set(new DateTime()); lastFailureException.set(exception); Throwable cause = exception; while (cause.getClass() == RuntimeException.class && cause.getCause() != null) { cause = cause.getCause(); } synchronized (this) { DecayCounter counter = failureCountByType.get(cause.getClass()); if (counter == null) { counter = new DecayCounter(ExponentialDecay.oneMinute()); failureCountByType.put(cause.getClass(), counter); } counter.add(1); } }
public void recordFailure(Exception exception) { recentFailures.add(1); lastResponseTime.set(new DateTime()); Throwable cause = exception; while (cause.getClass() == RuntimeException.class && cause.getCause() != null) { cause = cause.getCause(); } synchronized (this) { DecayCounter counter = failureCountByType.get(cause.getClass()); if (counter == null) { counter = new DecayCounter(ExponentialDecay.oneMinute()); failureCountByType.put(cause.getClass(), counter); } counter.add(1); } }
public void recordFailure(Exception exception) { recentFailures.add(1); lastResponseTime.set(new DateTime()); lastFailureException.set(exception); Throwable cause = exception; while (cause.getClass() == RuntimeException.class && cause.getCause() != null) { cause = cause.getCause(); } synchronized (this) { DecayCounter counter = failureCountByType.get(cause.getClass()); if (counter == null) { counter = new DecayCounter(ExponentialDecay.oneMinute()); failureCountByType.put(cause.getClass(), counter); } counter.add(1); } }
public Distribution(Distribution distribution) { synchronized (distribution) { digest = new QuantileDigest(distribution.digest); } total = new DecayCounter(distribution.total.getAlpha()); total.merge(distribution.total); }
public Distribution(Distribution distribution) { synchronized (distribution) { digest = new QuantileDigest(distribution.digest); } total = new DecayCounter(distribution.total.getAlpha()); total.merge(distribution.total); }
@Test public void testCountDecays() { TestingTicker ticker = new TestingTicker(); DecayCounter counter = new DecayCounter(ExponentialDecay.oneMinute(), ticker); counter.add(1); ticker.increment(1, TimeUnit.MINUTES); assertTrue(Math.abs(counter.getCount() - 1 / Math.E) < 1e-9); }
@Test public void testCountDecays() { TestingTicker ticker = new TestingTicker(); DecayCounter counter = new DecayCounter(ExponentialDecay.oneMinute(), ticker); counter.add(1); ticker.increment(1, TimeUnit.MINUTES); assertTrue(Math.abs(counter.getCount() - 1 / Math.E) < 1e-9); }
@Test public void testAddAfterRescale() { TestingTicker ticker = new TestingTicker(); DecayCounter counter = new DecayCounter(ExponentialDecay.oneMinute(), ticker); counter.add(1); ticker.increment(1, TimeUnit.MINUTES); counter.add(2); double expected = 2 + 1 / Math.E; assertTrue(Math.abs(counter.getCount() - expected) < 1e-9); } }
@Test public void testAddAfterRescale() { TestingTicker ticker = new TestingTicker(); DecayCounter counter = new DecayCounter(ExponentialDecay.oneMinute(), ticker); counter.add(1); ticker.increment(1, TimeUnit.MINUTES); counter.add(2); double expected = 2 + 1 / Math.E; assertTrue(Math.abs(counter.getCount() - expected) < 1e-9); } }