iOS and tvOS Libraries for RUM
This page lists integrated libraries you can use for iOS and tvOS applications.
Alamofire
Starting from version 3.7.0, the RUM iOS SDK automatically tracks Alamofire requests after you enable RUM with urlSessionTracking configuration.
- Configure RUM monitoring by following the Setup guide.
- (Optional) For detailed timing breakdown (DNS resolution, SSL handshake, time to first byte, connection time, download duration), enable
URLSessionInstrumentation for Alamofire.SessionDelegate:
import Alamofire
import DatadogRUM
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: Alamofire.SessionDelegate.self))
For additional information on sampling rate, distributed tracing, and adding custom attributes to tracked RUM resources, refer to Advanced Configuration > Automatically track network requests.
Apollo GraphQL
Starting from version 3.7.0, the RUM iOS SDK automatically tracks Apollo GraphQL requests after you enable RUM with urlSessionTracking configuration.
- Configure RUM monitoring by following the Setup guide.
- (Optional) For detailed timing breakdown (DNS resolution, SSL handshake, time to first byte, connection time, download duration), enable
URLSessionInstrumentation for Apollo.URLSessionClient:
import Apollo
import DatadogRUM
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: Apollo.URLSessionClient.self))
For additional information on sampling rate, distributed tracing, and adding custom attributes to tracked RUM resources, see Advanced Configuration > Automatically track network requests.
For more advanced Apollo integration using the Datadog Apollo interceptor, see the Datadog Apollo interceptor package and Apollo instrumentation.
SDWebImage
Starting from version 3.7.0, the RUM iOS SDK automatically tracks SDWebImage requests after you enable RUM with urlSessionTracking configuration.
- Configure RUM monitoring by following the Setup guide.
- (Optional) For detailed timing breakdown (DNS resolution, SSL handshake, time to first byte, connection time, download duration), enable
URLSessionInstrumentation for SDWebImageDownloader:
import SDWebImage
import DatadogRUM
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: SDWebImageDownloader.self as! URLSessionDataDelegate.Type))
For additional information on sampling rate, distributed tracing, and adding custom attributes to tracked RUM resources, see Advanced Configuration > Automatically track network requests.
OpenAPI Generator
Starting from version 3.7.0, the RUM iOS SDK automatically tracks OpenAPI Generator requests after you enable RUM with urlSessionTracking configuration.
For detailed timing breakdown (DNS resolution, SSL handshake, time to first byte, connection time, download duration), follow these steps:
- Configure RUM monitoring by following the Setup guide.
- Create a dummy
URLSessionDataDelegate. - Enable
URLSessionInstrumentation for EmptySessionDelegate. - Configure
URLSession with your dummy URLSessionDataDelegate. - Create an OpenAPI client with
.buffered processing mode.
import DatadogRUM
import OpenAPIRuntime
import OpenAPIURLSession
// Dummy delegate
class EmptySessionDelegate: NSObject, URLSessionDataDelegate {}
// Create `URLSession` with your delegate
let delegate = EmptySessionDelegate()
let urlSession = URLSession(configuration: .default, delegate: delegate, delegateQueue: nil)
// Enable instrumentation for your delegate class
URLSessionInstrumentation.enableDurationBreakdown(with: .init(delegateClass: EmptySessionDelegate.self))
// Create transport with `.buffered` processing mode (required for proper instrumentation)
let transport = URLSessionTransport(configuration: .init(
session: urlSession,
httpBodyProcessingMode: .buffered
))
// Create the OpenAPI client
bufferedClient = Client(
serverURL: try! Servers.Server1.url(),
transport: transport
)
For additional information on sampling rate, distributed tracing, and adding custom attributes to tracked RUM resources, see Advanced Configuration > Automatically track network requests.