集成火山引擎amp
This commit is contained in:
@@ -3,7 +3,7 @@ apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'android-aspectjx'
|
||||
|
||||
apply plugin: 'apm-plugin'
|
||||
////apply ByteX宿主
|
||||
//apply plugin: 'bytex'
|
||||
//ByteX {
|
||||
@@ -143,6 +143,27 @@ aspectjx {
|
||||
include "com.mogo.chat"
|
||||
}
|
||||
|
||||
ApmPlugin {
|
||||
// 是否进行插桩
|
||||
enable true
|
||||
// 是否在Debug包插桩,默认不插桩
|
||||
enableInDebug true
|
||||
// 启动分析开关:监控App启动耗时,需要同时开启pageLoadSwitch
|
||||
startSwitch = true
|
||||
// 页面响应开关:监控Activity的生命周期耗时
|
||||
pageLoadSwitch = true
|
||||
// 网络监控开关:监控okhttp3的网络请求
|
||||
okHttp3Switch = true
|
||||
// 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
|
||||
whiteList = [
|
||||
"com.mogo"
|
||||
]
|
||||
// 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
|
||||
blackList = [
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
//Crash日志收集
|
||||
@@ -153,6 +174,8 @@ dependencies {
|
||||
debugImplementation rootProject.ext.dependencies.debugleakcanary
|
||||
releaseImplementation rootProject.ext.dependencies.releaseleakcanary
|
||||
|
||||
implementation 'com.volcengine:apm_insight:1.4.4.cn'
|
||||
implementation 'com.volcengine:apm_insight_crash:1.4.2'
|
||||
|
||||
implementation rootProject.ext.dependencies.mogologlib
|
||||
compileOnly rootProject.ext.dependencies.adasapi
|
||||
|
||||
@@ -5,7 +5,15 @@ import android.content.Intent;
|
||||
import android.os.Process;
|
||||
import android.util.Log;
|
||||
|
||||
import com.apm.applog.AppLog;
|
||||
import com.apm.insight.AttachUserData;
|
||||
import com.apm.insight.CrashType;
|
||||
import com.apm.insight.MonitorCrash;
|
||||
import com.apm.insight.log.VLog;
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
import com.bytedance.apm.insight.ApmInsight;
|
||||
import com.bytedance.apm.insight.ApmInsightInitConfig;
|
||||
import com.bytedance.apm.insight.IDynamicParams;
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
|
||||
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
|
||||
@@ -34,12 +42,16 @@ import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.ProcessUtils;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
@@ -52,6 +64,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
private long start;
|
||||
// private volatile static RefWatcher refWatcher;
|
||||
private static final String BYTEAMP_APPID = "302368";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -64,6 +77,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
start = System.currentTimeMillis();
|
||||
CrashSystem crashSystem = CrashSystem.getInstance(this);
|
||||
crashSystem.init();
|
||||
initCrash();
|
||||
initApmInsight();
|
||||
//设置debug模式,日志不上传
|
||||
// crashSystem.setDebug(BuildConfig.DEBUG);
|
||||
Logger.init(BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF);
|
||||
@@ -71,6 +86,86 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
initModules();
|
||||
}
|
||||
|
||||
private void initCrash() {
|
||||
|
||||
MonitorCrash crash = MonitorCrash.init(this, BYTEAMP_APPID, CommonUtils.getVersionCode(this), CommonUtils.getVersionName(this))
|
||||
.setCustomDataCallback(new AttachUserData() {
|
||||
@Override
|
||||
public Map<? extends String, ? extends String> getUserData(CrashType type) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("app_custom", "app_value");
|
||||
return map;
|
||||
}
|
||||
});
|
||||
crash.config().setChannel("eagle");
|
||||
// crash.config().setDeviceId("did");//可选,可以设置自定义did,不设置会使用内部默认的
|
||||
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
||||
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
||||
}
|
||||
|
||||
/**
|
||||
* ApmInsight性能监控初始化
|
||||
*/
|
||||
private void initApmInsight() {
|
||||
|
||||
ApmInsightInitConfig.Builder builder = ApmInsightInitConfig.builder();
|
||||
//设置分配的appid
|
||||
builder.aid(BYTEAMP_APPID);
|
||||
//是否开启卡顿功能
|
||||
builder.blockDetect(true);
|
||||
//是否开启严重卡顿功能
|
||||
builder.seriousBlockDetect(true);
|
||||
//是否开启流畅性和丢帧
|
||||
builder.fpsMonitor(true);
|
||||
//控制是否打开WebVeiw监控
|
||||
builder.enableWebViewMonitor(true);
|
||||
//控制是否打开内存监控
|
||||
builder.memoryMonitor(true);
|
||||
//控制是否打开电量监控
|
||||
builder.batteryMonitor(true);
|
||||
//是否打印日志,注:线上release版本要配置为false
|
||||
builder.debugMode(true);
|
||||
//支持用户自定义user_id把平台数据和自己用户关联起来,可以不配置
|
||||
// builder.userId("user_id");
|
||||
//私有化部署:配置数据上报的域名 (私有化部署才需要配置,内部有默认域名),测试支持设置http://www.xxx.com 默认是https协议
|
||||
// builder.defaultReportDomain("www.xxx.com");
|
||||
//设置渠道。1.3.16版本增加接口
|
||||
builder.channel("local");
|
||||
//打开自定义日志回捞能力,1.4.1版本新增接口
|
||||
builder.enableLogRecovery(true);
|
||||
//设置数据和Rangers Applog数据打通,设备标识did必填。1.3.16版本增加接口
|
||||
// builder.setDynamicParams(new IDynamicParams() {
|
||||
// @Override
|
||||
// public String getUserUniqueID() {
|
||||
// //可选。依赖AppLog可以通过AppLog.getUserUniqueID()获取,否则可以返回null。
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getAbSdkVersion() {
|
||||
// //可选。如果依赖AppLog可以通过AppLog.getAbSdkVersion()获取,否则可以返回null。
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getSsid() {
|
||||
// //可选。依赖AppLog可以通过AppLog.getSsid()获取,否则可以返回null。
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getDid() {
|
||||
// //1.4.0版本及以上,可选,其他版本必填。设备的唯一标识,如果依赖AppLog可以通过 AppLog.getDid() 获取,也可以自己生成。
|
||||
// return AppLog.getDid();
|
||||
// }
|
||||
// });
|
||||
ApmInsight.getInstance().init(this, builder.build());
|
||||
|
||||
//初始化自定日志,配置自定义日志最大占用磁盘,内部一般配置20,代表最大20M磁盘占用。1.4.1版本开始存在这个api
|
||||
VLog.init(this, 20);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldInit() {
|
||||
Logger.w(TAG, "evaluate shouldInit() with: %s", ProcessUtils.getProcessName(Process.myPid()));
|
||||
|
||||
10
build.gradle
10
build.gradle
@@ -12,6 +12,12 @@ buildscript {
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-public/' }
|
||||
maven {
|
||||
url "https://artifact.bytedance.com/repository/Volcengine/"
|
||||
}
|
||||
maven {
|
||||
url "https://artifact.bytedance.com/repository/byteX/"
|
||||
}
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
@@ -19,6 +25,7 @@ buildscript {
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31'
|
||||
classpath "com.alibaba:arouter-register:1.0.2"
|
||||
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
|
||||
classpath 'com.volcengine:apm_insight_plugin:1.4.1'
|
||||
// classpath "com.bytedance.android.byteX:base-plugin:0.3.0"
|
||||
// classpath "com.mogo.cloud:hook:${HOOK_LOG_VERSION}"
|
||||
|
||||
@@ -37,6 +44,9 @@ allprojects {
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-public/' }
|
||||
maven {
|
||||
url "https://artifact.bytedance.com/repository/Volcengine/"
|
||||
}
|
||||
google()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
|
||||
@@ -21,8 +22,8 @@ import kotlinx.android.synthetic.main.view_autopilot_status.view.*
|
||||
* 自动驾驶状态按钮
|
||||
*/
|
||||
class AutoPilotStatusView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
context: Context,
|
||||
attrs: AttributeSet
|
||||
) : ConstraintLayout(context, attrs), View.OnClickListener, IMogoAdasOCHCallback {
|
||||
|
||||
private val TAG = "AutopilotStatusView"
|
||||
@@ -65,7 +66,6 @@ class AutoPilotStatusView @JvmOverloads constructor(
|
||||
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
|
||||
}
|
||||
}
|
||||
startAutoPilot();
|
||||
}
|
||||
|
||||
private fun startAutoPilot() {
|
||||
|
||||
Reference in New Issue
Block a user