@Test public void doesNotReportNullGaugeValues() throws Exception { reportGauge(null); verifyNoReporting(); }
private void reportGauge(String name, Gauge gauge, long timestamp) { final EventClosure reporter = newEvent(name, timestamp, gauge.getClass().getSimpleName()); Object o = gauge.getValue(); if (o instanceof Float) { reporter.name().metric((Float) o).send(); } else if (o instanceof Double) { reporter.name().metric((Double) o).send(); } else if (o instanceof Byte) { reporter.name().metric((Byte) o).send(); } else if (o instanceof Short) { reporter.name().metric((Short) o).send(); } else if (o instanceof Integer) { reporter.name().metric((Integer) o).send(); } else if (o instanceof Long) { reporter.name().metric((Long) o).send(); } else if (o == null) { log.debug("Gauge {} has a null value", name); } else { log.debug("Gauge {} was of an unknown type: {} ", name, o.getClass().toString()); } }
RiemannReporter extends ScheduledReporter { private void reportGauge(String name, Gauge gauge, long timestamp) { final EventClosure reporter = newEvent(name, timestamp, gauge.getClass().getSimpleName()); Object o = gauge.getValue(); if (o instanceof Float) { reporter.name().metric((Float) o).send(); } else if (o instanceof Double) { reporter.name().metric((Double) o).send(); } else if (o instanceof Byte) { reporter.name().metric((Byte) o).send(); } else if (o instanceof Short) { reporter.name().metric((Short) o).send(); } else if (o instanceof Integer) { reporter.name().metric((Integer) o).send(); } else if (o instanceof Long) { reporter.name().metric((Long) o).send(); } else if (o == null) { log.debug("Gauge {} has a null value", name); } else { log.debug("Gauge {} was of an unknown type: {} ", name, o.getClass().toString()); } } }
RiemannReporter extends ScheduledReporter { private void reportGauge(String name, Gauge gauge, long timestamp) { final EventClosure reporter = newEvent(name, timestamp, gauge.getClass().getSimpleName()); Object o = gauge.getValue(); if (o instanceof Float) { reporter.name().metric((Float) o).send(); } else if (o instanceof Double) { reporter.name().metric((Double) o).send(); } else if (o instanceof Byte) { reporter.name().metric((Byte) o).send(); } else if (o instanceof Short) { reporter.name().metric((Short) o).send(); } else if (o instanceof Integer) { reporter.name().metric((Integer) o).send(); } else if (o instanceof Long) { reporter.name().metric((Long) o).send(); } else if (o == null) { log.debug("Gauge {} has a null value", name); } else { log.debug("Gauge {} was of an unknown type: {} ", name, o.getClass().toString()); } } private  RiemannReporter(MetricRegistry registry,
                            Riemann riemann,
                            Clock clock,
                            TimeUnit rateUnit,
                            TimeUnit durationUnit,
                            Float ttl,
                            String prefix,
                            String separator,
                            String localHost,
                            List<String> tags,
                            MetricFilter filter,
                            ValueFilterMap valueFilterMap); }
RiemannReporter extends ScheduledReporter { private void reportGauge(String name, Gauge gauge, long timestamp) { final EventClosure reporter = newEvent(name, timestamp, gauge.getClass().getSimpleName()); Object o = gauge.getValue(); if (o instanceof Float) { reporter.name().metric((Float) o).send(); } else if (o instanceof Double) { reporter.name().metric((Double) o).send(); } else if (o instanceof Byte) { reporter.name().metric((Byte) o).send(); } else if (o instanceof Short) { reporter.name().metric((Short) o).send(); } else if (o instanceof Integer) { reporter.name().metric((Integer) o).send(); } else if (o instanceof Long) { reporter.name().metric((Long) o).send(); } else if (o == null) { log.debug("Gauge {} has a null value", name); } else { log.debug("Gauge {} was of an unknown type: {} ", name, o.getClass().toString()); } } private  RiemannReporter(MetricRegistry registry,
                            Riemann riemann,
                            Clock clock,
                            TimeUnit rateUnit,
                            TimeUnit durationUnit,
                            Float ttl,
                            String prefix,
                            String separator,
                            String localHost,
                            List<String> tags,
                            MetricFilter filter,
                            ValueFilterMap valueFilterMap); static Builder forRegistry(MetricRegistry registry); @Override void report(SortedMap<String, Gauge> gauges,
                       SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms,
                       SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers); @Override void stop(); }
RiemannReporter extends ScheduledReporter { private void reportGauge(String name, Gauge gauge, long timestamp) { final EventClosure reporter = newEvent(name, timestamp, gauge.getClass().getSimpleName()); Object o = gauge.getValue(); if (o instanceof Float) { reporter.name().metric((Float) o).send(); } else if (o instanceof Double) { reporter.name().metric((Double) o).send(); } else if (o instanceof Byte) { reporter.name().metric((Byte) o).send(); } else if (o instanceof Short) { reporter.name().metric((Short) o).send(); } else if (o instanceof Integer) { reporter.name().metric((Integer) o).send(); } else if (o instanceof Long) { reporter.name().metric((Long) o).send(); } else if (o == null) { log.debug("Gauge {} has a null value", name); } else { log.debug("Gauge {} was of an unknown type: {} ", name, o.getClass().toString()); } } private  RiemannReporter(MetricRegistry registry,
                            Riemann riemann,
                            Clock clock,
                            TimeUnit rateUnit,
                            TimeUnit durationUnit,
                            Float ttl,
                            String prefix,
                            String separator,
                            String localHost,
                            List<String> tags,
                            MetricFilter filter,
                            ValueFilterMap valueFilterMap); static Builder forRegistry(MetricRegistry registry); @Override void report(SortedMap<String, Gauge> gauges,
                       SortedMap<String, Counter> counters,
                       SortedMap<String, Histogram> histograms,
                       SortedMap<String, Meter> meters,
                       SortedMap<String, Timer> timers); @Override void stop();  }