diff --git a/Sources/Datadog/RUM/RUMMonitor/DDNoopRUMMonitor.swift b/Sources/Datadog/RUM/RUMMonitor/DDNoopRUMMonitor.swift index 253f1d145f..bf643594fd 100644 --- a/Sources/Datadog/RUM/RUMMonitor/DDNoopRUMMonitor.swift +++ b/Sources/Datadog/RUM/RUMMonitor/DDNoopRUMMonitor.swift @@ -26,6 +26,13 @@ internal class DDNoopRUMMonitor: DDRUMMonitor { warn() } + override func stopView( + viewController: UIViewController, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + override func startView( key: String, name: String? = nil, @@ -33,4 +40,155 @@ internal class DDNoopRUMMonitor: DDRUMMonitor { ) { warn() } + + override func stopView( + key: String, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func addTiming( + name: String + ) { + warn() + } + + override func addError( + message: String, + type: String? = nil, + source: RUMErrorSource = .custom, + stack: String? = nil, + attributes: [AttributeKey: AttributeValue] = [:], + file: StaticString? = #file, + line: UInt? = #line + ) { + warn() + } + + override func addError( + error: Error, + source: RUMErrorSource = .custom, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func startResourceLoading( + resourceKey: String, + request: URLRequest, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func startResourceLoading( + resourceKey: String, + url: URL, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func startResourceLoading( + resourceKey: String, + httpMethod: RUMMethod, + urlString: String, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func addResourceMetrics( + resourceKey: String, + metrics: URLSessionTaskMetrics, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func addResourceMetrics( + resourceKey: String, + fetch: (start: Date, end: Date), + redirection: (start: Date, end: Date)?, + dns: (start: Date, end: Date)?, + connect: (start: Date, end: Date)?, + ssl: (start: Date, end: Date)?, + firstByte: (start: Date, end: Date)?, + download: (start: Date, end: Date)?, + responseSize: Int64?, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func stopResourceLoading( + resourceKey: String, + response: URLResponse, + size: Int64? = nil, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func stopResourceLoading( + resourceKey: String, + statusCode: Int?, + kind: RUMResourceType, + size: Int64? = nil, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func stopResourceLoadingWithError( + resourceKey: String, + error: Error, + response: URLResponse? = nil, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func stopResourceLoadingWithError( + resourceKey: String, + errorMessage: String, + type: String? = nil, + response: URLResponse? = nil, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func startUserAction( + type: RUMUserActionType, + name: String, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func stopUserAction( + type: RUMUserActionType, + name: String? = nil, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func addUserAction( + type: RUMUserActionType, + name: String, + attributes: [AttributeKey: AttributeValue] = [:] + ) { + warn() + } + + override func addAttribute(forKey key: AttributeKey, value: AttributeValue) { + warn() + } + + override func removeAttribute(forKey key: AttributeKey) { + warn() + } } diff --git a/Tests/DatadogTests/Datadog/RUM/RUMMonitor/DDNoopRUMMonitorTests.swift b/Tests/DatadogTests/Datadog/RUM/RUMMonitor/DDNoopRUMMonitorTests.swift index e7f2ce39fe..437f6b228d 100644 --- a/Tests/DatadogTests/Datadog/RUM/RUMMonitor/DDNoopRUMMonitorTests.swift +++ b/Tests/DatadogTests/Datadog/RUM/RUMMonitor/DDNoopRUMMonitorTests.swift @@ -20,6 +20,23 @@ class DDNoopRUMMonitorTests: XCTestCase { noop.startView(key: "view-key", name: "View") noop.stopView(viewController: mockView) noop.stopView(key: "view-key") + noop.addTiming(name: #function) + noop.addError(message: #function) + noop.addError(error: ProgrammerError(description: #function)) + noop.startResourceLoading(resourceKey: #function, request: .mockAny()) + noop.startResourceLoading(resourceKey: #function, url: .mockRandom()) + noop.startResourceLoading(resourceKey: #function, httpMethod: .mockAny(), urlString: #function) + noop.addResourceMetrics(resourceKey: #function, metrics: .mockAny()) + noop.addResourceMetrics(resourceKey: #function, fetch: (start: .mockAny(), end: .mockAny()), redirection: nil, dns: nil, connect: nil, ssl: nil, firstByte: nil, download: nil, responseSize: nil) + noop.stopResourceLoading(resourceKey: #function, response: .mockAny()) + noop.stopResourceLoading(resourceKey: #function, statusCode: nil, kind: .mockAny()) + noop.stopResourceLoadingWithError(resourceKey: #function, error: ProgrammerError(description: #function)) + noop.stopResourceLoadingWithError(resourceKey: #function, errorMessage: #function) + noop.startUserAction(type: .click, name: #function) + noop.stopUserAction(type: .click, name: #function) + noop.addUserAction(type: .click, name: #function) + noop.addAttribute(forKey: .mockAny(), value: #function) + noop.removeAttribute(forKey: .mockAny()) // Then let expectedWarningMessage = """ @@ -28,7 +45,7 @@ class DDNoopRUMMonitorTests: XCTestCase { See https://docs.datadoghq.com/real_user_monitoring/ios """ - XCTAssertEqual(dd.logger.criticalLogs.count, 2) + XCTAssertEqual(dd.logger.criticalLogs.count, 21) dd.logger.criticalLogs.forEach { log in XCTAssertEqual(log.message, expectedWarningMessage) }