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

Method getDataPointFromString

src/tsd/PutDataPointRpc.java:791–812  ·  view source on GitHub ↗

Converts the string array to an IncomingDataPoint. WARNING: This method does not perform validation. It should only be used by the Telnet style execute above within the error callback. At that point it means the array parsed correctly as per importDataPoint. @param tsdb The TSDB for

(final TSDB tsdb, 
                                                     final String[] words)

Source from the content-addressed store, hash-verified

789 * @return An incoming data point object.
790 */
791 protected IncomingDataPoint getDataPointFromString(final TSDB tsdb,
792 final String[] words) {
793 final IncomingDataPoint dp = new IncomingDataPoint();
794 dp.setMetric(words[1]);
795
796 if (words[2].contains(".")) {
797 dp.setTimestamp(Tags.parseLong(words[2].replace(".", "")));
798 } else {
799 dp.setTimestamp(Tags.parseLong(words[2]));
800 }
801
802 dp.setValue(words[3]);
803
804 final HashMap<String, String> tags = new HashMap<String, String>();
805 for (int i = 4; i < words.length; i++) {
806 if (!words[i].isEmpty()) {
807 Tags.parse(tags, words[i]);
808 }
809 }
810 dp.setTags(tags);
811 return dp;
812 }
813
814 /**
815 * Simple helper to format an error trying to save a data point

Callers 2

executeMethod · 0.95
callMethod · 0.45

Calls 8

setMetricMethod · 0.95
setTimestampMethod · 0.95
parseLongMethod · 0.95
setValueMethod · 0.95
parseMethod · 0.95
setTagsMethod · 0.95
containsMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected