public Object getValue(TaggedLogAPIEntity entity, String field) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!entityClass.equals(entity.getClass())) { if ((entityClass.equals(GenericMetricEntity.class) && entity.getClass().equals(GenericMetricShadowEntity.class))) { GenericMetricShadowEntity e = (GenericMetricShadowEntity)entity; return e.getValue(); } else { throw new IllegalArgumentException("Invalid entity type: " + entity.getClass().getSimpleName()); } } final Method m = qualifierGetterMap.get(field); if (m == null) { // The field is a tag if (entity.getTags() != null) { return entity.getTags().get(field); } } if (m != null) { return m.invoke(entity); } return null; }
logAPIEntity = HBaseInternalLogHelper.buildEntity(internalLog, ed); if(logAPIEntity instanceof GenericMetricEntity){ if(singleMetricEntity == null) singleMetricEntity = new GenericMetricShadowEntity(); GenericMetricEntity e = (GenericMetricEntity)logAPIEntity; if(e.getValue()!=null) { long ts = logAPIEntity.getTimestamp() + i * ed.getMetricDefinition().getInterval(); singleMetricEntity.setTimestamp(ts); singleMetricEntity.setTags(e.getTags()); singleMetricEntity.setValue(e.getValue()[i]);
@Override public void entityCreated(TaggedLogAPIEntity entity) throws Exception { GenericMetricEntity e = (GenericMetricEntity)entity; double[] value = e.getValue(); if (value != null) { int count = value.length; @SuppressWarnings("unused") Class<?> cls = ed.getMetricDefinition().getSingleTimestampEntityClass(); for (int i = 0; i < count; i++) { long ts = entity.getTimestamp() + i * ed.getMetricDefinition().getInterval(); // exclude those entity which is not within the time range in search condition. [start, end) if (ts < start || ts >= end) { continue; } single.setTimestamp(ts); single.setTags(entity.getTags()); single.setValue(e.getValue()[i]); for (EntityCreationListener l : listeners) { l.entityCreated(single); } } } }
if (logAPIEntity instanceof GenericMetricEntity) { if (singleMetricEntity == null) { singleMetricEntity = new GenericMetricShadowEntity(); long ts = logAPIEntity.getTimestamp() + i * ed.getMetricDefinition().getInterval(); singleMetricEntity.setTimestamp(ts); singleMetricEntity.setTags(e.getTags()); singleMetricEntity.setValue(e.getValue()[i]);
@Override public void entityCreated(TaggedLogAPIEntity entity) throws Exception{ GenericMetricEntity e = (GenericMetricEntity)entity; double[] value = e.getValue(); if(value != null) { int count =value.length; @SuppressWarnings("unused") Class<?> cls = ed.getMetricDefinition().getSingleTimestampEntityClass(); for (int i = 0; i < count; i++) { long ts = entity.getTimestamp() + i * ed.getMetricDefinition().getInterval(); // exclude those entity which is not within the time range in search condition. [start, end) if (ts < start || ts >= end) { continue; } single.setTimestamp(ts); single.setTags(entity.getTags()); single.setValue(e.getValue()[i]); for (EntityCreationListener l : _listeners) { l.entityCreated(single); } } } }
public Object getValue(TaggedLogAPIEntity entity, String field) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!entityClass.equals(entity.getClass())) { if ((entityClass.equals(GenericMetricEntity.class) && entity.getClass().equals(GenericMetricShadowEntity.class))) { GenericMetricShadowEntity e = (GenericMetricShadowEntity)entity; return e.getValue(); } else { throw new IllegalArgumentException("Invalid entity type: " + entity.getClass().getSimpleName()); } } final Method m = qualifierGetterMap.get(field); if (m == null) { // The field is a tag if (entity.getTags() != null) { return entity.getTags().get(field); } } if (m != null) { return m.invoke(entity); } return null; }