@Test public void incrementCounter() throws Exception { conf.setVar(HiveConf.ConfVars.HIVE_METRICS_CLASS, "org.apache.hadoop.hive.common.metrics.metrics2.CodahaleMetrics"); MetricsFactory.init(conf); assertThat(HiveMetricsHelper.incrementCounter("name")).get().isEqualTo(1L); }
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);  }