Skip to content

Commit

Permalink
Adding New Metric Cases to Case module (sustainable-computing-io#1453)
Browse files Browse the repository at this point in the history
Signed-off-by: Kaiyi <kaiyiliu21@gmail.com>
  • Loading branch information
KaiyiLiu1234 authored and vprashar2929 committed May 22, 2024
1 parent 24acb5b commit cd38a4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
20 changes: 14 additions & 6 deletions e2e/tools/validator/src/validator/cases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@

RAW_PROM_QUERIES = [
{
"expected_query": "rate(kepler_process_package_joules_total \
{{job='metal', pid='{vm_pid}', mode='dynamic'}}[{interval}])",
"expected_query": "rate(kepler_process_package_joules_total{{job='metal', pid='{vm_pid}', mode='dynamic'}}[{interval}])",
"actual_query": "rate(kepler_node_platform_joules_total{{job='vm'}}[{interval}])",
},
# {
# "expected_query": "",
# "actual_query": "",
# },
{
"expected_query": "rate(kepler_process_platform_joules_total{{job='metal', pid='{vm_pid}', mode='dynamic'}}[{interval}])",
"actual_query": "rate(kepler_node_platform_joules_total{{job='vm'}}[{interval}])",
},
{
"expected_query": "rate(kepler_process_bpf_cpu_time_ms_total{{job='metal', pid='{vm_pid}'}}[{interval}])",
"actual_query": "sum by(__name__, job) (rate(kepler_process_bpf_cpu_time_ms_total{{job='vm'}}[{interval}]))",
},
{
"expected_query": "rate(kepler_process_bpf_page_cache_hit_total{{job='metal', pid='{vm_pid}'}}[{interval}])",
"actual_query": "sum by(__name__, job) (rate(kepler_process_bpf_page_cache_hit_total{{job='vm'}}[{interval}]))",
},


]

Expand Down
9 changes: 5 additions & 4 deletions e2e/tools/validator/src/validator/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def stress(cfg: Validator, script_path: str):
test_cases = TestCases(cfg.metal.vm, cfg.prometheus)
metrics_validator = MetricsValidator(cfg.prometheus)
test_case_result = test_cases.load_test_cases()
click.secho("Validation results during stress test:")
for test_case in test_case_result.test_cases:
expected_query = test_case.expected_query
actual_query = test_case.actual_query
Expand All @@ -87,13 +88,13 @@ def stress(cfg: Validator, script_path: str):
expected_query,
actual_query)

# TODO: print what the values mean
click.secho("Validation results during stress test:")
click.secho(f"Expected Query Name: {expected_query}", fg='bright_yellow')
click.secho(f"Actual Query Name: {actual_query}", fg='bright_yellow')
click.secho(f"Absolute Errors during stress test: {metrics_res.ae}", fg='green')
click.secho(f"Absolute Percentage Errors during stress test: {metrics_res.ape}", fg='green')
click.secho(f"Mean Absolute Error (MAE) during stress test: {metrics_res.mae}", fg="blue")
click.secho(f"Mean Absolute Error (MAE) during stress test: {metrics_res.mae}", fg="red")
click.secho(f"Mean Absolute Percentage Error (MAPE) during stress test: {metrics_res.mape}", fg="red")
click.secho(f"Mean Squared Error (MSE) during stress test: {metrics_res.rmse}", fg="red")
click.secho(f"Mean Squared Error (MSE) during stress test: {metrics_res.rmse}", fg="blue")
click.secho("---------------------------------------------------", fg="cyan")


0 comments on commit cd38a4b

Please sign in to comment.