Introduction to the C SDK

The C SDK is designed to support the often complex, multi-threaded nature of C/C++ applications. You can gain a new level of visibility to help you identify and solve performance issues. You can also collect and analyze data to help you improve the customer experience and make data-driven business decisions.

The C SDK can be used to instrument a wide range of applications beyond C or C++. If your application does not use other New Relic APM agent languages and can import C libraries, then you can use New Relic's C SDK to take advantage of New Relic's monitoring capabilities and features.

New Relic has contributed the C SDK to the open source community under an Apache 2.0 license.

Monitor app performance

C SDK: APM Overview
rpm.newrelic.com > (select an app) > Monitoring > Overview: Here is an example of some of the data you can view in New Relic APM after you deploy the C SDK for your app. For example, you can troubleshoot the performance spikes in web external segments with links to dashboards with transactions, transaction traces, errors, and more.

If your app meets the C SDK's compatibility and requirements in Linux environments, you can customize the generic library to communicate with New Relic, then start with New Relic APM to monitor your application's performance.

What you can do with New Relic How to do it
See the big picture
  • Start with the APM Overview page to monitor the throughput, response times, errors, memory and CPU usage transactions in your applications and services, then explore other application details with additional APM dashboards.
  • With deployment markers, see how code changes impact application performance and health.
  • Use New Relic Infrastructure to view detailed host and server data. When you install the Infrastructure and APM on the same host, they automatically detect one another. You can then view a list of hosts in the APM UI, and filter your Infrastructure hosts by APM app in the Infrastructure UI.
Identify and fix errors
Analyze business data
And more!
  • Monitor and troubleshoot your application users' desktop experience with your application, including page load timing problems, JavaScript errors, session trace timelines, etc., by using New Relic Browser
  • Use automated, scriptable tools to monitor your websites, critical business transactions, and API endpoints with New Relic Synthetics.
  • Analyze and fine-tune your Android and iOS application performance, troubleshoot crashes, compare multiple versions, and examine the performance of HTTP and other network components with New Relic Mobile.

Architecture: C library and daemon

The C SDK relies on two components to send data from your application to New Relic:

  • The library of New Relic C SDK calls: You download this library, then add the calls and instrumentation to your application's code. This allows you to identify and customize the kinds of data that matters the most to you.
  • The C SDK daemon: This is a separate file that accumulates data identified in the calls from your application's code, and sends it to New Relic.
C SDK architecture
C SDK architecture: To send data from your application to New Relic, the daemon must be invoked before making calls to your application's C SDK instrumentation library.

Working together, the C SDK instrumentation and the daemon allow you to view and query data about transactions using the library calls. The workflow between your application and New Relic must occur in this order:

  1. An HTTPS link is established between the daemon and New Relic. The daemon must be invoked first, before your instrumented application is invoked.
  2. Next, socket communication is established between your instrumented application and the daemon. This occurs after successful calls to newrelic_new_app_config() and newrelic_create_app().

The call to newrelic_create_app() is non-blocking. Its second parameter allows you to specify an amount of time for your instrumented application to wait so that the socket communication is adequately established. For example:

newrelic_app_t* app = newrelic_create_app(config, 10000);

If your instrumented application sends transactions before both the daemon connection and your application's socket communication are established, data reported from your application will be lost.

Get started with the C SDK

Make sure your application meets the compatibility and requirements for the C SDK, and if you do not already have one, sign up for a free New Relic account. Then follow the installation and instrumentation procedures. Within a few minutes, you will be able to view data from your application in your New Relic account's UI.

For more help

Recommendations for learning more: