
com.etsy.statsd.profiler.reporter.Reporter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of statsd-jvm-profiler Show documentation
Show all versions of statsd-jvm-profiler Show documentation
Simple JVM profiler using StatsD
package com.etsy.statsd.profiler.reporter;
import com.etsy.statsd.profiler.Arguments;
import com.google.common.base.Preconditions;
import java.util.Map;
/**
* Interface for reporters
*
* @author Andrew Johnson
*/
public abstract class Reporter {
public static final Class>[] CONSTRUCTOR_PARAM_TYPES =new Class>[]{Arguments.class};
/**
* The underlying implementation for this reporter
*/
protected T client;
public Reporter(Arguments arguments) {
Preconditions.checkNotNull(arguments);
handleArguments(arguments);
client = createClient(arguments.server, arguments.port, arguments.metricsPrefix);
}
/**
* Record a gauge value
*
* @param key The name of the gauge
* @param value The value of the gauge
*/
public abstract void recordGaugeValue(String key, long value);
/**
* Record multiple gauge values
* This is useful for reporters that can send points in batch
*
* @param gauges A map of gauge names to values
*/
public abstract void recordGaugeValues(Map gauges);
/**
* Construct the underlying client implementation for this reporter
*
* @param server The server to which to report data
* @param port The port on which the server is running
* @param prefix The prefix for metrics
* @return An instance of T, the client implementation
*/
protected abstract T createClient(String server, int port, String prefix);
/**
* Handle any additional arguments necessary for this reporter
*
* @param arguments The arguments given to the profiler agent
*/
protected abstract void handleArguments(Arguments arguments);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy