public static Counter counter(MonitoringInfoMetricName metricName) {
    return new DelegatingCounter(metricName);
  }
@Test
  public void testCounterDoesNotFailOperationsWhenNoMetricsContainerPresent() {
    MetricsEnvironment.setCurrentContainer(null);
    assertNull(MetricsEnvironment.getCurrentContainer());
    HashMap<String, String> labels = new HashMap<String, String>();
    String urn = MonitoringInfoConstants.Urns.ELEMENT_COUNT;
    MonitoringInfoMetricName name = MonitoringInfoMetricName.named(urn, labels);

    Counter counter = LabeledMetrics.counter(name);
    counter.inc();
    counter.inc(5L);
    counter.dec();
    counter.dec(5L);
  }