PerfSDK 0.3.0

PerfSDK 0.3.0

TestsTested
LangLanguage SwiftSwift
License Custom
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Jonathan Grana, Steven Lu.



PerfSDK 0.3.0

  • By
  • Jonathan Grana

PerfSDK

PerfSDK times and records status codes from external networking requests and sends them to the Perf data pipeline.

This is an experimental integration and is stable, here are the caveats for this integration

  • URLs may not normalize correctly

Install

  1. To install it via CocoaPods, add this line to your Podfile. Latest version is swift 3.0 to use swift 2.3 please use version 2.1 of the Perf SDK.

    pod "PerfSDK"
  2. To install with Carthage, add this line to your Cartfile

    github "perflabs/PerfSDK"
  3. In your AppDelegate.swift file add the following import

    import PerfSDK
  4. If you don’t use any networking library, add this line into didFinishLaunchingWithOptions delegate in your AppDelegate.swift file

    Perf.sharedInit("PERF_API_KEY")
  5. If you’re using Alamofire, use this line instead

    Perf.sharedInit("PERF_API_KEY", configuration:  Alamofire.Manager.sharedInstance.session.configuration)

Configuration Options

  1. If you use NSURLSession, you’ll need to add these lines anywhere you instantiate a new NSURLSession

    let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
    Perf.registerConfiguration(configuration)
    let defaultSession = NSURLSession(configuration: configuration)
  2. If you use a lot of external services and only want to monitor specific domains, you can specify a list of domains after the sharedInit call

    Perf.shared?.whiteListDomains = ["perf.sh"]