Create Business Transactions
Define a Business Transaction by enclosing the code that constitutes the request you want to
monitor between StartBT()
and EndBT()
calls.
StartBT()
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 Go SDK Reference for
GetExitcallCorrelationHeader()
. If the transaction does not need to
correlate with another transaction, pass an empty string 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 StoreBT()
. Retrieve the handle from the
global handle registry using GetBT()
.
For example, to set a Business Transaction:
// start the "Checkout" transaction
btHandle := appd.StartBT("Checkout", "")
// Optionally store the handle in the global registry
appd.StoreBT(btHandle, my_bt_guid)
...
// Retrieve a stored handle from the global registry
myBtHandle = appd.GetBT(my_bt_guid)
// end the transaction
appd.EndBT(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 EndBT()
, the agent stops
reporting metrics for the business transaction.