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
Choose how you want to export your telemetry data to New Relic:
Both approaches involve configuring your service with an OTLP exporter to send data over the OpenTelemetry Protocol (OTLP).
To do so, follow the documentation of the OTLP exporter for your service's language:
- ...Find additional OTLP language support in GitHub
New Relic's language-specific exporters for OpenTelemetry are now deprecated in favor of the OpenTelemetry collector and native OTLP endpoint options described here. If you were previously using a New Relic language-specific exporter consider signing up for the pre-release of New Relic's native OTLP endpoint.
If you are interested in tracing, there are 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. Both the OpenTelemetry collector and the native OTLP endpoint support this option.
- If you want New Relic to analyze all your traces, 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. While Infinite Tracing is not yet compatible with the native OTLP endpoint, it is still possible to configure tail-based sampling via the collector, for more information see Tail Sampling Processor.
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.
To use the collector:
- Configure your OpenTelemetry collector to export data to New Relic, using our example as a guide.
The New Relic exporter for the collector will be deprecated in the future. If you are running your own collector, you will instead be able to use the OpenTelemetry Collector's OTLP exporter When we release our native OTLP endpoint (pre-release), th If you were previously using a New Relic language-specific exporter consider using the OTLP exporter for your language and send data directly to New Relic's native OTLP endpoint (pre-release).
The example above uses a New Relic exporter, but we have a pre-release program if you want to try out the native OTLP endpoint for sending your data to New Relic. You can either use the OTLP exporter in the OpenTelemetry collector or send us data directly from your service. If you are interested, let us know by completing this form.
You can configure your service's OTLP exporter to send data directly to New Relic.
If you're running your own OpenTelemetry collector, you can use the OTLP exporter for the collector to send data to New Relic.
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.
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.