public Tuple2<Long, Double> increase(String name, ImmutableMap<String, String> labels, Double value, long windowSize, long now) {
        ID id = new ID(name, labels);
        Queue<Tuple2<Long, Double>> window = windows.computeIfAbsent(id, unused -> new PriorityQueue<>());
        synchronized (window) {
            window.offer(Tuple.of(now, value));
            long waterLevel = now - windowSize;
            Tuple2<Long, Double> peek = window.peek();
            if (peek._1 > waterLevel) {
                return peek;
            }

            Tuple2<Long, Double> result = peek;
            while (peek._1 < waterLevel) {
                result = window.poll();
                peek = window.element();
            }

            // Choose the closed slot to the expected timestamp
            if (waterLevel - result._1 <= peek._1 - waterLevel) {
                return result;
            }

            return peek;
        }
    }
@Test
    public void testPT1M() {
        double[] actuals = parameters().stream().mapToDouble(e -> {
            Tuple2<Long, Double> increase = CounterWindow.INSTANCE.increase(
                "test", ImmutableMap.<String, String>builder().build(), e._2,
                Duration.parse("PT1M").getSeconds() * 1000, e._1
            );
            return e._2 - increase._2;
        }).toArray();

        Assertions.assertArrayEquals(new double[] {0, 1d, 2d, 3d, 4d, 0d, 5d, 5d}, actuals, 0.d);
    }