public void mark()

in core/src/main/java/com/spotify/metrics/core/DelegatingDerivingMeter.java [41:68]


    public void mark(long currentValue) {
        if (currentValue < 0) {
            throw new IllegalArgumentException("Negative values not allowed, got: " + currentValue);
        }

        long previous = lastValue.getAndSet(currentValue);

        if (previous < 0) {
            // discard initial value
            return;
        }

        long delta = currentValue - previous;

        if (delta < 0) {
            // discard negative values; the rationale is that this should only happen if the
            // outer value is reset,
            // for instance due to a restart or something. Reporting a (potentially very) large
            // negative value at that
            // point would lead to strange gaps. The other way you can get a negative value is if
            // updates occur out of
            // order, and this is expected to be extremely rare, so there's no need to deal with
            // that special case.
            return;
        }

        delegate.mark(delta);
    }