The SDK provides mobile Telemetry instrumentation that captures:
- HTTP requests, using URLSession instrumentation
- Unhandled exceptions (NSException, NSError, Error)
- Custom Logs ()
- Crashes - using PLCrashReporter
- Page navigation (Swift use swizzling / SwiftUI use modifier)
- User Actions (Clicks - UI elements)
- ANR (Application Not Responding) detection
- Mobile Vitals (FPS, CPU, Memory, Cold Start, Warm Start, Slow/Frozen Frames)
Coralogix RUM agent for iOS supports iOS 13 and higher.
The integration requires minimal effort with a few lines of code. To install this package,
import git@github.com:coralogix/cx-ios-sdk in SPM.
Remember to call this as early in your application life cycle as possible.
Ideally in applicationDidFinishLaunching in your AppDelegate
import UIKit
import Coralogix
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var coralogixRum: CoralogixRum?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let domain = CoralogixDomain.US2
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY")
self.coralogixRum = CoralogixRum(options: options)
return true
}
Or if you are using swiftUI
import SwiftUI
import Coralogix
@main
struct DemoAppApp: App {
@State private var coralogixRum: CoralogixRum
init() {
let domain = CoralogixDomain.US2
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY")
self.coralogixRum = CoralogixRum(options: options)
}
var body: some Scene {
WindowGroup {
ContentView(coralogixRum: $coralogixRum)
}
}
}Turn on/off specific instrumentation, default to true. Each instrumentation is responsible for which data the SDK will track and collect for you.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
instrumentations: [.mobileVitals: true,
.custom: true,
.errors: true,
.network: true,
.userActions: false,
.anr: true,
.lifeCycle: false])The ignoreErrors option allows you to exclude errors that meet specific criteria. This option accepts a set of strings and regular expressions to match against the event's error message. Use regular expressions for exact matching as strings remove partial matches.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
ignoreErrors: []) //[".*errorcode=.*", "Im cusom Error"]The ignoreUrls option allows you to exclude network requests that meet specific criteria. This options accepts a set of strings and regular expressions to match against the event's network url. Use regular expressions for exact matching as strings remove partial matches.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
ignoreUrls: []) //[".*\\.il$","https://www.coralogix.com/academy"])Provide labels based on url or event
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
labels: ["item" : "item_number_5", "itemPrice" : 1000]) Determines whether the SDK should collect the user's IP address and corresponding geolocation data. Defaults to true.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
collectIPData: true)Number between 0-100 as a percentage of SDK sessions should be initialized.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
sampleRate: 100)Enable event access and modification before sending to Coralogix, supporting content modification.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
beforeSend: { cxRum in
var editableCxRum = cxRum
if var sessionContext = editableCxRum["session_context"] as? [String: Any] {
sessionContext["user_email"] = "john.doe@coralogix.com"
editableCxRum["session_context"] = sessionContext
}
return editableCxRum
}), and event discarding
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
beforeSend: { cxRum in
var editableCxRum = cxRum
if var viewContext = editableCxRum["view_context"] as? [String: Any],
let view = viewContext["view"] {
if view == "DetailsViewController" {
return nil
}
}
})Turn on/off specific Mobile Vitals, default to all trues. Each Mobile Vitals is responsible for which data the SDK will track and collect for you.
Note: ANR is controlled separately via the instrumentations option, not as a mobile vital.
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,
environment: "ENVIRONMENT",
application: "APP-NAME",
version: "APP-VERSION",
publicKey: "API-KEY",
mobileVitals: [.cpuDetector: true,
.warmDetector: true,
.coldDetector: true,
.slowFrozenFramesDetector: true,
.memoryDetector: true,
.renderingDetector: true])Mobile vitals are sampled at fixed, battery-optimized intervals:
- FPS: Continuous per-frame tracking via CADisplayLink (~60Hz) with 1-second aggregation/reporting
- CPU: 1 second
- Memory: 1 second
These intervals are optimized for battery efficiency while capturing all important performance trends. The 1-second sampling provides accurate statistics (min/max/avg/p95) for monitoring without excessive battery drain.
Note: Prior to v2.2.0, the SDK exposed (non-functional) configuration parameters for these intervals. These have been removed as they were never actually used.
Memory Utilization:
- Calculated as:
(app footprint / total device physical RAM) × 100% - Example: 500MB footprint on 6GB device = 8.3%
- Note: iOS reserves 1-2GB for system processes, so practical app maximum is typically 70-80%
- Apps exceeding ~80% utilization risk receiving memory warnings from iOS and may be terminated if memory pressure continues
- The SDK reports utilization relative to total device capacity (matching iOS Instruments behavior)
- Edge case: Values >100% are theoretically impossible but the cap was removed to surface measurement anomalies. If you observe >100% readings, treat them as flags for investigation (likely indicating measurement timing issues, device reporting quirks, or transient OS behavior) rather than literal memory usage
Slow and Frozen Frames:
- Slow frames: Frame render time exceeds expected budget + 3% tolerance (e.g., >17.2ms on 60Hz display)
- Frozen frames: Frame render time >= 700ms (causes perceivable UI freeze)
- The 700ms frozen frame threshold aligns with ANR detection, providing consistent "unresponsive UI" definition across the SDK
- Thresholds automatically adapt to display refresh rate (60Hz standard, 120Hz ProMotion)
- Industry comparison: Apple recommends 250ms, Firebase uses 400ms, Sentry/Coralogix use 700ms (aligned with ANR)
See the Session Recording Guide for installation steps and examples.
This project is licensed under the MIT License - see the LICENSE file for details.