public void mergeMetric(String name, RuntimeMetric metric)
    {
        metrics.computeIfAbsent(name, k -> new RuntimeMetric(name, metric.getUnit())).mergeWith(metric);
    }
@Test
    public void testMergeMetric()
    {
        RuntimeStats stats1 = new RuntimeStats();
        stats1.addMetricValue(TEST_METRIC_NAME_1, NONE, 2);
        stats1.addMetricValue(TEST_METRIC_NAME_1, NONE, 3);
        stats1.addMetricValue(TEST_METRIC_NAME_NANO_1, NANO, 3);

        RuntimeStats stats2 = new RuntimeStats();
        stats2.addMetricValue(TEST_METRIC_NAME_NANO_2, NANO, 5);
        stats2.mergeMetric(TEST_METRIC_NAME_2, stats1.getMetric(TEST_METRIC_NAME_1));
        stats2.mergeMetric(TEST_METRIC_NAME_NANO_2, stats1.getMetric(TEST_METRIC_NAME_NANO_1));

        assertEquals(stats2.getMetrics().size(), 2);
        assertRuntimeMetricEquals(
                stats2.getMetric(TEST_METRIC_NAME_2),
                new RuntimeMetric(TEST_METRIC_NAME_2, NONE, 5, 2, 3, 2));
        assertRuntimeMetricEquals(
                stats2.getMetric(TEST_METRIC_NAME_NANO_2),
                new RuntimeMetric(TEST_METRIC_NAME_NANO_2, NANO, 8, 2, 5, 3));
    }