Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Tracer Plugin for the Java SpecialAgent which provides automatic OpenTracing-based instrumentation for 3rd-party Java libraries

License

Notifications You must be signed in to change notification settings

newrelic/newrelic-tracer-java

Archived header

Archival Notice

❗Notice: This project has been archived as is and is no longer actively maintained.

OpenTracing has been superseded by OpenTelemetry and it is highly recommended that you move all projects to OpenTelemetry at this time. Please see the links below to learn more about how to send data from OpenTelemetry data sources to the New Relic platform.

The current recommended approaches for sending OpenTelemetry data to the New Relic platform are as follows:

  • Configure your OpenTelemetry data source to send data to the OpenTelemetry Collector using the OpenTelemetry Protocol (OTLP) and configure the collector to forward the data using the New Relic collector exporter.
  • Configure your OpenTelemetry data source to send data to the native OpenTelemetry Protocol (OTLP) data ingestion endpoint. OTLP is an open source gRPC based protocol for sending telemetry data. The protocol is vendor agnostic and open source.

For more details please see:


New Relic OpenTracing Tracer Plugin

An OpenTracing TracerFactory that utilizes the OpenTelemetry TraceShim to convert to an OpenTelemetry Tracer. This functions as a Tracer Plugin for the Java SpecialAgent which provides automatic OpenTracing-based instrumentation for 3rd-party Java libraries.

Data collected by the Tracer is sent to New Relic by the New Relic OpenTelemetry Exporter.

⚠️ NOTICE: The Tracer Plugin utilizes the Alpha v0.2 release of OpenTelemetry APIs. OpenTelemetry APIs are subject to change while approaching a stable release and are not yet recommended for use in production environments.

Provided Instrumentation

See Instrumentation plugins and rules for lists of all instrumentation provided by the SpecialAgent.

Getting Started

See Usage

Usage

The Tracer Plugin has not yet been publish but can be built and added to a project as a jar file dependency.

Gradle:

dependencies {
    implementation files('libs/newrelic-tracer-java-0.2.0-SNAPSHOT-all.jar')
}

To use with manual OpenTracing instrumentation simply create an instance of the NewRelicTracerFactory and get a Tracer implementation from it via getTracer():

NewRelicTracerFactory newRelicTracerFactory = new NewRelicTracerFactory();
Tracer newrelicTracer = newRelicTracerFactory.getTracer();

To use the Tracer Plugin with the Java Special Agent for OpenTracing simply add system properties such as the following to the run configuration of your service:

-javaagent:path/to/opentracing-specialagent-1.5.7. -Dsa.tracer=./libs/newrelic-tracer-java-0.2.0-SNAPSHOT-all.jar -Dsa.log.level=INFO -Dnr.apiKey=XXX -Dnr.serviceName="MyService"

Building

  • Requirements: Java 8 or greater

./gradlew shadowJar

Configuration

A New Relic API insert key is required to send data to New Relic. The API insert key can be configured directly via a system property or with an optional config file.

Config Mechanisms

(Option 1) Individual system properties

-Dnr.apiKey=123xyz -Dnr.serviceName=foo

(Option 2) Config file nr_tracer.properties specified by the Java SpecialAgent system property

-Dsa.config=nr_tracer.properties

with the contents:

nr.apiKey=123xyz
nr.serviceName=foo

Additionally, while this is subject to change, the OC_RESOURCE_LABELS OpenConsensus environment variable currently will decorate the generated OpenTelemetry spans with attributes that you specify:

export OC_RESOURCE_LABELS="service.name=foo,env=prod,host=bar"

Config Properties

List of all configurable Tracer properties

Config Key Value Required
nr.apiKey New Relic Insights API Insert key Yes
nr.serviceName Display name of service, sets service.name on the spans No

Testing

TODO

Support

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

If the issue has been confirmed as a bug or is a feature request, file a GitHub issue.

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 newrelic-tracer-java! 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. We also host a community project page dedicated to New Relic OpenTracing Tracer Plugin.

Licensing

The newrelic-tracer-java is licensed under the Apache 2.0 License.

The newrelic-tracer-java may use 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 THIRD_PARTY_NOTICES.md.

About

Tracer Plugin for the Java SpecialAgent which provides automatic OpenTracing-based instrumentation for 3rd-party Java libraries

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages