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.
-
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'
-
via maven:
<dependency>
<groupId>com.newrelic.telemetry</groupId>
<artifactId>micrometer-registry-new-relic</artifactId>
<version>0.5.0</version>
</dependency>
- The registry class is
io.micrometer.newrelic.NewRelicRegistry
. It will need to be built via aio.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.
CI builds are run on Azure Pipelines:
The project uses gradle 5 for building, and the gradle wrapper is provided.
To compile, run the tests and build the jar:
$ ./gradlew build
For tips on how to find and query your data, see Find metric data.
For general querying information, see:
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.
- Find the staging repo on Sonatype, which should be named similar to
comnewrelic-nnnn
, and validate that the contents and version look correct. - If the contents look correct, select the staging repo and choose
close
, leaving a comment such asreleasing 0.5.0
. - When the staging repo is finished closing, select the staging repo and choose
release
, keeping theAutomatically Drop
checkbox checked, and leave a comment such asreleasing 0.5.0
. - Verify that the artifact was published on Maven Central at: https://repo1.maven.org/maven2/com/newrelic/telemetry/micrometer-registry-new-relic/
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'
).