mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Make 'room list catch-up' analytics transaction network aware (#6233)
* Make 'room list catch-up' analytics transaction network aware. * Add `RoomListService.isInitialSyncDone`. Use this to simplify `DefaultAnalyticsRoomListStateWatcher`'s logic.
This commit is contained in:
committed by
GitHub
parent
b65b9eeab9
commit
8fab22ec7d
+7
@@ -7,7 +7,14 @@
|
||||
|
||||
package io.element.android.services.analyticsproviders.api
|
||||
|
||||
import kotlin.time.Duration
|
||||
|
||||
interface AnalyticsTransaction {
|
||||
/**
|
||||
* The time elapsed since the transaction started until now if the transaction is ongoing or the time it finished.
|
||||
*/
|
||||
val duration: Duration
|
||||
|
||||
/**
|
||||
* Start a child span from this transaction.
|
||||
*/
|
||||
|
||||
+8
@@ -11,7 +11,10 @@ import io.element.android.services.analyticsproviders.api.AnalyticsTransaction
|
||||
import io.sentry.ISpan
|
||||
import io.sentry.ITransaction
|
||||
import io.sentry.Sentry
|
||||
import io.sentry.SentryInstantDate
|
||||
import timber.log.Timber
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.nanoseconds
|
||||
|
||||
class SentryAnalyticsTransaction private constructor(span: ISpan) : AnalyticsTransaction {
|
||||
constructor(name: String, operation: String?, description: String? = null) : this(
|
||||
@@ -19,6 +22,11 @@ class SentryAnalyticsTransaction private constructor(span: ISpan) : AnalyticsTra
|
||||
)
|
||||
private val inner = span
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
override val duration: Duration get() {
|
||||
return (inner.finishDate ?: SentryInstantDate()).diff(inner.startDate).nanoseconds
|
||||
}
|
||||
|
||||
override fun startChild(operation: String, description: String?): AnalyticsTransaction = SentryAnalyticsTransaction(
|
||||
inner.startChild(operation, description)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user