cameronhotchkies / micrometer-registry-newrelic

Micrometer registry implementation that sends data to New Relic as dimensional metrics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Relic Micrometer registry

A Micrometer metrics registry for sending dimensional metrics to New Relic using the New Relic Java Telemetry SDK.

This registry should be able to be used both within a Spring Boot application, or any application that uses micrometer for recording metrics.

Note: the micrometer project currently includes a NewRelicMeterRegistry that writes metrics to NewRelic as custom events. This implementation is intended to supersede that, as dimensional metrics are a better fit for micrometer metrics than custom events.

Usage:

  1. via gradle:

    implementation 'com.newrelic.telemetry:micrometer-registry-new-relic:0.5.0'

    Note: you might need to also include a dependency on micrometer-core itself, for example:

    implementation 'io.micrometer:micrometer-core:1.2.2'

  2. via maven:

    <dependency>
        <groupId>com.newrelic.telemetry</groupId>
        <artifactId>micrometer-registry-new-relic</artifactId>
        <version>0.5.0</version>
    </dependency>
  1. The registry class is io.micrometer.newrelic.NewRelicRegistry. It will need to be built via a io.micrometer.NewRelicRegistryConfig implementation. An example of how you might do that is in the wiki: Spring-Config-Example

In order to send metrics to New Relic, you will also need an Insights Insert API Key. Please see New Relic Api Keys for more information.

And, that's it! For details on what your metrics will look like once they are reported, please see the Micrometer exporter spec.

Javadoc for this project can be found here: Javadocs

Building

CI builds are run on Azure Pipelines: Build Status

The project uses gradle 5 for building, and the gradle wrapper is provided.

To compile, run the tests and build the jar:

$ ./gradlew build

Find and use your data

For tips on how to find and query your data, see Find metric data.

For general querying information, see:

Release Process

Publish to Staging Repo

To stage the release simply submit and merge a PR to update the build.gradle.kts file with the version to be released (e.g. version := "0.5.0").

Results of the job can be viewed here: https://dev.azure.com/NRAzurePipelines/Java%20CI/_build

After the staging release job has run successfully it will publish the new artifact to a staging repository on Sonatype at: https://oss.sonatype.org/#stagingRepositories.

Manually Release Staging Repo

  1. Find the staging repo on Sonatype, which should be named similar to comnewrelic-nnnn, and validate that the contents and version look correct.
  2. If the contents look correct, select the staging repo and choose close, leaving a comment such as releasing 0.5.0.
  3. When the staging repo is finished closing, select the staging repo and choose release, keeping the Automatically Drop checkbox checked, and leave a comment such as releasing 0.5.0.
  4. Verify that the artifact was published on Maven Central at: https://repo1.maven.org/maven2/com/newrelic/telemetry/micrometer-registry-new-relic/

Post Release

Submit and merge a PR with the following:

  • Update the build.gradle.kts file with to a snapshot version of a potential future release (e.g. version := "0.5.1-SNAPSHOT").
  • Update the CHANGELOG with details of the new release:
    ## [0.5.0]
    - Miscellaneous bug fixes and tweaks
  • Update the Usage example in the README with the newly released version (e.g. implementation 'com.newrelic.telemetry:micrometer-registry-new-relic:0.5.0').

About

Micrometer registry implementation that sends data to New Relic as dimensional metrics.

License:Apache License 2.0


Languages

Language:Java 95.5%Language:Kotlin 4.2%Language:Shell 0.3%