Monitor transactions
Transactions let you keep track of any process inside your application with a beginning and an end. For example, a transaction could be a process such as registration, login, or a purchase.
A transaction is basically an event that starts and then finishes in one of three ways:
- The transaction is completed normally, resulting in a status of "SUCCESS".
- The transaction is cancelled by the user, possibly because the process took too much time to complete, resulting in a status of "CANCEL".
- The transaction failed because the app crashed, resulting in a status of "FAIL".
Use the following methods to work with transactions.
- To start a transaction, use the transactionStart: method.
- To stop a transaction, use the transactionStop: method.
- To cancel a transaction with a reason, use the transactionCancel:reason: method.
To identify slow transactions that negatively affect the user experience, monitor how long transactions take to complete by going to the Transactions dashboard in Splunk MINT Management Console.
Example code
// Objective-C NSString* c = @"MintTransaction"; [[Mint sharedInstance] transactionStart:transactionId andResultBlock:^(TransactionStartResult *transactionStartResult) { NSString* message = [NSString stringWithFormat:@"Transaction with ID:%@ %@", transactionId, transactionStartResult.transactionStatus == SuccessfullyStartedTransaction ? @"started successfully" : @"failed to start"]; NSLog(@"%@", message); }]; // Continue your code... // Do something in a block method. End the transaction so you can track that // in your dashboard to resolve an issue or for monitoring. [[Mint sharedInstance] transactionStop:transactionId andResultBlock:^(TransactionStopResult *transactionStopResult) { NSString* message = [NSString stringWithFormat:@"Transaction with ID:%@ %@", transactionId, transactionStopResult.transactionStatus == UserSuccessfullyStoppedTransaction ? @"stopped successfully" : @"failed to stop"]; NSLog(@"%@", message); }];
// Swift let transactionID:String = "MintTransactionID" Mint.sharedInstance().transactionStart(transactionID, andResultBlock: { (transactionStartResult: TransactionStartResult!) -> Void in let result = transactionStartResult.transactionStatus.value == SuccessfullyStartedTransaction.value ? "OK" : "Failed" println("Transaction Started: \(result)") } ) Mint.sharedInstance().transactionStop("TransactionId", andResultBlock: { (transactionStopResult: TransactionStopResult!) -> Void in let result = transactionStopResult.transactionStatus.value == UserSuccessfullyStoppedTransaction.value ? "OK" : "Failed" println("Transaction Stopped: \(result)") } )
Customize session handling | Add and report events |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (EOL): 4.0.x
Feedback submitted, thanks!