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.
- 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.
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.
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.
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.
- ...See a complete list of languages in GitHub
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.
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)
Both approaches require a New Relic Insights insert key, so keep it handy.
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.
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:
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:
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.