Commit 02765258 by 万齐军

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

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