Adding a maximum event count

revert-dabc3590
lasantha 8 years ago
parent 74edcfe307
commit 032b9a524c

@ -35,6 +35,7 @@ import java.util.Map;
public class APIUtil { public class APIUtil {
private static Log log = LogFactory.getLog(APIUtil.class); private static Log log = LogFactory.getLog(APIUtil.class);
private static int maxEventCount = 100;
public static String getAuthenticatedUser() { public static String getAuthenticatedUser() {
PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
@ -82,6 +83,8 @@ public class APIUtil {
int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query); int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query);
if (eventCount == 0) { if (eventCount == 0) {
return null; return null;
}else if(eventCount>maxEventCount){
eventCount=maxEventCount;
} }
List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount, List<SearchResultEntry> resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount,
sortByFields); sortByFields);

Loading…
Cancel
Save