public JmxCollector register() {
        return register(PrometheusRegistry.defaultRegistry);
    }
@Test
    public void testNameAndLabelsFromPattern() throws Exception {
        new JmxCollector(
                        "\n---\nrules:\n- pattern: `^hadoop<(service)=(DataNode), name=DataNodeActivity-ams-hdd001-50010><>(replaceBlockOpMinTime):`\n  name: hadoop_$3\n  labels:\n    `$1`: `$2`"
                                .replace('`', '"'))
                .register(prometheusRegistry);
        assertEquals(
                200,
                getSampleValue(
                        "hadoop_replaceBlockOpMinTime",
                        new String[] {"service"},
                        new String[] {"DataNode"}),
                .001);
    }