Splunk MINT SDK for iOS

Splunk MINT SDK for iOS Developer Guide

Download manual as PDF

Download topic as PDF

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.

PREVIOUS
Customize session handling
  NEXT
Add and report events

This documentation applies to the following versions of Splunk MINT SDK for iOS: 5.2.x


Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters