@Test public void testSinglePointMeasurementValue() { String testPoints = "cpu value=1i 1434055562000000000"; 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()); assertEquals(1434055562000000000L / (1000 * 1000), dp.getTimestamp()); }
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);  }