Authored by hugufei

add error log StandardAggregation

... ... @@ -8,6 +8,8 @@ import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.search.aggregations.Aggregation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
... ... @@ -25,6 +27,8 @@ import com.yoho.search.utils.IgnoreSomeException;
@Service
public class AggregationService implements ApplicationEventPublisherAware{
private static final Logger logger = LoggerFactory.getLogger(AggregationService.class);
@Autowired
private AggregationFactoryService aggregationFactoryService;
... ... @@ -78,6 +82,7 @@ public class AggregationService implements ApplicationEventPublisherAware{
}
return result;
} catch (Exception e) {
logger.error(e.getMessage());
publisher.publishEvent(new SearchEvent(EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSE.getEventName(),
EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSE.getFunctionName(),
EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSE.getMoudleName(),"exception",IgnoreSomeException.filterSomeException(e),null));
... ... @@ -107,6 +112,7 @@ public class AggregationService implements ApplicationEventPublisherAware{
Map<String, Aggregation> aggMaps = this.doSearchForAggregation(searchParam, paramMap);
return aggregation.getAggNameAndResponse(aggMaps);
} catch (Exception e) {
logger.error(e.getMessage());
publisher.publishEvent(new SearchEvent(EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSEWITHOUTCACHE.getEventName(),
EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSEWITHOUTCACHE.getFunctionName(),
EventReportEnum.AGGREGATIONSERVICE_GETAGGNAMEANDRESPONSEWITHOUTCACHE.getMoudleName(),"exception",IgnoreSomeException.filterSomeException(e),null));
... ...