add trace

This commit is contained in:
tongchenfei
2020-12-28 18:00:30 +08:00
parent f339a765ee
commit 9baba79975

View File

@@ -132,7 +132,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
var latLonFromDistance: MogoLatLng? = null
val p = TanluUploadParams(IMogoTanluProvider.TYPE_BLOCK, IMogoTanluProvider.UPLOAD_FROM_STRATEGY_BLOCK_AUTO)
var aveTmp: Float = 0f
// 到达时间限制,上报速度,数据清空
if (stopFlag < STOP_FLAG_THRESHOLD) {
// 停车标志位小于阈值,判定不是停车,计算平均值,进行上报
@@ -141,6 +141,7 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
sum += it
}
val ave = sum / speedCacheList.size
aveTmp = ave
Logger.d(TAG, "平均速度为: $ave")
blockFromSpeed = ave <= 10
// 上报平均速度
@@ -158,6 +159,17 @@ class BlockStrategy(private val context: Context, private val apis: IMogoService
} else {
Logger.d(TAG, "根据距离,没有判定为拥堵, tripDistance: $tripDistance, frontDistance: $frontDistance, currentSpeed: $currentSpeed")
}
if (blockFromDistance || blockFromSpeed) {
// 埋点
var type = 0
if (blockFromDistance) {
type = type xor 1
}
if(blockFromSpeed){
type = type xor 2
}
apis.analyticsApi.track("v2x_share_block_strategy", mapOf("type" to type, "ave" to aveTmp, "tripDistance" to tripDistance, "currentSpeed" to currentSpeed, "isClose" to isClose()))
}
tripDistance = 0
lastLat = 0.0
lastLon = 0.0