@Test @SuppressWarnings("unchecked") public void testPutGauge() { NuxeoMetricSet metrics = new NuxeoMetricSet(MetricName.build("nuxeo", "prefix")); Integer value = Integer.valueOf(10); metrics.putGauge(() -> value, MetricName.build("special", "value")); assertNotNull(metrics.getMetrics()); assertFalse(metrics.getMetrics().isEmpty()); Metric gauge = metrics.getMetrics().get(MetricName.build("nuxeo.prefix.special.value")); assertTrue(gauge instanceof Gauge); assertTrue(metrics.getMetricNames().contains(MetricName.build("nuxeo.prefix.special.value"))); assertEquals(value, ((Gauge<Integer>) gauge).getValue()); }
public <T> void putGauge(Gauge<T> gauge, MetricName name) { metrics.put(prefixName.append(name), gauge); }
NuxeoMetricSet implements MetricSet { public <T> void putGauge(Gauge<T> gauge, MetricName name) { metrics.put(prefixName.append(name), gauge); } }
NuxeoMetricSet implements MetricSet { public <T> void putGauge(Gauge<T> gauge, MetricName name) { metrics.put(prefixName.append(name), gauge); } NuxeoMetricSet();  NuxeoMetricSet(String name, String... names);  NuxeoMetricSet(MetricName name);  NuxeoMetricSet(Supplier<Map<MetricName, Metric>> metricsSupplier, MetricName name); }
NuxeoMetricSet implements MetricSet { public <T> void putGauge(Gauge<T> gauge, MetricName name) { metrics.put(prefixName.append(name), gauge); } NuxeoMetricSet();  NuxeoMetricSet(String name, String... names);  NuxeoMetricSet(MetricName name);  NuxeoMetricSet(Supplier<Map<MetricName, Metric>> metricsSupplier, MetricName name); void putGauge(Gauge<T> gauge, MetricName name); void putGauge(Gauge<T> gauge, String name, String... names); @Override Map<MetricName, Metric> getMetrics(); MetricName getPrefixName(); Set<MetricName> getMetricNames(); }
NuxeoMetricSet implements MetricSet { public <T> void putGauge(Gauge<T> gauge, MetricName name) { metrics.put(prefixName.append(name), gauge); } NuxeoMetricSet();  NuxeoMetricSet(String name, String... names);  NuxeoMetricSet(MetricName name);  NuxeoMetricSet(Supplier<Map<MetricName, Metric>> metricsSupplier, MetricName name); void putGauge(Gauge<T> gauge, MetricName name); void putGauge(Gauge<T> gauge, String name, String... names); @Override Map<MetricName, Metric> getMetrics(); MetricName getPrefixName(); Set<MetricName> getMetricNames();  }