All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.librato.metrics.reporter.DeltaMetricSupplier Maven / Gradle / Ivy

Go to download

The LibratoReporter class runs in the background, publishing metrics to the Librato Metrics API at the specified interval.

The newest version!
package com.librato.metrics.reporter;

import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * Used to supply metrics to the delta tracker on initialization. Uses the metric name conversion
 * to ensure that the correct names are supplied for the metric.
 */
public class DeltaMetricSupplier implements DeltaTracker.MetricSupplier {
    final MetricRegistry registry;

    public DeltaMetricSupplier(MetricRegistry registry) {
        this.registry = registry;
    }

    public Map getMetrics() {
        final Map map = new HashMap();
        for (Map.Entry entry : registry.getMetrics().entrySet()) {
            // todo: ensure the name here is what we expect
            final String name = entry.getKey();
            map.put(name, entry.getValue());
        }
        return map;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy