begin_transaction()
function is used to start a new transaction.
For supported frameworks, Atatus Python agent will automatically capture the transactions.
This function can be used to instrument unsupported frameworks or background operations.
Compatibility
Compatible with all Python agent versions.
Syntax
copy
client.begin_transaction(transaction_type)
Parameter | Type | Description |
---|---|---|
transaction_type | String (Required) | Transaction type. It should be "request" for web requests. |
Example
To call "begin_transaction", you need to create Client instance with app name, and license key as follows
copy
import atatus
client = atatus.get_client()
Example for sample custom transaction
copy
import atatus
client = atatus.get_client()
def handle_request():
client.begin_transaction("request")
atatus.set_transaction_name("/books/create") # your transaction name
# TODO: your operations
client.end_transaction()
After begin transaction, you have to set a transaction name using the atatus.set_transaction_name() function.