下面列出了怎么用com.codahale.metrics.graphite.GraphiteReporter的API类实例代码及写法,或者点击链接到github查看源代码。
protected void initGraphiteReporter() {
if (!this.conf.findBooleanEntry("GRAPHITE_METRICS_ENABLED", false)) {
logger.debug("Graphite Metrics are disabled");
return;
}
logger.debug("Graphite Metrics are enabled");
final String prefix = this.conf.findStringEntry("GRAPHITE_METRICS_PREFIX", "emissary");
final String host = this.conf.findStringEntry("GRAPHITE_METRICS_HOST", "localhost");
final int port = this.conf.findIntEntry("GRAPHITE_METRICS_PORT", 2003);
final int interval = this.conf.findIntEntry("GRAPHITE_METRICS_INTERVAL", -1);
final TimeUnit intervalUnit = TimeUnit.valueOf(this.conf.findStringEntry("GRAPHITE_METRICS_INTERVAL_UNIT", TimeUnit.MINUTES.name()));
final TimeUnit rateUnit = TimeUnit.valueOf(this.conf.findStringEntry("GRAPHITE_RATE_UNIT", TimeUnit.SECONDS.name()));
final TimeUnit durationUnit = TimeUnit.valueOf(this.conf.findStringEntry("GRAPHITE_DURATION_UNIT", TimeUnit.MILLISECONDS.name()));
final Graphite graphite = new Graphite(new InetSocketAddress(host, port));
final GraphiteReporter graphiteReporter =
GraphiteReporter.forRegistry(this.metrics).prefixedWith(prefix).convertRatesTo(rateUnit).convertDurationsTo(durationUnit)
.filter(MetricFilter.ALL).build(graphite);
if (interval > 0) {
graphiteReporter.start(interval, intervalUnit);
}
}
@Override
public void report(MetricRegistry metricRegistry) {
JbootMetricGraphiteReporterConfig config = Jboot.config(JbootMetricGraphiteReporterConfig.class);
if (StrUtil.isBlank(config.getHost())) {
throw new NullPointerException("graphite reporter host must not be null, please config jboot.metrics.reporter.graphite.host in you properties.");
}
if (config.getPort() == null) {
throw new NullPointerException("graphite reporter port must not be null, please config jboot.metrics.reporter.graphite.port in you properties.");
}
if (config.getPrefixedWith() == null) {
throw new NullPointerException("graphite reporter prefixedWith must not be null, please config jboot.metrics.reporter.graphite.prefixedWith in you properties.");
}
Graphite graphite = new Graphite(new InetSocketAddress(config.getHost(), config.getPort()));
GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith(config.getPrefixedWith())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(1, TimeUnit.MINUTES);
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
public static void startReporters(MetricRegistry registry) {
// Graphite reporter to Grafana Cloud
OkHttpClient client = new OkHttpClient.Builder()
//.addNetworkInterceptor(HttpClient.getLoggingInterceptor())
.build();
if (!Configs.properties().hasPath("metrics.graphite.host")
|| !Configs.properties().hasPath("metrics.grafana.api_key")) {
log.info("Missing metrics reporter key or host skipping");
return;
}
String graphiteHost = Configs.properties().getString("metrics.graphite.host");
String grafanaApiKey = Configs.properties().getString("metrics.grafana.api_key");
final GraphiteHttpSender graphite = new GraphiteHttpSender(client, graphiteHost, grafanaApiKey);
final GraphiteReporter reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(Metrics.metricPrefix("stubbornjava"))
.convertRatesTo(TimeUnit.MINUTES)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(10, TimeUnit.SECONDS);
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
/**
* Configure Dropwizard helper.
* @param graphiteHost graphite server host
* @param port graphits server port
* @param tu time unit
* @param period reporting period
* @param vopt Vert.x options
* @param hostName logical hostname for this node (reporting)
*/
public static void config(String graphiteHost, int port, TimeUnit tu,
int period, VertxOptions vopt, String hostName) {
final String registryName = "okapi";
MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions();
metricsOpt.setEnabled(true).setRegistryName(registryName);
vopt.setMetricsOptions(metricsOpt);
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, port));
final String prefix = "folio.okapi." + hostName;
GraphiteReporter reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(prefix)
.build(graphite);
reporter.start(period, tu);
logger.info("Metrics remote {}:{} this {}", graphiteHost, port, prefix);
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
public static void startReporters(MetricRegistry registry) {
// Graphite reporter to Grafana Cloud
OkHttpClient client = new OkHttpClient.Builder()
//.addNetworkInterceptor(HttpClient.getLoggingInterceptor())
.build();
if (!Configs.properties().hasPath("metrics.graphite.host")
|| !Configs.properties().hasPath("metrics.grafana.api_key")) {
log.info("Missing metrics reporter key or host skipping");
return;
}
String graphiteHost = Configs.properties().getString("metrics.graphite.host");
String grafanaApiKey = Configs.properties().getString("metrics.grafana.api_key");
final GraphiteHttpSender graphite = new GraphiteHttpSender(client, graphiteHost, grafanaApiKey);
final GraphiteReporter reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(Metrics.metricPrefix("stubbornjava"))
.convertRatesTo(TimeUnit.MINUTES)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(10, TimeUnit.SECONDS);
}
@PostConstruct
private void init() {
Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED, Boolean.class, false);
if (graphiteEnabled) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = propertyResolver.getRequiredProperty(PROP_HOST);
Integer graphitePort = propertyResolver.getRequiredProperty(PROP_PORT, Integer.class);
String graphitePrefix = propertyResolver.getProperty(PROP_GRAPHITE_PREFIX, String.class, "");
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED, Boolean.class, false);
if (graphiteEnabled) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = propertyResolver.getRequiredProperty(PROP_HOST);
Integer graphitePort = propertyResolver.getRequiredProperty(PROP_PORT, Integer.class);
String graphitePrefix = propertyResolver.getProperty(PROP_GRAPHITE_PREFIX, String.class, "");
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
private void createReporter(String metricFilter, String environment, String serviceName, String version, MetricRegistry metricRegistry) {
// optionally filter metrics to send to graphite server
MetricFilter filter = MetricFilter.FILTER_NONE;
if (!(Strings.isNullOrEmpty(metricFilter) || "*".equals(metricFilter))) {
filter = new MetricFilter(metricFilter);
}
this.filter = filter;
this.graphiteReporter = GraphiteReporter
.forRegistry(metricRegistry)
.prefixedWith(getPreFix(environment, serviceName, version))
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(filter)
.build(graphite);
}
@Test
public void shouldHandlePostMount() {
bundle.init(container, configuration);
MetricRegistry metricRegistry = mock(MetricRegistry.class);
JmxReporter jmxReporter = mock(JmxReporter.class);
GraphiteReporter graphiteReporter = mock(GraphiteReporter.class);
doReturn(metricRegistry).when(bundle).createMetricRegistry();
doReturn(jmxReporter).when(bundle).createJmxReporter(metricRegistry);
doReturn(graphiteReporter).when(bundle).createGraphiteReporter(eq(configuration.getGraphiteReporterConfiguration()), eq(metricRegistry));
bundle.postMount(application);
verify(jmxReporter).start();
verify(graphiteReporter).start(configuration.getGraphiteReporterConfiguration().getPollPeriodInSecs(), TimeUnit.SECONDS);
}
@Inject
public MetricsFactoryImpl(MetricsFig metricsFig) {
registry = new MetricRegistry();
String metricsHost = metricsFig.getHost();
if (!metricsHost.equals("false")) {
Graphite graphite = new Graphite(new InetSocketAddress(metricsHost, 2003));
graphiteReporter = GraphiteReporter.forRegistry(registry).prefixedWith("usergrid-metrics")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL)
.build(graphite);
graphiteReporter.start(30, TimeUnit.SECONDS);
} else {
logger.warn("MetricsService:Logger not started.");
}
jmxReporter = JmxReporter.forRegistry(registry).build();
jmxReporter.start();
}
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("graphite");
if (!config.getBoolean("enable", false)) {
return Collections.emptyList();
}
String host = config.getString("host");
String prefix = config.getString("prefix", "");
int port = config.getInt("port", 8080);
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
Graphite graphite = new Graphite(host, port);
GraphiteReporter reporter =
GraphiteReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit)
.convertRatesTo(rateUnit).prefixedWith(prefix).build(graphite);
reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);
log.info("Reporting metrics to graphite server {}:{}", host, port);
return Collections.singletonList((AutoCloseable) reporter);
}
@Override
public void configureReporters(MetricRegistry registry) {
if (graphiteEndpoint != null) {
log.info("Starting Graphite reporter");
reporter = registerReporter(GraphiteReporter
.forRegistry(registry)
.prefixedWith(MetricRegistry.name("road", "truck-park", "host", getHostname(), "road", roadName))
.convertRatesTo(SECONDS)
.convertDurationsTo(MILLISECONDS)
.build(new Graphite(graphiteEndpoint)));
}
}
@Bean
@ConditionalOnProperty(prefix = "metrics.graphite", name = "enabled", havingValue = "true")
ScheduledReporter graphiteReporter(GraphiteProperties graphiteProperties, MetricRegistry metricRegistry) {
final Graphite graphite = new Graphite(graphiteProperties.getHost(), graphiteProperties.getPort());
final ScheduledReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith(graphiteProperties.getPrefix())
.build(graphite);
reporter.start(graphiteProperties.getInterval(), TimeUnit.SECONDS);
return reporter;
}
@Override
public ScheduledReporter newInstance(String qualifiedReplicaName) {
InetSocketAddress address = new InetSocketAddressFactory().newInstance(graphiteHost);
Graphite graphite = new Graphite(address);
String prefix = DotJoiner.join(graphitePrefix, qualifiedReplicaName);
return GraphiteReporter.forRegistry(runningMetricRegistry).prefixedWith(prefix).build(graphite);
}
private ScheduledReporter createAndGetConfiguredGraphiteReporter(String prefix, String graphiteHost) {
LOG.info("Configuring Graphite reporter. Sendig data to host:port {}", graphiteHost);
HostAndPort addr = HostAndPort.fromString(graphiteHost);
final Graphite graphite = new Graphite(
new InetSocketAddress(addr.getHostText(), addr.getPort()));
return GraphiteReporter.forRegistry(metrics)
.prefixedWith(prefix)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
}
@Override
protected ScheduledReporter getReporter(Map<String, Object> configuration, MetricRegistry registry) {
Object namespace = configuration.get(Configuration.GRAPHITE_NAMESPACE);
Object hostname = configuration.get(Configuration.GRAPHITE_HOSTNAME);
Object port = configuration.get(Configuration.GRAPHITE_PORT);
Objects.requireNonNull(namespace, String.format("Configuration required: %s", Configuration.GRAPHITE_NAMESPACE));
Objects.requireNonNull(hostname, String.format("Configuration required: %s", Configuration.GRAPHITE_HOSTNAME));
Objects.requireNonNull(port, String.format("Configuration required: %s", Configuration.GRAPHITE_PORT));
registry.register(MetricRegistry.name("jvm", "gc"), new GarbageCollectorMetricSet());
registry.register(MetricRegistry.name("jvm", "threads"), new ThreadStatesGaugeSet());
registry.register(MetricRegistry.name("jvm", "classes"), new ClassLoadingGaugeSet());
registry.register(MetricRegistry.name("jvm", "fd"), new FileDescriptorRatioGauge());
registry.register(MetricRegistry.name("jvm", "memory"), new MemoryUsageGaugeSet());
ScheduledReporter reporter = GraphiteReporter
.forRegistry(registry)
.prefixedWith(namespace.toString())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.SECONDS)
.build(new Graphite(new InetSocketAddress(hostname.toString(), Integer.parseInt(port.toString()))));
reporter.start(1L, TimeUnit.MINUTES);
return reporter;
}
@Before
public void setUp(TestContext context) {
String graphiteHost = System.getProperty("graphiteHost");
final String registryName = "okapi";
MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
// Note the setEnabled (true or false)
DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions().
setEnabled(false).setRegistryName(registryName);
vertx = Vertx.vertx(new VertxOptions().setMetricsOptions(metricsOpt));
reporter1 = ConsoleReporter.forRegistry(registry).build();
reporter1.start(1, TimeUnit.SECONDS);
if (graphiteHost != null) {
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, 2003));
reporter2 = GraphiteReporter.forRegistry(registry)
.prefixedWith("okapiserver")
.build(graphite);
reporter2.start(1, TimeUnit.MILLISECONDS);
}
DeploymentOptions opt = new DeploymentOptions()
.setConfig(new JsonObject().put("port", Integer.toString(port)));
vertx.deployVerticle(MainVerticle.class.getName(),
opt, context.asyncAssertSuccess());
httpClient = vertx.createHttpClient();
}
@Override
public synchronized Reporter getReporter(MetricRegistry registry) {
if (null == reporter) {
Graphite graphite = new Graphite(new InetSocketAddress(graphiteURL, graphitePort));
reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(prefix)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
}
return reporter;
}
@Override
public void init(List<KafkaMetric> list) {
super.init(list);
InetSocketAddress address = new InetSocketAddress(
config.getString(DropwizardReporterConfig.GRAPHITE_HOST_PROPERTY_NAME),
config.getInt(DropwizardReporterConfig.GRAPHITE_PORT_PROPERTY_NAME));
graphite = new Graphite(address);
reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(config.getString(DropwizardReporterConfig.GRAPHITE_PREFIX_PROPERTY_NAME))
.build(graphite);
LOGGER.info("Starting the reporter");
reporter.start(11, TimeUnit.SECONDS);
}
@Override
protected void configure() {
bind(GraphiteSender.class).toProvider(GraphiteSenderProvider.class);
bind(GraphiteReporter.class).toProvider(GraphiteReporterProvider.class);
addConfigBeans();
addInitializer(MetricsGraphiteReporterService.class);
}
@Override
public GraphiteReporter get() {
return GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith(configuration.getPrefix())
.convertRatesTo(configuration.getUnitRates())
.convertDurationsTo(configuration.getUnitDurations())
.filter(new RegexMetricFilter(configuration.getIncludeMetrics()))
.build(graphiteSender);
}
@Test
public void get() throws Exception {
final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration();
final GraphiteSender graphiteSender = new GraphiteUDP("127.0.0.1", 12345);
final MetricRegistry metricRegistry = new MetricRegistry();
final GraphiteReporterProvider provider = new GraphiteReporterProvider(configuration, graphiteSender, metricRegistry);
final GraphiteReporter reporter = provider.get();
assertNotNull(reporter);
}