Quick Start¶
This document provides the shortest integration path for the macOS RUM SDK to help you complete verifiable data reporting with minimal steps.
The application supports automatic access with Agent and manual access. The following steps describe the minimal configuration for manual access.
Prerequisites¶
Before you begin, complete the following preparations:
- Create a macOS application in Real User Monitoring (RUM) and obtain the
RUM App ID - Confirm the reporting URL and authentication method
- Local environment deployment: prepare
datakitUrl - Public DataWay: prepare
datawayUrlandclientToken - Confirm that SDK installation has been completed in the project, using
CocoaPodsorSwift Package Manager
Integration Steps¶
- Install
FTMacOSSDKin the project - Initialize
FTSDKConfigbefore the application starts - Initialize
FTRumConfigand enable collection of View, Action, Resource, crashes, and freezes - Keep debug logging enabled, run the application, and trigger a window switch or network request
- Confirm in the console and on the Guance platform that data has been reported successfully
Install the SDK¶
For installation methods, refer directly to Application Access.
If you only want to verify quickly, we recommend using CocoaPods or Swift Package Manager first.
Minimal Initialization Example¶
Because the viewDidLoad method of the first displayed view NSViewController and the windowDidLoad method of NSWindowController are called earlier than AppDelegate applicationDidFinishLaunching, to avoid anomalies in lifecycle collection for the first view, we recommend initializing the SDK in main.m or main.swift.
// main.m file
#import "FTMacOSSDK.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
// For local environment deployment, use [[FTSDKConfig alloc] initWithDatakitUrl:datakitUrl]
FTSDKConfig *config = [[FTSDKConfig alloc] initWithDatawayUrl:datawayUrl clientToken:clientToken];
config.enableSDKDebugLog = YES;
[FTSDKAgent startWithConfigOptions:config];
FTRumConfig *rumConfig = [[FTRumConfig alloc] initWithAppid:appid];
rumConfig.enableTrackAppCrash = YES;
rumConfig.enableTrackAppANR = YES;
rumConfig.enableTrackAppFreeze = YES;
rumConfig.enableTraceUserAction = YES;
rumConfig.enableTraceUserView = YES;
rumConfig.enableTraceUserResource = YES;
rumConfig.errorMonitorType = FTErrorMonitorAll;
rumConfig.deviceMetricsMonitorType = FTDeviceMetricsMonitorAll;
[[FTSDKAgent sharedInstance] startRumWithConfigOptions:rumConfig];
}
return NSApplicationMain(argc, argv);
}
import Cocoa
import FTMacOSSDK
let delegate = AppDelegate()
NSApplication.shared.delegate = delegate
// For local environment deployment, use FTSDKConfig(datakitUrl: datakitUrl)
let config = FTSDKConfig(datawayUrl: datawayUrl, clientToken: clientToken)
config.enableSDKDebugLog = true
FTSDKAgent.start(withConfigOptions: config)
let rumConfig = FTRumConfig(appid: appid)
rumConfig.enableTraceUserAction = true
rumConfig.enableTrackAppANR = true
rumConfig.enableTraceUserView = true
rumConfig.enableTraceUserResource = true
rumConfig.enableTrackAppCrash = true
rumConfig.enableTrackAppFreeze = true
rumConfig.errorMonitorType = .all
rumConfig.deviceMetricsMonitorType = .all
rumConfig.monitorFrequency = .rare
FTSDKAgent.sharedInstance().startRum(withConfigOptions: rumConfig)
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
When using Swift, create the
main.swiftfile first and remove@mainor@NSApplicationMainfromAppDelegate.swift.
Optional: Initialize Log and Trace¶
If you also need log collection or distributed tracing, continue by adding the following initialization:
FTLoggerConfig *loggerConfig = [[FTLoggerConfig alloc] init];
loggerConfig.enableCustomLog = YES;
loggerConfig.enableLinkRumData = YES;
[[FTSDKAgent sharedInstance] startLoggerWithConfigOptions:loggerConfig];
FTTraceConfig *traceConfig = [[FTTraceConfig alloc] init];
traceConfig.enableAutoTrace = YES;
traceConfig.enableLinkRumData = YES;
[[FTSDKAgent sharedInstance] startTraceWithConfigOptions:traceConfig];
let loggerConfig = FTLoggerConfig()
loggerConfig.enableCustomLog = true
loggerConfig.enableLinkRumData = true
FTSDKAgent.sharedInstance().startLogger(withConfigOptions: loggerConfig)
let traceConfig = FTTraceConfig()
traceConfig.enableAutoTrace = true
traceConfig.enableLinkRumData = true
FTSDKAgent.sharedInstance().startTrace(withConfigOptions: traceConfig)
Verify the Integration¶
- Keep
enableSDKDebugLog = YES/trueenabled and run the application - Open a window or initiate a
URLSessionnetwork request - Confirm in the Xcode console that logs related to SDK initialization and data synchronization appear
- Return to the Guance console and confirm that the corresponding RUM data appears in the application
If you need further troubleshooting, see Troubleshooting.
Next Steps¶
- For complete installation and initialization instructions, continue reading Application Access
- For descriptions of all initialization parameters, see SDK Initialization
- For detailed RUM, Log, and Trace configurations, see RUM Configuration, Log Configuration, and Trace Configuration
- If you need to set global tags, see Using Custom Tags