@Test
    public void testGc() {
        String dataDir = createEmptyDataDir("QuestMetricsDbGc", "metrics");
        ManualClock clock = new ManualClock();
        int days = 10; // The first metrics are this many days in the past
        clock.retreat(Duration.ofDays(10));
        Instant startTime = clock.instant();

        QuestMetricsDb db = new QuestMetricsDb(dataDir, clock);

        db.addNodeMetrics(nodeTimeseries(24 * days, Duration.ofHours(1), clock, "host1", "host2", "host3"));

        var application1 = ApplicationId.from("t1", "a1", "i1");
        var cluster1 = new ClusterSpec.Id("cluster1");
        db.addClusterMetrics(application1, Map.of(cluster1, new ClusterMetricSnapshot(clock.instant(), 30.0, 15.0)));

        assertEquals(24 * days, db.getNodeTimeseries(Duration.between(startTime, clock.instant()),
                                                              Set.of("host1")).get(0).size());
        db.gc();
        assertTrue(db.getNodeTimeseries(Duration.between(startTime, clock.instant()), Set.of("host1")).get(0).size() < 24 * 4);
        db.gc(); // no-op
        assertTrue(db.getNodeTimeseries(Duration.between(startTime, clock.instant()), Set.of("host1")).get(0).size() < 24 * 4);
    }
Print query rate from a real database.

How to use:

1. Download data from a production config server: rsync -az --progress cfgN.example.com:/data/vespa/storage/cfgN/opt/vespa/var/db/vespa/autoscaling /tmp/cfgN-questdb
2. Set application ID and cluster ID
3. Adjust start and end instant as necessary
4. Run test to print data
5. Output from test can be used as test input in {@link ClusterTimeseriesTest}
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/QuestMetricsDbTest.java