[2.13.0-arch-opt] add apm tag of car type

This commit is contained in:
zhongchao
2023-02-21 14:02:10 +08:00
parent 964340ef68
commit b3b53d478f
2 changed files with 16 additions and 6 deletions

View File

@@ -25,7 +25,6 @@ object AppIdentityModeUtils {
private const val SWEEPER = "Sweeper" private const val SWEEPER = "Sweeper"
private fun getInfo(appIdentityMode: String): Array<String> { private fun getInfo(appIdentityMode: String): Array<String> {
val split = appIdentityMode.split("_") val split = appIdentityMode.split("_")
if (split.size == 3) { if (split.size == 3) {
@@ -34,6 +33,14 @@ object AppIdentityModeUtils {
return arrayOf("", "", "") return arrayOf("", "", "")
} }
fun getBuildCarType(appIdentityMode: String): String {
val (_, _, carType) = getInfo(appIdentityMode)
if(carType.isNotEmpty()){
return carType
}
return ""
}
/** /**
* 是否是 司机端(这里不细分具体是:小巴、出租车等类型) * 是否是 司机端(这里不细分具体是:小巴、出租车等类型)
* *
@@ -43,7 +50,7 @@ object AppIdentityModeUtils {
@JvmStatic @JvmStatic
fun isDriver(appIdentityMode: String): Boolean { fun isDriver(appIdentityMode: String): Boolean {
val (_, identity, _) = getInfo(appIdentityMode) val (_, identity, _) = getInfo(appIdentityMode)
if (!identity.isEmpty()) { if (identity.isNotEmpty()) {
return identity == DRIVER return identity == DRIVER
} }
return false return false
@@ -58,7 +65,7 @@ object AppIdentityModeUtils {
@JvmStatic @JvmStatic
fun isPassenger(appIdentityMode: String): Boolean { fun isPassenger(appIdentityMode: String): Boolean {
val (_, identity, _) = getInfo(appIdentityMode) val (_, identity, _) = getInfo(appIdentityMode)
if (!identity.isEmpty()) { if (identity.isNotEmpty()) {
return identity == PASSENGER return identity == PASSENGER
} }
return false return false
@@ -73,7 +80,7 @@ object AppIdentityModeUtils {
@JvmStatic @JvmStatic
fun isBus(appIdentityMode: String): Boolean { fun isBus(appIdentityMode: String): Boolean {
val (bussness, _, _) = getInfo(appIdentityMode) val (bussness, _, _) = getInfo(appIdentityMode)
if (!bussness.isEmpty()) { if (bussness.isNotEmpty()) {
return bussness == BUS return bussness == BUS
} }
return false return false
@@ -88,7 +95,7 @@ object AppIdentityModeUtils {
@JvmStatic @JvmStatic
fun isSweeper(appIdentityMode: String): Boolean { fun isSweeper(appIdentityMode: String): Boolean {
val (bussness, _, _) = getInfo(appIdentityMode) val (bussness, _, _) = getInfo(appIdentityMode)
if (!bussness.isEmpty()) { if (bussness.isNotEmpty()) {
return bussness == SWEEPER return bussness == SWEEPER
} }
return false return false
@@ -103,7 +110,7 @@ object AppIdentityModeUtils {
@JvmStatic @JvmStatic
fun isTaxi(appIdentityMode: String): Boolean { fun isTaxi(appIdentityMode: String): Boolean {
val (bussness, _, _) = getInfo(appIdentityMode) val (bussness, _, _) = getInfo(appIdentityMode)
if (!bussness.isEmpty()) { if (bussness.isNotEmpty()) {
return bussness == TAXI return bussness == TAXI
} }
return false return false

View File

@@ -13,6 +13,8 @@ import com.bytedance.apm.insight.ApmInsightInitConfig;
import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.bindingcar.CarInfo; import com.mogo.eagle.core.data.bindingcar.CarInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CommonUtils; import com.mogo.eagle.core.utilcode.util.CommonUtils;
@@ -96,6 +98,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
crash.addTags("CITYCODE", mCityCode); crash.addTags("CITYCODE", mCityCode);
crash.addTags("LATITUDE", mLat); crash.addTags("LATITUDE", mLat);
crash.addTags("LONGITUTE", mLogt); crash.addTags("LONGITUTE", mLogt);
crash.addTags("CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode));
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址 // crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖 // crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖