Splunk MINT SDK for iOS (Legacy)

Splunk MINT SDK for iOS Developer Guide

Splunk MINT is no longer available for purchase as of January 29, 2021. Customers who have already been paying to ingest and process MINT data in Splunk Enterprise will continue to receive support until December 31, 2021, which is End of Life for all MINT products: App, Web Service (Management Console), SDK and Add-On.

Trace Objective-C methods

If you are using Objective-C, you can log trace information on specific methods in your code to measure performance using the following macros:

MINT_METHOD_TRACE_START: Starts the method trace.
MINT_METHOD_TRACE_STOP: Stops the method trace.
MINT_NONARC_METHOD_TRACE_STOP: Stops the method trace. Use this macro if you are not using ARC.

Note  You cannot use this feature with Swift, which does not support macros.

To trace an Objective-C method, add a MINT_METHOD_TRACE_START call to the beginning of your method and a MINT_METHOD_TRACE_STOP call to the end of it, as follows:

// Objective-C
- (void)test {
    MINT_METHOD_TRACE_START
    
    NSLog(@"Hello, World");
    
    MINT_METHOD_TRACE_STOP
}

If you are not using ARC, use the MINT_NONARC_METHOD_TRACE_STOP macro to avoid a memory leak issue.

Then, run a search in Splunk Web on the "mint:methodinvocation" sourcetype to view trace information and performance metrics, for example:

index=mint sourcetype="mint:methodinvocation" | head 5

The trace method automatically picks up performance metrics for your method and sends it to Splunk Enterprise. The following fields contain trace information:

  • threadID: The thread ID.
  • method: The method that was traced.
  • elapsedTime: The elapsed time between starting and stopping the method trace, in nanoseconds.


Here's an example result:

 {
   apiKey: 12345
   appEnvironment: Testing
   appRunningState: Foreground
   appVersionCode: 1
   appVersionName: 1.0
   batteryLevel: -100
   carrier: NA
   connection: WIFI
   currentView: GHUnitIOSViewController
   device: x86_64
   elapsedTime: 52077306
   extraData: {
   }
   locale: US
   method: -[SplunkiOSTests testMethodTrace]
   msFromStart: 1679
   osVersion: 9.2
   packageName: SplunkTests
   platform: iOS
   remoteIP: 204.107.141.240
   screenOrientation: Portrait
   sdkVersion: 5.0.0
   session_id: 83B0BFA2-D224-4EE8-B65F-1A9C6A2A790A
   state: CONNECTED
   threadID: 19207
   transactions: {
   }
   userIdentifier: NA
   uuid: fake_uid
} 
Last modified on 05 November, 2019
View memory warnings   Disable network monitoring

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


Was this topic useful?







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