diff --git a/DatadogObjc/Sources/RUM/RUMDataModels+objc.swift b/DatadogObjc/Sources/RUM/RUMDataModels+objc.swift index 082a83d237..c54cbe53be 100644 --- a/DatadogObjc/Sources/RUM/RUMDataModels+objc.swift +++ b/DatadogObjc/Sources/RUM/RUMDataModels+objc.swift @@ -7973,6 +7973,10 @@ public class DDTelemetryConfigurationEventTelemetryConfiguration: NSObject { get { root.swiftModel.telemetry.configuration.mobileVitalsUpdatePeriod as NSNumber? } } + @objc public var numberOfDisplays: NSNumber? { + root.swiftModel.telemetry.configuration.numberOfDisplays as NSNumber? + } + @objc public var plugins: [DDTelemetryConfigurationEventTelemetryConfigurationPlugins]? { set { root.swiftModel.telemetry.configuration.plugins = newValue?.map { $0.swiftModel } } get { root.swiftModel.telemetry.configuration.plugins?.map { DDTelemetryConfigurationEventTelemetryConfigurationPlugins(swiftModel: $0) } } @@ -8514,4 +8518,4 @@ public class DDTelemetryConfigurationEventView: NSObject { // swiftlint:enable force_unwrapping -// Generated from https://github.com/DataDog/rum-events-format/tree/45a80c1390b8ec886534f5f1b43763a6d9d0a643 +// Generated from https://github.com/DataDog/rum-events-format/tree/2d2cd6aecf0ea4f1ffe61b7149dfdef75397fdbf diff --git a/DatadogRUM/Sources/DataModels/RUMDataModels.swift b/DatadogRUM/Sources/DataModels/RUMDataModels.swift index 137ce4f479..360d5d8cd5 100644 --- a/DatadogRUM/Sources/DataModels/RUMDataModels.swift +++ b/DatadogRUM/Sources/DataModels/RUMDataModels.swift @@ -8,6 +8,8 @@ import DatadogInternal // This file was generated from JSON Schema. Do not modify it directly. +// swiftlint:disable all + internal protocol RUMDataModel: Codable {} /// Schema of all properties of an Action event @@ -78,7 +80,7 @@ public struct RUMActionEvent: RUMDataModel { /// View properties public var view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case dd = "_dd" case account = "account" case action = "action" @@ -103,6 +105,76 @@ public struct RUMActionEvent: RUMDataModel { case view = "view" } + /// Schema of all properties of an Action event + /// + /// - Parameters: + /// - dd: Internal properties + /// - account: Account properties + /// - action: Action properties + /// - application: Application properties + /// - buildId: Generated unique ID of the application build. Unlike version or build_version this field is not meant to be coming from the user, but rather generated by the tooling for each build. + /// - buildVersion: The build version for this application + /// - ciTest: CI Visibility properties + /// - connectivity: Device connectivity properties + /// - container: View Container properties (view wrapping the current view) + /// - context: User provided context + /// - date: Start of the event in ms from epoch + /// - device: Device properties + /// - display: Display properties + /// - os: Operating system properties + /// - service: The service name for this application + /// - session: Session properties + /// - source: The source of this event + /// - synthetics: Synthetics properties + /// - usr: User properties + /// - version: The version for this application + /// - view: View properties + public init( + dd: DD, + account: Account? = nil, + action: Action, + application: Application, + buildId: String? = nil, + buildVersion: String? = nil, + ciTest: RUMCITest? = nil, + connectivity: RUMConnectivity? = nil, + container: Container? = nil, + context: RUMEventAttributes? = nil, + date: Int64, + device: RUMDevice? = nil, + display: Display? = nil, + os: RUMOperatingSystem? = nil, + service: String? = nil, + session: Session, + source: Source? = nil, + synthetics: RUMSyntheticsTest? = nil, + usr: RUMUser? = nil, + version: String? = nil, + view: View + ) { + self.dd = dd + self.account = account + self.action = action + self.application = application + self.buildId = buildId + self.buildVersion = buildVersion + self.ciTest = ciTest + self.connectivity = connectivity + self.container = container + self.context = context + self.date = date + self.device = device + self.display = display + self.os = os + self.service = service + self.session = session + self.source = source + self.synthetics = synthetics + self.usr = usr + self.version = version + self.view = view + } + /// Internal properties public struct DD: Codable { /// Action properties @@ -120,7 +192,7 @@ public struct RUMActionEvent: RUMDataModel { /// Session-related internal properties public let session: Session? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case action = "action" case browserSdkVersion = "browser_sdk_version" case configuration = "configuration" @@ -128,6 +200,25 @@ public struct RUMActionEvent: RUMDataModel { case session = "session" } + /// Internal properties + /// + /// - Parameters: + /// - action: Action properties + /// - browserSdkVersion: Browser SDK version + /// - configuration: Subset of the SDK configuration options in use during its execution + /// - session: Session-related internal properties + public init( + action: Action? = nil, + browserSdkVersion: String? = nil, + configuration: Configuration? = nil, + session: Session? = nil + ) { + self.action = action + self.browserSdkVersion = browserSdkVersion + self.configuration = configuration + self.session = session + } + /// Action properties public struct Action: Codable { /// The strategy of how the auto click action name is computed @@ -139,12 +230,28 @@ public struct RUMActionEvent: RUMDataModel { /// Target properties public let target: Target? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case nameSource = "name_source" case position = "position" case target = "target" } + /// Action properties + /// + /// - Parameters: + /// - nameSource: The strategy of how the auto click action name is computed + /// - position: Action position properties + /// - target: Target properties + public init( + nameSource: NameSource? = nil, + position: Position? = nil, + target: Target? = nil + ) { + self.nameSource = nameSource + self.position = position + self.target = target + } + /// The strategy of how the auto click action name is computed public enum NameSource: String, Codable { case customAttribute = "custom_attribute" @@ -163,10 +270,23 @@ public struct RUMActionEvent: RUMDataModel { /// Y coordinate relative to the target element of the action (in pixels) public let y: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case x = "x" case y = "y" } + + /// Action position properties + /// + /// - Parameters: + /// - x: X coordinate relative to the target element of the action (in pixels) + /// - y: Y coordinate relative to the target element of the action (in pixels) + public init( + x: Int64, + y: Int64 + ) { + self.x = x + self.y = y + } } /// Target properties @@ -180,11 +300,27 @@ public struct RUMActionEvent: RUMDataModel { /// Width of the target element (in pixels) public let width: Int64? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case height = "height" case selector = "selector" case width = "width" } + + /// Target properties + /// + /// - Parameters: + /// - height: Height of the target element (in pixels) + /// - selector: CSS selector path of the target element + /// - width: Width of the target element (in pixels) + public init( + height: Int64? = nil, + selector: String? = nil, + width: Int64? = nil + ) { + self.height = height + self.selector = selector + self.width = width + } } } @@ -196,10 +332,23 @@ public struct RUMActionEvent: RUMDataModel { /// The percentage of sessions tracked public let sessionSampleRate: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case sessionReplaySampleRate = "session_replay_sample_rate" case sessionSampleRate = "session_sample_rate" } + + /// Subset of the SDK configuration options in use during its execution + /// + /// - Parameters: + /// - sessionReplaySampleRate: The percentage of sessions with RUM & Session Replay pricing tracked + /// - sessionSampleRate: The percentage of sessions tracked + public init( + sessionReplaySampleRate: Double? = nil, + sessionSampleRate: Double + ) { + self.sessionReplaySampleRate = sessionReplaySampleRate + self.sessionSampleRate = sessionSampleRate + } } /// Session-related internal properties @@ -210,11 +359,24 @@ public struct RUMActionEvent: RUMDataModel { /// The precondition that led to the creation of the session public let sessionPrecondition: RUMSessionPrecondition? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case plan = "plan" case sessionPrecondition = "session_precondition" } + /// Session-related internal properties + /// + /// - Parameters: + /// - plan: Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) + /// - sessionPrecondition: The precondition that led to the creation of the session + public init( + plan: Plan? = nil, + sessionPrecondition: RUMSessionPrecondition? = nil + ) { + self.plan = plan + self.sessionPrecondition = sessionPrecondition + } + /// Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) public enum Plan: Int, Codable { case plan1 = 1 @@ -233,10 +395,26 @@ public struct RUMActionEvent: RUMDataModel { public var accountInfo: [String: Encodable] - enum StaticCodingKeys: String, CodingKey { + public enum StaticCodingKeys: String, CodingKey { case id = "id" case name = "name" } + + /// Account properties + /// + /// - Parameters: + /// - id: Identifier of the account + /// - name: Name of the account + /// - accountInfo: + public init( + id: String, + name: String? = nil, + accountInfo: [String: Encodable] + ) { + self.id = id + self.name = name + self.accountInfo = accountInfo + } } /// Action properties @@ -268,7 +446,7 @@ public struct RUMActionEvent: RUMDataModel { /// Type of the action public let type: ActionType - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case crash = "crash" case error = "error" case frustration = "frustration" @@ -280,14 +458,58 @@ public struct RUMActionEvent: RUMDataModel { case type = "type" } + /// Action properties + /// + /// - Parameters: + /// - crash: Properties of the crashes of the action + /// - error: Properties of the errors of the action + /// - frustration: Action frustration properties + /// - id: UUID of the action + /// - loadingTime: Duration in ns to the action is considered loaded + /// - longTask: Properties of the long tasks of the action + /// - resource: Properties of the resources of the action + /// - target: Action target properties + /// - type: Type of the action + public init( + crash: Crash? = nil, + error: Error? = nil, + frustration: Frustration? = nil, + id: String? = nil, + loadingTime: Int64? = nil, + longTask: LongTask? = nil, + resource: Resource? = nil, + target: Target? = nil, + type: ActionType + ) { + self.crash = crash + self.error = error + self.frustration = frustration + self.id = id + self.loadingTime = loadingTime + self.longTask = longTask + self.resource = resource + self.target = target + self.type = type + } + /// Properties of the crashes of the action public struct Crash: Codable { /// Number of crashes that occurred on the action public let count: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case count = "count" } + + /// Properties of the crashes of the action + /// + /// - Parameters: + /// - count: Number of crashes that occurred on the action + public init( + count: Int64 + ) { + self.count = count + } } /// Properties of the errors of the action @@ -295,9 +517,19 @@ public struct RUMActionEvent: RUMDataModel { /// Number of errors that occurred on the action public let count: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case count = "count" } + + /// Properties of the errors of the action + /// + /// - Parameters: + /// - count: Number of errors that occurred on the action + public init( + count: Int64 + ) { + self.count = count + } } /// Action frustration properties @@ -305,10 +537,20 @@ public struct RUMActionEvent: RUMDataModel { /// Action frustration types public let type: [FrustrationType] - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case type = "type" } + /// Action frustration properties + /// + /// - Parameters: + /// - type: Action frustration types + public init( + type: [FrustrationType] + ) { + self.type = type + } + public enum FrustrationType: String, Codable { case rageClick = "rage_click" case deadClick = "dead_click" @@ -323,9 +565,19 @@ public struct RUMActionEvent: RUMDataModel { /// Number of long tasks that occurred on the action public let count: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case count = "count" } + + /// Properties of the long tasks of the action + /// + /// - Parameters: + /// - count: Number of long tasks that occurred on the action + public init( + count: Int64 + ) { + self.count = count + } } /// Properties of the resources of the action @@ -333,9 +585,19 @@ public struct RUMActionEvent: RUMDataModel { /// Number of resources that occurred on the action public let count: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case count = "count" } + + /// Properties of the resources of the action + /// + /// - Parameters: + /// - count: Number of resources that occurred on the action + public init( + count: Int64 + ) { + self.count = count + } } /// Action target properties @@ -343,9 +605,19 @@ public struct RUMActionEvent: RUMDataModel { /// Target name public var name: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case name = "name" } + + /// Action target properties + /// + /// - Parameters: + /// - name: Target name + public init( + name: String + ) { + self.name = name + } } /// Type of the action @@ -365,9 +637,19 @@ public struct RUMActionEvent: RUMDataModel { /// UUID of the application public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Application properties + /// + /// - Parameters: + /// - id: UUID of the application + public init( + id: String + ) { + self.id = id + } } /// View Container properties (view wrapping the current view) @@ -378,11 +660,24 @@ public struct RUMActionEvent: RUMDataModel { /// Attributes of the view's container public let view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case source = "source" case view = "view" } + /// View Container properties (view wrapping the current view) + /// + /// - Parameters: + /// - source: Source of the parent view + /// - view: Attributes of the view's container + public init( + source: Source, + view: View + ) { + self.source = source + self.view = view + } + /// Source of the parent view public enum Source: String, Codable { case android = "android" @@ -400,9 +695,19 @@ public struct RUMActionEvent: RUMDataModel { /// ID of the parent view public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Attributes of the view's container + /// + /// - Parameters: + /// - id: ID of the parent view + public init( + id: String + ) { + self.id = id + } } } @@ -411,10 +716,20 @@ public struct RUMActionEvent: RUMDataModel { /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public let viewport: Viewport? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case viewport = "viewport" } + /// Display properties + /// + /// - Parameters: + /// - viewport: The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + public init( + viewport: Viewport? = nil + ) { + self.viewport = viewport + } + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public struct Viewport: Codable { /// Height of the viewport (in pixels) @@ -423,10 +738,23 @@ public struct RUMActionEvent: RUMDataModel { /// Width of the viewport (in pixels) public let width: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case height = "height" case width = "width" } + + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + /// + /// - Parameters: + /// - height: Height of the viewport (in pixels) + /// - width: Width of the viewport (in pixels) + public init( + height: Double, + width: Double + ) { + self.height = height + self.width = width + } } } @@ -441,11 +769,27 @@ public struct RUMActionEvent: RUMDataModel { /// Type of the session public let type: RUMSessionType - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case hasReplay = "has_replay" case id = "id" case type = "type" } + + /// Session properties + /// + /// - Parameters: + /// - hasReplay: Whether this session has a replay + /// - id: UUID of the session + /// - type: Type of the session + public init( + hasReplay: Bool? = nil, + id: String, + type: RUMSessionType + ) { + self.hasReplay = hasReplay + self.id = id + self.type = type + } } /// The source of this event @@ -477,13 +821,35 @@ public struct RUMActionEvent: RUMDataModel { /// URL of the view public var url: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" case inForeground = "in_foreground" case name = "name" case referrer = "referrer" case url = "url" } + + /// View properties + /// + /// - Parameters: + /// - id: UUID of the view + /// - inForeground: Is the action starting in the foreground (focus in browser) + /// - name: User defined name of the view + /// - referrer: URL that linked to the initial view of the page + /// - url: URL of the view + public init( + id: String, + inForeground: Bool? = nil, + name: String? = nil, + referrer: String? = nil, + url: String + ) { + self.id = id + self.inForeground = inForeground + self.name = name + self.referrer = referrer + self.url = url + } } } @@ -599,7 +965,7 @@ public struct RUMErrorEvent: RUMDataModel { /// View properties public var view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case dd = "_dd" case account = "account" case action = "action" @@ -627,6 +993,85 @@ public struct RUMErrorEvent: RUMDataModel { case view = "view" } + /// Schema of all properties of an Error event + /// + /// - Parameters: + /// - dd: Internal properties + /// - account: Account properties + /// - action: Action properties + /// - application: Application properties + /// - buildId: Generated unique ID of the application build. Unlike version or build_version this field is not meant to be coming from the user, but rather generated by the tooling for each build. + /// - buildVersion: The build version for this application + /// - ciTest: CI Visibility properties + /// - connectivity: Device connectivity properties + /// - container: View Container properties (view wrapping the current view) + /// - context: User provided context + /// - date: Start of the event in ms from epoch + /// - device: Device properties + /// - display: Display properties + /// - error: Error properties + /// - featureFlags: Feature flags properties + /// - freeze: Properties of App Hang and ANR errors + /// - os: Operating system properties + /// - service: The service name for this application + /// - session: Session properties + /// - source: The source of this event + /// - synthetics: Synthetics properties + /// - usr: User properties + /// - version: The version for this application + /// - view: View properties + public init( + dd: DD, + account: Account? = nil, + action: Action? = nil, + application: Application, + buildId: String? = nil, + buildVersion: String? = nil, + ciTest: RUMCITest? = nil, + connectivity: RUMConnectivity? = nil, + container: Container? = nil, + context: RUMEventAttributes? = nil, + date: Int64, + device: RUMDevice? = nil, + display: Display? = nil, + error: Error, + featureFlags: FeatureFlags? = nil, + freeze: Freeze? = nil, + os: RUMOperatingSystem? = nil, + service: String? = nil, + session: Session, + source: Source? = nil, + synthetics: RUMSyntheticsTest? = nil, + usr: RUMUser? = nil, + version: String? = nil, + view: View + ) { + self.dd = dd + self.account = account + self.action = action + self.application = application + self.buildId = buildId + self.buildVersion = buildVersion + self.ciTest = ciTest + self.connectivity = connectivity + self.container = container + self.context = context + self.date = date + self.device = device + self.display = display + self.error = error + self.featureFlags = featureFlags + self.freeze = freeze + self.os = os + self.service = service + self.session = session + self.source = source + self.synthetics = synthetics + self.usr = usr + self.version = version + self.view = view + } + /// Internal properties public struct DD: Codable { /// Browser SDK version @@ -641,13 +1086,29 @@ public struct RUMErrorEvent: RUMDataModel { /// Session-related internal properties public let session: Session? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case browserSdkVersion = "browser_sdk_version" case configuration = "configuration" case formatVersion = "format_version" case session = "session" } + /// Internal properties + /// + /// - Parameters: + /// - browserSdkVersion: Browser SDK version + /// - configuration: Subset of the SDK configuration options in use during its execution + /// - session: Session-related internal properties + public init( + browserSdkVersion: String? = nil, + configuration: Configuration? = nil, + session: Session? = nil + ) { + self.browserSdkVersion = browserSdkVersion + self.configuration = configuration + self.session = session + } + /// Subset of the SDK configuration options in use during its execution public struct Configuration: Codable { /// The percentage of sessions with RUM & Session Replay pricing tracked @@ -656,10 +1117,23 @@ public struct RUMErrorEvent: RUMDataModel { /// The percentage of sessions tracked public let sessionSampleRate: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case sessionReplaySampleRate = "session_replay_sample_rate" case sessionSampleRate = "session_sample_rate" } + + /// Subset of the SDK configuration options in use during its execution + /// + /// - Parameters: + /// - sessionReplaySampleRate: The percentage of sessions with RUM & Session Replay pricing tracked + /// - sessionSampleRate: The percentage of sessions tracked + public init( + sessionReplaySampleRate: Double? = nil, + sessionSampleRate: Double + ) { + self.sessionReplaySampleRate = sessionReplaySampleRate + self.sessionSampleRate = sessionSampleRate + } } /// Session-related internal properties @@ -670,11 +1144,24 @@ public struct RUMErrorEvent: RUMDataModel { /// The precondition that led to the creation of the session public let sessionPrecondition: RUMSessionPrecondition? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case plan = "plan" case sessionPrecondition = "session_precondition" } + /// Session-related internal properties + /// + /// - Parameters: + /// - plan: Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) + /// - sessionPrecondition: The precondition that led to the creation of the session + public init( + plan: Plan? = nil, + sessionPrecondition: RUMSessionPrecondition? = nil + ) { + self.plan = plan + self.sessionPrecondition = sessionPrecondition + } + /// Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) public enum Plan: Int, Codable { case plan1 = 1 @@ -693,10 +1180,26 @@ public struct RUMErrorEvent: RUMDataModel { public var accountInfo: [String: Encodable] - enum StaticCodingKeys: String, CodingKey { + public enum StaticCodingKeys: String, CodingKey { case id = "id" case name = "name" } + + /// Account properties + /// + /// - Parameters: + /// - id: Identifier of the account + /// - name: Name of the account + /// - accountInfo: + public init( + id: String, + name: String? = nil, + accountInfo: [String: Encodable] + ) { + self.id = id + self.name = name + self.accountInfo = accountInfo + } } /// Action properties @@ -704,9 +1207,19 @@ public struct RUMErrorEvent: RUMDataModel { /// UUID of the action public let id: RUMActionID - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Action properties + /// + /// - Parameters: + /// - id: UUID of the action + public init( + id: RUMActionID + ) { + self.id = id + } } /// Application properties @@ -714,9 +1227,19 @@ public struct RUMErrorEvent: RUMDataModel { /// UUID of the application public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Application properties + /// + /// - Parameters: + /// - id: UUID of the application + public init( + id: String + ) { + self.id = id + } } /// View Container properties (view wrapping the current view) @@ -727,11 +1250,24 @@ public struct RUMErrorEvent: RUMDataModel { /// Attributes of the view's container public let view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case source = "source" case view = "view" } + /// View Container properties (view wrapping the current view) + /// + /// - Parameters: + /// - source: Source of the parent view + /// - view: Attributes of the view's container + public init( + source: Source, + view: View + ) { + self.source = source + self.view = view + } + /// Source of the parent view public enum Source: String, Codable { case android = "android" @@ -749,9 +1285,19 @@ public struct RUMErrorEvent: RUMDataModel { /// ID of the parent view public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Attributes of the view's container + /// + /// - Parameters: + /// - id: ID of the parent view + public init( + id: String + ) { + self.id = id + } } } @@ -760,10 +1306,20 @@ public struct RUMErrorEvent: RUMDataModel { /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public let viewport: Viewport? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case viewport = "viewport" } + /// Display properties + /// + /// - Parameters: + /// - viewport: The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + public init( + viewport: Viewport? = nil + ) { + self.viewport = viewport + } + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public struct Viewport: Codable { /// Height of the viewport (in pixels) @@ -772,10 +1328,23 @@ public struct RUMErrorEvent: RUMDataModel { /// Width of the viewport (in pixels) public let width: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case height = "height" case width = "width" } + + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + /// + /// - Parameters: + /// - height: Height of the viewport (in pixels) + /// - width: Width of the viewport (in pixels) + public init( + height: Double, + width: Double + ) { + self.height = height + self.width = width + } } } @@ -838,7 +1407,7 @@ public struct RUMErrorEvent: RUMDataModel { /// A boolean value saying if any of the stack traces was truncated due to minification. public let wasTruncated: Bool? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case binaryImages = "binary_images" case category = "category" case causes = "causes" @@ -860,6 +1429,70 @@ public struct RUMErrorEvent: RUMDataModel { case wasTruncated = "was_truncated" } + /// Error properties + /// + /// - Parameters: + /// - binaryImages: Description of each binary image (native libraries; for Android: .so files) loaded or referenced by the process/application. + /// - category: The specific category of the error. It provides a high-level grouping for different types of errors. + /// - causes: Causes of the error + /// - csp: Content Security Violation properties + /// - fingerprint: Fingerprint used for Error Tracking custom grouping + /// - handling: Whether the error has been handled manually in the source code or not + /// - handlingStack: Handling call stack + /// - id: UUID of the error + /// - isCrash: Whether this error crashed the host application + /// - message: Error message + /// - meta: Platform-specific metadata of the error event. + /// - resource: Resource properties of the error + /// - source: Source of the error + /// - sourceType: Source type of the error (the language or platform impacting the error stacktrace format) + /// - stack: Stacktrace of the error + /// - threads: Description of each thread in the process when error happened. + /// - timeSinceAppStart: Time since application start when error happened (in milliseconds) + /// - type: The type of the error + /// - wasTruncated: A boolean value saying if any of the stack traces was truncated due to minification. + public init( + binaryImages: [BinaryImages]? = nil, + category: Category? = nil, + causes: [Causes]? = nil, + csp: CSP? = nil, + fingerprint: String? = nil, + handling: Handling? = nil, + handlingStack: String? = nil, + id: String? = nil, + isCrash: Bool? = nil, + message: String, + meta: Meta? = nil, + resource: Resource? = nil, + source: Source, + sourceType: SourceType? = nil, + stack: String? = nil, + threads: [Threads]? = nil, + timeSinceAppStart: Int64? = nil, + type: String? = nil, + wasTruncated: Bool? = nil + ) { + self.binaryImages = binaryImages + self.category = category + self.causes = causes + self.csp = csp + self.fingerprint = fingerprint + self.handling = handling + self.handlingStack = handlingStack + self.id = id + self.isCrash = isCrash + self.message = message + self.meta = meta + self.resource = resource + self.source = source + self.sourceType = sourceType + self.stack = stack + self.threads = threads + self.timeSinceAppStart = timeSinceAppStart + self.type = type + self.wasTruncated = wasTruncated + } + /// Description of the binary image (native library; for Android: .so file) loaded or referenced by the process/application. public struct BinaryImages: Codable { /// CPU architecture from the library. @@ -880,7 +1513,7 @@ public struct RUMErrorEvent: RUMDataModel { /// Build UUID that uniquely identifies the binary image. public let uuid: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case arch = "arch" case isSystem = "is_system" case loadAddress = "load_address" @@ -888,6 +1521,31 @@ public struct RUMErrorEvent: RUMDataModel { case name = "name" case uuid = "uuid" } + + /// Description of the binary image (native library; for Android: .so file) loaded or referenced by the process/application. + /// + /// - Parameters: + /// - arch: CPU architecture from the library. + /// - isSystem: Determines if it's a system or user library. + /// - loadAddress: Library's load address (hexadecimal). + /// - maxAddress: Max value from the library address range (hexadecimal). + /// - name: Name of the library. + /// - uuid: Build UUID that uniquely identifies the binary image. + public init( + arch: String? = nil, + isSystem: Bool, + loadAddress: String? = nil, + maxAddress: String? = nil, + name: String, + uuid: String + ) { + self.arch = arch + self.isSystem = isSystem + self.loadAddress = loadAddress + self.maxAddress = maxAddress + self.name = name + self.uuid = uuid + } } /// The specific category of the error. It provides a high-level grouping for different types of errors. @@ -913,13 +1571,32 @@ public struct RUMErrorEvent: RUMDataModel { /// The type of the error public let type: String? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case message = "message" case source = "source" case stack = "stack" case type = "type" } + /// Properties for one of the error causes + /// + /// - Parameters: + /// - message: Error message + /// - source: Source of the error + /// - stack: Stacktrace of the error + /// - type: The type of the error + public init( + message: String, + source: Source, + stack: String? = nil, + type: String? = nil + ) { + self.message = message + self.source = source + self.stack = stack + self.type = type + } + /// Source of the error public enum Source: String, Codable { case network = "network" @@ -938,10 +1615,20 @@ public struct RUMErrorEvent: RUMDataModel { /// In the context of CSP errors, indicates how the violated policy is configured to be treated by the user agent. public let disposition: Disposition? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case disposition = "disposition" } + /// Content Security Violation properties + /// + /// - Parameters: + /// - disposition: In the context of CSP errors, indicates how the violated policy is configured to be treated by the user agent. + public init( + disposition: Disposition? = nil + ) { + self.disposition = disposition + } + /// In the context of CSP errors, indicates how the violated policy is configured to be treated by the user agent. public enum Disposition: String, Codable { case enforce = "enforce" @@ -978,7 +1665,7 @@ public struct RUMErrorEvent: RUMDataModel { /// The name of the crashed process. public let process: String? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case codeType = "code_type" case exceptionCodes = "exception_codes" case exceptionType = "exception_type" @@ -987,6 +1674,34 @@ public struct RUMErrorEvent: RUMDataModel { case path = "path" case process = "process" } + + /// Platform-specific metadata of the error event. + /// + /// - Parameters: + /// - codeType: The CPU architecture of the process that crashed. + /// - exceptionCodes: CPU specific information about the exception encoded into 64-bit hexadecimal number preceded by the signal code. + /// - exceptionType: The name of the corresponding BSD termination signal. (in case of iOS crash) + /// - incidentIdentifier: A client-generated 16-byte UUID of the incident. + /// - parentProcess: Parent process information. + /// - path: The location of the executable. + /// - process: The name of the crashed process. + public init( + codeType: String? = nil, + exceptionCodes: String? = nil, + exceptionType: String? = nil, + incidentIdentifier: String? = nil, + parentProcess: String? = nil, + path: String? = nil, + process: String? = nil + ) { + self.codeType = codeType + self.exceptionCodes = exceptionCodes + self.exceptionType = exceptionType + self.incidentIdentifier = incidentIdentifier + self.parentProcess = parentProcess + self.path = path + self.process = process + } } /// Resource properties of the error @@ -1003,13 +1718,32 @@ public struct RUMErrorEvent: RUMDataModel { /// URL of the resource public var url: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case method = "method" case provider = "provider" case statusCode = "status_code" case url = "url" } + /// Resource properties of the error + /// + /// - Parameters: + /// - method: HTTP method of the resource + /// - provider: The provider for this resource + /// - statusCode: HTTP Status code of the resource + /// - url: URL of the resource + public init( + method: RUMMethod, + provider: Provider? = nil, + statusCode: Int64, + url: String + ) { + self.method = method + self.provider = provider + self.statusCode = statusCode + self.url = url + } + /// The provider for this resource public struct Provider: Codable { /// The domain name of the provider @@ -1021,12 +1755,28 @@ public struct RUMErrorEvent: RUMDataModel { /// The type of provider public let type: ProviderType? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case domain = "domain" case name = "name" case type = "type" } + /// The provider for this resource + /// + /// - Parameters: + /// - domain: The domain name of the provider + /// - name: The user friendly name of the provider + /// - type: The type of provider + public init( + domain: String? = nil, + name: String? = nil, + type: ProviderType? = nil + ) { + self.domain = domain + self.name = name + self.type = type + } + /// The type of provider public enum ProviderType: String, Codable { case ad = "ad" @@ -1086,18 +1836,47 @@ public struct RUMErrorEvent: RUMDataModel { /// Platform-specific state of the thread when its state was captured (CPU registers dump for iOS, thread state enum for Android, etc.). public let state: String? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case crashed = "crashed" case name = "name" case stack = "stack" case state = "state" } + + /// Description of the thread in the process when error happened. + /// + /// - Parameters: + /// - crashed: Tells if the thread crashed. + /// - name: Name of the thread (e.g. 'Thread 0'). + /// - stack: Unsymbolicated stack trace of the given thread. + /// - state: Platform-specific state of the thread when its state was captured (CPU registers dump for iOS, thread state enum for Android, etc.). + public init( + crashed: Bool, + name: String, + stack: String, + state: String? = nil + ) { + self.crashed = crashed + self.name = name + self.stack = stack + self.state = state + } } } /// Feature flags properties public struct FeatureFlags: Codable { public var featureFlagsInfo: [String: Encodable] + + /// Feature flags properties + /// + /// - Parameters: + /// - featureFlagsInfo: + public init( + featureFlagsInfo: [String: Encodable] + ) { + self.featureFlagsInfo = featureFlagsInfo + } } /// Properties of App Hang and ANR errors @@ -1105,9 +1884,19 @@ public struct RUMErrorEvent: RUMDataModel { /// Duration of the main thread freeze (in ns) public let duration: Int64 - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case duration = "duration" } + + /// Properties of App Hang and ANR errors + /// + /// - Parameters: + /// - duration: Duration of the main thread freeze (in ns) + public init( + duration: Int64 + ) { + self.duration = duration + } } /// Session properties @@ -1121,11 +1910,27 @@ public struct RUMErrorEvent: RUMDataModel { /// Type of the session public let type: RUMSessionType - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case hasReplay = "has_replay" case id = "id" case type = "type" } + + /// Session properties + /// + /// - Parameters: + /// - hasReplay: Whether this session has a replay + /// - id: UUID of the session + /// - type: Type of the session + public init( + hasReplay: Bool? = nil, + id: String, + type: RUMSessionType + ) { + self.hasReplay = hasReplay + self.id = id + self.type = type + } } /// The source of this event @@ -1157,13 +1962,35 @@ public struct RUMErrorEvent: RUMDataModel { /// URL of the view public var url: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" case inForeground = "in_foreground" case name = "name" case referrer = "referrer" case url = "url" } + + /// View properties + /// + /// - Parameters: + /// - id: UUID of the view + /// - inForeground: Is the error starting in the foreground (focus in browser) + /// - name: User defined name of the view + /// - referrer: URL that linked to the initial view of the page + /// - url: URL of the view + public init( + id: String, + inForeground: Bool? = nil, + name: String? = nil, + referrer: String? = nil, + url: String + ) { + self.id = id + self.inForeground = inForeground + self.name = name + self.referrer = referrer + self.url = url + } } } @@ -1297,7 +2124,7 @@ public struct RUMLongTaskEvent: RUMDataModel { /// View properties public var view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case dd = "_dd" case account = "account" case action = "action" @@ -1323,6 +2150,79 @@ public struct RUMLongTaskEvent: RUMDataModel { case view = "view" } + /// Schema of all properties of a Long Task event + /// + /// - Parameters: + /// - dd: Internal properties + /// - account: Account properties + /// - action: Action properties + /// - application: Application properties + /// - buildId: Generated unique ID of the application build. Unlike version or build_version this field is not meant to be coming from the user, but rather generated by the tooling for each build. + /// - buildVersion: The build version for this application + /// - ciTest: CI Visibility properties + /// - connectivity: Device connectivity properties + /// - container: View Container properties (view wrapping the current view) + /// - context: User provided context + /// - date: Start of the event in ms from epoch + /// - device: Device properties + /// - display: Display properties + /// - longTask: Long Task properties + /// - os: Operating system properties + /// - service: The service name for this application + /// - session: Session properties + /// - source: The source of this event + /// - synthetics: Synthetics properties + /// - usr: User properties + /// - version: The version for this application + /// - view: View properties + public init( + dd: DD, + account: Account? = nil, + action: Action? = nil, + application: Application, + buildId: String? = nil, + buildVersion: String? = nil, + ciTest: RUMCITest? = nil, + connectivity: RUMConnectivity? = nil, + container: Container? = nil, + context: RUMEventAttributes? = nil, + date: Int64, + device: RUMDevice? = nil, + display: Display? = nil, + longTask: LongTask, + os: RUMOperatingSystem? = nil, + service: String? = nil, + session: Session, + source: Source? = nil, + synthetics: RUMSyntheticsTest? = nil, + usr: RUMUser? = nil, + version: String? = nil, + view: View + ) { + self.dd = dd + self.account = account + self.action = action + self.application = application + self.buildId = buildId + self.buildVersion = buildVersion + self.ciTest = ciTest + self.connectivity = connectivity + self.container = container + self.context = context + self.date = date + self.device = device + self.display = display + self.longTask = longTask + self.os = os + self.service = service + self.session = session + self.source = source + self.synthetics = synthetics + self.usr = usr + self.version = version + self.view = view + } + /// Internal properties public struct DD: Codable { /// Browser SDK version @@ -1340,7 +2240,7 @@ public struct RUMLongTaskEvent: RUMDataModel { /// Session-related internal properties public let session: Session? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case browserSdkVersion = "browser_sdk_version" case configuration = "configuration" case discarded = "discarded" @@ -1348,6 +2248,25 @@ public struct RUMLongTaskEvent: RUMDataModel { case session = "session" } + /// Internal properties + /// + /// - Parameters: + /// - browserSdkVersion: Browser SDK version + /// - configuration: Subset of the SDK configuration options in use during its execution + /// - discarded: Whether the long task should be discarded or indexed + /// - session: Session-related internal properties + public init( + browserSdkVersion: String? = nil, + configuration: Configuration? = nil, + discarded: Bool? = nil, + session: Session? = nil + ) { + self.browserSdkVersion = browserSdkVersion + self.configuration = configuration + self.discarded = discarded + self.session = session + } + /// Subset of the SDK configuration options in use during its execution public struct Configuration: Codable { /// The percentage of sessions with RUM & Session Replay pricing tracked @@ -1356,10 +2275,23 @@ public struct RUMLongTaskEvent: RUMDataModel { /// The percentage of sessions tracked public let sessionSampleRate: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case sessionReplaySampleRate = "session_replay_sample_rate" case sessionSampleRate = "session_sample_rate" } + + /// Subset of the SDK configuration options in use during its execution + /// + /// - Parameters: + /// - sessionReplaySampleRate: The percentage of sessions with RUM & Session Replay pricing tracked + /// - sessionSampleRate: The percentage of sessions tracked + public init( + sessionReplaySampleRate: Double? = nil, + sessionSampleRate: Double + ) { + self.sessionReplaySampleRate = sessionReplaySampleRate + self.sessionSampleRate = sessionSampleRate + } } /// Session-related internal properties @@ -1370,11 +2302,24 @@ public struct RUMLongTaskEvent: RUMDataModel { /// The precondition that led to the creation of the session public let sessionPrecondition: RUMSessionPrecondition? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case plan = "plan" case sessionPrecondition = "session_precondition" } + /// Session-related internal properties + /// + /// - Parameters: + /// - plan: Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) + /// - sessionPrecondition: The precondition that led to the creation of the session + public init( + plan: Plan? = nil, + sessionPrecondition: RUMSessionPrecondition? = nil + ) { + self.plan = plan + self.sessionPrecondition = sessionPrecondition + } + /// Session plan: 1 is the plan without replay, 2 is the plan with replay (deprecated) public enum Plan: Int, Codable { case plan1 = 1 @@ -1393,10 +2338,26 @@ public struct RUMLongTaskEvent: RUMDataModel { public var accountInfo: [String: Encodable] - enum StaticCodingKeys: String, CodingKey { + public enum StaticCodingKeys: String, CodingKey { case id = "id" case name = "name" } + + /// Account properties + /// + /// - Parameters: + /// - id: Identifier of the account + /// - name: Name of the account + /// - accountInfo: + public init( + id: String, + name: String? = nil, + accountInfo: [String: Encodable] + ) { + self.id = id + self.name = name + self.accountInfo = accountInfo + } } /// Action properties @@ -1404,9 +2365,19 @@ public struct RUMLongTaskEvent: RUMDataModel { /// UUID of the action public let id: RUMActionID - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Action properties + /// + /// - Parameters: + /// - id: UUID of the action + public init( + id: RUMActionID + ) { + self.id = id + } } /// Application properties @@ -1414,9 +2385,19 @@ public struct RUMLongTaskEvent: RUMDataModel { /// UUID of the application public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Application properties + /// + /// - Parameters: + /// - id: UUID of the application + public init( + id: String + ) { + self.id = id + } } /// View Container properties (view wrapping the current view) @@ -1427,11 +2408,24 @@ public struct RUMLongTaskEvent: RUMDataModel { /// Attributes of the view's container public let view: View - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case source = "source" case view = "view" } + /// View Container properties (view wrapping the current view) + /// + /// - Parameters: + /// - source: Source of the parent view + /// - view: Attributes of the view's container + public init( + source: Source, + view: View + ) { + self.source = source + self.view = view + } + /// Source of the parent view public enum Source: String, Codable { case android = "android" @@ -1449,9 +2443,19 @@ public struct RUMLongTaskEvent: RUMDataModel { /// ID of the parent view public let id: String - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case id = "id" } + + /// Attributes of the view's container + /// + /// - Parameters: + /// - id: ID of the parent view + public init( + id: String + ) { + self.id = id + } } } @@ -1460,10 +2464,20 @@ public struct RUMLongTaskEvent: RUMDataModel { /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public let viewport: Viewport? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case viewport = "viewport" } + /// Display properties + /// + /// - Parameters: + /// - viewport: The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + public init( + viewport: Viewport? = nil + ) { + self.viewport = viewport + } + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. public struct Viewport: Codable { /// Height of the viewport (in pixels) @@ -1472,10 +2486,23 @@ public struct RUMLongTaskEvent: RUMDataModel { /// Width of the viewport (in pixels) public let width: Double - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case height = "height" case width = "width" } + + /// The viewport represents the rectangular area that is currently being viewed. Content outside the viewport is not visible onscreen until scrolled into view. + /// + /// - Parameters: + /// - height: Height of the viewport (in pixels) + /// - width: Width of the viewport (in pixels) + public init( + height: Double, + width: Double + ) { + self.height = height + self.width = width + } } } @@ -1511,7 +2538,7 @@ public struct RUMLongTaskEvent: RUMDataModel { /// Start time of the time period spent in style and layout calculations public let styleAndLayoutStart: Double? - enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case blockingDuration = "blocking_duration" case duration = "duration" case entryType = "entry_type" @@ -1524,6 +2551,43 @@ public struct RUMLongTaskEvent: RUMDataModel { case styleAndLayoutStart = "style_and_layout_start" } + /// Long Task properties + /// + /// - Parameters: + /// - blockingDuration: Duration in ns for which the animation frame was being blocked + /// - duration: Duration in ns of the long task or long animation frame + /// - entryType: Type of the event: long task or long animation frame + /// - firstUiEventTimestamp: Start time of of the first UI event (mouse/keyboard and so on) to be handled during the course of this frame + /// - id: UUID of the long task or long animation frame + /// - isFrozenFrame: Whether this long task is considered a frozen frame + /// - renderStart: Start time of the rendering cycle, which includes requestAnimationFrame callbacks, style and layout calculation, resize observer and intersection observer callbacks + /// - scripts: A list of long scripts that were executed over the course of the long frame + /// - startTime: Start time of the long animation frame + /// - styleAndLayoutStart: Start time of the time period spent in style and layout calculations + public init( + blockingDuration: Int64? = nil, + duration: Int64, + entryType: EntryType? = nil, + firstUiEventTimestamp: Double? = nil, + id: String? = nil, + isFrozenFrame: Bool? = nil, + renderStart: Double? = nil, + scripts: [Scripts]? = nil, + startTime: Double? = nil, + styleAndLayoutStart: Double? = nil + ) { + self.blockingDuration = blockingDuration + self.duration = duration + self.entryType = entryType + self.firstUiEventTimestamp = firstUiEventTimestamp + self.id = id + self.isFrozenFrame = isFrozenFrame + self.renderStart = renderStart + self.scripts = scripts + self.startTime = startTime + self.styleAndLayoutStart = styleAndLayoutStart + } + /// Type of the event: long task or long animation frame public enum EntryType: String, Codable { case longTask = "long-task" @@ -1564,7 +2628,7 @@ public struct RUMLongTaskEvent: RUMDataModel { /// The container (the top-level document, or an