@SuppressWarnings("unchecked")
@Test
public void testGetMetrics() {

    Counter c1 = MetricManager.getCounter("product111", MetricName.build("middleware.product.provider"));
    c1.inc();
    Meter m1 = MetricManager.getMeter("carts111", MetricName.build("shared.carts.my_cart"));
    m1.mark();
    Meter m2 = MetricManager.getMeter("carts111", MetricName.build("shared.carts.my_cart").tagged("source", "taobao"));
    m2.mark(10);
    Response productResponse = target("metrics/product111").request().accept(MediaType.APPLICATION_JSON_TYPE).get(Response.class);
    Map<String, Object> res = productResponse.readEntity(Map.class);
    Assert.assertEquals(true, res.get("success"));
    List objs = (List)res.get("data");
    // .count, .bucket_count, .qps
    Assert.assertEquals(3, objs.size());
    Response cartsResponse = target("metrics/carts111").request().accept(MediaType.APPLICATION_JSON_TYPE).get(Response.class);
    res = cartsResponse.readEntity(Map.class);
    Assert.assertEquals(true, res.get("success"));
    objs = (List)res.get("data");
    Assert.assertEquals(12, objs.size());
}