This is an unsupported example. This project is provided AS-IS WITHOUT WARRANTY OR SUPPORT.
This repository contains two example application, used to illustrate instrumenting an application with the New Relic C SDK. The two applications are a client app written in C and a server app written in C++. The client will send an HTTP get request to the server application with a distributed trace payload. Either of these application can be replaced with an application written in an other New Relic supported language and instrumented with a New Relic agent.
- gcc 4.9 or greater
- CMake 3.0 or greater
- g++ 7.3.1 or greater
- curl 7.29 or greater
The server will require the following environment variables.
Var Name | Description | Required |
---|---|---|
NEW_RELIC_LICENSE_KEY | The New Relic License Key. | Required |
NEW_RELIC_HOST | New Relic collector host. If NULL will be set to the default of collector.newrelic.com | Not required |
SERVER_NEW_RELIC_APP_NAME | The New Relic app name that will appear in the UI. | Required |
Run the following commands to build the server application.
- Clone and compile the C SDK, there are more instructions here.
- Use the
make dynamic
command to create thelibnewrelic.so
- Use the
- Copy
libnewrelic.so
to the server/ directory. - Copy
libnewrelic.h
to this projects root directory. cmake .
make
- Follow the directions in the C SDK repo to start the New Relic daemon.
./server
The client will require the following environment variables and there are no defaults.
Var Name | Description | Required |
---|---|---|
NEW_RELIC_LICENSE_KEY | The New Relic License Key. | Required |
NEW_RELIC_HOST | New Relic collector host. If NULL will be set to the default of collector.newrelic.com | Not Required |
CLIENT_NEW_RELIC_APP_NAME | The New Relic app name that will appear in the UI. | Required |
Run the following commands to build the client application.
- Clone and compile the C SDK, there are more instructions here.
- Copy
libnewrelic.h
andlibnewrelic.a
to this projects root directory. make
- Follow the directions in the C SDK repo to start the New Relic daemon.
./client.out