簡體   English   中英

Firebase 性能自定義跟蹤啟動/停止問題

[英]Firebase Performance custom trace starting/stopping problem

我想測量屏幕上的加載時間,這涉及多個 API 調用,因此除了 HTTP 跟蹤之外還需要自定義跟蹤。 屏幕有一個分頁的recyclerview,所以我需要多次運行跟蹤。 但是,這是行不通的。 我收到類似Trace 'Home_Loading' has already started, should not start again! 當我第二次嘗試運行它時,即使在調用 stop() 之后也是如此。 例如,這段代碼

        val startupTrace = FirebasePerformance.getInstance().newTrace("Home_Loading")
        startupTrace.start()
        startupTrace.stop()
        startupTrace.start()
        startupTrace.stop()

導致以下 logcat

E/FirebasePerformance: Trace 'Home_Loading' has already started, should not start again!
E/FirebasePerformance: Trace 'Home_Loading' has already stopped, should not stop again!
D/FirebasePerformance: Logging trace metric - Home_Loading 0.0220ms

啟動/停止方法是否不同步? 還是不能多次運行相同的跟蹤?

您不能多次啟動和停止跟蹤。 一條軌跡只能有一個不同的起點和終點。 如果您需要執行第二次跟蹤,則需要創建一個新的跟蹤 object 來啟動和停止。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM