@Override
    public Map<String, Double> getValue() {
        if (!lifetimeBaseline.isSet()) { return Map.of(); }
        if (!retentionWindows.isSet()) { return Map.of(); }

        final Optional<FlowCapture> possibleCapture = doCapture();
        if (possibleCapture.isEmpty()) { return Map.of(); }

        final FlowCapture currentCapture = possibleCapture.get();

        final Map<String, Double> rates = new LinkedHashMap<>();

        this.retentionWindows.get()
                             .forEach(window -> window.baseline(currentCapture.nanoTime())
                                                      .or(() -> windowDefaultBaseline(window))
                                                      .map((baseline) -> calculateRate(currentCapture, baseline))
                                                      .orElseGet(OptionalDouble::empty)
                                                      .ifPresent((rate) -> rates.put(window.policy.policyName(), rate)));

        injectLifetime(currentCapture, rates);

        return Collections.unmodifiableMap(rates);
    }
@Test
    public void testFunctionalityWithinSecondsOfInitialization() {
        final ManualAdvanceClock clock = new ManualAdvanceClock(Instant.now());
        final LongCounter numeratorMetric = new LongCounter(MetricKeys.EVENTS_KEY.asJavaString());
        final Metric<Number> denominatorMetric = new UptimeMetric("uptime", clock::nanoTime).withUnitsPrecise(UptimeMetric.ScaleUnits.SECONDS);

        final ExtendedFlowMetric flowMetric = new ExtendedFlowMetric(clock::nanoTime, "flow", numeratorMetric, denominatorMetric);

        assertThat(flowMetric.getValue(), is(anEmptyMap()));

        clock.advance(Duration.ofSeconds(1));
        numeratorMetric.increment(17);

        // clock has advanced 1s, but we have performed no explicit captures.
        final Map<String, Double> flowMetricValue = flowMetric.getValue();
        assertThat(flowMetricValue, is(not(anEmptyMap())));
        assertThat(flowMetricValue, hasEntry("current",         17.0));
        assertThat(flowMetricValue, hasEntry("lifetime",        17.0));
    }