aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/telemetry
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2022-11-30 14:46:10 +0000
committerpmikus <peter.mikus@protonmail.ch>2022-12-06 07:12:09 +0000
commit5466cc69f18a480dbff7e39d28abbbccf683ba2f (patch)
tree1ec87291b32aa79dc2f6a48b7a3533548f5ed61b /resources/tools/telemetry
parentbfbdfaedb044b7643b81f47e76285baedfee9e25 (diff)
feat(telemetry): Add telemetry export
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Ibb8a59fd4e08bc736494c7ab18e689a55f7a98dc
Diffstat (limited to 'resources/tools/telemetry')
-rw-r--r--resources/tools/telemetry/bundle_perf_stat.py8
-rw-r--r--resources/tools/telemetry/bundle_vppctl.py6
-rw-r--r--resources/tools/telemetry/constants.py1
-rw-r--r--resources/tools/telemetry/metrics.py8
4 files changed, 14 insertions, 9 deletions
diff --git a/resources/tools/telemetry/bundle_perf_stat.py b/resources/tools/telemetry/bundle_perf_stat.py
index 17afbe0824..471dd07b18 100644
--- a/resources/tools/telemetry/bundle_perf_stat.py
+++ b/resources/tools/telemetry/bundle_perf_stat.py
@@ -91,10 +91,16 @@ class BundlePerfStat:
def detach(self):
+ """
+ Detach function.
+ """
pass
def fetch_data(self):
- pass
+ """
+ Fetch data function.
+ """
+ pass
def process_data(self):
"""
diff --git a/resources/tools/telemetry/bundle_vppctl.py b/resources/tools/telemetry/bundle_vppctl.py
index 5334237496..d0ee3754c7 100644
--- a/resources/tools/telemetry/bundle_vppctl.py
+++ b/resources/tools/telemetry/bundle_vppctl.py
@@ -30,7 +30,7 @@ M_RUN_SEPARATOR = (
r"(-)+"
)
M_RUN_NODES = (
- r"(?P<name>\S+)\s+"
+ r"(?P<node_name>\S+)\s+"
r"(?P<state>\S+\s\S+|\S+)\s+"
r"(?P<calls>\d+)\s+"
r"(?P<vectors>\d+)\s+"
@@ -284,7 +284,7 @@ class BundleVppctl:
item = dict()
labels = dict()
item["name"] = metric
- labels["name"] = nodes["name"]
+ labels["node_name"] = nodes["node_name"]
labels["state"] = nodes["state"]
try:
labels["thread_name"] = thread["thread_name"]
@@ -364,7 +364,7 @@ class BundleVppctl:
item = dict()
labels = dict()
item["name"] = metric
- labels["name"] = node["node_name"]
+ labels["node_name"] = node["node_name"]
labels["thread_name"] = thread["thread_name"]
labels["thread_id"] = thread["thread_id"]
item["labels"] = labels
diff --git a/resources/tools/telemetry/constants.py b/resources/tools/telemetry/constants.py
index 5363ddeaa4..d5641ede2d 100644
--- a/resources/tools/telemetry/constants.py
+++ b/resources/tools/telemetry/constants.py
@@ -50,4 +50,3 @@ class Constants:
# Could not successfuly run perf stat command
err_linux_perf_stat = 53
-
diff --git a/resources/tools/telemetry/metrics.py b/resources/tools/telemetry/metrics.py
index 7a22acfd1b..27fad89a5c 100644
--- a/resources/tools/telemetry/metrics.py
+++ b/resources/tools/telemetry/metrics.py
@@ -104,7 +104,7 @@ class Metric:
u"Sample", [u"name", u"labels", u"value", u"timestamp"]
)
- if not re.compile(r"^[a-zA-Z_:][a-zA-Z0-9_:]*$").match(name):
+ if not re.compile(r"^[a-zA-Z._:][a-zA-Z0-9._:]*$").match(name):
raise ValueError(f"Invalid metric name: {name}!")
if typ not in self.metric_types:
raise ValueError(f"Invalid metric type: {typ}!")
@@ -210,11 +210,11 @@ class MetricBase:
:rasies ValueError: If name does not conform with naming conventions.
"""
full_name = u""
- full_name += f"{namespace}_" if namespace else u""
- full_name += f"{subsystem}_" if subsystem else u""
+ full_name += f"{namespace}." if namespace else u""
+ full_name += f"{subsystem}." if subsystem else u""
full_name += name
- if not re.compile(r"^[a-zA-Z_:][a-zA-Z0-9_:]*$").match(full_name):
+ if not re.compile(r"^[a-zA-Z._:][a-zA-Z0-9._:]*$").match(full_name):
raise ValueError(
f"Invalid metric name: {full_name}!"
)