77import org .influxdb .dto .QueryResult ;
88
99import java .io .IOException ;
10+ import java .time .Instant ;
1011import java .util .*;
1112import java .util .concurrent .TimeUnit ;
1213
@@ -40,10 +41,13 @@ public static void main(String[] args) {
4041 List <String > newFieldNames = new ArrayList <>(series .getColumns ());
4142 int javaVersionIndex = newFieldNames .indexOf (JAVA_VERSION_TAG_NAME );
4243 newFieldNames .remove (javaVersionIndex );
44+ assert (newFieldNames .get (0 ).equals ("time" ));
45+ newFieldNames .remove (0 );
4346 Point .Builder builder = Point .measurement (newMeasure );
4447 Map <String , String > newTags = new HashMap <>(series .getTags ());
4548 List <Object > newValues = new ArrayList <>(series .getValues ().get (0 ));
4649 Object removed = newValues .remove (javaVersionIndex );
50+ String time = (String ) newValues .remove (0 );
4751 newTags .put (JAVA_VERSION_TAG_NAME , (String ) removed );
4852 newTags .entrySet ().removeIf (x -> x .getValue () == null || x .getValue ().equals ("" ));
4953 builder .tag (newTags );
@@ -53,6 +57,8 @@ public static void main(String[] args) {
5357 newFieldsMap .put (newFieldNames .get (i ), newValues .get (i ));
5458 }
5559 builder .fields (newFieldsMap );
60+ Instant parse = Instant .parse (time );
61+ builder .time (parse .toEpochMilli (), TimeUnit .MILLISECONDS );
5662 Point point = builder .build ();
5763 batchPoints .point (point );
5864 }
0 commit comments