public static Map<String, Object> map(String metricName, Metric metric) {
        final Map<String, Object> metricMap = Maps.newHashMap();
        metricMap.put("full_name", metricName);
        metricMap.put("name", metricName.substring(metricName.lastIndexOf(".") + 1));

        if (metric instanceof Timer) {
            metricMap.put("metric", buildTimerMap((Timer) metric));
            metricMap.put("type", "timer");
        } else if(metric instanceof Meter) {
            metricMap.put("metric", buildMeterMap((Meter) metric));
            metricMap.put("type", "meter");
        } else if(metric instanceof Histogram) {
            metricMap.put("metric", buildHistogramMap((Histogram) metric));
            metricMap.put("type", "histogram");
        } else if(metric instanceof Counter) {
            metricMap.put("metric", metric);
            metricMap.put("type", "counter");
        } else if(metric instanceof Gauge) {
            metricMap.put("metric", metric);
            metricMap.put("type", "gauge");
        } else {
            throw new IllegalArgumentException("Unknown metric type " + metric.getClass());
        }
        return metricMap;
    }
@Test
    public void mapSupportsMeter() {
        final Meter meter = new Meter();
        meter.mark();

        final Map<String, Object> map = MetricUtils.map("metric", meter);
        assertThat(map)
                .containsEntry("type", "meter")
                .extracting("metric")
                .extracting("rate")
                .extracting("total")
                .isEqualTo(1L);
    }