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
- Export your telemetry data to New Relic
- View your data in the New Relic UI
Step 1. Prerequisites
First things first:
- If we don't already know you, sign up for a free New Relic account.
- Copy your account license key.
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.
Go to the repository for your language and follow the instructions to instrument your service. When you're done, return here to complete Step 3. Export 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
Step 3. Export your telemetry data to New Relic
The OpenTelemetry Protocol, or OTLP for short, is a general purpose telemetry data delivery protocol designed for the OpenTelemetry project. This protocol describes how to encode and transmit telemetry data, which makes it a natural choice for data transport. Each language SDK provides an OTLP exporter you can configure to export data over OTLP.
In this step, we focus on how to configure an OTLP exporter in your service to export data directly to New Relic. If you prefer to export your data first to an OpenTelemetry collector, we have separate instructions.
To complete this third step, first familiarize yourself with some required New Relic settings, and then complete the steps in the OTLP exporter documentation for your language.
Review New Relic settings for exports
Before you go to the external OTLP exporter documentation, consult the table below so you're ready to do the following:
- Configure the OTLP exporter to add a header (
api-key
) whose value is the license key for the New Relic account you want to send data to. - Based on your integration, configure the endpoint where the exporter sends data to New Relic. The endpoints are region-specific, so use the one according to where your account is based. For example, use the EU endpoint if your account is based in Europe.
Integration | gRPC | HTTP | Endpoint | Supported Ports | API header name | API header value | TLS encryption required |
---|---|---|---|---|---|---|---|
US OTLP | ✅ | ✅ |
|
| License key | ✅ | |
EU OTLP | ✅ | ✅ |
|
| License key | ✅ | |
US FedRamp OTLP | ✅ | ✅ |
|
| License key | ✅ | |
Infinite Tracing | ✅ | ❌ |
|
|
| License key | ✅ |
Important
In Node.js, the opentelemetry-collector-exporter-grpc library requires additional options to enable TLS.
A note about ports
OTLP standards designate gRPC traffic to port 4317
, and HTTP traffic to port 4318
. The New Relic US FedRamp Native OTLP endpoint adheres to those specifications, as well as allowing gRPC traffic on port 443
.
However, non-FedRamp New Relic endpoints will accept both gRPC and HTTP traffic on any of the ports listed in the above chart.
A note about endpoints
Per the OpenTelemetry spec on endpoint URLs for OTLP/HTTP: If you are sending HTTP traffic and using the non-per-signal environment variable (OTEL_EXPORTER_OTLP_ENDPOINT
), you can simply set OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:{port}
and the exporter should append the appropriate path for the signal type (i.e., v1/traces
or v1/metrics
).
If you are using a per-signal environment variable (i.e., OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
and/or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
), you are required to set it with the appropriate path. For example, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://otlp.nr-data.net:4318/v1/traces
. Not doing so will result in a 404. Note that this environment variable takes precedence over the non-per-signal one.
Complete the export configuration steps
Click on the link below for your language and complete the configuration steps. When you're done, return here to complete Step 4. View your data in the New Relic UI.
- C++
- Erlang
- Go
- Java
- Javascript/Node.js
- .NET
- PHP
- Python
- Ruby
- Rust
- Swift
- ...Find additional OTLP language support in GitHub
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, watch the New Relic One user interface for your traces, metrics, and logs!
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 or how to make sure your data appears in the UI, see View your OpenTelemetry data in New Relic.
View our OpenTelemetry examples
View some of our examples for using OpenTelemetry with New Relic.
Unsupported specifications
New Relic currently supports opentelemetry-specification v1.8.0
with a few exceptions:
- Successful responses from New Relic have no response body, instead of a Protobuf-encoded response based on the data type. New Relic also responds with success after authenticating, before decoding and validation.
- Failure responses from New Relic do not include
Status.message
orStatus.details
, since OTLP clients don't use theStatus
object. - JSON-encoded Protobuf messages are not yet supported.
What's next?
After you do your initial setup, check out our best-practices guide for tips about various configurations to improve your use of OpenTelemetry and New Relic.