优化日志上报的tag
This commit is contained in:
@@ -38,6 +38,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
|||||||
|
|
||||||
private static final String TAG = "ApmCrashReportProvider";
|
private static final String TAG = "ApmCrashReportProvider";
|
||||||
private static final String MAP_SDK_VERSION = "MAP_SDK_VERSION";
|
private static final String MAP_SDK_VERSION = "MAP_SDK_VERSION";
|
||||||
|
private CarInfo mInfo = null;
|
||||||
|
private String mCityCode;
|
||||||
|
private String mLat;
|
||||||
|
private String mLogt;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context) {
|
public void init(Context context) {
|
||||||
@@ -54,27 +58,28 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
|||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
//车辆信息
|
//车辆信息
|
||||||
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
|
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
|
||||||
CarInfo info = null;
|
|
||||||
if (carInfoString != null && !carInfoString.isEmpty()) {
|
if (carInfoString != null && !carInfoString.isEmpty()) {
|
||||||
info = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
mInfo = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//车辆所在位置
|
//车辆所在位置
|
||||||
String cityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
mCityCode = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_CITY_CODE);
|
||||||
String lat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
mLat = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LATITUDE);
|
||||||
String logt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
mLogt = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.LOCATION_LONGITUDE);
|
||||||
// Log.d("liyz", "cityCode = " + cityCode + " --lat = " +lat + " --logt = " + logt);
|
Log.d("liyz", "cityCode = " + mCityCode + " --lat = " +mLat + " --logt = " + mLogt);
|
||||||
//地图版本
|
//地图版本
|
||||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||||
map.put("MAP_SDK_VERSION", mapSDKVersion);
|
map.put("MAP_SDK_VERSION", mapSDKVersion);
|
||||||
if (info != null) {
|
map.put("CITYCODE", mCityCode);
|
||||||
CallerLogger.INSTANCE.d(TAG, "nuber = " + info.getNumber_plate() + "--brand = " + info.getBrand() + "--modle = " + info.getModel());
|
map.put("LATITUDE", mLat);
|
||||||
map.put("PLATE_NUMBER", info.getNumber_plate());
|
map.put("LONGITUTE", mLogt);
|
||||||
map.put("BRAND", info.getBrand());
|
|
||||||
map.put("MODEL", info.getModel());
|
if (mInfo != null) {
|
||||||
map.put("CITYCODE", cityCode);
|
CallerLogger.INSTANCE.d(TAG, "nuber = " + mInfo.getNumber_plate() + "--brand = " + mInfo.getBrand() + "--modle = " + mInfo.getModel());
|
||||||
map.put("LATITUDE", lat);
|
map.put("PLATE_NUMBER", mInfo.getNumber_plate());
|
||||||
map.put("LONGITUTE", logt);
|
map.put("BRAND", mInfo.getBrand());
|
||||||
|
map.put("MODEL", mInfo.getModel());
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -89,6 +94,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
|||||||
crash.config().setDeviceId(DeviceIdUtils.getDeviceId(context));
|
crash.config().setDeviceId(DeviceIdUtils.getDeviceId(context));
|
||||||
}
|
}
|
||||||
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
|
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
|
||||||
|
crash.addTags("CITYCODE", mCityCode);
|
||||||
|
crash.addTags("LATITUDE", mLat);
|
||||||
|
crash.addTags("LONGITUTE", mLogt);
|
||||||
|
|
||||||
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
||||||
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
||||||
|
|
||||||
@@ -98,6 +107,15 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
|||||||
dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
|
dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
|
||||||
dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
|
dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
|
||||||
dimension.put(MAP_SDK_VERSION, mapSDKVersion);
|
dimension.put(MAP_SDK_VERSION, mapSDKVersion);
|
||||||
|
dimension.put("CITYCODE", mCityCode);
|
||||||
|
dimension.put("LATITUDE", mLat);
|
||||||
|
dimension.put("LONGITUTE", mLogt);
|
||||||
|
if (mInfo != null) {
|
||||||
|
dimension.put("PLATE_NUMBER", mInfo.getNumber_plate());
|
||||||
|
dimension.put("BRAND", mInfo.getBrand());
|
||||||
|
dimension.put("MODEL", mInfo.getModel());
|
||||||
|
}
|
||||||
|
|
||||||
HashMap<String, Double> metric = new HashMap<>();
|
HashMap<String, Double> metric = new HashMap<>();
|
||||||
//指标值
|
//指标值
|
||||||
//metric.put("Devices_ID_metric", (double) 100);
|
//metric.put("Devices_ID_metric", (double) 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user