- Access to OpenTelemetry APIs
- Network Monitoring
- Crash Reporting
- AppLifecycle Instrumentation
- Slow Rendering Detection
- WebView Instrumentation
- Api for sending custom errors & record exceptions
- Custom logging
- Session Recording
.package(url: "https://github.com/middleware-labs/middleware-ios", from: "1.0.5"),
pod "MiddlewareRum", "~> 1.0.5"
import SwiftUI
import MiddlewareRum
@main
struct YourApp: App {
init() {
MiddlewareRumBuilder()
.globalAttributes(["customerId" : "123456"])
.target("<target>")
.serviceName("Mobile-SDK-iOS")
.projectName("Mobile-SDK-iOS")
.rumAccessToken("<account-key>")
.deploymentEnvironment("PROD")
.build()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Methods that can be used for setting instrumentation & configure your application.
Option | Description |
.rumAccessToken(String)
|
Sets the RUM account access token to authorize client to send telemetry data to Middleware |
.target(String)
|
Sets the target URL to which you want to send telemetry data. For example - Unified Observability Platform | Middleware |
.serviceName(String)
|
Sets the service name for your application. This can be used further for filtering by service name. |
.projectName(String)
|
Sets the project name for your application. |
.deploymentEnvironment(String)
|
Sets the environment attribute on the spans that are generated by the instrumentation. For Example - PROD | DEV |
.disableCrashReportingInstrumentation()
|
Disable crash reporting. By default it is enabled. |
.disableNetworkMonitoring()
|
Disable HTTP Instrumentation. By default it is enabled. |
.disableSlowRenderingDetection()
|
Disable slow or frozen frame renders. By default it is enabled. |
.slowFrameDetectionThresholdMs(Double)
|
Sets the default polling for slow render detection. Default value in milliseconds is 16.7 |
.frozenFrameDetectionThresholdMs(Double)
|
Sets the default polling for slow render detection. Default value in milliseconds is 700 |
MiddlewareRum.info("Some information")
MiddlewareRum.debug("Some information")
MiddlewareRum.trace("Some information")
MiddlewareRum.warning("Some information")
MiddlewareRum.error("Some information")
MiddlewareRum.critical("Some information")
MiddlewareRum.addError("Unable to process I am error")
MiddlewareRum.addException(e: NSException(name: NSExceptionName(rawValue: "RuntimeException"), reason: "I am custom exception"))
MiddlewareRum.setScreenName("WebView")
MiddlewareRum.setGlobalAttributes(["some": "value"])
MiddlewareRum.integrateWebViewWithBrowserRum(view: webView)
By default session recording is enabled, to disable call .disableRecording()
:
MiddlewareRumBuilder()
.globalAttributes(["customerId" : "123456"])
.target("<target>")
.serviceName("Mobile-SDK-iOS")
.projectName("Mobile-SDK-iOS")
.rumAccessToken("<account-key>")
.deploymentEnvironment("PROD")
.disableRecording()
.build()
//SwiftUI
Text("Very important sensitive text").sensitive()
// UIKit
MiddlewareRum.addIgnoredView(view)