Nike-Inc / metrics-new-relic-insights

Reporter to send Dropwizard Metrics to New Relic Insights.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Relic Insights Dropwizard Metrics Collector

Download

This library provides a reporter for Metrics that writes to New Relic Insights.

Each of the main types of Metrics (Gauges, Counters, Histograms, Meters, Timers) have all available data (percentiles, min, max, etc. as applicable) reported as "custom metrics" in New Relic.

You can build the project with the following command:

./gradlew clean build

Reference the Jar like this in your gradle build file:

dependencies {
    compile(
        "com.nike.metrics:metrics-new-relic-insights:1.8"
    )
}

Usage

Set up your MetricRegistry like this:

NewRelicInsightsReporter reporter = NewRelicInsightsReporter.forRegistry(registry)
                .name("New Relic Metrics")
                .filter(MetricFilter.ALL)
                .rateUnit(TimeUnit.SECONDS)
                .durationUnit(TimeUnit.MILLISECONDS)
                .metricNamePrefix("")
                .build();

reporter.start(1, TimeUnit.MINUTES);

This will report all attributes of all metrics to New Relic using seconds as the rate unit and milliseconds as the duration unit. Data will be reported via the New Relic Agent once a minute.

Custom metrics in New Relic Insights

The metrics reporter will be recognized by Insights as Custom Metrics and will look something like this in your data explorer:

Custom Metrics From Dropwizard in Insights

Things like timers and Gauges have multiple attributes. In Insights these will be represented as attributes to the metric which you can see in your data explorer like this:

Custom Metric Attributes

Insights has some metric naming restrictions, you should read about them here.

About

Reporter to send Dropwizard Metrics to New Relic Insights.

License:Apache License 2.0


Languages

Language:Java 100.0%