Signposting: split sync into initialSync and firstRooms which will track how long the very first sync takes separately from how long the first rooms appear in the list

This commit is contained in:
Stefan Ceriu 2023-08-24 13:26:37 +03:00 committed by Stefan Ceriu
parent ecc549b280
commit 6171d878b0
4 changed files with 33 additions and 14 deletions

View File

@ -74,6 +74,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
navigationRootCoordinator = NavigationRootCoordinator() navigationRootCoordinator = NavigationRootCoordinator()
Self.setupServiceLocator(navigationRootCoordinator: navigationRootCoordinator, appSettings: appSettings) Self.setupServiceLocator(navigationRootCoordinator: navigationRootCoordinator, appSettings: appSettings)
ServiceLocator.shared.analytics.signpost.beginFirstRooms()
ServiceLocator.shared.analytics.startIfEnabled() ServiceLocator.shared.analytics.startIfEnabled()
@ -553,7 +555,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
private func startSync() { private func startSync() {
guard let userSession else { return } guard let userSession else { return }
ServiceLocator.shared.analytics.signpost.beginSync() ServiceLocator.shared.analytics.signpost.beginFirstSync()
userSession.clientProxy.startSync() userSession.clientProxy.startSync()
let identifier = "StaleDataIndicator" let identifier = "StaleDataIndicator"
@ -575,7 +577,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate,
case .startedUpdating: case .startedUpdating:
showLoadingIndicator() showLoadingIndicator()
case .receivedSyncUpdate: case .receivedSyncUpdate:
ServiceLocator.shared.analytics.signpost.endSync() ServiceLocator.shared.analytics.signpost.endFirstSync()
ServiceLocator.shared.userIndicatorController.retractIndicatorWithId(identifier) ServiceLocator.shared.userIndicatorController.retractIndicatorWithId(identifier)
default: default:
break break

View File

@ -164,7 +164,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
// End the initial sync performance timing once the room list is about to be displayed. // End the initial sync performance timing once the room list is about to be displayed.
if roomListMode == .rooms, self.state.roomListMode == .skeletons { if roomListMode == .rooms, self.state.roomListMode == .skeletons {
analytics.signpost.endSync() analytics.signpost.endFirstRooms()
} }
self.state.roomListMode = roomListMode self.state.roomListMode = roomListMode

View File

@ -26,7 +26,8 @@ class Signposter {
/// Signpost name constants. /// Signpost name constants.
enum Name { enum Name {
static let login: StaticString = "Login" static let login: StaticString = "Login"
static let sync: StaticString = "Sync" static let firstSync: StaticString = "FirstSync"
static let firstRooms: StaticString = "FirstRooms"
static let roomFlow: StaticString = "RoomFlow" static let roomFlow: StaticString = "RoomFlow"
} }
@ -51,19 +52,34 @@ class Signposter {
self.loginState = nil self.loginState = nil
} }
// MARK: - Sync // MARK: - FirstSync
private var syncState: OSSignpostIntervalState? private var firstSyncState: OSSignpostIntervalState?
func beginSync() { func beginFirstSync() {
syncState = signposter.beginInterval(Name.sync) firstSyncState = signposter.beginInterval(Name.firstSync)
} }
func endSync() { func endFirstSync() {
guard let syncState else { return } guard let firstSyncState else { return }
signposter.endInterval(Name.sync, syncState) signposter.endInterval(Name.firstSync, firstSyncState)
self.syncState = nil self.firstSyncState = nil
}
// MARK: - FirstRooms
private var firstRoomsState: OSSignpostIntervalState?
func beginFirstRooms() {
firstRoomsState = signposter.beginInterval(Name.firstRooms)
}
func endFirstRooms() {
guard let firstRoomsState else { return }
signposter.endInterval(Name.firstRooms, firstRoomsState)
self.firstRoomsState = nil
} }
// MARK: - Room Flow // MARK: - Room Flow

View File

@ -14,8 +14,9 @@ NOW=`date -u -Iminutes`
grep ".*measured.*values" $1 | sed -e "s/.*Test Case .*-\[//" -e "s/\]' measured \[/,/" -e "s/\].*values: \[/,/" -e "s/\], performance.*//" -e "s/^/$2,/" \ grep ".*measured.*values" $1 | sed -e "s/.*Test Case .*-\[//" -e "s/\]' measured \[/,/" -e "s/\].*values: \[/,/" -e "s/\], performance.*//" -e "s/^/$2,/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Duration .AppLaunch., s/launchPerformance/" \ -e "s/IntegrationTests.LoginTests testLoginFlow,Duration .AppLaunch., s/launchPerformance/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Duration .Login., s/loginPerformance/" \ -e "s/IntegrationTests.LoginTests testLoginFlow,Duration .Login., s/loginPerformance/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Duration .RoomFlow., s/roomflowPerformance/" \ -e "s/IntegrationTests.LoginTests testLoginFlow,Duration .RoomFlow., s/roomFlowPerformance/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Duration .Sync., s/syncPerformance/" \ -e "s/IntegrationTests.LoginTests testLoginFlow,Duration .FirstRooms., s/firstRoomsPerformance/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Duration .FirstSync., s/firstSyncPerformance/" \
-e "s/IntegrationTests.LoginTests testLoginFlow,Clock Monotonic Time, s/totalTime/" \ -e "s/IntegrationTests.LoginTests testLoginFlow,Clock Monotonic Time, s/totalTime/" \
-e "s/^/$NOW,/" -e "s/^/$NOW,/"