New Relic has APM language agents for C, Go, Java, Node.js, .NET, PHP, Python, and Ruby. Each of these offers several ways to leverage the power of distributed tracing:
Impacts to APM tells you what to expect if you are a current APM user but haven't set up distributed tracing.
Quick start for standard distributed tracing (recommended):
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.
Tip
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.
Step 2. Instrument each service with an APM agent
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:
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:
Here's one way you can see traces for a particular service:
Click Browse data in the top menu bar, and then click Traces.
Select your entity in the left pane.
If you don't see the traces you want, you can filter by the trace.id.
You can bring your logs and application's data together to make troubleshooting easier and faster. With logs in context, you can see log messages related to your errors and traces directly in your app's UI.
From the Transactions page, click on a trace to go to the Trace details page.
From the trace details page, click See logs.
To view details related to an individual log message, click directly on the message.
Standard distributed tracing for APM agents (above) use 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.
Step 1. Complete the instrumentation for standard distributed tracing in the quick start above
The Infinite Tracing setup builds on the instrumentation step from the Quick start for standard distributed tracing.
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:
Here's an overview of the settings. For more help with configuration, see Ruby agent configuration.
To set up Infinite Tracing, you need to install the Infinite Tracing gem. The gem is available in rubygems.org. For applications using Bundler, additionally include the Infinite Tracing gem in the Gemfile:
gem 'newrelic-infinite_tracing'
If you're using Rails 3 or higher, or Rails 2.3 in the recommended configuration, Rails will automatically call Bundler.require and cause newrelic-infinite_tracing to be required during startup of your application. If you're using Sinatra or another framework, you must manually call require 'newrelic/infinite_tracing' or manually call Bundler.require.
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:
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:
Your JVM's networkaddress.cache.ttl security setting must not be set to forever or -1. For more information about this networking property, please visit the Oracle Network Properties docs.
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.
Important
Server-side configuration is not available for Infinite Tracing.
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.
To instrument the calling service:
Ensure the version of the APM agent that monitors the calling service supports distributed tracing.
Ensure the version of the APM agent that monitors the called service supports distributed tracing.
If the New Relic agent on the called service does not identify a New Relic transaction, use the agent API to declare a transaction:
One way to tell that a transaction is not in progress: when newrelic_create_distributed_trace_payload() is called, a NULL pointer is returned. To solve this problem, follow the procedures to create a transaction with the C SDK.
One way to tell that a transaction is not in progress: when Transaction.InsertDistributedTraceHeaders(h http.Header) is called, no headers are inserted. To create a transaction, see Instrument Go transactions.
One way to tell that a transaction is not in progress: when Transaction.insertDistributedTraceHeaders(Headers) is called, no headers are inserted (this API requires agent 6.4.0+). To create a transaction, see Java agent transaction-related APIs.
One way to tell that a transaction is not in progress: newrelic_insert_distributed_trace_headers() returns false. To create a transaction, see newrelic_start_transaction.
To tell that a transaction is not in progress: when transaction = current_transaction() is run, transaction is None. Or, if result = accept_distributed_trace_payload(payload) is run, then the result is False.
If you are using a Rack-based web framework and have enabled New Relic's Rack instrumentation, the Ruby agent will handle starting a transaction for you. For other use cases, see the add_transaction_tracer API method.
Extract the payload from the call that you received (for example, in a header).