Skip to content

Commit fd62020

Browse files
Added setup type to profile dropdown (#236)
* [add] Further improved the remote profiler daemon * [add] Added setup type to profile dropdown * Extended logging in profiler daemon * Bumping version * Bumping version * Bumping version * Extended logging in profiler daemon * Extended logging in profiler daemon * Extended logging in profiler daemon * Extended logging in profiler daemon
1 parent 0d2b2c5 commit fd62020

File tree

4 files changed

+72
-32
lines changed

4 files changed

+72
-32
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.5.13"
3+
version = "0.5.14"
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]>","Redis Performance Group <[email protected]>"]
66
readme = "README.md"

redisbench_admin/profilers/daemon.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,31 @@ def set_app_loggers(self, app):
5454
app.logger.addHandler(handler)
5555
self.perf.set_logger(app.logger)
5656

57+
def update_vars_from_request(self, request, app):
58+
app.logger.info("Updating vars from request")
59+
self.dso = ""
60+
self.test_name = ""
61+
self.setup_name = ""
62+
if request.is_json:
63+
data = request.get_json()
64+
app.logger.info("Received the JSON payload {}".format(data))
65+
if "dso" in data:
66+
self.dso = data["dso"]
67+
if "test_name" in data:
68+
self.test_name = data["test_name"]
69+
if "setup_name" in data:
70+
self.setup_name = data["setup_name"]
71+
if "github_actor" in data:
72+
self.github_actor = data["github_actor"]
73+
if "github_branch" in data:
74+
self.github_branch = data["github_branch"]
75+
if "github_repo_name" in data:
76+
self.github_repo_name = data["github_repo_name"]
77+
if "github_org_name" in data:
78+
self.github_org_name = data["github_org_name"]
79+
if "github_sha" in data:
80+
self.github_sha = data["github_sha"]
81+
5782
def create_app_endpoints(self, app):
5883
@app.before_first_request
5984
def before_first_request():
@@ -80,27 +105,7 @@ def profile_start(profiler_name, pid):
80105
self.github_branch,
81106
github_branch_detached,
82107
) = extract_git_vars()
83-
self.dso = ""
84-
self.test_name = ""
85-
self.setup_name = ""
86-
if request.is_json:
87-
data = request.get_json()
88-
if "dso" in data:
89-
self.dso = data["dso"]
90-
if "test_name" in data:
91-
self.test_name = data["test_name"]
92-
if "setup_name" in data:
93-
self.setup_name = data["setup_name"]
94-
if "github_actor" in data:
95-
self.github_actor = data["github_actor"]
96-
if "github_branch" in data:
97-
self.github_branch = data["github_branch"]
98-
if "github_repo_name" in data:
99-
self.github_repo_name = data["github_repo_name"]
100-
if "github_org_name" in data:
101-
self.github_org_name = data["github_org_name"]
102-
if "github_sha" in data:
103-
self.github_sha = data["github_sha"]
108+
self.update_vars_from_request(request, app)
104109

105110
self.collection_summary_str = local_profilers_platform_checks(
106111
self.dso,
@@ -130,6 +135,7 @@ def profile_start(profiler_name, pid):
130135
start_time_str=start_time_str,
131136
)
132137
)
138+
app.logger.info("Storing profile in {}".format(profile_filename))
133139
result = self.perf.start_profile(
134140
pid,
135141
profile_filename,

redisbench_admin/profilers/perf_daemon_caller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def start_profile(self, pid, output="", frequency=99):
7272
self.remote_endpoint, pid, frequency
7373
)
7474

75-
response = requests.post(url, data)
75+
response = requests.post(url, data=None, json=data)
7676
if response.status_code == 200:
7777
self.result = True
7878

@@ -88,7 +88,7 @@ def stop_profile(self, **kwargs):
8888
self.remote_endpoint, self.pid
8989
)
9090

91-
response = requests.post(url, {})
91+
response = requests.post(url)
9292
if response.status_code == 200:
9393
result = True
9494
status_dict = response.json()

redisbench_admin/run_remote/run_remote.py

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ def run_remote_command_logic(args, project_name, project_version):
434434
)
435435

436436
if profilers_enabled:
437+
logging.info("Stopping remote profiler")
437438
remote_perf.stop_profile()
438439
(
439440
perf_stop_status,
@@ -481,30 +482,63 @@ def run_remote_command_logic(args, project_name, project_version):
481482
profile_markdown_str = (
482483
profile_markdown_str.replace("\n", "")
483484
)
484-
profile_id = "{}_hash_{}".format(
485-
start_time_str, tf_github_sha
485+
profile_id = "{}_{}_hash_{}".format(
486+
start_time_str, setup_name, tf_github_sha
486487
)
487488
profile_string_testcase_markdown_key = (
488489
"profile:{}:{}".format(
489490
profile_id, test_name
490491
)
491492
)
492-
zset_profiles = "profiles:{}_{}".format(
493-
tf_github_org,
494-
tf_github_repo,
493+
zset_profiles = "profiles:{}_{}_{}".format(
494+
tf_github_org, tf_github_repo, setup_name
495+
)
496+
zset_profiles_setup = (
497+
"profiles:setups:{}_{}".format(
498+
tf_github_org,
499+
tf_github_repo,
500+
)
495501
)
496502
profile_set_redis_key = (
497503
"profile:{}:testcases".format(profile_id)
498504
)
499-
https_link = "{}?var-org={}&var-repo={}".format(
505+
zset_profiles_setups_testcases = (
506+
"profiles:testcases:{}_{}_{}".format(
507+
tf_github_org,
508+
tf_github_repo,
509+
setup_name,
510+
)
511+
)
512+
zset_profiles_setups_testcases_profileid = (
513+
"profiles:ids:{}_{}_{}_{}".format(
514+
tf_github_org,
515+
tf_github_repo,
516+
setup_name,
517+
test_name,
518+
)
519+
)
520+
https_link = "{}?var-org={}&var-repo={}&var-setup={}".format(
500521
grafana_profile_dashboard,
501522
tf_github_org,
502523
tf_github_repo,
503-
) + "&var-profile_id={}&var-profile_test_case={}".format(
504-
profile_id,
524+
setup_name,
525+
) + "&var-test_case={}&var-profile_id={}".format(
505526
test_name,
527+
profile_id,
506528
)
507529
if args.push_results_redistimeseries:
530+
rts.redis.zadd(
531+
zset_profiles_setup,
532+
{setup_name: start_time_ms},
533+
)
534+
rts.redis.zadd(
535+
zset_profiles_setups_testcases,
536+
{test_name: start_time_ms},
537+
)
538+
rts.redis.zadd(
539+
zset_profiles_setups_testcases_profileid,
540+
{profile_id: start_time_ms},
541+
)
508542
rts.redis.zadd(
509543
zset_profiles,
510544
{profile_id: start_time_ms},

0 commit comments

Comments
 (0)