for (Map.Entry<String, PropertyInfo> entry: propertyInfoMap.entrySet()) {
String propertyKey = entry.getKey();
PropertyInfo propertyInfo = entry.getValue();
String propertyId = propertyInfo.getPropertyId();
TemporalInfo temporalInfo = request.getTemporalInfo(id);
if ((propertyInfo.isPointInTime() && temporalInfo == null) ||
(propertyInfo.isTemporal() && temporalInfo != null)) {
long startTime;
long endTime;
if (temporalInfo != null) {
Long endTimeSeconds = temporalInfo.getEndTime();
endTime = endTimeSeconds != -1 ? endTimeSeconds * 1000 : Long.MAX_VALUE;
startTime = temporalInfo.getStartTime() * 1000;
} else {
startTime = 0L;
endTime = Long.MAX_VALUE;
}
String[] parts = propertyId.split("\\.");
int size = parts.length;
if (size >= 3) {
metricsDefinitionSet.add(
new MetricDefinition(
startTime,
endTime,
parts[size - 3],
parts[size - 2],
parts[size - 1],
componentName.toLowerCase(),
hostName,
propertyKey,
temporalInfo)
);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Can't get metrics for " + id + " : " + propertyId);
}
}
}
}
}
Map<MetricDefinition, List<DataPoint>> results = getMetric(metricsDefinitionSet, statement);
for(MetricDefinition metricDefinition : metricsDefinitionSet) {
List<DataPoint> dataPoints = results.containsKey(metricDefinition) ? results.get(metricDefinition) : new ArrayList<DataPoint>();
TemporalInfo temporalInfo = metricDefinition.getTemporalInfo();
String propertyKey = metricDefinition.getPropertyKey();
if (dataPoints != null) {
if (temporalInfo == null){
// return the value of the last data point
int length = dataPoints.size();