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

Method parsePercentiles

src/tsd/QueryRpc.java:898–912  ·  view source on GitHub ↗

Parse the "percentile" section of the query string and returns an list of float that contains the percentile calculation paramters the format of the section: percentile[xx,yy,zz] xx, yy, zz are the floats @param spec @return

(final String spec)

Source from the content-addressed store, hash-verified

896 * @return
897 */
898 public static final List<Float> parsePercentiles(final String spec) {
899 List<Float> rs = new ArrayList<Float>();
900 int start_pos = spec.indexOf('[');
901 int end_pos = spec.indexOf(']');
902 if (start_pos == -1 || end_pos == -1) {
903 throw new BadRequestException("Malformated percentile query paramater: " + spec);
904 }
905
906 String [] floats = Tags.splitString(spec.substring(start_pos + 1, end_pos), ',');
907 for (String s : floats) {
908 String trimed = s.trim();
909 rs.add(Float.valueOf(trimed));
910 }
911 return rs;
912 }
913
914 /** @param collector Populates the collector with statistics */
915 public static void collectStats(final StatsCollector collector) {

Callers 3

testParsePercentileMethod · 0.95
parseMTypeSubQueryMethod · 0.95

Calls 2

splitStringMethod · 0.95
addMethod · 0.45

Tested by 1

testParsePercentileMethod · 0.76