Create Business Transactions
Define a Business Transaction by enclosing the code that constitutes the request that you
want to monitor between appd_bt_begin()
and
appd_bt_end()
calls. appd_bt_begin()
returns a
handle to use in subsequent routines that affect that business transaction.
If you are creating a business transaction that correlates with an upstream business
transaction, pass the correlation header of the upstream transaction so the new
transaction that you are creating can correlate with it. See
appd_exitcall_get_correlation_header()
in C/C++ SDK Reference. If the
transaction does not need to correlate with another transaction, pass
NULL
for the correlation header parameter.
You can optionally store the business transaction handle in the global handle registry
with a guid for easy retrieval later using appd_bt_store()
. Retrieve
the handle from the global handle registry using appd_bt_get()
.
The following example demonstrates setting a business transaction:
// start the "Checkout" transaction
appd_bt_handle btHandle = appd_bt_begin("Checkout", NULL);
// Optionally store the handle in the global registry
appd_bt_store(btHandle, my_bt_guid);
...
// Retrieve a stored handle from the global registry
appd_bt_handle myBtHandle = appd_bt_get(my_bt_guid);
...
// end the transaction
appd_bt_end(btHandle);
Between starting and ending the transaction, you can perform operations such as adding errors to the business transaction, defining the transaction snapshot attributes, adding backends and exit calls, and so on.
When the business transaction ends, via a call to appd_bt_end()
, the
agent stops reporting metrics for the business transaction.