From 5133e9813082b670b880911dfd4dead17fe5f692 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 28 Feb 2022 20:41:36 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20=E5=A2=9E=E5=8A=A0APM=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5pad=E5=94=AF=E4=B8=80=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../crashreport/apm/ApmCrashReportProvider.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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 7fd5286c10..2460e95e1d 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 @@ -8,11 +8,13 @@ import com.apm.insight.CrashType; import com.apm.insight.MonitorCrash; import com.apm.insight.log.VLog; import com.bytedance.apm.insight.ApmInsight; +import com.bytedance.apm.insight.ApmInsightAgent; import com.bytedance.apm.insight.ApmInsightInitConfig; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.eagle.core.utilcode.mogo.logger.Logger; import com.mogo.eagle.core.utilcode.util.AppUtils; import com.mogo.eagle.core.utilcode.util.CommonUtils; +import com.mogo.eagle.core.utilcode.util.DeviceIdUtils; import com.mogo.test.crashreport.CrashReportConstants; import com.mogo.test.crashreport.ITestCrashReportProvider; @@ -23,7 +25,7 @@ import java.util.Map; /** * @author congtaowang * @since 2020/9/9 - * + *

* 描述 */ @Route(path = CrashReportConstants.PATH) @@ -39,7 +41,8 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider { initCrash(context); initApmInsight(context); } - private void initCrash(final Context context) { + + private void initCrash(final Context context) { MonitorCrash crash = MonitorCrash.init(context, BYTEAMP_APPID, CommonUtils.getVersionCode(context), CommonUtils.getVersionName(context)) .setCustomDataCallback(new AttachUserData() { @@ -55,9 +58,17 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider { crash.config().setChannel("eagle"); crash.config().setDeviceId(MoGoAiCloudClientConfig.getInstance().getSn());//可选,可以设置自定义did,不设置会使用内部默认的 String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context); - crash.addTags(MAP_SDK_VERSION,mapSDKVersion); + crash.addTags(MAP_SDK_VERSION, mapSDKVersion); // crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址 // crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖 + + HashMap dimension = new HashMap<>(); + //维度值 + dimension.put("Devices_ID", DeviceIdUtils.getWidevineID(context)); + HashMap metric = new HashMap<>(); + //指标值 + metric.put("Devices_ID_metric", (double) 100); + ApmInsightAgent.monitorEvent("event1", dimension, metric); } /**