protected void checkNotNull(Object obj,String name) throws EagleServiceClientException{ if(obj == null) throw new EagleServiceClientException(name+" should not be null but given"); }
LOG.error(e.getMessage(),e); } catch (EagleServiceClientException e) { LOG.error(e.getMessage(),e); LOG.error(e.getMessage(),e); } catch (EagleServiceClientException e) { LOG.error(e.getMessage(),e);
LOG.error(e.getMessage(),e); } catch (EagleServiceClientException e) { LOG.error(e.getMessage(),e); LOG.error(e.getMessage(),e); } catch (EagleServiceClientException e) { LOG.error(e.getMessage(),e);
protected void checkNotNull(Object obj,String name) throws EagleServiceClientException{ if(obj == null) throw new EagleServiceClientException(name+" should not be null but given"); }
private Map<String, Long> queryGroupByMetrics(String condition, long startTime, long endTime, int limit) { try { GenericServiceAPIResponseEntity response = client.search() .pageSize(Integer.MAX_VALUE) .query(condition) .startTime(startTime) .endTime(endTime).send(); if (!response.isSuccess()) { LOG.error(response.getException()); return null; } List<Map<List<String>, List<Double>>> result = response.getObj(); return parseQueryResult(result, limit); } catch (EagleServiceClientException e) { LOG.error(e.getMessage(), e); return new HashMap<>(); } }
protected <E extends TaggedLogAPIEntity> String getServiceNameByClass(Class<E> entityClass) throws EagleServiceClientException { EntityDefinition entityDefinition = null; try { entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(entityClass); } catch (InstantiationException e) { throw new EagleServiceClientException(e); } catch (IllegalAccessException e) { throw new EagleServiceClientException(e); } if(entityDefinition == null){ throw new EagleServiceClientException("cannot find entity definition of class "+entityClass); } return entityDefinition.getService(); }
protected <E extends TaggedLogAPIEntity> String getServiceNameByClass(Class<E> entityClass) throws EagleServiceClientException { EntityDefinition entityDefinition = null; try { entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(entityClass); } catch (InstantiationException e) { throw new EagleServiceClientException(e); } catch (IllegalAccessException e) { throw new EagleServiceClientException(e); } if(entityDefinition == null){ throw new EagleServiceClientException("cannot find entity definition of class "+entityClass); } return entityDefinition.getService(); }
public EagleServiceQueryBuilder setPageSize(int pageSize) throws EagleServiceClientException { if (pageSize <= 0) { throw new EagleServiceClientException("pageSize can't be less than 1"); } request.setPageSize(pageSize); return this; }
public EagleServiceQueryBuilder setPageSize(int pageSize) throws EagleServiceClientException { if (pageSize <= 0) { throw new EagleServiceClientException("pageSize can't be less than 1"); } request.setPageSize(pageSize); return this; }
public EagleServiceQueryBuilder addReturnTag(String tagKey) throws EagleServiceClientException { if (tagKey == null) { throw new EagleServiceClientException("tagKey can't be null"); } List<String> returnTags = request.getReturnTags(); if (returnTags == null) { returnTags = new ArrayList<String>(); request.setReturnTags(returnTags); } if (!returnTags.contains(tagKey)) { returnTags.add(tagKey); } return this; }
public EagleServiceQueryBuilder addReturnField(String field) throws EagleServiceClientException { if (field == null) { throw new EagleServiceClientException("field can't be null"); } List<String> returnFields = request.getReturnFields(); if (returnFields == null) { returnFields = new ArrayList<String>(); request.setReturnFields(returnFields); } if (!returnFields.contains(field)) { returnFields.add(field); } return this; }
public EagleServiceQueryBuilder addReturnField(String field) throws EagleServiceClientException { if (field == null) { throw new EagleServiceClientException("field can't be null"); } List<String> returnFields = request.getReturnFields(); if (returnFields == null) { returnFields = new ArrayList<String>(); request.setReturnFields(returnFields); } if (!returnFields.contains(field)) { returnFields.add(field); } return this; }
protected <E extends TaggedLogAPIEntity> Map<String,List<E>> groupEntitiesByService(List<E> entities) throws EagleServiceClientException { Map<String,List<E>> serviceEntityMap = new HashMap<String, List<E>>(); if(LOG.isDebugEnabled()) LOG.debug("Grouping entities by service name"); for(E entity: entities) { if(entity == null) { LOG.warn("Skip null entity"); continue; } try { EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(entity.getClass()); if(entityDefinition == null){ throw new EagleServiceClientException("Failed to find entity definition of class: "+entity.getClass()); } String serviceName = entityDefinition.getService(); List<E> bucket = serviceEntityMap.get(serviceName); if(bucket == null){ bucket = new LinkedList<E>(); serviceEntityMap.put(serviceName, bucket); } bucket.add(entity); } catch (InstantiationException e) { throw new EagleServiceClientException(e); } catch (IllegalAccessException e) { throw new EagleServiceClientException(e); } } return serviceEntityMap; }
public EagleServiceQueryBuilder addReturnTag(String tagKey) throws EagleServiceClientException { if (tagKey == null) { throw new EagleServiceClientException("tagKey can't be null"); } List<String> returnTags = request.getReturnTags(); if (returnTags == null) { returnTags = new ArrayList<String>(); request.setReturnTags(returnTags); } if (!returnTags.contains(tagKey)) { returnTags.add(tagKey); } return this; }
protected <E extends TaggedLogAPIEntity> Map<String,List<E>> groupEntitiesByService(List<E> entities) throws EagleServiceClientException { Map<String,List<E>> serviceEntityMap = new HashMap<String, List<E>>(); if(LOG.isDebugEnabled()) LOG.debug("Grouping entities by service name"); for(E entity: entities){ if(entity == null) { LOG.warn("Skip null entity"); continue; } try { EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(entity.getClass()); if(entityDefinition == null){ throw new EagleServiceClientException("Failed to find entity definition of class: "+entity.getClass()); } String serviceName = entityDefinition.getService(); List<E> bucket = serviceEntityMap.get(serviceName); if(bucket == null){ bucket = new LinkedList<E>(); serviceEntityMap.put(serviceName, bucket); } bucket.add(entity); } catch (InstantiationException e) { throw new EagleServiceClientException(e); } catch (IllegalAccessException e) { throw new EagleServiceClientException(e); } } return serviceEntityMap; }
public String getQueryParameterString(String service) throws EagleServiceClientException { if (pageSize <= 0) { throw new EagleServiceClientException("pageSize can't be less than 1, pageSize: " + pageSize); throw new EagleServiceClientException("Got an UnsupportedEncodingException" + e.getMessage(), e);
public String getQueryParameterString(String service) throws EagleServiceClientException { if (pageSize <= 0) { throw new EagleServiceClientException("pageSize can't be less than 1, pageSize: " + pageSize); throw new EagleServiceClientException("Got an UnsupportedEncodingException" + e.getMessage(), e);
public String getQueryParameterString() throws EagleServiceClientException { if (pageSize < 0) { throw new EagleServiceClientException("pageSize can't be less than 0, pageSize: " + pageSize);
public String getQueryParameterString() throws EagleServiceClientException { if (pageSize <= 0) { throw new EagleServiceClientException("pageSize can't be less than 1, pageSize: " + pageSize); throw new EagleServiceClientException("Invalid startTime and endTime, startTime: " + startTime + ", endTime: " + endTime); throw new EagleServiceClientException("Invalid request, no return tag or field added");
public String getQueryParameterString() throws EagleServiceClientException { if (pageSize < 0) { throw new EagleServiceClientException("pageSize can't be less than 0, pageSize: " + pageSize);