@Test public void nullMetricsClass() { assertThat(HiveMetricsHelper.incrementCounter("name")).isNotPresent(); }
public static Optional<Long> incrementCounter(String name) { try { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { return Optional.of(metrics.incrementCounter(name)); } } catch (Exception e) { log.warn("Unable to increment counter {}", name, e); } return Optional.empty(); }
HiveMetricsHelper { public static Optional<Long> incrementCounter(String name) { try { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { return Optional.of(metrics.incrementCounter(name)); } } catch (Exception e) { log.warn("Unable to increment counter {}", name, e); } return Optional.empty(); } }
HiveMetricsHelper { public static Optional<Long> incrementCounter(String name) { try { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { return Optional.of(metrics.incrementCounter(name)); } } catch (Exception e) { log.warn("Unable to increment counter {}", name, e); } return Optional.empty(); }  }
HiveMetricsHelper { public static Optional<Long> incrementCounter(String name) { try { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { return Optional.of(metrics.incrementCounter(name)); } } catch (Exception e) { log.warn("Unable to increment counter {}", name, e); } return Optional.empty(); }  static Optional<Long> incrementCounter(String name); }
HiveMetricsHelper { public static Optional<Long> incrementCounter(String name) { try { Metrics metrics = MetricsFactory.getInstance(); if (metrics != null) { return Optional.of(metrics.incrementCounter(name)); } } catch (Exception e) { log.warn("Unable to increment counter {}", name, e); } return Optional.empty(); }  static Optional<Long> incrementCounter(String name);  }