New Relic APM agents now support OpenTelemetry (OTel) APIs, allowing you to instrument your applications using vendor-neutral OpenTelemetry APIs while maintaining full access to New Relic's powerful APM features. This capability gives you the flexibility to write portable instrumentation code without sacrificing the depth of insights and features that New Relic provides.
Benefits
Using OpenTelemetry API support with New Relic agents provides several advantages:
Vendor-neutral instrumentation: Write custom instrumentation using standard OpenTelemetry APIs that work across observability platforms
No migration required: Enable OTel API support in your existing New Relic agent without replacing your current instrumentation
Gradual adoption: Use OpenTelemetry APIs for new custom instrumentation while existing New Relic instrumentation continues to work
Mixed-mode compatibility: Seamlessly trace requests across services instrumented with New Relic agents, OpenTelemetry APIs, or pure OTel agents
Community instrumentation: Leverage native OpenTelemetry instrumentation for frameworks and libraries
What this feature provides
When you enable OpenTelemetry API support in a New Relic agent, the agent can:
Capture spans, traces, metrics, and logs created using OpenTelemetry APIs
Integrate OTel-generated telemetry seamlessly into New Relic APM traces
Support native OpenTelemetry instrumentation that doesn't conflict with New Relic's built-in instrumentation
Maintain trace context across mixed New Relic and OpenTelemetry instrumented services
重要
This feature is disabled by default. You must explicitly enable it through agent configuration.
Supported languages and features
OpenTelemetry API support is available for the following New Relic APM agents:
Language
Minimum version
Traces API
Metrics API
Logs API
Span links
Events on spans
Java
[9.1.0]
Node.js
[13.13.0]
.NET
[10.49.0]
See note below
Python
[11.5.0]
See note below
Ruby
[10.2.0]
ヒント
.NET and Python logs: The .NET agent already uses the logging library that became the OpenTelemetry API for log data. The Python agent already supports the logging module. For backwards compatibility, enabling OpenTelemetry API support does not change how these agents instrument logs.
Sampling in Mixed Environments
All agents now support trace ratio sampling, aligning with OpenTelemetry standards and ensuring consistent sampling logic across mixed environments.
Key benefits:
Consistent sampling decisions across New Relic and OTel-instrumented services
Preservation of upstream trace decisions from OTel SDKs
For details on how adaptive sampling works, sampling targets per agent, and configuration options, see Distributed tracing sampling.
Supported instrumentation types
Native instrumentation (automatic)
Native OpenTelemetry instrumentation is supported out of the box. These instrumentations are built directly into the library or framework by its maintainer and automatically work when you enable OpenTelemetry API support.
The specific native instrumentations available vary by language agent. See the configuration section for details on which instrumentations are supported for each language.
重要
Known limitation: Some native instrumentations may produce slightly different span names or metric names compared to New Relic's built-in instrumentation due to differences in OpenTelemetry semantic conventions (for example, Elasticsearch, RabbitMQ).
Custom instrumentation with OpenTelemetry APIs
You can write custom instrumentation using the standard OpenTelemetry APIs:
Traces: Create custom spans and add attributes using the OpenTelemetry Tracing API
Metrics: Record custom metrics using the OpenTelemetry Metrics API (where supported)
Logs: Write logs using the OpenTelemetry Logs API (where supported)
The Java agent instruments the OpenTelemetry trace, metrics, and logs APIs to capture signals emitted by your application. It does not ship or automatically enable any OpenTelemetry instrumentations. OpenTelemetry auto-instrumentation is not supported.
Supported instrumentation types
Manual instrumentation
Custom instrumentation using the OpenTelemetry trace, metrics, or logs APIs will be automatically captured by the agent.
Library and native instrumentation
OpenTelemetry standalone library instrumentations and native instrumentation built directly into libraries will work with the New Relic agent. However, OpenTelemetry bytecode-based auto-instrumentation will not be detected by the New Relic agent.
Enable OpenTelemetry API support
Enable OpenTelemetry API support in your newrelic.js configuration file:
exports.config={
// ... other config
opentelemetry:{
enabled:true,
traces:{
enabled:true
}
}
// ... other config
}
重要
The Node.js agent does not automatically enable any OpenTelemetry instrumentations. It only instruments the OpenTelemetry APIs to capture telemetry emitted by your application.
Supported OpenTelemetry APIs
When OpenTelemetry support is enabled, the Node.js agent fully supports:
The Metrics API is the most useful feature for Node.js customers. It expands the metrics collection capability to include dimensional metrics, a frequently requested feature.
The JavaScript OpenTelemetry Logs API is still in development, but the Node.js agent supports it. You can use the API to emit logs that will be shipped to New Relic.
Customers who instrument their applications with the OpenTelemetry API will find that the agent processes and ships that data correctly.
Native and library instrumentation (limited)
The list of OpenTelemetry instrumentations has significant overlap with the Node.js agent's supported modules. Instrumentations that are not already covered by the New Relic agent may:
Conflict with agent internals
Not have sufficient customer demand
注意
We have not tested OpenTelemetry instrumentations outside of the official OpenTelemetry list and cannot recommend specific ones at this time.
Known limitations
No automatic instrumentations: The agent does not automatically enable OpenTelemetry instrumentations. Customers must manually instrument their code using OpenTelemetry APIs.
Enable OpenTelemetry API support
Enable OpenTelemetry API support using either environment variables or the newrelic.config XML configuration file.
Using environment variables:
bash
$
NEW_RELIC_OPENTELEMETRY_ENABLED=true
Using newrelic.config:
<configuration>
<openTelemetryenabled="true"/>
</configuration>
ヒント
Traces and Metrics are both enabled by default when OpenTelemetry support is enabled.
Supported native instrumentations
When you enable OpenTelemetry API support, the .NET agent can capture telemetry from OpenTelemetry-instrumented libraries.
Traces instrumentations
The agent supports libraries with native OpenTelemetry tracing instrumentation. Custom instrumentation written using the OpenTelemetry Tracing API is also supported.
Metrics instrumentations
When metrics are enabled, the agent supports OpenTelemetry metric instrumentations from libraries and frameworks. Custom instrumentation written using the OpenTelemetry Metrics API is also supported.
Logs instrumentations
The .NET agent already instruments the logging library that became the OpenTelemetry API for log data. No changes are required for logs when enabling OpenTelemetry API support. For backwards compatibility, log instrumentation continues to work as before.
Enable OpenTelemetry API support
Enable OpenTelemetry API support in your newrelic.ini configuration file or using environment variables:
Using newrelic.ini:
[newrelic]
opentelemetry.enabled=true
Using environment variable:
bash
$
NEW_RELIC_OPENTELEMETRY_ENABLED=true
重要
When OpenTelemetry support is enabled, the agent will automatically detect if opentelemetry-api is installed and switch to using OpenTelemetry instrumentation for supported libraries.
How it works
When OpenTelemetry support is enabled and the agent detects opentelemetry-api is installed:
Native instrumentation: For libraries with native OpenTelemetry instrumentation built in, the agent automatically disables New Relic's hooks and uses the native OpenTelemetry instrumentation instead.
Library instrumentation: If an OpenTelemetry instrumentation library is detected, the agent automatically uses the OpenTelemetry instrumentation instead of New Relic's instrumentation hooks.
Some instrumentations (such as AWS and gRPC libraries) will continue to use New Relic's instrumentation. AI libraries with native instrumentation are explicitly disabled for now and will be supported in a future release.
Manual instrumentation
Any custom instrumentation written using the OpenTelemetry Tracing API will be captured by the agent.
Example:
from opentelemetry import trace
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("my-custom-span")as span:
span.set_attribute("custom.attribute","value")
# Your code here
Supported features
Traces API
✅ Fully supported: Create custom spans and add attributes using the OpenTelemetry Tracing API
Metrics API
❌ Not yet supported: OpenTelemetry Metrics API is not enabled in the Python agent
Logs API
✅ Already works: The agent already supports the logging module. There is no OpenTelemetry API for logging in Python (only an SDK exists). What OpenTelemetry configures for logging is whether it's enabled and which endpoints to send data to.
How it works
When OpenTelemetry support is enabled:
Agent searches the system to determine if OpenTelemetry instrumentation libraries are installed
Automatic switching: If found, the agent uses the OpenTelemetry library's instrumentation instead of New Relic's hooks
Seamless integration: OpenTelemetry spans are integrated into New Relic traces
Known limitations
Metrics not supported: OpenTelemetry Metrics API is not yet enabled
Some AWS and gRPC libraries excluded: Will continue to use New Relic instrumentation
AI libraries disabled: Native OpenTelemetry instrumentation for AI libraries is disabled for now
Include/exclude settings: Fine-tuning options are planned for future releases but only enable/disable is currently functional
Enable OpenTelemetry API support
To enable OpenTelemetry API support in the Ruby agent, add the following to your newrelic.yml configuration file:
opentelemetry:
enabled:true
Or set the environment variable:
bash
$
NEW_RELIC_OPENTELEMETRY_ENABLED=true
Supported features
Traces API
✅ Supported: Create custom spans and add attributes using the OpenTelemetry Tracing API
Metrics API
❌ Not supported: OpenTelemetry Metrics API
Logs API
❌ Not supported: OpenTelemetry Logs API
Span Links
❌ Not supported: Span Links
Events on Spans
❌ Not supported: Events on Spans
How it works
The Ruby agent detects the presence of the OpenTelemetry API installation and instruments OpenTelemetry APIs for Tracing to generate telemetry. When a library or your application code calls OpenTelemetry APIs, the New Relic Ruby agent translates those calls into New Relic data if OpenTelemetry support is enabled.
Requirement: The OpenTelemetry API must be present in your application for the hybrid agent functionality to work.
Supported instrumentations
The Ruby agent works with three types of OpenTelemetry instrumentation:
1. Native instrumentation
Libraries with built-in OpenTelemetry instrumentation calls are supported. When these libraries make calls to the OpenTelemetry API, the Ruby agent captures and translates them into New Relic telemetry.
If you install gems from the opentelemetry-ruby-contrib repository, their calls to OpenTelemetry APIs will be processed and transformed into New Relic data.
For a comprehensive list of available Ruby instrumentation, consult the OpenTelemetry registry.
3. Custom/manual instrumentation
When OpenTelemetry support is enabled, calling OpenTelemetry APIs in your application code will generate New Relic telemetry automatically.
Known limitations
Limited API support: Only Traces API is supported in this release
Metrics and Logs: Not available
Exclude list: Work is ongoing to automate the prevention of duplicate telemetry when both OpenTelemetry and New Relic have instrumented the same methods. For now, you may need to manually disable one instrumentation to prevent duplicates.
Span Links and Events: Not currently supported
Verify it's working
After enabling OpenTelemetry API support, verify that it's working:
Deploy your application with the updated agent configuration.
If using custom instrumentation, ensure your code is creating spans/metrics using OpenTelemetry APIs.
View distributed traces to see spans created by OpenTelemetry APIs integrated into your traces
Limitations and known issues
Instrumentation limitations
Limitation
Description
Library instrumentation not supported
OpenTelemetry library instrumentations that require separate package installation are not supported in this release. Only native instrumentations that are built directly into the library by its maintainer work automatically.
Java bytecode instrumentation not detected
Java OpenTelemetry auto-instrumentation that uses bytecode manipulation will not be detected by the New Relic Java agent.
Semantic convention differences
Some OpenTelemetry instrumentations use different naming conventions for spans and metrics compared to New Relic's built-in instrumentation:
Elasticsearch: Span names and operation names may differ in casing and length
RabbitMQ: Distributed tracing works differently (span links vs. parent/child relationships)
ヒント
These differences may affect existing dashboards and alert conditions that rely on specific span or metric names. Review and update your queries if you switch from New Relic instrumentation to OpenTelemetry instrumentation for these services.
Agent-specific limitations
Python: Only Traces API is supported; Metrics and Logs APIs are not available
Ruby: Only Traces API is supported; Metrics and Logs APIs are not available
.NET: Enabling OpenTelemetry metrics may increase dimensional metric ingest costs
Troubleshooting
OpenTelemetry spans not appearing in traces
If you've enabled OpenTelemetry API support but don't see OTel-generated spans in your traces:
Check your agent configuration to confirm OpenTelemetry support is enabled:
Review environment variables or configuration files
Check agent logs for confirmation that OpenTelemetry support is active
Ensure you've restarted your application after changing configuration
Confirm you're running the minimum required agent version that supports OpenTelemetry APIs. See the supported languages table above.
Need help?
If you're experiencing issues with OpenTelemetry API support, please reach out to New Relic Support for assistance.