Authored by hugufei

召回日志整理

... ... @@ -75,7 +75,7 @@ public class BatchRequestResponseEntrace {
private CompletableFuture<List<RecallRequestResponse>> doRecallSknList(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
return CompletableFuture.supplyAsync(() -> {
long begin = System.currentTimeMillis();
List<RecallRequestResponse> requestResponses = sknRecallRecallRequestResponseBuilder.batchRecallBySknList(userRecallRequest, userPersonalFactor);
List<RecallRequestResponse> requestResponses = sknRecallRecallRequestResponseBuilder.buildRecallRequestsForSkn(userRecallRequest, userPersonalFactor);
RecallLoggerHelper.info("batchRecall-doRecallSknList,request size is [{}],cost is [{}]", requestResponses.size(), System.currentTimeMillis() - begin);
return requestResponses;
}, recallExecutorService);
... ... @@ -90,7 +90,7 @@ public class BatchRequestResponseEntrace {
private CompletableFuture<List<RecallRequestResponse>> doRecallCommon(UserRecallRequest userRecallRequest, PagePersonalFactor pagePersonalFactor) {
return CompletableFuture.supplyAsync(() -> {
long begin = System.currentTimeMillis();
List<RecallRequest> requests = commonRequestBuilder.buildCommonRecallRequests(userRecallRequest, pagePersonalFactor);
List<RecallRequest> requests = commonRequestBuilder.buildRecallRequestsForCommon(userRecallRequest, pagePersonalFactor);
List<RecallRequestResponse> requestResponses = batchRecallBaseService.batchRecallAndCache(requests);
RecallLoggerHelper.info("batchRecall-doRecallCommon,request size is [{}],cost is [{}]", requests.size(), System.currentTimeMillis() - begin);
return requestResponses;
... ... @@ -107,7 +107,7 @@ public class BatchRequestResponseEntrace {
private CompletableFuture<List<RecallRequestResponse>> doRecallSortBrand(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
return CompletableFuture.supplyAsync(() -> {
long begin = System.currentTimeMillis();
List<RecallRequest> requests = sortBrandRecallRequestBuilder.buildSortBrandRequests(userRecallRequest, userPersonalFactor);
List<RecallRequest> requests = sortBrandRecallRequestBuilder.buildRecallRequestsForSortBrand(userRecallRequest, userPersonalFactor);
List<RecallRequestResponse> vecSortBrandRequestsResponses = batchRecallBaseService.batchRecallAndCache(requests);
RecallLoggerHelper.info("batchRecall-doRecallSortBrand,request size is [{}],cost is [{}]", requests.size(), System.currentTimeMillis() - begin);
return vecSortBrandRequestsResponses;
... ...
... ... @@ -8,8 +8,6 @@ import com.yoho.search.models.recall.UserPersonalFactor;
import com.yoho.search.models.recall.UserRecallRequest;
import com.yoho.search.service.recall.helper.RecallLoggerHelper;
import com.yoho.search.service.recall.strategy.SortBrandType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
... ... @@ -40,18 +38,10 @@ public class QueryUserPersionalFactorBean {
if (!userRecallRequest.hasUidOrUdid()) {
return new UserPersonalFactor();
}
int uid = userRecallRequest.getUid();
String udid = userRecallRequest.getUdid();
//2、获取用户的个性化因子
long begin = System.currentTimeMillis();
UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(), pageFactor.getMisortIds());
long cost = System.currentTimeMillis() - begin;
RecallLoggerHelper.info("QueryUserPersionalFactorBean[2]:queryUserPersionalFactor. uid is[{}],udid is[{}], cost is[{}]", uid, udid, cost);
//3、构造结果
begin = System.currentTimeMillis();
UserPersonalFactor userPersonalFactor = this.buildUserPersonalFactor(userRecallRequest, pageFactor, userFactor);
cost = System.currentTimeMillis() - begin;
RecallLoggerHelper.info("QueryUserPersionalFactorBean[3]:buildUserPersonalFactor, uid is[{}],udid is[{}], cost is[{}ms],", uid, udid, cost);
return userPersonalFactor;
} catch (Exception e) {
RecallLoggerHelper.error(e.getMessage(), e);
... ...
... ... @@ -34,7 +34,7 @@ public class CommonRecallRequestBuilder {
* @param userRecallRequest
* @return
*/
public List<RecallRequest> buildCommonRecallRequests(UserRecallRequest userRecallRequest, PagePersonalFactor pagePersonalFactor) {
public List<RecallRequest> buildRecallRequestsForCommon(UserRecallRequest userRecallRequest, PagePersonalFactor pagePersonalFactor) {
//1、构造召回请求
List<RecallRequest> requests = new ArrayList<>();
//2、firstSkn的召回
... ... @@ -70,7 +70,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildFirstSknRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.FIRST_SKN, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, FIRST_SKN size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, FIRST_SKN size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -87,7 +87,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildDirectTrainRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.DIRECT_TRAIN, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, DIRECT_TRAIN size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, DIRECT_TRAIN size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -103,7 +103,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildUfoDirectTrainRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.DIRECT_TRAIN_UFO, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, DIRECT_TRAIN_UFO size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, DIRECT_TRAIN_UFO size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -119,7 +119,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildNewShopRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.NEW_SHOP, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, NEW_SHOP size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, NEW_SHOP size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -135,7 +135,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildAddFlowRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.ADD_FLOW, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, ADD_FLOW size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, ADD_FLOW size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -151,7 +151,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildNewProductRequest(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.NEW_PRODUCT, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, NEW_PRODUCT size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, NEW_PRODUCT size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -167,7 +167,7 @@ public class CommonRecallRequestBuilder {
*/
private List<RecallRequest> buildCommonRandomStrategy(UserRecallRequest userRecallRequest) {
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.COMMON_RANDOM, 0);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, COMMON_RANDOM size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, COMMON_RANDOM size is [{}]",size);
if (size == 0) {
return Collections.emptyList();
}
... ... @@ -187,7 +187,7 @@ public class CommonRecallRequestBuilder {
if (size == 0 || size < pageSize) {
size = pageSize;
}
RecallLoggerHelper.infoDetail(userRecallRequest,"buildCommonRequest, COMMON_HEAT_VALUE size is [{}]",size);
RecallLoggerHelper.infoDetail(userRecallRequest,"buildRecallRequestsForCommon, COMMON_HEAT_VALUE size is [{}]",size);
CommonHeatValueStrategy strategy = new CommonHeatValueStrategy(size);
return this.buildRequestList(userRecallRequest, strategy);
}
... ...
... ... @@ -54,7 +54,7 @@ public class SknRecallRecallRequestResponseBuilder {
*
* @return
*/
public List<RecallRequestResponse> batchRecallBySknList(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
public List<RecallRequestResponse> buildRecallRequestsForSkn(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
try {
List<Integer> filterSknList = new ArrayList<>();
//1、获取实时点击skn的配置
... ... @@ -64,7 +64,7 @@ public class SknRecallRecallRequestResponseBuilder {
} else {
recSknCount = 0;
}
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSknRequests, REC_SKN size is [{}]", recSknCount);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSkn, REC_SKN size is [{}]", recSknCount);
//2、获取相似skn的配置
int youtubeSknCount = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.RT_YOUTUBE_SKN, 0);
... ... @@ -73,7 +73,7 @@ public class SknRecallRecallRequestResponseBuilder {
} else {
youtubeSknCount = 0;
}
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSknRequests, RT_YOUTUBE_SKN size is [{}]", recSknCount);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSkn, RT_YOUTUBE_SKN size is [{}]", recSknCount);
//3、获取相似skn的配置
int rtSimSknCount = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.RT_SIM_SKN, 0);
... ... @@ -82,7 +82,7 @@ public class SknRecallRecallRequestResponseBuilder {
} else {
rtSimSknCount = 0;
}
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSknRequests, rtSimSknCount size is [{}]", recSknCount);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSkn, rtSimSknCount size is [{}]", recSknCount);
//4、执行查询
if (filterSknList.isEmpty()) {
... ...
... ... @@ -19,7 +19,7 @@ public class SortBrandRecallRequestBuilder {
@Autowired
private RecallConfigService recallConfigService;
public List<RecallRequest> buildSortBrandRequests(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
public List<RecallRequest> buildRecallRequestsForSortBrand(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
List<RecallRequest> requests = new ArrayList<>();
requests.addAll(this.buildRealTimeSortBrandRequests(userRecallRequest, userPersonalFactor));
requests.addAll(this.buildVectorW2vSortBrandRequests(userRecallRequest, userPersonalFactor));
... ... @@ -30,25 +30,25 @@ public class SortBrandRecallRequestBuilder {
private List<RecallRequest> buildRealTimeSortBrandRequests(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
List<RecallRequest> requests = this.buildSortBrandRecallRequests(userRecallRequest, userPersonalFactor.getRealTimeSortBrandList(), SortBrandType.REC_SORT_BRAND);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSortBrandRequests, REC_SORT_BRAND size is [{}]", requests.size());
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSortBrand, REC_SORT_BRAND size is [{}]", requests.size());
return requests;
}
private List<RecallRequest> buildVectorW2vSortBrandRequests(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
List<RecallRequest> requests = this.buildSortBrandRecallRequests(userRecallRequest, userPersonalFactor.getVectorW2vSortBrandList(), SortBrandType.VEC_W2V_SORT_BRAND);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSortBrandRequests, VEC_W2V_SORT_BRAND size is [{}]", requests.size());
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSortBrand, VEC_W2V_SORT_BRAND size is [{}]", requests.size());
return requests;
}
private List<RecallRequest> buildVectorRnnSortBrandRequests(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
List<RecallRequest> requests = this.buildSortBrandRecallRequests(userRecallRequest, userPersonalFactor.getVectorRnnSortBrandList(), SortBrandType.VEC_RNN_SORT_BRAND);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSortBrandRequests, VEC_RNN_SORT_BRAND size is [{}]", requests.size());
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSortBrand, VEC_RNN_SORT_BRAND size is [{}]", requests.size());
return requests;
}
private List<RecallRequest> buildConfigSortBrandRequests(UserRecallRequest userRecallRequest, UserPersonalFactor userPersonalFactor) {
List<RecallRequest> requests = this.buildSortBrandRecallRequests(userRecallRequest, userPersonalFactor.getConfigSortBrandList(), SortBrandType.CONFIG_SORT_BRAND);
RecallLoggerHelper.infoDetail(userRecallRequest, "buildSortBrandRequests, CONFIG_SORT_BRAND size is [{}]", requests.size());
RecallLoggerHelper.infoDetail(userRecallRequest, "buildRecallRequestsForSortBrand, CONFIG_SORT_BRAND size is [{}]", requests.size());
return requests;
}
... ...