• English日本語한국어
  • Log inStart now

Enable distributed tracing for your Go applications

Distributed tracing allows you to see the entire journey of your requests throughout a distributed system. For the Go agent, we offer two types of distributed tracing (for more details, see How span sampling works):

  • Standard (head-based sampling): Before any traces arrive, we determine a set percentage of traces to accept and analyze. This gives you a solid starting point to see how tracing can help you. It is turned on by default in Go agents 3.16.0 and higher.

  • Infinite Tracing (tail-based sampling): Our cloud-based service accepts all your traces and then sorts through them to find the most important. After you set up standard tracing, we recommend you add this option because it analyzes all of your traces and gives you configuration options to sample the traces that matter most to you.

All the steps you need to get started with distributed tracing are right here:

New Go 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 tracing. We'll get you through the agent installation to get head-based sampling going. After that, you can set up Infinite Tracing, which is optional but recommended.

Tip

The Go agent requires you to manually instrument your Go services, unlike the auto-instrumentation of the other New Relic agents. This means you need to add some lines to your code to use the Go agent and enable distributed tracing.

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.

If you already have some services instrumented with this APM agent, and you want to include them in distributed tracing, you'll need to manually enable distributed tracing for each service. See Options for older Go agents.

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 touch your request so you can instrument each of them to send trace data to New Relic.

Step 2. Instrument each service with an APM agent

You'll repeat the agent installation routine for each service involved in your transactions. If some of your services use other languages, simply repeat the installation steps for those languages.

To start the installation routine, click the tile below. When you are finished installing each agent, return here to see tips for viewing your traces.

Golang
Start installation

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 some ways to view your traces in the UI:

For more help finding your traces in the UI:

Set up Infinite Tracing

Standard distributed tracing for APM agents (above) captures up to 10% of your traces, but if you want us to analyze all your data and find the most relevant traces, you can set up Infinite Tracing.

Tip

To learn more about this feature, see Infinite Tracing.

Before beginning, first ensure you meet the requirements.

Step 1. Complete the new agent installation

The Infinite Tracing setup builds on the instrumentation step from the New agent installations 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:

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 Go agents

If you have older Go 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

After reviewing the compatibility information below, follow the configuration settings:

Configure your older Go agents

See the settings below to enable distributed tracing.

Tip

If you've been using an older agent without distributed tracing, before turning on distributed tracing, check out Impacts to APM.

Additional manual instrumentation

All installations of the Go agent and distributed tracing require some manual instrumentation using the settings listed in Go agent configuration settings. Still, you may need to do some additional configuration to optize your setup. Here are some guidelines for instrumenting transactions and HTTP requests.

For more details on using these, see the Go agent GitHub repo.

Copyright © 2024 New Relic Inc.

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