def flow_query(field,client,interval,dp_name,cookie=None,table_id=0,
flow=None):
query_dict = base_flow_query(field, interval, dp_name, cookie, table_id)
if flow is not None:
query_dict["WHERE"] += match_fields_query(flow)
query = ' '.join(['%s' % (value) for (key, value) in query_dict.items()])
result = client.query(query)
gen = result[(field, None)]
for v in gen:
return v["non_negative_derivative"]
# The StatsCollector needs to receive
# an InfluxDBClient object to perform queries.
# e.g:
# INFLUXDB_DB = "sdx"
# INFLUXDB_HOST = "localhost"
# INFLUXDB_PORT = 8086
# INFLUXDB_USER = ""
# INFLUXDB_PASS = ""
# client = InfluxDBClient(
# host=INFLUXDB_HOST, port=INFLUXDB_PORT,
# username=INFLUXDB_USER, password=INFLUXDB_PASS,
# database=INFLUXDB_DB, timeout=10)
# c = StatsCollector(client)
评论列表
文章目录