Skip to content

Commit 55bd98a

Browse files
Fixed metrics extraction on timeseries exporter in case of missing metrics (#117)
* [fix] Fixed metrics extraction on timeseries exporter in case of missing metrics * Bumping version from 0.1.82 to 0.1.83
1 parent cc6c8e9 commit 55bd98a

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.1.82"
3+
version = "0.1.83"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>"]
66
readme = "README.md"

redisbench_admin/utils/remote.py

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -547,40 +547,44 @@ def extract_perbranch_timeseries_from_results(
547547
):
548548
branch_time_series_dict = {}
549549
for jsonpath in metrics:
550-
jsonpath_expr = parse(jsonpath)
551-
metric_name = jsonpath[2:]
552-
find_res = jsonpath_expr.find(results_dict)
553-
if find_res is not None and len(find_res) > 0:
554-
metric_value = float(find_res[0].value)
555-
556-
branch_tags = get_project_ts_tags(
557-
tf_github_org, tf_github_repo, deployment_type, tf_triggering_env
558-
)
559-
branch_tags["branch"] = str(tf_github_branch)
560-
branch_tags["test_name"] = str(test_name)
561-
branch_tags["metric"] = str(metric_name)
562-
ts_name = (
563-
"ci.benchmarks.redislabs/by.branch/"
564-
"{triggering_env}/{github_org}/{github_repo}/"
565-
"{test_name}/{deployment_type}/{branch}/{metric}".format(
566-
branch=str(tf_github_branch),
567-
github_org=tf_github_org,
568-
github_repo=tf_github_repo,
569-
deployment_type=deployment_type,
570-
test_name=test_name,
571-
triggering_env=tf_triggering_env,
572-
metric=metric_name,
550+
try:
551+
jsonpath_expr = parse(jsonpath)
552+
except Exception:
553+
pass
554+
finally:
555+
metric_name = jsonpath[2:]
556+
find_res = jsonpath_expr.find(results_dict)
557+
if find_res is not None and len(find_res) > 0:
558+
metric_value = float(find_res[0].value)
559+
560+
branch_tags = get_project_ts_tags(
561+
tf_github_org, tf_github_repo, deployment_type, tf_triggering_env
562+
)
563+
branch_tags["branch"] = str(tf_github_branch)
564+
branch_tags["test_name"] = str(test_name)
565+
branch_tags["metric"] = str(metric_name)
566+
ts_name = (
567+
"ci.benchmarks.redislabs/by.branch/"
568+
"{triggering_env}/{github_org}/{github_repo}/"
569+
"{test_name}/{deployment_type}/{branch}/{metric}".format(
570+
branch=str(tf_github_branch),
571+
github_org=tf_github_org,
572+
github_repo=tf_github_repo,
573+
deployment_type=deployment_type,
574+
test_name=test_name,
575+
triggering_env=tf_triggering_env,
576+
metric=metric_name,
577+
)
573578
)
574-
)
575579

576-
branch_time_series_dict[ts_name] = {
577-
"labels": branch_tags.copy(),
578-
"data": {datapoints_timestamp: metric_value},
579-
}
580-
else:
581-
logging.warning(
582-
"Unable to find metric path {} in {}".format(jsonpath, results_dict)
583-
)
580+
branch_time_series_dict[ts_name] = {
581+
"labels": branch_tags.copy(),
582+
"data": {datapoints_timestamp: metric_value},
583+
}
584+
else:
585+
logging.warning(
586+
"Unable to find metric path {} in {}".format(jsonpath, results_dict)
587+
)
584588
return True, branch_time_series_dict
585589

586590

0 commit comments

Comments
 (0)