• Log in

Language agents and distributed tracing

When you install new instances of the New Relic APM agents for C, Go, Java, Node.js, .NET, PHP, Python, or Ruby, standard distributed tracing is turned on by default.

This default distributed tracing for APM agents uses head-based sampling. This means that before any traces arrive at New Relic, we apply an algorithm to determine how many traces to accept and analyze. This default head-based sampling can give you basic insights into what's happening in your distributed systems.

We also offer Infinite Tracing, which we recommend because it can give you even greater visibility into your distributed systems. This option uses tail-based sampling, which means that we don't do any sampling until after we've gathered and analyzed 100 percent of your traces. Your traces are sent to a cloud-based trace observer which collects and analyzes your data, looking for helpful traces.

Whether you want to get distributed tracing by installing a new agent or need help turning on distributed tracing in an older agent, we have instructions to get you going:


If you want to get more background before getting started, check out these topics:

Set up tracing for new agents

Whether you just want to try out standard distributed tracing (head-based sampling) or also want to set up Infinite Tracing (tail-based sampling), you need to start by setting up standard distributed tracing. We'll get you through the APM agent installation to get head-based sampling going. Then, if you want to try out Infinite Tracing, you can take some additional steps.

Install an agent to get standard distributed tracing:

This is the best approach to set up standard distributed tracing if you haven't installed any APM agents for your services yet, or if you want to instrument additional services.


You'll need a New Relic account to set up distributed tracing. If you don't already have one, you can quickly
create a free account.

Step 1. Identify services

Figure out which services you want to instrument so they each send trace data to New Relic. For each of the services you identify, you'll install the APM agent, following the tips in the next step.

Step 2. Instrument each service with an APM agent

You will install a new APM agent to get the default distributed tracing. We have installation assistants for a variety of languages to help you instrument each service.

You should run the installation assistant for each service you want to instrument to ensure that each installation has a unique application name.

To start the assistant, click the link for your language:

APM: Golang
APM: Java
APM: Node.js
APM: Python
APM: Ruby


This quick-start approach with the installation assistant automatically enables distributed tracing for each service you run it on, but if you already have a APM agent that you want to participate in distributed tracing, you'll need to manually enable distributed tracing. See Options for older APM agents.

Step 3. View traces

After you instrument each of your services with APM agents, generate some traffic in your application so we can capture some traces. Here are two ways to view your traces in the UI:

For more help finding your traces in the UI:

Set up Infinite Tracing (recommended)

Standard distributed tracing for APM agents (above) uses adaptive sampling to capture up to 10 traces per minute, but if you want us to analyze all your data and find the most relevant traces, you can set up Infinite Tracing. This alternative to standard distributed tracing is available for all APM language agents except C SDK.


To learn more about this feature, see Infinite Tracing.

Before beginning, first ensure you meet the requirements.

Step 1. Complete the instrumentation for standard distributed tracing

The Infinite Tracing setup builds on the instrumentation steps above for standard distributed tracing. Make sure you've completed these before you got to the next step about the trace observer.

Step 2. Set up the trace observer

The trace observer is a New Relic AWS-based service that collects and analyzes all your traces. Follow the instructions in Set up trace observer. When you're done, return here with your trace observer information and continue with the next step to configure the agent.

Step 3: Configure the agent for Infinite Tracing

Infinite Tracing configuration settings include the standard distributed tracing plus information about the trace observer. Find the settings for your language agent below:

Step 4. (Optional) Customize Infinite Tracing

After you add the agent configuration settings, you should start seeing data in the New Relic UI. After you spend some time analyzing your data, you may want to adjust some of the features of Infinite Tracing:

Options for older APM agents

If you have older APM agents, use this section to figure out if the distributed tracing features you want are supported.

Following the compatibility information is a section showing the basic configuration settings to turn on standard distributed tracing. If your older agent supports Infinite Tracing and you want to set it up, see the steps above.

Compatibility guide

Find your language agents below to confirm if you can use your existing agents with distributed tracing:

Configure standard distributed tracing for your older agents

Distributed tracing is enabled through configuration settings. Review the following agent-specific sections. For general help with agent configurations, see Configure the agent.


Server-side configuration is not available for Infinite Tracing.


If you need help with proxy configuration, see Proxy support.

Manual instrumentation (If automatic instrumentation doesn't work)

Recommendation: Before performing any custom instrumentation, read:

If a service is not passing the trace header to other services, you can use the distributed tracing payload APIs to instrument the calling service and the called service. The calling service uses an API call to generate a payload, which is accepted by the called service.

Copyright © 2022 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.