@Test
  public void testSimpleAndDerivedMetricsCalculations() {
    int numExecutorsConfigured = 4;
    int numExecutors = 2;
    int numExecutorsAvailable = 1;
    int waitQueueSizeConfigured = 10;
    int waitQueueSize = 5;
    int queuedRequests = 3;

    LlapDaemonExecutorMetrics metrics = LlapDaemonExecutorMetrics.create("test", "test", numExecutorsConfigured,
        waitQueueSizeConfigured, new int[]{1}, 1, 1, 1);
    metrics.setNumExecutors(numExecutors);
    metrics.setNumExecutorsAvailable(numExecutorsAvailable);
    metrics.setWaitQueueSize(waitQueueSize);
    metrics.setExecutorNumQueuedRequests(queuedRequests);
    Map<String, Long> data = Maps.newHashMap();
    metrics.getMetrics(new DumpingMetricsCollector(data), true);

    // Simple values
    assertTrue(numExecutorsConfigured == data.get(ExecutorNumExecutorsConfigured.name()));
    assertTrue(numExecutors == data.get(ExecutorNumExecutors.name()));
    assertTrue(waitQueueSizeConfigured == data.get(ExecutorWaitQueueSizeConfigured.name()));
    assertTrue(waitQueueSize == data.get(ExecutorWaitQueueSize.name()));
    assertTrue(queuedRequests == data.get(ExecutorNumQueuedRequests.name()));
    assertTrue(numExecutorsAvailable == data.get(ExecutorNumExecutorsAvailable.name()));

    // Derived values
    assertTrue((waitQueueSizeConfigured + numExecutorsConfigured) == data.get(ExecutorMaxFreeSlotsConfigured.name()));
    assertTrue((waitQueueSize + numExecutors) == data.get(ExecutorMaxFreeSlots.name()));
    assertTrue((waitQueueSize + numExecutorsAvailable - queuedRequests) == data.get(ExecutorAvailableFreeSlots.name()));
  }
Check for the maximum expected amount of data for TimedAverageMetrics.
15000 data point / 10 minute window / data every 50 ms.
llap-server/src/test/org/apache/hadoop/hive/llap/metrics/TestLlapDaemonExecutorMetrics.java