浏览代码

corrected tagging of actual brew process for storing in time serires db

pull/194/head
Johannes 7 年前
父节点
当前提交
b5c722b0aa
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. +6
    -7
      modules/logs/endpoints.py

+ 6
- 7
modules/logs/endpoints.py 查看文件

@@ -60,17 +60,12 @@ class LogView(FlaskView):
cbpi.notify("Failed to delete log", "", type="danger")
return ('', 204)

def querry_tsdb(self, type, id):
def query_tsdb(self, type, id):
kairosdb_server = "http://127.0.0.1:" + cbpi.cache["config"]["kairos_db_port"].__dict__["value"]

tag = ""

if cbpi.cache["active_brew"] != "" and cbpi.cache["active_brew"] != "none":
tag = '"brew": "%s"' % cbpi.cache["active_brew"]

data = dict(metrics=[
{
"tags": {tag},
"tags": {},
"name": "cbpi.%s_%s" % (type, id),
"aggregators": [
{
@@ -91,6 +86,9 @@ class LogView(FlaskView):
"unit": "days"
})

if cbpi.cache["active_brew"] != "none":
data["metrics"][0]["tags"] = {"brew": [cbpi.cache["active_brew"]]}

self.logger.debug("query: %s", json.dumps(data))

response = requests.post(kairosdb_server + "/api/v1/datapoints/query", json.dumps(data))
@@ -125,6 +123,7 @@ class LogView(FlaskView):

if use_kairosdb:
return self.querry_tsdb(type, id)
return self.query_tsdb(type, id)
else:
return self.querry_log(type, id)



正在加载...
取消
保存