From 9baba7997535bb4beb6f509c0c4f270c7a3f1111 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Mon, 28 Dec 2020 18:00:30 +0800 Subject: [PATCH] add trace --- .../module/share/strategyreceiver/BlockStrategy.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt index 8786930973..f2332890b3 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/strategyreceiver/BlockStrategy.kt @@ -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