MetricManager { public static Compass getCompass(String group, MetricName name) { IMetricManager manager = getIMetricManager(); return manager.getCompass(group, name); }  static Meter getMeter(String group, MetricName name); static Counter getCounter(String group, MetricName name); static Histogram getHistogram(String group, MetricName name); static Histogram getHistogram(String group, MetricName name, ReservoirType type); static Timer getTimer(String group, MetricName name); static Timer getTimer(String group, MetricName name, ReservoirType type); static Compass getCompass(String group, MetricName name); static Compass getCompass(String group, MetricName name, ReservoirType type); static FastCompass getFastCompass(String group, MetricName name); static ClusterHistogram getClusterHistogram(String group, MetricName name, long[] buckets); static ClusterHistogram getClusterHistogram(String group, MetricName name); static void register(String group, MetricName name, Metric metric); @SuppressWarnings("unchecked") static IMetricManager getIMetricManager(); static final IMetricManager NOP_METRIC_MANAGER; }
@Test public void testNOPCompass() { Compass compass = MetricManager.getCompass("test", MetricName.build("com.taobao.test")); Compass.Context context = compass.time(); context.stop(); context.success(); context.error("error1"); Assert.assertEquals(0, compass.getCount()); Assert.assertEquals(0, compass.getSuccessCount()); Assert.assertEquals(0, compass.getErrorCodeCounts().size()); }