[6.2.6][技术优化] 将卡顿日志转成在链路日志中存储

This commit is contained in:
renwj
2023-12-22 17:42:33 +08:00
parent 5256f4597f
commit acdcde8caf
5 changed files with 41 additions and 217 deletions

View File

@@ -13,27 +13,22 @@ import com.mogo.eagle.core.block.runtime.report.*
import com.mogo.eagle.core.function.api.devatools.block.*
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.VLogUtils
import java.util.concurrent.TimeUnit.SECONDS
internal class MoGoBlockProviderImpl: IMoGoBlockProvider, IBlockListener {
companion object {
private const val TAG = "BLOCK_REPORT"
}
@Volatile
private var hasInit = false
// private val linkedLog by lazy { MainBlockLinkedLog() }
private val linkedLog by lazy { MainBlockLinkedLog() }
override fun init(ctx: Context) {
BlockDetector.init(BlockMetrics.Builder()
.context(ctx)
.multiplier(1.2f)
.multiplier(2.0f)
.isDebug(false)
.period(5, SECONDS)
.junkRateThreshold(0.2f)
.junkRateThreshold(0.6f)
.recorder(null, 500, 500)
.build())
hasInit = true
@@ -69,12 +64,7 @@ internal class MoGoBlockProviderImpl: IMoGoBlockProvider, IBlockListener {
}
}
}
val msg = GsonUtils.toJson(map)
try {
VLogUtils.w(TAG, msg)
} catch (t: Throwable) {
Log.e(TAG, "onDumped error", t)
}
linkedLog.record(GsonUtils.toJson(map))
}
})
}