Monitor transactions
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.
A transaction ID is returned when you create a transaction. Use this transaction ID if you need to cancel or stop the transaction.
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* transactionName = @"TransactionName"; NSString* transactionID; transactionID = [[Mint sharedInstance] transactionStart:transactionName]; [[Mint sharedInstance] transactionStop:transactionID]; transactionID = [[Mint sharedInstance] transactionStart:transactionName]; [[Mint sharedInstance] transactionCancel:transactionID reason:@"reason"];
// Swift let transactionName:String = "TransactionName" var transactionID:String; transactionID = Mint.sharedInstance().transactionStart(transactionName) Mint.sharedInstance().transactionStop(transactionID) transactionID = Mint.sharedInstance().transactionStart(transactionName) Mint.sharedInstance().transactionCancel(transactionID, reason: "reason")
Add custom data to transactions
You can add extra custom data to specific transactions as a list or as a key-value pair. Custom data can only be viewed using the Splunk MINT App.
Example code
// Objective-C NSString* transactionName = @"TransactionName"; NSString* transactionID; MintLimitedExtraData *limitedExtraData = [[MintLimitedExtraData alloc] init]; [limitedExtraData setValue:@"value" forKey:@"key"]; transactionID = [[Mint sharedInstance] transactionStart:transactionName extraData:limitedExtraData]; [[Mint sharedInstance] transactionStop:transactionID extraData:limitedExtraData]; transactionID = [[Mint sharedInstance] transactionStart:transactionName extraDataKey:@"key" extraDataValue:@"value"]; [[Mint sharedInstance] transactionStop:transactionID extraDataKey:@"key" extraDataValue:@"value"]; transactionID = [[Mint sharedInstance] transactionStart:transactionName extraDataKey:@"key" extraDataValue:@"value"]; [[Mint sharedInstance] transactionCancel:transactionID reason:@"reason" extraData:limitedExtraData];
// Swift let transactionName:String = "TransactionName" var transactionID:String; transactionID = Mint.sharedInstance().transactionStart(transactionName, extraDataKey: "key", extraDataValue: "value") Mint.sharedInstance().transactionStop(transactionID, extraDataKey: "key", extraDataValue: "value") let limitedExtraData = MintLimitedExtraData() limitedExtraData.setValue("value", forKey: "key") transactionID = Mint.sharedInstance().transactionStart(transactionName, extraData: limitedExtraData) Mint.sharedInstance().transactionStop(transactionID, extraData: limitedExtraData) transactionID = Mint.sharedInstance().transactionStart(transactionName, extraData: limitedExtraData) Mint.sharedInstance().transactionCancel(transactionID, reason: "reason")
View custom data
To view the custom data for transactions, open the Splunk MINT App and run a search. For example, the following search lists the names of started transactions with the values of the custom "member" field:
sourcetype=mint:trstart extraData.member=* | table tr_name, extraData.member
For more about running searches in MINT, see Searches in the Splunk MINT App User Guide.
Customize session handling | Add and report events |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (Legacy): 5.2.x
Feedback submitted, thanks!