MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / mergeAndReturnResults

Method mergeAndReturnResults

src/core/MultiGetQuery.java:796–836  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

794 }
795
796 private void mergeAndReturnResults() throws Exception {
797 final long hbase_time = DateTime.currentTimeMillis();
798 TsdbQuery.scanlatency.add((int) (hbase_time - fetch_start_time));
799 if (LOG.isDebugEnabled()) {
800 LOG.debug("Finished fetching data for metric: " + Bytes.pretty(metric)
801 + " using " + (hbase_time - fetch_start_time) + "ms");
802 }
803 LOG.info("Finished fetching data for metric: " + Bytes.pretty(metric)
804 + " using " + (hbase_time - fetch_start_time) + "ms");
805 if (exception != null) {
806 LOG.error("After all of the multi-gets finished, at "
807 + "least one threw an exception", exception);
808 throw exception;
809 }
810
811 final long merge_start = DateTime.nanoTime();
812
813 // Merge sorted spans together
814 if (!isHistogramScan()) {
815 mergeDataPoints();
816 } else {
817 // Merge histogram data points
818 mergeHistogramDataPoints();
819 }
820
821 if (LOG.isDebugEnabled()) {
822 LOG.debug("It took " + (DateTime.currentTimeMillis() - hbase_time) + " ms, "
823 + " to merge and sort the rows into a tree map");
824 }
825
826 if (query_stats != null) {
827 query_stats.addStat(query_index, QueryStat.SCANNER_MERGE_TIME,
828 (DateTime.nanoTime() - merge_start));
829 }
830
831 if (!isHistogramScan()) {
832 results.callback(spans);
833 } else {
834 histogramResults.callback(histogramSpans);
835 }
836 }
837
838 private boolean isHistogramScan() {
839 return histogramSpans != null;

Callers 2

handleExceptionMethod · 0.95

Calls 8

currentTimeMillisMethod · 0.95
nanoTimeMethod · 0.95
isHistogramScanMethod · 0.95
mergeDataPointsMethod · 0.95
errorMethod · 0.80
addStatMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected