Skip to content

Commit b182631

Browse files
Added extractRedisGraphVersion() and extractPerVersionTimeSeriesFromResults() to remote.py (#40)
* [add] Added extractRedisGraphVersion() and extractPerVersionTimeSeriesFromResults() to remote.py * Bumping version from 0.1.39 to 0.1.40
1 parent 4ecfc05 commit b182631

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
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.39"
3+
version = "0.1.40"
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: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,56 @@ def pushDataToRedisTimeSeries(rts: Client, branch_time_series_dict: dict):
343343
pass
344344
return datapoint_errors, datapoint_inserts
345345

346+
def extractRedisGraphVersion(results_dict: dict):
347+
version = None
348+
if "DBSpecificConfigs" in results_dict:
349+
if "RedisGraphVersion" in results_dict["DBSpecificConfigs"]:
350+
version = results_dict["DBSpecificConfigs"]["RedisGraphVersion"]
351+
return version
352+
353+
354+
def extractPerVersionTimeSeriesFromResults(
355+
datapoints_timestamp: int,
356+
metrics: list,
357+
results_dict: dict,
358+
project_version: str,
359+
tf_github_org: str,
360+
tf_github_repo: str,
361+
deployment_type: str,
362+
test_name: str,
363+
tf_triggering_env: str,
364+
):
365+
branch_time_series_dict = {}
366+
for jsonpath in metrics:
367+
jsonpath_expr = parse(jsonpath)
368+
metric_name = jsonpath[2:]
369+
metric_value = float(jsonpath_expr.find(results_dict)[0].value)
370+
# prepare tags
371+
# branch tags
372+
version_tags = {
373+
"version": project_version,
374+
"github_org": tf_github_org,
375+
"github_repo": tf_github_repo,
376+
"deployment_type": deployment_type,
377+
"test_name": test_name,
378+
"triggering_env": tf_triggering_env,
379+
"metric": metric_name,
380+
}
381+
ts_name = "ci.benchmarks.redislabs/by.version/{triggering_env}/{github_org}/{github_repo}/{test_name}/{deployment_type}/{version}/{metric}".format(
382+
version=project_version,
383+
github_org=tf_github_org,
384+
github_repo=tf_github_repo,
385+
deployment_type=deployment_type,
386+
test_name=test_name,
387+
triggering_env=tf_triggering_env,
388+
metric=metric_name,
389+
)
390+
391+
branch_time_series_dict[ts_name] = {
392+
"labels": version_tags.copy(),
393+
"data": {datapoints_timestamp: metric_value},
394+
}
395+
return True, branch_time_series_dict
346396

347397
def extractPerBranchTimeSeriesFromResults(
348398
datapoints_timestamp: int,
@@ -371,7 +421,7 @@ def extractPerBranchTimeSeriesFromResults(
371421
"triggering_env": tf_triggering_env,
372422
"metric": metric_name,
373423
}
374-
ts_name = "ci.benchmarks.redislabs/{triggering_env}/{github_org}/{github_repo}/{test_name}/{deployment_type}/{branch}/{metric}".format(
424+
ts_name = "ci.benchmarks.redislabs/by.branch/{triggering_env}/{github_org}/{github_repo}/{test_name}/{deployment_type}/{branch}/{metric}".format(
375425
branch=str(tf_github_branch),
376426
github_org=tf_github_org,
377427
github_repo=tf_github_repo,

0 commit comments

Comments
 (0)