public void recordLatency(String node, long requestLatencyMs) {
        if (!node.isEmpty()) {
            String nodeTimeName = "node-" + node + ".latency";
            Sensor nodeRequestTime = this.metrics.getSensor(nodeTimeName);
            if (nodeRequestTime != null)
                nodeRequestTime.record(requestLatencyMs);
        }
    }
@Test
    public void testSingleNodeLatency() {
        String connectionId = "0";
        MetricName nodeLatencyAvg = metrics.metricName("request-latency-avg", group);
        MetricName nodeLatencyMax = metrics.metricName("request-latency-max", group);
        registerNodeLatencyMetric(connectionId, nodeLatencyAvg, nodeLatencyMax);

        adminFetchMetricsManager.recordLatency(connectionId, 333);
        mockSleepTimeWindow();
        adminFetchMetricsManager.recordLatency(connectionId, 444);
        assertEquals(388.5, metricValue(nodeLatencyAvg), EPSILON);
        assertEquals(444, metricValue(nodeLatencyMax), EPSILON);
        adminFetchMetricsManager.recordLatency(connectionId, 666);
        assertEquals(481, metricValue(nodeLatencyAvg), EPSILON);
        assertEquals(666, metricValue(nodeLatencyMax), EPSILON);

        // first record(333) expired
        mockSleepTimeWindow();
        assertEquals(555, metricValue(nodeLatencyAvg), EPSILON);
        assertEquals(666, metricValue(nodeLatencyMax), EPSILON);

        // all records expired
        mockSleepTimeWindow();
        assertTrue(Double.isNaN(metricValue(nodeLatencyAvg)));
        assertTrue(Double.isNaN(metricValue(nodeLatencyMax)));
    }