in core/src/main/java/com/spotify/metrics/core/LockFreeExponentiallyDecayingReservoir.java [83:90]
private void update(long value, long timestampNanos) {
double itemWeight = weight(timestampNanos - startTick);
double priority = itemWeight / ThreadLocalRandom.current().nextDouble();
boolean mapIsFull = count >= size;
if (!mapIsFull || values.firstKey() < priority) {
addSample(priority, value, itemWeight, mapIsFull);
}
}