From b5c722b0aa1e18995b2c76a6425dc468be1aee0f Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 16 May 2018 07:51:46 +0200 Subject: [PATCH] corrected tagging of actual brew process for storing in time serires db --- modules/logs/endpoints.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/logs/endpoints.py b/modules/logs/endpoints.py index e67ef08..b2a1179 100644 --- a/modules/logs/endpoints.py +++ b/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)