Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUMM-2606 Launch Time Publisher #1030

Merged
merged 5 commits into from
Nov 2, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Datadog/Datadog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -665,6 +665,7 @@
D255382A288F0B2400727FAD /* LowPowerModePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2553828288F0B2300727FAD /* LowPowerModePublisher.swift */; };
D255382C288F161500727FAD /* BatteryStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D255382B288F161500727FAD /* BatteryStatus.swift */; };
D255382D288F161500727FAD /* BatteryStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = D255382B288F161500727FAD /* BatteryStatus.swift */; };
D2612F48290197C700509B7D /* LaunchTimePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C7E3AD28FEBDA10023B2CC /* LaunchTimePublisher.swift */; };
D26C49AF2886DC7B00802B2D /* ApplicationStatePublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D26C49AE2886DC7B00802B2D /* ApplicationStatePublisherTests.swift */; };
D26C49B02886DC7B00802B2D /* ApplicationStatePublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D26C49AE2886DC7B00802B2D /* ApplicationStatePublisherTests.swift */; };
D26C49B22886E10E00802B2D /* AppStateHistoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D26C49B12886E10E00802B2D /* AppStateHistoryTests.swift */; };
@@ -697,8 +698,6 @@
D2A1EE27287C35DE00D28DFB /* ContextValueReaderMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE25287C35DE00D28DFB /* ContextValueReaderMock.swift */; };
D2A1EE29287D914900D28DFB /* LaunchTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE28287D914900D28DFB /* LaunchTime.swift */; };
D2A1EE2A287D914900D28DFB /* LaunchTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE28287D914900D28DFB /* LaunchTime.swift */; };
D2A1EE2C287D91D900D28DFB /* LaunchTimeReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE2B287D91D900D28DFB /* LaunchTimeReader.swift */; };
D2A1EE2D287D91D900D28DFB /* LaunchTimeReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE2B287D91D900D28DFB /* LaunchTimeReader.swift */; };
D2A1EE2F287DA4F200D28DFB /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE2E287DA4F200D28DFB /* UserInfo.swift */; };
D2A1EE30287DA4F200D28DFB /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE2E287DA4F200D28DFB /* UserInfo.swift */; };
D2A1EE32287DA51900D28DFB /* UserInfoPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE31287DA51900D28DFB /* UserInfoPublisher.swift */; };
@@ -709,8 +708,8 @@
D2A1EE39287EEB7600D28DFB /* NetworkConnectionInfoPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE37287EBE4200D28DFB /* NetworkConnectionInfoPublisherTests.swift */; };
D2A1EE3B287EECC000D28DFB /* CarrierInfoPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3A287EECA800D28DFB /* CarrierInfoPublisherTests.swift */; };
D2A1EE3C287EECC200D28DFB /* CarrierInfoPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3A287EECA800D28DFB /* CarrierInfoPublisherTests.swift */; };
D2A1EE3E2885D7EC00D28DFB /* LaunchTimeReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3D2885D7EC00D28DFB /* LaunchTimeReaderTests.swift */; };
D2A1EE3F2885D7EC00D28DFB /* LaunchTimeReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3D2885D7EC00D28DFB /* LaunchTimeReaderTests.swift */; };
D2A1EE3E2885D7EC00D28DFB /* LaunchTimePublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3D2885D7EC00D28DFB /* LaunchTimePublisherTests.swift */; };
D2A1EE3F2885D7EC00D28DFB /* LaunchTimePublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE3D2885D7EC00D28DFB /* LaunchTimePublisherTests.swift */; };
D2A1EE442886B8B400D28DFB /* UserInfoPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE432886B8B400D28DFB /* UserInfoPublisherTests.swift */; };
D2A1EE452886B8B400D28DFB /* UserInfoPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1EE432886B8B400D28DFB /* UserInfoPublisherTests.swift */; };
D2B3F0442823EE8400C2B5EE /* DataBlockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B3F0432823EE8300C2B5EE /* DataBlockTests.swift */; };
@@ -724,6 +723,7 @@
D2B3F052282E827700C2B5EE /* DDHTTPHeadersWriter+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B3F051282E826A00C2B5EE /* DDHTTPHeadersWriter+apiTests.m */; };
D2B3F053282E827B00C2B5EE /* DDHTTPHeadersWriter+apiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B3F051282E826A00C2B5EE /* DDHTTPHeadersWriter+apiTests.m */; };
D2C7E3AB28F97DCF0023B2CC /* BatteryStatusPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C7E3AA28F97DCF0023B2CC /* BatteryStatusPublisherTests.swift */; };
D2C7E3AE28FEBDA10023B2CC /* LaunchTimePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C7E3AD28FEBDA10023B2CC /* LaunchTimePublisher.swift */; };
D2CB6E0C27C50EAE00A62B57 /* Datadog.h in Headers */ = {isa = PBXBuildFile; fileRef = 61133B85242393DE00786299 /* Datadog.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2CB6E0D27C50EAE00A62B57 /* ObjcAppLaunchHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6179FFD1254ADB1100556A0B /* ObjcAppLaunchHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2CB6E0E27C50EAE00A62B57 /* ObjcExceptionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E68FB54244707FD0013A8AA /* ObjcExceptionHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1914,20 +1914,20 @@
D2A1EE22287740B500D28DFB /* ApplicationStatePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationStatePublisher.swift; sourceTree = "<group>"; };
D2A1EE25287C35DE00D28DFB /* ContextValueReaderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextValueReaderMock.swift; sourceTree = "<group>"; };
D2A1EE28287D914900D28DFB /* LaunchTime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTime.swift; sourceTree = "<group>"; };
D2A1EE2B287D91D900D28DFB /* LaunchTimeReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTimeReader.swift; sourceTree = "<group>"; };
D2A1EE2E287DA4F200D28DFB /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = "<group>"; };
D2A1EE31287DA51900D28DFB /* UserInfoPublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoPublisher.swift; sourceTree = "<group>"; };
D2A1EE34287EB8DB00D28DFB /* ServerOffsetPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerOffsetPublisherTests.swift; sourceTree = "<group>"; };
D2A1EE37287EBE4200D28DFB /* NetworkConnectionInfoPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkConnectionInfoPublisherTests.swift; sourceTree = "<group>"; };
D2A1EE3A287EECA800D28DFB /* CarrierInfoPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarrierInfoPublisherTests.swift; sourceTree = "<group>"; };
D2A1EE3D2885D7EC00D28DFB /* LaunchTimeReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTimeReaderTests.swift; sourceTree = "<group>"; };
D2A1EE3D2885D7EC00D28DFB /* LaunchTimePublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTimePublisherTests.swift; sourceTree = "<group>"; };
D2A1EE432886B8B400D28DFB /* UserInfoPublisherTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserInfoPublisherTests.swift; sourceTree = "<group>"; };
D2B3F0432823EE8300C2B5EE /* DataBlockTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataBlockTests.swift; sourceTree = "<group>"; };
D2B3F04628292D6E00C2B5EE /* DataMigratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataMigratorTests.swift; sourceTree = "<group>"; };
D2B3F0492829510600C2B5EE /* DatadogCoreProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatadogCoreProtocol.swift; sourceTree = "<group>"; };
D2B3F04C282A85FD00C2B5EE /* DatadogCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatadogCore.swift; sourceTree = "<group>"; };
D2B3F051282E826A00C2B5EE /* DDHTTPHeadersWriter+apiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDHTTPHeadersWriter+apiTests.m"; sourceTree = "<group>"; };
D2C7E3AA28F97DCF0023B2CC /* BatteryStatusPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatteryStatusPublisherTests.swift; sourceTree = "<group>"; };
D2C7E3AD28FEBDA10023B2CC /* LaunchTimePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchTimePublisher.swift; sourceTree = "<group>"; };
D2CB6ED127C50EAE00A62B57 /* Datadog.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Datadog.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2CB6F8F27C520D400A62B57 /* DatadogTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DatadogTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D2CB6FB027C5217A00A62B57 /* DatadogObjc.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DatadogObjc.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -4419,7 +4419,7 @@
D20605A82874C1CD0047275C /* NetworkConnectionInfoPublisher.swift */,
D20605B12874E1660047275C /* CarrierInfoPublisher.swift */,
D2A1EE31287DA51900D28DFB /* UserInfoPublisher.swift */,
D2A1EE2B287D91D900D28DFB /* LaunchTimeReader.swift */,
D2C7E3AD28FEBDA10023B2CC /* LaunchTimePublisher.swift */,
D2A1EE22287740B500D28DFB /* ApplicationStatePublisher.swift */,
D2553825288F0B1A00727FAD /* BatteryStatusPublisher.swift */,
D2553828288F0B2300727FAD /* LowPowerModePublisher.swift */,
@@ -4435,7 +4435,7 @@
D2A1EE3A287EECA800D28DFB /* CarrierInfoPublisherTests.swift */,
D2A1EE37287EBE4200D28DFB /* NetworkConnectionInfoPublisherTests.swift */,
D2A1EE432886B8B400D28DFB /* UserInfoPublisherTests.swift */,
D2A1EE3D2885D7EC00D28DFB /* LaunchTimeReaderTests.swift */,
D2A1EE3D2885D7EC00D28DFB /* LaunchTimePublisherTests.swift */,
D26C49AE2886DC7B00802B2D /* ApplicationStatePublisherTests.swift */,
D2C7E3AA28F97DCF0023B2CC /* BatteryStatusPublisherTests.swift */,
D21C26D028A64599005DD405 /* MessageBusTests.swift */,
@@ -5412,7 +5412,6 @@
61133BE02423979B00786299 /* Datadog.swift in Sources */,
61E945E32869BF3D00A946C4 /* CoreLogger.swift in Sources */,
61133BCB2423979B00786299 /* CarrierInfoProvider.swift in Sources */,
D2A1EE2C287D91D900D28DFB /* LaunchTimeReader.swift in Sources */,
61C5A89024509AA700DA608C /* TracingFeature.swift in Sources */,
61E5333624B84B43003D6C4E /* RUMMonitor.swift in Sources */,
9EB4B862274E79D50041CD03 /* WKUserContentController+Datadog.swift in Sources */,
@@ -5442,6 +5441,7 @@
61133BE82423979B00786299 /* LogFileOutput.swift in Sources */,
61133BD72423979B00786299 /* DataUploadWorker.swift in Sources */,
61D3E0D4277B23F1008BE766 /* KronosTimeStorage.swift in Sources */,
D2C7E3AE28FEBDA10023B2CC /* LaunchTimePublisher.swift in Sources */,
61133BD12423979B00786299 /* FilesOrchestrator.swift in Sources */,
D20605A3287464F40047275C /* ContextValuePublisher.swift in Sources */,
61133BCD2423979B00786299 /* NetworkConnectionInfoProvider.swift in Sources */,
@@ -5700,7 +5700,7 @@
61B5E42726DFB145000B0A5F /* DDDatadog+apiTests.m in Sources */,
6121627C247D220500AC5D67 /* TracingWithLoggingIntegrationTests.swift in Sources */,
61FF282124B8981D000B3D9B /* RUMEventBuilderTests.swift in Sources */,
D2A1EE3E2885D7EC00D28DFB /* LaunchTimeReaderTests.swift in Sources */,
D2A1EE3E2885D7EC00D28DFB /* LaunchTimePublisherTests.swift in Sources */,
61FD9FD22853562B00214BD9 /* RUMDeviceInfoTests.swift in Sources */,
61B5E42926DFB60A000B0A5F /* DDConfiguration+apiTests.m in Sources */,
D232CAD52832D762001B262C /* DatadogCoreMock.swift in Sources */,
@@ -5959,6 +5959,7 @@
D2CB6E1327C50EAE00A62B57 /* SwiftUIViewModifier.swift in Sources */,
D2CB6E1427C50EAE00A62B57 /* SwiftUIExtensions.swift in Sources */,
D2CB6E1527C50EAE00A62B57 /* ServerDateCorrector.swift in Sources */,
D2612F48290197C700509B7D /* LaunchTimePublisher.swift in Sources */,
D2CB6E1627C50EAE00A62B57 /* RUMWithCrashContextIntegration.swift in Sources */,
D2CB6E1727C50EAE00A62B57 /* OTSpan.swift in Sources */,
D2CB6E1827C50EAE00A62B57 /* RUMViewIdentity.swift in Sources */,
@@ -6087,7 +6088,6 @@
D2CB6E7E27C50EAE00A62B57 /* RUMMonitor.swift in Sources */,
D26C49C0288982DA00802B2D /* FeatureUpload.swift in Sources */,
D2CB6E8027C50EAE00A62B57 /* WKUserContentController+Datadog.swift in Sources */,
D2A1EE2D287D91D900D28DFB /* LaunchTimeReader.swift in Sources */,
D2CB6E8127C50EAE00A62B57 /* DataUploader.swift in Sources */,
D2CB6E8227C50EAE00A62B57 /* DeleteAllDataMigrator.swift in Sources */,
D2CB6E8327C50EAE00A62B57 /* RUMUserActionScope.swift in Sources */,
@@ -6376,7 +6376,7 @@
D2CB6F7F27C520D400A62B57 /* DDDatadog+apiTests.m in Sources */,
D2CB6F8027C520D400A62B57 /* TracingWithLoggingIntegrationTests.swift in Sources */,
D2CB6F8227C520D400A62B57 /* RUMEventBuilderTests.swift in Sources */,
D2A1EE3F2885D7EC00D28DFB /* LaunchTimeReaderTests.swift in Sources */,
D2A1EE3F2885D7EC00D28DFB /* LaunchTimePublisherTests.swift in Sources */,
61FD9FD12853562A00214BD9 /* RUMDeviceInfoTests.swift in Sources */,
D2CB6F8327C520D400A62B57 /* DDConfiguration+apiTests.m in Sources */,
D232CAD62832D762001B262C /* DatadogCoreMock.swift in Sources */,
43 changes: 43 additions & 0 deletions Sources/Datadog/DatadogCore/Context/LaunchTimePublisher.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-2020 Datadog, Inc.
*/

import Foundation

#if SPM_BUILD
import _Datadog_Private
#endif

internal struct LaunchTimePublisher: ContextValuePublisher {
private typealias AppLaunchHandler = __dd_private_AppLaunchHandler

let initialValue: LaunchTime?

init() {
initialValue = LaunchTime(
launchTime: AppLaunchHandler.shared.launchTime?.doubleValue,
launchDate: AppLaunchHandler.shared.launchDate,
isActivePrewarm: AppLaunchHandler.shared.isActivePrewarm
)
}

func publish(to receiver: @escaping ContextValueReceiver<LaunchTime?>) {
let launchDate = AppLaunchHandler.shared.launchDate
let isActivePrewarm = AppLaunchHandler.shared.isActivePrewarm

AppLaunchHandler.shared.setApplicationDidBecomeActiveCallback { launchTime in
let value = LaunchTime(
launchTime: launchTime,
launchDate: launchDate,
isActivePrewarm: isActivePrewarm
)
receiver(value)
}
}

func cancel() {
AppLaunchHandler.shared.setApplicationDidBecomeActiveCallback { _ in }
}
}
37 changes: 0 additions & 37 deletions Sources/Datadog/DatadogCore/Context/LaunchTimeReader.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/Datadog/DatadogCore/DatadogCore.swift
Original file line number Diff line number Diff line change
@@ -449,7 +449,7 @@ extension DatadogContextProvider {
self.init(context: context)

subscribe(\.serverTimeOffset, to: ServerOffsetPublisher(provider: serverDateProvider))
assign(reader: LaunchTimeReader(), to: \.launchTime)
subscribe(\.launchTime, to: LaunchTimePublisher())

if #available(iOS 12, tvOS 12, *) {
subscribe(\.networkConnectionInfo, to: NWPathMonitorPublisher())
Original file line number Diff line number Diff line change
@@ -61,8 +61,8 @@ public struct DatadogContext {

/// Application launch time.
///
/// Can be `zero` if the launch could not yet been evaluated.
var launchTime: LaunchTime = .zero
/// Can be `nil` if the launch could not yet been evaluated.
var launchTime: LaunchTime?
Comment on lines +64 to +65
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the nil value is quite unexpected and will be there only for a short while when SDK is being warmed up (this is what we mean by "evaluated"), right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. In practice, this value will be evaluated when we subscribe to the publisher, it will be done when initialising the core.


/// Provides the history of app foreground / background states.
var applicationStateHistory: AppStateHistory
12 changes: 4 additions & 8 deletions Sources/Datadog/DatadogInternal/Context/LaunchTime.swift
Original file line number Diff line number Diff line change
@@ -13,15 +13,11 @@ import Foundation
///
/// If the `UIApplication.didBecomeActiveNotification` has not yet been received by the
/// time this value is provided, it will represent the time interval between now and the process start time.
maxep marked this conversation as resolved.
Show resolved Hide resolved
/* public */ let launchTime: TimeInterval
/* public */ let launchTime: TimeInterval?

/// The date when the application process started.
/* public */ let launchDate: Date

/// Returns `true` if the application is pre-warmed.
/* public */ let isActivePrewarm: Bool
}

extension LaunchTime {
/// Returns a zero launch time with inactive pre-warm.
/* public */ static var zero: LaunchTime {
.init(launchTime: 0, isActivePrewarm: false)
}
}
18 changes: 14 additions & 4 deletions Sources/Datadog/RUM/RUMMonitor/Scopes/RUMViewScope.swift
Original file line number Diff line number Diff line change
@@ -314,13 +314,23 @@ internal class RUMViewScope: RUMScope, RUMContextProvider {
var attributes = self.attributes
var loadingTime: Int64? = nil

if context.launchTime.isActivePrewarm {
if context.launchTime?.isActivePrewarm == true {
// Set `active_pre_warm` attribute to true in case
// of pre-warmed app
// of pre-warmed app.
attributes[Constants.activePrewarm] = true
} else {
} else if let launchTime = context.launchTime?.launchTime {
// Report Application Launch Time only if not pre-warmed
loadingTime = context.launchTime.launchTime.toInt64Nanoseconds
loadingTime = launchTime.toInt64Nanoseconds
} else if let launchDate = context.launchTime?.launchDate {
// The launchTime can be `nil` if the application is not yet
// active (UIApplicationDidBecomeActiveNotification). That is
// the case when instrumenting a SwiftUI application that start
maxep marked this conversation as resolved.
Show resolved Hide resolved
// a RUM view on `SwiftUI.View/onAppear`.
//
// In that case, we consider the time between the application
// launch and the first view start as the application loading
// time.
loadingTime = viewStartTime.timeIntervalSince(launchDate).toInt64Nanoseconds
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we introduce a regression now? Previously there was no unhandled control flow:

// before:

} else {
   loadingTime = context.launchTime.launchTime.toInt64Nanoseconds
}

and now there is:

// now:

} else if let launchDate = context.launchTime.launchDate {
   // ...
} // <--- unhandled

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that non-optional launchDate could solve it (ref. to above: #1030 (comment)).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the context.launchTime was 0 when not evaluated. I think it's more correct to have loadingTime == nil instead of 0. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, now it describes much better with the nil 👌.


let actionEvent = RUMActionEvent(
Loading