QueryMultiSeriesAsync() public method

Queries Influx DB and gets a time series data back. Ideal for fetching measurement values. The return list is of InfluxSeries, and each element in there will have properties named after columns in series
public QueryMultiSeriesAsync ( string dbName, string measurementQuery, TimePrecision precision = TimePrecision.Nanoseconds ) : Task>
dbName string Name of the database
measurementQuery string Query text, Only results with single series are supported for now
precision TimePrecision epoch precision of the data set
return Task>
Exemplo n.º 1
0
        public async Task <double> SumTheWaterLevel(string endpoint, string database)
        {
            var client = new InfluxDBClient(endpoint);

            var query = "SELECT water_level FROM h2o_feet";

            var results = await client.QueryMultiSeriesAsync(database, query);

            var serie = results.Single();

            double total = 0;

            foreach (dynamic entry in serie.Entries)
            {
                // Not sure why but water_level comes back as a string.
                total += double.Parse(entry.Water_level);
            }

            return(total);
        }