Install the Splunk RUM iOS agent
Instrument your iOS applications for Splunk Observability Cloud real user monitoring / RUM using the iOS RUM library from the Splunk OpenTelemetry Instrumentation for iOS.
To instrument a new iOS application with the new Splunk RUM agent, follow the instructions on this page. If you're already instrumenting the application with the 0.13.0 or lower version of the Splunk RUM, follow the instructions on Upgrade the Splunk RUM iOS agent instead.
Decide which version to run in your environment
Latest updates automatically whenever Splunk RUM releases a new version. In pre-production, use latest to try out the most recent version of Splunk RUM. In production environments, use the pinned version which was previously tested in pre-production and update the production version on a monthly cycle.
Check compatibility and requirements
Splunk RUM for Mobile supports the following versions:
iOS 15 and higher
iPadOS 15 and higher
Generate customized instructions using the guided setup
Before you instrument and configure Splunk RUM for your iOS application, understand which data RUM collects about your application and determine the scope of what you want to monitor. See Data collected by Splunk RUM.
To access the iOS Instrumentation guided setup, follow these steps:
Log in to Splunk Observability Cloud.
In the navigation menu, select Data Management.
Go to the Available integrations tab, or select Add Integration in the Deployed integrations tab.
In the integration filter menu, select By Use Case.
Select the Monitor user experience use case.
Select the iOS Instrumentation tile to open the iOS Instrumentation guided setup.
Install the Splunk RUM agent manually
To install the iOS RUM library using Swift Package Manager, follow these steps:
In Xcode, Add a dependency to the Splunk RUM package,
SplunkAgent
, in Swift package manager (SPM):In Xcode, select
or , and enter the following URL in the search bar:https://github.com/signalfx/splunk-otel-ios
Select Dependency Rule Exact Version and change the version to
2.0.0
.Select Add Package to install the package.
Initialize the Splunk RUM package,
SplunkAgent
Include following code snippet in
AppDelegate.swift
or@main Content
file in your application:- Swift
import SplunkAgent let endpointConfiguration = EndpointConfiguration( realm: "YOUR_REALM", rumAccessToken: "YOUR_RUM_ACCESS_TOKEN" ) let agentConfiguration = AgentConfiguration( endpoint: endpointConfiguration, appName: "YOUR_APP_NAME", deploymentEnvironment: "YOUR_DEPLOYMENT_ENVIRONMENT" ) var agent: SplunkRum? do { agent = try SplunkRum.install(with: agentConfiguration) } catch { print("Unable to start the Splunk agent, error: \(error)") } // Example: Enable automated navigation tracking agent?.navigation.preferences.enableAutomatedTracking = true // Example: Start session replay agent?.sessionReplay.start()
- Objective-C
@import SplunkAgentObjC; SPLKEndpointConfiguration* endpointConfiguration = [[SPLKEndpointConfiguration alloc] initWithRealm:@"<YOUR_REALM>" rumAccessToken:@"YOUR_RUM_ACCESS_TOKEN"]; SPLKAgentConfiguration* agentConfiguration = [[SPLKAgentConfiguration alloc] initWithEndpoint:endpointConfiguration appName:@"YOUR_APP_NAME" deploymentEnvironment:@"YOUR_DEPLOYMENT_ENVIRONMENT"]; NSError* error = nil; SPLKAgent* agent = [SPLKAgent installWith:agentConfiguration error:&error]; if (agent == nil) { NSLog(@"Unable to start the Splunk agent, error: %@", [error description]); } else { // Example: Start session replay [[agent sessionReplay] start]; }
realm
is the Splunk Observability Cloud realm, for example,us0
. To find your Splunk realm, see Note about realms.To generate a RUM access token, see Generate your RUM access token in Splunk Observability Cloud.
Deploy the changes to your application.
Disable crash reporting
The crash reporting module is included in the new Splunk RUM agent and is enabled by default. No additional steps are needed to activate crash reporting. If you want to deactivate crash reporting, include the following code snippet in AppDelegate.swift or in the @main Content file in your application:
import SplunkCrashReports
// Disable configuration for crash reporting
let crashReportsConfig = SplunkCrashReports.CrashReportsConfiguration(isEnabled: false)
// Initialize the configuration of the Agent
let agentConfig = AgentConfiguration(endpoint: .init(realm: "your-realm", rumAccessToken: "your-rum-access-token"),
appName: "your-app-name",
deploymentEnvironment: "deployment-environment")
// Specify crash module configuration during agent installation
let agent: SplunkRum = try SplunkRum.install(with: agentConfig, moduleConfigurations: [crashReportsConfig])
https://github.com/signalfx/splunk-otel-ios-crashreporting
will be deprecated in the future.Link Splunk RUM with Splunk APM
Splunk RUM uses server timing to calculate the response time between the front end and back end of your application, and to join the front-end and back-end traces for end-to-end visibility.
By default, the Splunk Distributions of OpenTelemetry already send the Server-Timing
header. The header links spans from the browser with back-end spans and traces.
The APM environment variable for controlling the Server-Timing
header is SPLUNK_TRACE_RESPONSE_HEADER_ENABLED
. Set SPLUNK_TRACE_RESPONSE_HEADER_ENABLED=true
to link to Splunk APM.
Instrument iOS WebViews using the Browser RUM library
You can use Mobile RUM instrumentation and Browser RUM instrumentation simultaneously to see RUM data combined in one stream. You can do this by sharing the session.id
between both instrumentations.
The following Swift snippet shows how to integrate iOS RUM with Splunk Browser RUM:
import WebKit
import SplunkAgent
...
/*
Make sure that the WebView instance only loads pages under
your control and instrumented with Splunk Browser RUM. The
integrateWithBrowserRum() method can expose the session.id
of your user to every site/page loaded in the WebView instance.
*/
let webview: WKWebView = ...
SplunkRum.shared.webViewNativeBridge.integrateWithBrowserRum(webView)
Change attributes before they’re collected
To remove or change attributes in your spans, such as personally identifiable information (PII), see Filter spans.
How to contribute
The Splunk OpenTelemetry Instrumentation for iOS is open-source software. You can contribute to its improvement by creating pull requests in GitHub. To learn more, see the contributing guidelines in GitHub.
Next steps
To add custom attributes, adapt the instrumentation to your environment and application, customize sampling, and more, see Configure the Splunk iOS RUM instrumentation.
To check that your data is in your Splunk RUM for Mobile instance, see Check that your data is coming in.
To troubleshoot, see Troubleshoot iOS instrumentation for Splunk Observability Cloud.