MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / findSpans

Method findSpans

src/core/TsdbQuery.java:860–898  ·  view source on GitHub ↗

Finds all the Spans that match this query. This is what actually scans the HBase table and loads the data into Spans. @return A map from HBase row key to the Span for that row key. Since a Span actually contains multiple HBase rows, the row key stored in the map has i

()

Source from the content-addressed store, hash-verified

858 * @throws IllegalArgumentException if bad data was retrieved from HBase.
859 */
860 private Deferred<SortedMap<byte[], Span>> findSpans() throws HBaseException {
861 final short metric_width = tsdb.metrics.width();
862 final TreeMap<byte[], Span> spans = // The key is a row key from HBase.
863 new TreeMap<byte[], Span>(new SpanCmp(
864 (short)(Const.SALT_WIDTH() + metric_width)));
865
866 // Copy only the filters that should trigger a tag resolution. If this list
867 // is empty due to literals or a wildcard star, then we'll save a TON of
868 // UID lookups
869 final List<TagVFilter> scanner_filters;
870 if (filters != null) {
871 scanner_filters = new ArrayList<TagVFilter>(filters.size());
872 for (final TagVFilter filter : filters) {
873 if (filter.postScan()) {
874 scanner_filters.add(filter);
875 }
876 }
877 } else {
878 scanner_filters = null;
879 }
880
881 if (Const.SALT_WIDTH() > 0) {
882 final List<Scanner> scanners = new ArrayList<Scanner>(Const.SALT_BUCKETS());
883 for (int i = 0; i < Const.SALT_BUCKETS(); i++) {
884 scanners.add(getScanner(i));
885 }
886 scan_start_time = DateTime.nanoTime();
887 return new SaltScanner(tsdb, metric, scanners, spans, scanner_filters,
888 delete, rollup_query, query_stats, query_index, null,
889 max_bytes, max_data_points).scan();
890 } else {
891 final List<Scanner> scanners = new ArrayList<Scanner>(1);
892 scanners.add(getScanner(0));
893 scan_start_time = DateTime.nanoTime();
894 return new SaltScanner(tsdb, metric, scanners, spans, scanner_filters,
895 delete, rollup_query, query_stats, query_index, null, max_bytes,
896 max_data_points).scan();
897 }
898 }
899
900 private Deferred<SortedMap<byte[], Span>> findSpansWithMultiGetter() throws HBaseException {
901 final short metric_width = tsdb.metrics.width();

Callers 1

runAsyncMethod · 0.95

Calls 9

SALT_WIDTHMethod · 0.95
SALT_BUCKETSMethod · 0.95
getScannerMethod · 0.95
nanoTimeMethod · 0.95
postScanMethod · 0.80
widthMethod · 0.65
sizeMethod · 0.65
addMethod · 0.45
scanMethod · 0.45

Tested by

no test coverage detected