如何拆分List <series>中存储的值

时间:2017-11-20 12:21:48

标签: java split influxdb

我需要帮助分割存储在列表

中的值

请找到以下代码:

public class Connect_InfluxDB {
    public static void main(String[] args) {

        // Connect to InfluxDB
        InfluxDB influxDB = InfluxDBFactory.connect("http://localhost:8086");

        // Create a database
        String dbName = "jmeter";

        System.out.println("SELECT sum"+"("+"errorCount"+")"+"/"+"count"+"("+"responseTime"+")"+" FROM "+ "requestsRaw");
        Query errorcount = new Query("SELECT sum"+"("+"errorCount"+")"+"/"+"count"+"("+"responseTime"+")"+" FROM "+ "requestsRaw", dbName);

        QueryResult queryResult = influxDB.query(errorcount);

        // iterate the results and print details
        for (QueryResult.Result result : queryResult.getResults()) {

            // print details of the entire result
            System.out.println(result.toString());

            // iterate the series within the result
            for (QueryResult.Series series : result.getSeries()) {
                System.out.println("series.getName() = " + series.getName());
                System.out.println("series.getColumns() = " + series.getColumns());
                System.out.println("series.getValues() = " + series.getValues());
                System.out.println("series.getTags() = " + series.getTags());
            }
        }

        Query passcount = new Query("SELECT 1 - sum"+"("+"errorCount"+")"+"/"+"count"+"("+"responseTime"+")"+" FROM "+ "requestsRaw", dbName);

        QueryResult queryResult1 = influxDB.query(passcount);

        // iterate the results and print details
        for (Result result : queryResult1.getResults()) {

            // print details of the entire result
            System.out.println(result.toString());

            // iterate the series within the result
            for (Series series : result.getSeries()) {
                System.out.println("series.getName() = " + series.getName());
                System.out.println("series.getColumns() = " + series.getColumns());
                System.out.println("series.getValues() = " + series.getValues());
                System.out.println("series.getTags() = " + series.getTags());
            }
        }

        // Delete the database
        //influxDB.deleteDatabase(dbName);
    }

    public List<Series> getSeries() {
        return this.getSeries();
      }
}

我得到以上传递和错误计数查询的以下结果

Error count-series.getValues() = [[1970-01-01T00:00:00Z, 0.7083333333333334]]

Passcount-series.getValues() = [[1970-01-01T00:00:00Z, 0.29166666666666663]]

我只想从列表中选择值(例如:0.708&amp; 0.291)我该怎么做。请注意点亮。对此提出任何建议都会有所帮助。提前谢谢。

0 个答案:

没有答案