• Log in

Enable distributed tracing for your C applications


As of April 2022, we're discontinuing support for several capabilities, including the C SDK. For more details, including how you can easily prepare for this transition, see our Explorers Hub post.

Read on to learn how to enable and instrument distributed tracing for the New Relic's C SDK.

Enable distributed tracing

To enable distributed tracing for a New Relic-monitored C application:

  1. Create a default newrelic_app_config_t and set the distributed_tracing.enabled field to true.

    newrelic_app_config_t* config
    = newrelic_create_app_config(app_name, license_key);
    config->distributed_tracing.enabled = true;
  2. Continue with the procedures to instrument transactions and HTTP requests.


Span events can be enabled/disabled separately from distributed tracing.

Instrument transactions and HTTP requests

For transactions that occur in multiple services, the distributed trace payload contains information that allows New Relic to stitch them together into a complete transaction trace. However, if New Relic-monitored services are not sending trace context to each other, it will result in incomplete trace details. For more information, see the documentation about passing the distributed tracing API header and the C SDK's distributed tracing documentation on GitHub.

If you want to...

Use this

Create and return a payload to be sent to the called service


Accept a payload sent from the first service

This will link these services together in a trace.

Return a base64-encoded JSON string representation of the payload

This offers the same behavior as newrelic_create_distributed_trace_payload().

Accept a base64-encoded string for the payload

This offers the same behavior as newrelic_accept_distributed_trace_payload().

Examine logs for trace details

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.

  1. From the Transactions page, click on a trace to go to the Trace details page.
  2. From the trace details page, click See logs.
  3. To view details related to an individual log message, click directly on the message.

You can also see logs in context of your infrastructure data, such as Kubernetes clusters. No need to switch to another UI page.

Copyright © 2022 New Relic Inc.

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