Code Monkey home page Code Monkey logo

newrelic-opentelemetry-integration-java's Introduction

Community Project header

New Relic OpenTelemetry Integration (Java agent)

A custom distribution of the OpenTelemetry Java agent that uses the New Relic OpenTelemetry exporter by default to send telemetry data to the New Relic platform.

Installing and using New Relic OpenTelemetry Integration

The New Relic OpenTelemetry Integration is a standard Java agent. To use it, you just need the -javaagent startup flag and the following system properties.

-javaagent:/path/to/newrelic-opentelemetry-javaagent-*-all.jar
-Dnewrelic.api.key=<Insights Insert Key>
-Dnewrelic.service.name=fun_service

Since the New Relic OpenTelemetry Integration is built using the New Relic OpenTelemetry exporter it uses the same system properties.

Here is an example that overrides the endpoints where metric and span data is sent (e.g. EU region instead of default US region) and increases the logging level.

-javaagent:/path/to/newrelic-opentelemetry-javaagent-*-all.jar
-Dnewrelic.api.key=<Insights Insert Key>
-Dnewrelic.service.name=fun_service
-Dio.opentelemetry.javaagent.slf4j.simpleLogger.log.com.newrelic.telemetry=debug
-Dnewrelic.enable.audit.logging=true
-Dnewrelic.trace.uri.override=https://trace-api.eu.newrelic.com/trace/v1
-Dnewrelic.metric.uri.override=https://metric-api.eu.newrelic.com/metric/v1

Here is the list and description of all configurable properties for the New Relic OpenTelemetry exporter.

Find and use your data

Go to one.newrelic.com, search for your service name, and ๐ŸŒŸ

If you don't see your service, try running with debug and audit logging to confirm telemetry batches are being successfully sent. Here is an example of what you might see:

[Thread-6] DEBUG com.newrelic.telemetry.spans.SpanBatchSender - Sending a span batch (number of spans: 4) to the New Relic span ingest endpoint)
[Thread-6] DEBUG com.newrelic.telemetry.spans.json.SpanBatchMarshaller - Generating json for span batch.
[Thread-6] DEBUG com.newrelic.telemetry.transport.BatchDataSender - Response from New Relic ingest API: code: 202, body: {"requestId":"28fa2622-0001-b000-0000-01761fc2a899"}
[Thread-6] DEBUG com.newrelic.telemetry.TelemetryClient - Telemetry batch sent

For tips on how to find and query your data in New Relic, see Find trace/span data.

For general querying information, see:

Published Artifacts

Group Name Link Description
com.newrelic.telemetry newrelic-opentelemetry-javaagent Maven The java agent

Building

Requirements:

  • JDK 8+

To build run the following command:

./gradlew assemble

Testing

Requirements:

  • JDK 8+
  • Docker

smoke-tests contains simple tests to verify that the resulting agent builds and applies correctly.

To run the smoke tests run the following command:

./gradlew test

Example

To see the New Relic OpenTelemetry Integration in action we will be using the Spring Pet Clinic sample application.

First build the New Relic OpenTelemetry Integration, as described in the Building section, or download the jar file from here.

Next, follow the steps in the Running petclinic locally section but when executing the jar, add the java agent, service name, and insights insert key like below:

java -javaagent:/path/to/newrelic-opentelemetry-javaagent-*-all.jar -Dnewrelic.api.key=<Insights Insert Key> -Dnewrelic.service.name=pet-clinic -jar target/*.jar

Once running click around http://localhost:8080 a bit and then go to one.newrelic.com. In the upper right click on the magnifying glass and search for pet-clinic. There should be an "Integration-reported service" named pet-clinic. Click on that and you should see data coming in!

Support

New Relic hosts and moderates an online forum where you can interact with New Relic employees as well as other customers to get help and share best practices. Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub. You can find this project's topic/threads here:

Support Channels

Contributing

We encourage contributions to improve the New Relic OpenTelemetry Integration (Java Agent)! Keep in mind 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, required if your contribution is on behalf of a company, please drop us an email at [email protected].

License

The New Relic OpenTelemetry Integration (Java Agent) is licensed under the Apache 2.0 License.

The New Relic OpenTelemetry Integration (Java Agent) also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.

newrelic-opentelemetry-integration-java's People

Contributors

gfuller1 avatar grahamfuller1 avatar jack-berg avatar jasonjkeller avatar mmfred avatar tangollama avatar tspring avatar xixiapdx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.