Exit Call Management

exitCall.addAnalyticsData (key, value)

  • key: key to analytics data being added
  • value: value being added for this key

Attaches existing Analytics data generated for this transaction to the exit call.

Attaches custom data to Analytics generated for this transaction. If your application has a transaction handle, you can call txn.addAnalyticsData(key, value). If not, use appd.addAnalyticsData(key, value).

To enable this feature, the Analytics settings in the require statement must be set. See Node.js Settings Reference.

TimePromise.prototype.startExitCall(exitCallInfo)

  • exitCallInfo object

The exitCallInfo object has the following required properties:

  • exitType : string—the type of exit call, one of " EXIT_HTTP ", " EXIT_DB ", " EXIT_CACHE ", " EXIT_RABBITMQ ", " EXIT_WEB_SERVICE "
  • l abel : string—label for the exit call in the Controller UI
  • backendName : string—name of the backend remote system or service
  • identifyingProperties : Object—a hash of name/value pairs uniquely identifying the remote system or service being called. See Backend Identifying Properties.

Creates and starts a custom exit call, described by the exitCallInfo object.

You can supply more identifying properties in addition to the required ones.

Returns an ExitCall. See Exit Call Properties.

Sample exitCallInfo Object for MySQL

{
exitType: “EXIT_DB”,
label: "New SQL",
backendName: "NewDB"
identifyingProperties: {
“HOST”: “database-server”,
“PORT”: “12345”,
“DATABASE”: “my-database”,
"VENDOR" = “MYSQL"
},
…etc...
}

TimePromise.prototype.endExitCall(exitCall, error)

  • exitCall : ExitCall instance returned by startExitCall()
  • error: any; optional

Ends a custom exit call and attaches it to this transaction.

If an error is passed, the error is associated with the exit call, and the exit call is flagged as being in an error state.

TimePromise.prototype.beforeExitCall(exitCall)

  • exitCall: ExitCall

Returns an ExitCall.

Optional callback for modifying an automatically-detected (not custom) exit call.

The agent invokes this API immediately before your application makes the exit call when you supply a callback function. You can use the callback to:

  • Modify the exit call that is reported to the controller.
  • Suppress all reporting of the exit call by returning nothing.
  • Capture the exit call to create correlation information for a downstream transaction.

The following is an example of a modify exit call reported to the Controller.

txn.beforeExitCall = function customExitCallHandler(exitCall) {
// don't report database access for this transaction
if (exitCall.isSql) return;
// customize label for all other exit calls in this transaction
exitCall.label += " (my custom transaction)";
return exitCall;
}

TimePromise.prototype.exitCallCompleted(exitCall)

exitCall: ExitCall

Optional. Returns an ExitCall. Callback for modifying either a custom exit call created by startExitCall() or an automatically-detected exit call on completion of the exit call.

The agent invokes this API immediately after an exit call completes when you supply a callback function.

Use exitCallCompleted() to modify how the exit call is reported to the Controller by returning a modified exit call. Do not modify the backend identifying properties using this callback.

The following code is an example that modifies the exit call reported to the Controller.

txn.exitCallCompleted = function customExitCallPostProcessor(exitCall) {
// report MongoDB read and write operations as distinct exit calls
if (exitCall.backendName === "MongoDB")
exitCall.label += " " + exitCall.category;
}