use of datawave.webservice.query.exception.EmptyObjectException in project datawave by NationalSecurityAgency.
the class DocumentTransformerSupport method extractMetrics.
protected void extractMetrics(Document document, Key documentKey) {
Map<String, Attribute<? extends Comparable<?>>> dictionary = document.getDictionary();
Attribute<? extends Comparable<?>> timingMetadataAttribute = dictionary.get(LogTiming.TIMING_METADATA);
if (timingMetadataAttribute != null && timingMetadataAttribute instanceof TimingMetadata) {
TimingMetadata timingMetadata = (TimingMetadata) timingMetadataAttribute;
long currentSourceCount = timingMetadata.getSourceCount();
long currentNextCount = timingMetadata.getNextCount();
long currentSeekCount = timingMetadata.getSeekCount();
long currentYieldCount = timingMetadata.getYieldCount();
String host = timingMetadata.getHost();
sourceCount += currentSourceCount;
nextCount += currentNextCount;
seekCount += currentSeekCount;
yieldCount += currentYieldCount;
Map<String, Long> stageTimers = timingMetadata.getStageTimers();
if (stageTimers.containsKey(QuerySpan.Stage.DocumentSpecificTree.toString())) {
docRanges++;
} else if (stageTimers.containsKey(QuerySpan.Stage.FieldIndexTree.toString())) {
fiRanges++;
}
if (logTimingDetails || log.isTraceEnabled()) {
StringBuilder sb = new StringBuilder();
sb.append("retrieved document from host:").append(host).append(" at key:").append(documentKey.toStringNoTime()).append(" stageTimers:").append(stageTimers);
sb.append(" sourceCount:").append(currentSourceCount).append(" nextCount:").append(currentNextCount).append(" seekCount:").append(currentSeekCount).append(" yieldCount:").append(currentYieldCount);
if (log.isTraceEnabled()) {
log.trace(sb.toString());
} else {
log.info(sb.toString());
}
}
if (dictionary.size() == 1) {
// this document contained only timing metadata
throw new EmptyObjectException();
}
}
}
Aggregations