Skip to content

Commit

Permalink
test_page_service_batching: fix non-numeric metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Dec 3, 2024
1 parent dcb6295 commit 52e57fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 10 additions & 0 deletions test_runner/fixtures/benchmark_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ def record(
name = f"{self.PROPERTY_PREFIX}_{metric_name}"
if labels is None:
labels = {}

# Sometimes mypy can't catch non-numeric values,
# so adding a check here
try:
float(metric_value)
except ValueError as e:
raise ValueError(
f"`metric_value` (`{metric_value}`) must be a NUMERIC-friendly data type"
) from e

self.property_recorder(
name,
{
Expand Down
11 changes: 4 additions & 7 deletions test_runner/performance/pageserver/test_page_service_batching.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,18 @@ def test_throughput(
# name is not a metric, we just use it to identify the test easily in the `test_...[...]`` notation
}
)
params.update(
{
f"pipelining_config.{k}": (v, {})
for k, v in dataclasses.asdict(pipelining_config).items()
}
)
# For storing configuration as a metric, insert a fake 0 with labels with actual data
params.update({"pipelining_config": (0, {"labels": dataclasses.asdict(pipelining_config)})})

log.info("params: %s", params)

for param, (value, kwargs) in params.items():
zenbenchmark.record(
param,
metric_value=value,
metric_value=float(value),
unit=kwargs.pop("unit", ""),
report=MetricReport.TEST_PARAM,
labels=kwargs.pop("labels", None),
**kwargs,
)

Expand Down

0 comments on commit 52e57fb

Please sign in to comment.