diff options
author | QiLiang <liangqi1@huawei.com> | 2015-12-30 14:58:53 +0000 |
---|---|---|
committer | QiLiang <liangqi1@huawei.com> | 2016-01-07 06:23:51 +0000 |
commit | 65e32e513544392ce84c190434d23281b5c1afd2 (patch) | |
tree | 06db325e85da8aaee7e064a08e53a54df8d9310a /yardstick/dispatcher/influxdb.py | |
parent | 99ba990d4a01c0f3f4837f11a24b695f4a2393d2 (diff) |
InfluxDB dispatcher add more tags
- add runner_id tag
- add test case name tag
- add task_id tag
JIRA: YARDSTICK-212
Change-Id: I75c27e23942a6e2189019e94bfe8026a5fd67621
Signed-off-by: QiLiang <liangqi1@huawei.com>
Conflicts:
yardstick/dispatcher/influxdb.py
Diffstat (limited to 'yardstick/dispatcher/influxdb.py')
-rw-r--r-- | yardstick/dispatcher/influxdb.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/yardstick/dispatcher/influxdb.py b/yardstick/dispatcher/influxdb.py index c58054167..2f3ff089f 100644 --- a/yardstick/dispatcher/influxdb.py +++ b/yardstick/dispatcher/influxdb.py @@ -53,6 +53,8 @@ class InfluxdbDispatcher(DispatchBase): self.influxdb_url = "%s/write?db=%s" % (self.target, self.db_name) self.raw_result = [] self.case_name = "" + self.tc = "" + self.task_id = -1 self.static_tags = { "pod_name": os.environ.get('POD_NAME', 'unknown'), "installer": os.environ.get('INSTALLER_TYPE', 'unknown'), @@ -86,12 +88,22 @@ class InfluxdbDispatcher(DispatchBase): return str(int(float(timestamp) * 1000000000)) + def _get_extended_tags(self, data): + tags = { + "runner_id": data["runner_id"], + "tc": self.tc, + "task_id": self.task_id + } + + return tags + def _data_to_line_protocol(self, data): msg = {} point = {} point["measurement"] = self.case_name point["fields"] = self._dict_key_flatten(data["benchmark"]["data"]) point["time"] = self._get_nano_timestamp(data) + point["tags"] = self._get_extended_tags(data) msg["points"] = [point] msg["tags"] = self.static_tags @@ -108,6 +120,8 @@ class InfluxdbDispatcher(DispatchBase): if isinstance(data, dict) and "scenario_cfg" in data: self.case_name = data["scenario_cfg"]["type"] + self.tc = data["scenario_cfg"]["tc"] + self.task_id = data["scenario_cfg"]["task_id"] return 0 if self.case_name == "": |