query.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:endeavour 作者: h2020-endeavour 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号