@Test
public void testExportCounter() {

    AlibabaMetricsExports exports = new AlibabaMetricsExports(clock);
    Counter c1 = new BucketCounterImpl(1, 5, clock);
    MetricManager.getIMetricManager().register("test",
            MetricName.build("prom.test.counter").level(MetricLevel.CRITICAL), c1);
    for (int i = 0; i < 10; i++) {
        c1.inc();
    }
    clock.addSeconds(1);
    List<Collector.MetricFamilySamples> samples = exports.collect();
    Assert.assertEquals(2, samples.size());
    Assert.assertEquals("prom_test_counter_count", samples.get(0).name);
    Assert.assertEquals(10, samples.get(0).samples.get(0).value, 0.0001d);
    Assert.assertEquals("prom_test_counter_bucket_count", samples.get(1).name);
    Assert.assertEquals(10, samples.get(1).samples.get(0).value, 0.0001d);
}