Add custom data to crash reports
Add custom data to crash reports
Although Splunk MINT collects plenty of data associated with each crash of your app, you can collect additional custom data. To add custom data to your crash reports, use the extra data map or add data as key-value pairs. The maximum length of keys is 128 characters. The maximum length of values is 256 characters. The maximum number of extra data key-value pairs is 32.
- To add custom data as a key-value pair, use the addExtraData: selector as follows:
- To access the global MintLimitedExtraData with the [Mint sharedInstance].extraDataList property:
- To add custom data as dictionary with key-value pair, use the addExtraData: selector as follows:
- To remove a specific value from the extra data, use the removeExtraDataForKey: method.
- To clear the extra data completely, use the removeAllExtraData method.
// Objective-C [[Mint sharedInstance] addExtraData:@"Value" forKey:@"key"];
// Swift Mint.sharedInstance().addExtraData("value", forKey: "key")
This method adds extra data to the global MintLimitedExtraData global singleton instance object and sends appropriate values to the Splunk MINT server as key-value pairs, which you can then examine your request.
// Objective-C MintLimitedExtraData* extraData = [[MintLimitedExtraData alloc] init]; [extraData1 setValue:@"value3" forKey:@"key3"]; [[Mint sharedInstance] addExtraData:extraData];
// Swift let limitedExtraData = MintLimitedExtraData() limitedExtraData.setValue("value1", forKey: "key1") Mint.sharedInstance().addExtraData(limitedExtraData)
This usage gives the same result as the addExtraData: method of the Mint instance because both methods access the same global MintLimitedExtraData singleton instance. The MintLimitedExtraData is an object that is limited to a maximum count of 32 objects. If you try to add an object that exceeds this count, the first object in the list is removed, FIFO. You can't add multiple values with the same key. If you try, you will not get an error but the value of an existing key will change.
View custom crash data
To view the custom crash data in Splunk MINT Management Console:
- Go to the Errors dashboard and select an error.
- In the error details section, click the Error Instances tab.
- In the Show All column, click the arrow.
To view the custom data for all of your mobile apps, run a search in the Splunk MINT App. For example, the following search lists errors with the values of the custom "level" field:
sourcetype=mint:error | table message, extraData.level
For more about running searches in MINT, see Searches in the Splunk MINT App User Guide.
Report handled exceptions | Add breadcrumbs to crash reports |
This documentation applies to the following versions of Splunk MINT™ SDK for iOS (Legacy): 5.2.x
Feedback submitted, thanks!