OpenTelemetry is a flexible toolkit that you can implement in a variety of ways. We recommend a basic four-step approach for setting up OpenTelemetry with New Relic. Here's an overview of the process, followed by details for each step.
- Prerequisites
- Instrument your service with OpenTelemetry
- Send your telemetry data to New Relic
- View your data in the New Relic UI
In the following sections, we explain some basic architectural approaches, but if you want to explore other implementation options, check out OpenTelemetry architecture recipes.
Step 1. Prerequisites
First things first:
- If we don’t already know you, sign up for a free New Relic account.
- Make sure you have an Insights insert key to send spans and metrics to New Relic.
Step 2. Instrument your service with OpenTelemetry
To get started, you instrument your service with OpenTelemetry. OpenTelemetry has language-specific products and SDKs to help you. Many languages offer out-the-box instrumentation for common libraries and frameworks. Each language also provides an API for further instrumenting your service manually.
Tip
We recommend that you instrument as many services as possible to get the most benefit from distributed tracing.
Go to the repository for your language and follow the instructions to instrument your service. When you're done, return here to complete the next step of sending your telemetry data to New Relic.
- C++
- Erlang
- Go
- Java
- Javascript/Node.js
- .NET
- PHP
- Python
- Ruby
- Rust
- Swift
- ...See a complete list of languages in GitHub
Tip
For Java, you have the alternative of using our OpenTelemetry integration bundle that automatically instruments your service and exports data to New Relic. If you complete the setup for the the integration bundle, you can skip the next step and go right to Step 4: View your data in the New Relic UI.
Step 3. Send your telemetry data to New Relic
Choose how you want to export your telemetry data to New Relic:
- Use the OpenTelemetry collector (recommended)
- Use a New Relic language-specific exporter (if available)
Tip
Both of the examples below use a New Relic exporter, but we have a pre-release program if you want to try out the native OTLP exporter for sending your data to New Relic. You can either use the OTLP exporter with the OpenTelemetry collector or send us data directly from your service. If you are interested, let us know by completing this form.
You can use one or both of these approaches in your environment. We'll discuss some highlights of each approach here, but if you need more background, see Introduction to OpenTelemetry.
If you are interested in tracing, both setups provide two main options for trace sampling:
- Configure the head-based, native sampling in OpenTelemetry, which means OpenTelemetry samples traces before they are sent to New Relic. Head-based sampling doesn’t analyze all traces, but instead randomly samples traces up front before details about the completed traces are known.
- Configure tail-based sampling with New Relic Infinite Tracing, which reroutes traces to our cloud-based trace observer. The trace observer accepts all your traces and sorts through them to find useful ones. If you want to know more about this option, especially if you want to use it in the EU, see Introduction to Infinite Tracing.
Use the OpenTelemetry collector (recommended)
The OpenTelemetry project provides a tool called the OpenTelemetry Collector that you can deploy and use as an intermediate data aggregator. In your service, you use the OpenTelemetry exporter to send telemetry data first to the OpenTelemetry collector. Then, in the OpenTelemetry collector, you enable the New Relic exporter to send data to New Relic.
The diagram below shows the flow of data with the collector. If you want New Relic to analyze all your traces, you can also set up Infinite Tracing.
To use the collector:
- Configure your OpenTelemetry collector to export data to New Relic, using our example as a guide.
- Configure your service’s OTLP exporter to send data to your collector, following the documentation for your language's OTLP exporter:
Use a New Relic language-specific exporter
Tip
If you are using our Java integration bundle, you can skip this step because the export is configured automatically.
If you prefer not to use the OpenTelemetry collector, for selected languages, we offer a New Relic exporter to send data directly from your service to New Relic.
The diagram below shows the flow of data without the collector. If you want New Relic to analyze all your traces, you can also set up Infinite Tracing.
Go to the New Relic repository for your language and follow the instructions for setting up the exporter. When you are finished, return here for tips about viewing your data in the New Relic UI:
Step 4: View your data in the New Relic UI
Once you’ve instrumented your service and configured it to export its data to New Relic, you can go to New Relic and view your data.
The UI for OpenTelemetry has some similarities to the APM agent UI, so if you are familiar with that, you can go right to the UI. If you need help understanding your OpenTelemetry UI options, see View your OpenTelemetry data in New Relic.
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.