Skip to content

Commit

Permalink
improvement(latency_calculator): allow use it in longevity tests
Browse files Browse the repository at this point in the history
`latency_calculator_decorator` requires workload to be set. Up to now it
was taken from the test name. This change allows to set it by
`workload_name` test parameter, so it can be used in all kind of tests.

Added latency verification for all 'individual nemesis' cases (proposal,
anyway need to test with something).

closes: #9627
  • Loading branch information
soyacz authored and fruch committed Dec 31, 2024
1 parent f867079 commit 2bfc791
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit 2bfc791

Please sign in to comment.