/newrelic-jfr-core

JFR library that adapts JFR events to the New Relic Telemetry SDK

Primary LanguageJavaApache License 2.0Apache-2.0

Community Plus header

JFR Core

build badge

This repository contains the core New Relic JFR components. It can be used to acquire JFR events, transform them into New Relic telemetry, and then send them to New Relic (with the New Relic Telemetry SDK).

This repository contains the following modules:

  • jfr-mappers - Mappers that transform JFR RecordedEvent objects into telemetry. Also contains registries of all supported mappers.
  • jfr-daemon - An out-of-process daemon tool that uses a rotating fileset to near-continuously send telemetry to New Relic.

Installation

For general usage of the produced artifacts see JFR Mappers and JFR Daemon.

Getting Started

To build the project see Building.

Building

This project uses Java 11 and the gradle wrapper. To build it, run:

$ git clone https://github.com/newrelic/newrelic-jfr-core.git
$ cd jfr-core
$ ./gradlew build

The resulting jars of interest are:

  • jfr-mappers/build/libs/jfr-mappers-<version>.jar
  • jfr-daemon/build/libs/jfr-daemon-<version>.jar

Running tests

Unit tests are run with gradlew:

$ ./gradlew test

JFR Mappers

This module is a library of reusable JFR (Java Flight Recorder) mappers used to transform JFR RecordedEvent instances into New Relic telemetry collections that are compatible with the telemetry SDK.

We don't intend this library to be used directly. Instead, leverage tools like the jfr-daemon or the JFR reporter extension that are built upon this library.

As a dependency

Note: SNAPSHOT artifact is still preliminary.

maven dependency

<dependency>
    <groupId>com.newrelic</groupId>
    <artifactId>jfr-mappers</artifactId>
    <version>1.0.0</version>
</dependency>

gradle dependency

compile group: 'com.newrelic', name: 'jfr-mappers', version: '1.0.0'

JFR Daemon

This module builds a stand-alone process that consumes JFR events from an existing java process and sends telemetry to New Relic. This daemon process issues commands over JMX to periodically generate a series of rolling JFR files. It uses these files to build a "pseudo stream" of telemetry events.

How To Use

After building or downloading the jfr-daemon jar, you should first export the INSIGHTS_INSERT_KEY variable with your insights key:

$ export INSIGHTS_INSERT_KEY=abc123youractualkeyhere

After that, you can run the daemon like this:

$ java -jar jfr-daemon-<version>.jar 

(where <version> is the actual version number).

By default, the daemon will connect JMX to localhost on port 1099 and send data to New Relic US production metric and event ingest endpoints. If you need to change this default behavior, the following environment variables are recognized:

env var name required? default description
INSIGHTS_INSERT_KEY Y n/a The New Relic insert key for your account
NEW_RELIC_APP_NAME N(!) My Application The name of the remote applicaiton being monitored. You should probably set this so that your application shows up properly in the NR1 platform.
REMOTE_JMX_HOST N localhost The host to pull JFR data from via JMX
REMOTE_JMX_PORT N 1099 The port to pull JFR data from via JMX
METRICS_INGEST_URI N US production, EU production Where to send metric data
EVENTS_INGEST_URI N US production, EU production Where to send event data
JFR_SHARED_FILESYSTEM N false Use a shared filesystem instead of streaming data from JMX

Expose remote JMX on the application that the jfr-daemon will be attaching to by adding the following system properties:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=1099 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false

Support

Should you need assistance with New Relic products, you are in good hands with several support channels.

Support Channels

Privacy

At New Relic we take your privacy and the security of your information seriously, and are committed to protecting your information. We must emphasize the importance of not sharing personal data in public forums, and ask all users to scrub logs and diagnostic information for sensitive information, whether personal, proprietary, or otherwise.

We define “Personal Data” as any information relating to an identified or identifiable individual, including, for example, your name, phone number, post code or zip code, Device ID, IP address, and email address.

For more information, review New Relic’s General Data Privacy Notice.

Contribute

We encourage your contributions to improve [project name]! Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.

If you have any questions, or to execute our corporate CLA (which is required if your contribution is on behalf of a company), drop us an email at opensource@newrelic.com.

A note about vulnerabilities

As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

If you would like to contribute to this project, review these guidelines.

To all contributors, we thank you! Without your contribution, this project would not be what it is today.

License

jfr-core is licensed under the Apache 2.0 License.

jfr-core also uses source code from third party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the third party notices document.