Adjust metrics to the new specifications (#5937)
* Add `AnalyticsTransactions` with a set of `TransactionDefinition` items matching those in the user story * Use that for `AnalyticsLongRunningTransactions`, make sure we send the right fields (name, operation, description) * Add `AnalyticsSendMessageWatcher` to track how long it takes for an event to be sent and for us to get a call back for that from sync * Add `Noop` implementation for enterprise
This commit is contained in:
parent
a9e095ddf9
commit
06c4b9488b
33 changed files with 443 additions and 48 deletions
|
|
@ -320,7 +320,7 @@ class RootFlowNode(
|
|||
is ResolvedIntent.Navigation -> {
|
||||
val openingRoomFromNotification = intent.getBooleanExtra(ROOM_OPENED_FROM_NOTIFICATION, false)
|
||||
if (openingRoomFromNotification && resolvedIntent.deeplinkData is DeeplinkData.Room) {
|
||||
analyticsService.startLongRunningTransaction(AnalyticsLongRunningTransaction.NotificationTapOpensTimeline)
|
||||
analyticsService.startLongRunningTransaction(AnalyticsLongRunningTransaction.NotificationToMessage)
|
||||
}
|
||||
navigateTo(resolvedIntent.deeplinkData)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ package io.element.android.appnav.di
|
|||
|
||||
import io.element.android.features.messages.api.pinned.PinnedEventsTimelineProvider
|
||||
import io.element.android.libraries.matrix.api.timeline.TimelineProvider
|
||||
import io.element.android.services.analytics.api.watchers.AnalyticsSendMessageWatcher
|
||||
|
||||
interface TimelineBindings {
|
||||
val timelineProvider: TimelineProvider
|
||||
val pinnedEventsTimelineProvider: PinnedEventsTimelineProvider
|
||||
val analyticsSendMessageWatcher: AnalyticsSendMessageWatcher
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import io.element.android.libraries.matrix.api.room.RoomMembershipObserver
|
|||
import io.element.android.libraries.matrix.api.room.alias.ResolvedRoomAlias
|
||||
import io.element.android.libraries.matrix.ui.room.LoadingRoomState
|
||||
import io.element.android.services.analytics.api.AnalyticsLongRunningTransaction.LoadJoinedRoomFlow
|
||||
import io.element.android.services.analytics.api.AnalyticsLongRunningTransaction.NotificationTapOpensTimeline
|
||||
import io.element.android.services.analytics.api.AnalyticsLongRunningTransaction.NotificationToMessage
|
||||
import io.element.android.services.analytics.api.AnalyticsLongRunningTransaction.OpenRoom
|
||||
import io.element.android.services.analytics.api.AnalyticsService
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
|
|
@ -128,7 +128,7 @@ class RoomFlowNode(
|
|||
|
||||
override fun onBuilt() {
|
||||
super.onBuilt()
|
||||
val parentTransaction = analyticsService.getLongRunningTransaction(NotificationTapOpensTimeline)
|
||||
val parentTransaction = analyticsService.getLongRunningTransaction(NotificationToMessage)
|
||||
val openRoomTransaction = analyticsService.startLongRunningTransaction(OpenRoom, parentTransaction)
|
||||
analyticsService.startLongRunningTransaction(LoadJoinedRoomFlow, openRoomTransaction)
|
||||
resolveRoomId()
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ class JoinedRoomLoadedFlowNode(
|
|||
private val callback: Callback = callback()
|
||||
override val graph = roomGraphFactory.create(inputs.room)
|
||||
|
||||
private val sendMessageWatcher = (graph as? TimelineBindings)?.analyticsSendMessageWatcher
|
||||
|
||||
// This is an ugly hack to check activity recreation
|
||||
private var currentActivity: Activity? = null
|
||||
|
||||
|
|
@ -109,6 +111,7 @@ class JoinedRoomLoadedFlowNode(
|
|||
Timber.v("OnCreate => ${inputs.room.roomId}")
|
||||
appNavigationStateService.onNavigateToRoom(id, inputs.room.roomId)
|
||||
activeRoomsHolder.addRoom(inputs.room)
|
||||
sendMessageWatcher?.start()
|
||||
fetchRoomMembers()
|
||||
trackVisitedRoom()
|
||||
},
|
||||
|
|
@ -120,6 +123,7 @@ class JoinedRoomLoadedFlowNode(
|
|||
},
|
||||
onDestroy = {
|
||||
Timber.v("OnDestroy")
|
||||
sendMessageWatcher?.stop()
|
||||
// If we're just going through an activity recreation there's no need to destroy the Room object
|
||||
// Destroying it would actually cause an issue where its methods can no longer be called
|
||||
if (currentActivity?.isChangingConfigurations != true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue