Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Update the README to include a Quick Start section
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Veitas committed Dec 2, 2013
1 parent 29c0235 commit f8838e2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
@@ -1,6 +1,27 @@
# metrics-statsd

Statsd reporter for codahale/metrics.
Statsd reporter for [codahale/metrics] (https://github.com/codahale/metrics).

## Quick Start

The 3.x version of the Metrics library now uses the builder pattern to construct reporters. Below is an example of how to
create a StatsdReporter and report out metrics every 15 seconds.

```java
final Statsd statsd = new Statsd("localhost", port);

StatsdReporter reporter StatsdReporter.forRegistry(registry)
.prefixedWith("foo")
.convertDurationsTo(TimeUnit.MILLISECONDS)
.convertRatesTo(TimeUnit.SECONDS)
.filter(MetricFilter.ALL)
.build(statsd);
reporter.start(15, TimeUnit.SECONDS);
```

If you are using Dropwizard (0.7.x +), there is an easy way to configure a Metrics reporter to be used directly from your
YAML configuration file. See (https://github.com/dropwizard/dropwizard/tree/master/dropwizard-metrics-graphite) for an
example of how to create a ReporterFactory.

## Important Notes

Expand Down

0 comments on commit f8838e2

Please sign in to comment.