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

Method parseLastPointQuery

src/tsd/QueryRpc.java:806–844  ·  view source on GitHub ↗

Parses a last point query from the URI string @param tsdb The TSDB to which we belong @param http_query The HTTP query to work with @return A LastPointQuery object to execute against @throws BadRequestException if parsing failed

(final TSDB tsdb, 
      final HttpQuery http_query)

Source from the content-addressed store, hash-verified

804 * @throws BadRequestException if parsing failed
805 */
806 private LastPointQuery parseLastPointQuery(final TSDB tsdb,
807 final HttpQuery http_query) {
808 final LastPointQuery query = new LastPointQuery();
809
810 if (http_query.hasQueryStringParam("resolve")) {
811 query.setResolveNames(true);
812 }
813
814 if (http_query.hasQueryStringParam("back_scan")) {
815 try {
816 query.setBackScan(Integer.parseInt(http_query.getQueryStringParam("back_scan")));
817 } catch (NumberFormatException e) {
818 throw new BadRequestException("Unable to parse back_scan parameter");
819 }
820 }
821
822 final List<String> ts_queries = http_query.getQueryStringParams("timeseries");
823 final List<String> tsuid_queries = http_query.getQueryStringParams("tsuids");
824 final int num_queries =
825 (ts_queries != null ? ts_queries.size() : 0) +
826 (tsuid_queries != null ? tsuid_queries.size() : 0);
827 final List<LastPointSubQuery> sub_queries =
828 new ArrayList<LastPointSubQuery>(num_queries);
829
830 if (ts_queries != null) {
831 for (String ts_query : ts_queries) {
832 sub_queries.add(LastPointSubQuery.parseTimeSeriesQuery(ts_query));
833 }
834 }
835
836 if (tsuid_queries != null) {
837 for (String tsuid_query : tsuid_queries) {
838 sub_queries.add(LastPointSubQuery.parseTSUIDQuery(tsuid_query));
839 }
840 }
841
842 query.setQueries(sub_queries);
843 return query;
844 }
845
846 private void checkAuthorization(final TSDB tsdb, final Channel chan, final net.opentsdb.query.pojo.Query data_query) {
847 if (tsdb.getConfig().getBoolean("tsd.core.authentication.enable")) {

Callers 1

Calls 10

setResolveNamesMethod · 0.95
setBackScanMethod · 0.95
parseTimeSeriesQueryMethod · 0.95
parseTSUIDQueryMethod · 0.95
setQueriesMethod · 0.95
sizeMethod · 0.65
hasQueryStringParamMethod · 0.45
getQueryStringParamMethod · 0.45
getQueryStringParamsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected