Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(latency_calculator): allow use it in longevity tests #9628

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion defaults/test_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ zero_token_instance_type_db: 'i4i.large'
use_zero_nodes: false

latte_schema_parameters: {}

workload_name: ''
latency_decorator_error_thresholds:
write:
default:
Expand Down
4 changes: 4 additions & 0 deletions sdcm/sct_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,10 @@ class SCTConfiguration(dict):
help="Error thresholds for latency decorator."
" Defined by dict: {<write, read, mixed>: {<default|nemesis_name>:{<metric_name>: {<rule>: <value>}}}"),

dict(name="workload_name", env="SCT_WORKLOAD_NAME", type=str,
help="Workload name, can be: write|read|mixed|unset."
"Used for e.g. latency_calculator_decorator (use with 'use_hdr_cs_histogram' set to true)."
"If unset, workload is taken from test name."),
]

required_params = ['cluster_backend', 'test_duration', 'n_db_nodes', 'n_loaders', 'use_preinstalled_scylla',
Expand Down
5 changes: 5 additions & 0 deletions sdcm/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def latency_calculator_decorator(original_function: Optional[Callable] = None, *
"""
Gets the start time, end time and then calculates the latency based on function 'calculate_latency'.

For proper usage, it requires workload name (write, read, mixed) to be included in the test name
or setting 'workload_name' test parameter. Also requires monitoring set and 'use_hdr_cs_histogram' test parameter to be set to True.

:param func: Remote method to run.
:return: Wrapped method.
"""
Expand Down Expand Up @@ -212,6 +215,8 @@ def wrapped(*args, **kwargs): # noqa: PLR0914
workload = 'write'
elif 'mixed' in test_name:
workload = 'mixed'
elif tester.params.get('workload_name'):
workload = tester.params['workload_name']
else:
return res

Expand Down
Loading