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:
Create a default
newrelic_app_config_t
and set thedistributed_tracing.enabled
field totrue
.newrelic_app_config_t* config= newrelic_create_app_config(app_name, license_key);config->distributed_tracing.enabled = true;Continue with the procedures to instrument transactions and HTTP requests.
Important
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 |
Accept a base64-encoded string for the payload | This offers the same behavior as |
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.