[6.3.0][APM升级] 增加崩溃防护;增加主动上传Vlog接口

This commit is contained in:
renwj
2024-03-15 19:06:07 +08:00
parent d00f1f19a2
commit 63b42ab5e7
4 changed files with 44 additions and 18 deletions

View File

@@ -133,8 +133,8 @@ ext {
crashreport : "com.mogo.test:crashreport:${CRASHREPORT_VERSION}",
crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
apm_insight : 'com.volcengine:apm_insight:1.4.10.cn-rc.0',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.4.6-rc.17',
apm_insight : 'com.volcengine:apm_insight:1.5.4.cn-rc.1',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.5.0',
cicle_indicator : 'me.relex:circleindicator:2.1.6',
//========================= TTS语音 Maven 版本管理 =========================
@@ -237,7 +237,7 @@ ext {
google_auto_service : "com.google.auto.service:auto-service:1.0-rc7",
//======================== handler-proxy-runtime ==============
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:10.0.0"
handler_proxy_runtime : "com.mogo.eagle.core.handler.proxy:runtime:10.0.10"
]
android = [
fLauncherApplicationId : "com.mogo.launcher.f",

View File

@@ -1,8 +1,10 @@
package com.mogo.test.crashreport.apm;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.apm.insight.ExitType;
import com.apm.insight.MonitorCrash;
import com.apm.insight.log.VLog;
import com.bytedance.apm.insight.ApmInsight;
@@ -21,11 +23,12 @@ import com.mogo.commons.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CommonUtils;
import com.mogo.eagle.core.utilcode.util.DeviceUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.MetaDataUtils;
import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.ITestCrashReportProvider;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
@@ -218,6 +221,8 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
})
// 可选添加pv事件的自定义tag可以用来筛选崩溃率计算的分母数据
//.pageViewTags(<<Map<String, String>>>)
.exitType(ExitType.ALL) // 上报应用退出原因
.crashProtect(true) // 开启崩溃防护
.build();
MonitorCrash monitorCrash = MonitorCrash.init(context, config);
}
@@ -286,10 +291,26 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
// }
// });
ApmInsight.getInstance().init(context, builder.build());
//初始化自定日志配置自定义日志最大占用磁盘内部一般配置20,代表最大20M磁盘占用。1.4.1版本开始存在这个api
VLog.init(context, 50);
}
@Override
public boolean uploadVlog(long startTime, long endTime) {
AtomicBoolean result = new AtomicBoolean(false);
CountDownLatch latch = new CountDownLatch(1);
ApmInsightAgent.uploadVlog(startTime, endTime, (success, msg) -> {
Log.d(TAG, "--- uploadVlog callback ---:" + success + ", msg:" + msg);
result.set(success);
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return result.get();
}
}

View File

@@ -1,13 +0,0 @@
package com.mogo.test.crashreport;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* @author congtaowang
* @since 2020/9/9
*
* 描述
*/
public interface ITestCrashReportProvider extends IProvider {
}

View File

@@ -0,0 +1,18 @@
package com.mogo.test.crashreport
import com.alibaba.android.arouter.facade.template.IProvider
/**
* @author congtaowang
* @since 2020/9/9
*
* 描述
*/
interface ITestCrashReportProvider : IProvider {
/**
* 上传通过[com.mogo.eagle.core.utilcode.util.VLogUtils] 类记录的日志
* @param startTime 开始时间
* @param endTime 结束时间
*/
fun uploadVlog(startTime: Long, endTime: Long): Boolean
}