Commit 02765258 by 万齐军

Apm修复量大问题,debug不上报

parent 43fa0556
......@@ -5,6 +5,7 @@ import android.content.Context
import android.os.Handler
import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter
import com.apm.insight.log.VLog
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraInvitationBean
import com.ydl.audioim.http.AudioApiRequestUtil
......@@ -52,6 +53,7 @@ class YDLavManager {
companion object {
const val FILE_NAME = "consult.log"
private const val TAG = "YDLavManager"
//当前sdk的登录状态
var sdkStatus = -1
......@@ -429,7 +431,9 @@ class YDLavManager {
}
override fun onFailure(msg: String?) {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
if (msg != "LOGIN_ERR_ALREADY_LOGGED_IN") {
Apm.reportCustom("agora_login_error", msg ?: "", Exception(msg))
}
LogUtil.e("[agora]实时消息登录失败:$msg")
writeAgoraLog(
"声网rtm登录失败:$msg-------Time:${
......@@ -647,7 +651,7 @@ class YDLavManager {
* */
override fun onConnectionStateChanged(state: Int, reason: Int) {
val msg = "state:${state},reason:${reason}"
Apm.reportCustom("agora_connectionstate_error", msg, Exception(msg))
VLog.i(TAG, msg)
sdkStatus = state
writeAgoraLog(
"声网rtm登录状态:${state}-------Time:${AudioLogUtils.format.format(Calendar.getInstance().time)}",
......
......@@ -12,7 +12,10 @@ object Apm {
private var crash: MonitorCrash? = null
private var hasInit = false
fun initApm(context: Context, appId: String, vCode: Long, vName: String, debug: Boolean, uidCall: () -> String?) {
if (debug) return
val channel = if (debug) "debug" else WalleChannelReader.getChannel(context)
crash = MonitorCrash.init(
context,
......@@ -27,7 +30,7 @@ object Apm {
//.cpuMonitor(true)
//.fpsMonitor(true)
//.seriousBlockDetect(true)
.blockDetect(true)
.blockDetect(false)
// .enableWebViewMonitor(true)
.channel(channel)
.debugMode(debug)
......@@ -35,10 +38,13 @@ object Apm {
.setDynamicParams(ApmParams(crash, uidCall))
ApmInsight.getInstance().init(context, builder.build())
VLog.init(context, 20)
hasInit = true
}
fun reportCustom(type: String, msg: String, throwable: Throwable) {
crash?.reportCustomErr(msg, type, throwable)
if (hasInit) {
crash?.reportCustomErr(msg, type, throwable)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment