ConduitMetrics { synchronized public static Counter registerCounter(String serviceName, String counterType, String context) { if(!isEnabled){ LOG.warn("metrics not enabled"); return null; } if (registry.getCounters().get(createName(serviceName , counterType , context)) != null) { LOG.warn("Counter with name " + createName(serviceName , counterType , context )+ " already exsits"); return null; } Counter counterInst = registry.counter(createName(serviceName , counterType , context)); addToCache(serviceName, counterType, context, counterInst); return counterInst; }  static void init(Properties config); static void startAll(); static void stopAll(); static AbsoluteGauge registerAbsoluteGauge(String serviceName,
                                                    String counterType,
                                                    String context); static AbsoluteGauge registerAbsoluteGauge(String name,
      Number initalValue); static void updateAbsoluteGauge(String serviceName,
                                         String counterType,
                                         String context, Number value); @SuppressWarnings("rawtypes") static Gauge registerGauge(String name, Gauge gaugeInst); synchronized static Counter registerCounter(String serviceName,
      String counterType, String context); @SuppressWarnings("unchecked") static T getMetric(String serviceName,
			String counterType, String context); static void incCounter(String serviceName, String counterType,
      String context ,long value); static SlidingTimeWindowGauge registerSlidingWindowGauge(String serviceName,
	      String counterType, String context); static void updateSWGuage(String serviceName, String counterType,
			String context, long value);  }
@Test public void testRegisterCounter() { final String counterName = "test.counter"; final String serviceName = "LocalStreamService"; final String context = "stream1"; Counter abCounter = ConduitMetrics.registerCounter(serviceName, counterName, context); Assert.assertNotNull(abCounter); abCounter = ConduitMetrics.getMetric(serviceName, counterName, context); Assert.assertNotNull(abCounter); abCounter.inc(); Assert.assertEquals(abCounter.getCount(), 1); abCounter.inc(4); Assert.assertEquals(abCounter.getCount(), 5); ConduitMetrics.incCounter(serviceName, counterName, context, 9); Assert.assertEquals(abCounter.getCount(), 14); abCounter = ConduitMetrics.registerCounter(serviceName, counterName, context); Assert.assertNull(abCounter); }