• /
  • Log in

Enable distributed tracing for your C applications

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().

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.