class Metrics {

        private final Classification classification;
        private final LongAdder sumOfDurations = new LongAdder();
        private final LongAdder failedCount = new LongAdder();
        private final Recorder recorder;

        private final Histogram totalHistogram = new Histogram(HIGHEST_TRACKABLE_VALUE, NUMBER_OF_SIGNIFICANT_VALUE_DIGITS);

        public Metrics(Classification classification) {
            this.classification = classification;
            this.recorder = new Recorder(HIGHEST_TRACKABLE_VALUE, NUMBER_OF_SIGNIFICANT_VALUE_DIGITS);
        }

        public void recordValue(long duration) {<FILL_FUNCTION_BODY>}

        public void recordFailedExecution(long duration) {
            recordValue(duration);
            failedCount.increment();
        }

        public MetricsView createMetricsView() {
            Histogram histogram;
            synchronized (totalHistogram) {
                // getIntervalHistogram resets the internal histogram afterwards;
                // so we keep `totalHistogram` to not lose any measurements.
                Histogram intervalHistogram = recorder.getIntervalHistogram();
                totalHistogram.add(intervalHistogram);
                histogram = totalHistogram.copy();
            }
            return new MetricsView(
                histogram,
                sumOfDurations.longValue(),
                failedCount.longValue(),
                classification
            );
        }
    }

            // We use start and end time to calculate the duration (since we track them anyway)
            // If the system time is adjusted this can lead to negative durations
            // so we protect here against it.
            recorder.recordValue(Math.min(Math.max(0, duration), HIGHEST_TRACKABLE_VALUE));
            // we record the real duration (with no upper capping) in the sum of durations as there are no upper limits
            // for the values we record as it is the case with the histogram
            sumOfDurations.add(Math.max(0, duration));
        
<no_super_class>