public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) throws Exception {
   Object value = gauge.value();
   if (value instanceof Number) {
     pushGauge(name, (Number) value, epoch);
   } else {
     LOG.debug("Gauge " + name + " had non Number value, skipped");
   }
 }
 @Override
 public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) {
   Object v = gauge.value();
   EventDSL e = newEvent().service(service(name)).time(epoch);
   if (v instanceof Integer) {
     e.metric((Integer) v).send();
   } else if (v instanceof Long) {
     e.metric((Long) v).send();
   } else if (v instanceof Double) {
     e.metric((Double) v).send();
   } else if (v instanceof Float) {
     e.metric((Float) v).send();
   } else if (v instanceof Number) {
     e.metric(((Number) v).floatValue()).send();
   }
 }
예제 #3
0
 @Test
 public void returnsAValue() throws Exception {
   assertThat("a gauge returns a value", gauge.value(), is("woo"));
 }
 @Override
 public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) throws Exception {
   sendObj(sanitizeName(name) + ".count", StatType.GAUGE, gauge.value());
 }