public static Predicate<? super MetricKeyable> getSelectorFromRequestedMetrics(List<String> requestedMetrics) {
        if (requestedMetrics == null || requestedMetrics.isEmpty()) {
            log.debug("Telemetry subscription has specified no metric names; telemetry will record no metrics");
            return SELECTOR_NO_METRICS;
        } else if (requestedMetrics.size() == 1 && requestedMetrics.get(0) != null && requestedMetrics.get(0).equals("*")) {
            log.debug("Telemetry subscription has specified a single '*' metric name; using all metrics");
            return SELECTOR_ALL_METRICS;
        } else {
            log.debug("Telemetry subscription has specified to include only metrics that are prefixed with the following strings: {}", requestedMetrics);
            return k -> requestedMetrics.stream().anyMatch(f -> k.key().name().startsWith(f));
        }
    }
@Test
    public void testGetSelectorFromRequestedMetrics() {
        // no metrics selector
        assertEquals(ClientTelemetryUtils.SELECTOR_NO_METRICS, ClientTelemetryUtils.getSelectorFromRequestedMetrics(Collections.emptyList()));
        assertEquals(ClientTelemetryUtils.SELECTOR_NO_METRICS, ClientTelemetryUtils.getSelectorFromRequestedMetrics(null));
        // all metrics selector
        assertEquals(ClientTelemetryUtils.SELECTOR_ALL_METRICS, ClientTelemetryUtils.getSelectorFromRequestedMetrics(Collections.singletonList("*")));
        // specific metrics selector
        Predicate<? super MetricKeyable> selector = ClientTelemetryUtils.getSelectorFromRequestedMetrics(Arrays.asList("metric1", "metric2"));
        assertNotEquals(ClientTelemetryUtils.SELECTOR_NO_METRICS, selector);
        assertNotEquals(ClientTelemetryUtils.SELECTOR_ALL_METRICS, selector);
        assertTrue(selector.test(new MetricKey("metric1.test")));
        assertTrue(selector.test(new MetricKey("metric2.test")));
        assertFalse(selector.test(new MetricKey("test.metric1")));
        assertFalse(selector.test(new MetricKey("test.metric2")));
    }