@Test public void testSinglePointWithIMeasurementValueWithoutTimestamp() { String testPoints = "cpu value=1i\ncpu\ncpu mem test hello"; List<Point> dps = InfluxDecoder.pointsFromString("test", testPoints); assertEquals(1, dps.size()); Point dp = dps.get(0); assertEquals("cpu", dp.getMeasurementName()); assertEquals(0, dp.getTagsList().size()); assertEquals(1, dp.getValueList().get(0).longValue()); long ts = System.currentTimeMillis(); assertEquals(1, (dp.getTimestamp() / ts), 1); }
public static List<Point> pointsFromString(String dbName, String payload) { List<Point> dps = new ArrayList<>(); try { Iterable<String> splits = lineFromPayLoad(payload); for (String split : splits) { Builder builder = pointFromLine(Point.newBuilder(), dbName, split); if (builder != null) { Point point = builder.build(); dps.add(point); } } } catch (Exception e) { e.printStackTrace(); logger.fine("Rejected:" + payload); } return dps; }
InfluxDecoder { public static List<Point> pointsFromString(String dbName, String payload) { List<Point> dps = new ArrayList<>(); try { Iterable<String> splits = lineFromPayLoad(payload); for (String split : splits) { Builder builder = pointFromLine(Point.newBuilder(), dbName, split); if (builder != null) { Point point = builder.build(); dps.add(point); } } } catch (Exception e) { e.printStackTrace(); logger.fine("Rejected:" + payload); } return dps; } }
InfluxDecoder { public static List<Point> pointsFromString(String dbName, String payload) { List<Point> dps = new ArrayList<>(); try { Iterable<String> splits = lineFromPayLoad(payload); for (String split : splits) { Builder builder = pointFromLine(Point.newBuilder(), dbName, split); if (builder != null) { Point point = builder.build(); dps.add(point); } } } catch (Exception e) { e.printStackTrace(); logger.fine("Rejected:" + payload); } return dps; }  }
InfluxDecoder { public static List<Point> pointsFromString(String dbName, String payload) { List<Point> dps = new ArrayList<>(); try { Iterable<String> splits = lineFromPayLoad(payload); for (String split : splits) { Builder builder = pointFromLine(Point.newBuilder(), dbName, split); if (builder != null) { Point point = builder.build(); dps.add(point); } } } catch (Exception e) { e.printStackTrace(); logger.fine("Rejected:" + payload); } return dps; }  static List<String> lineFromPayLoad(String payload); static List<Point> pointsFromString(String dbName, String payload); static Point.Builder pointFromLine(Point.Builder builder, String dbName, String line); }
InfluxDecoder { public static List<Point> pointsFromString(String dbName, String payload) { List<Point> dps = new ArrayList<>(); try { Iterable<String> splits = lineFromPayLoad(payload); for (String split : splits) { Builder builder = pointFromLine(Point.newBuilder(), dbName, split); if (builder != null) { Point point = builder.build(); dps.add(point); } } } catch (Exception e) { e.printStackTrace(); logger.fine("Rejected:" + payload); } return dps; }  static List<String> lineFromPayLoad(String payload); static List<Point> pointsFromString(String dbName, String payload); static Point.Builder pointFromLine(Point.Builder builder, String dbName, String line);  }