From 63b42ab5e7409b7ef0a08e875703f37b93aa511c Mon Sep 17 00:00:00 2001 From: renwj Date: Fri, 15 Mar 2024 19:06:07 +0800 Subject: [PATCH] =?UTF-8?q?[6.3.0][APM=E5=8D=87=E7=BA=A7]=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=B4=A9=E6=BA=83=E9=98=B2=E6=8A=A4=EF=BC=9B=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=BB=E5=8A=A8=E4=B8=8A=E4=BC=A0Vlog=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 6 ++--- .../apm/ApmCrashReportProvider.java | 25 +++++++++++++++++-- .../crashreport/ITestCrashReportProvider.java | 13 ---------- .../crashreport/ITestCrashReportProvider.kt | 18 +++++++++++++ 4 files changed, 44 insertions(+), 18 deletions(-) delete mode 100644 test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.java create mode 100644 test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.kt diff --git a/config.gradle b/config.gradle index d8d537802f..7ee8c77407 100644 --- a/config.gradle +++ b/config.gradle @@ -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", diff --git a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java index 26d59c190f..44ec2664a6 100644 --- a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java +++ b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java @@ -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(<>>) + .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(); + } } diff --git a/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.java b/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.java deleted file mode 100644 index b07f21ebdc..0000000000 --- a/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.java +++ /dev/null @@ -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 { - -} diff --git a/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.kt b/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.kt new file mode 100644 index 0000000000..cbfee60e17 --- /dev/null +++ b/test/crashreport/src/main/java/com/mogo/test/crashreport/ITestCrashReportProvider.kt @@ -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 +}