@Override
    public List<NodeTimeseries> getNodeTimeseries(Duration period, Set<String> hostnames) {
        Instant startTime = clock().instant().minus(period);
        synchronized (lock) {
            if (hostnames.isEmpty())
                return nodeTimeseries.values().stream().map(ns -> ns.keepAfter(startTime)).toList();
            else
                return hostnames.stream()
                                .map(hostname -> nodeTimeseries.getOrDefault(hostname, new NodeTimeseries(hostname, List.of())).keepAfter(startTime))
                                .toList();
        }
    }
Lock all access for now since we modify lists inside a map
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/MemoryMetricsDb.java