Create Backends

A backend is a database or a remote service such as a message queue, HTTP service or cache service that your application uses. A backend component is not itself monitored by the application agent, but the agent monitors calls to it from instrumented servers. You need to create backends in the instrumented environment so that the agent can discover them. This involves:

  • Declaring the backend
  • Setting its identifying properties
  • Optionally configuring how the backend is presented in the Controller UI
  • Adding the backend to the instrumented application

Declare the Backend

You must declare a backend using appd_backend_declare() before the agent can detect it. After you declare a backend, you don't need to declare it again if the backend is used by other business transactions in a single SDK instance. A backend must be of one of the supported types listed under 'Exit Call Types' in C/C++ SDK Reference.

Identify the Backend

A backend also has identifying properties, which you set using appd_backend_set_identifying_property(). The properties vary depending on the type of the backend and the types of information that you want to display. The Controller displays identifying properties in backend dashboards. You must set at least one identifying property for the type of any backend that you plan to add.

The following shows the backend properties in the Controller UI for an ActiveMQ:

Backend properties

Resolve to a Tier

By default, the Controller doesn't display a detected backend as a separate entity in flowmaps, but the agent reports its metrics as part of the downstream tier. If you want to display the backend as a separate component and not resolved to the tier, use appd_backend_prevent_agent_resolution(). See Resolve Remote Services to Tiers.

Add to Application

After you declare and configure the backend, add it to the application so the agent can detect it.

Backend Example

The following listing shows an example of setting up a database backend.

// declare a backend, only once for this SDK instance
const char backendOne[] = "first backend";
appd_backend_declare(APPD_BACKEND_HTTP,  backendOne);
// set the host property
rc = appd_backend_set_identifying_property(backendOne, "HOST", "sqs-us-west-hostname");
if (rc) {
std:cerr << "Error: appd_backend_set_identifying_property: " << rc << ".";
return -1;
}
// do not resolve the backend to the tier
rc = appd_backend_prevent_agent_resolution(backendOne);
if (rc) {
std:cerr << "Error: appd_backend_prevent_agent_resolution: " << rc << ".";
return -1;
}
// add the backend
rc = appd_backend_add(backendOne);
if (rc)
{
std:cerr << "Error: appd_backend_add: " << rc << ".";
return -1;
}