Skip to content

Report: improve generation performance, fix y-axis filtering, and correct config applicability detection#347

Open
ol-nata wants to merge 8 commits into
ts-factory:mainfrom
ol-nata:performance/report
Open

Report: improve generation performance, fix y-axis filtering, and correct config applicability detection#347
ol-nata wants to merge 8 commits into
ts-factory:mainfrom
ol-nata:performance/report

Conversation

@ol-nata

@ol-nata ol-nata commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Info

Report generation was extremely slow for runs with many measurement results — slow enough to hit the default 10-minute proxy timeout and never complete (#346). This PR fixes the underlying query patterns causing that, and separately hardens the report config schema against a few states that silently produced broken or misleading reports.

Closes: #346

Overview of changes

Performance

  • Filtering by y-axis measurement values and by excluded arguments, and assembling the final per-test queryset, each built their result via union() of per-condition querysets, producing a query plan with a UNION branch for every condition. Rewritten to build a single condition from per-condition subqueries and apply it in one filter()/exclude() call.
  • Existence checks (if not qs:) materialized the entire queryset just to test truthiness. Replaced with exists().
  • Building each ReportPoint issued several queries per result (iteration, test, measurement, metas, test arguments) — classic N+1. Fixed with select_related/prefetch_related on measurement, result.iteration.test, result.iteration.test_arguments, and measurement.metas.

Y-axis filtering fix

Y-axis config entries (and nested fields) could previously be empty at the schema level. An empty entry produced no filtering at all for the corresponding test, silently showing every result instead of the intended subset. The schema now forbids empty y-axis entries, and a reformat step cleans up existing stored configs so they remain valid under the tightened schema.

Config applicability fix

Report config applicability for a run was determined from test_names_order, a field meant only for sorting, which could be absent or unrelated to the tests the config actually configures. This could cause a config to be wrongly reported as applicable, or a valid config to be missed. Applicability is now determined from the tests the config actually configures.

Optional test ordering

test_names_order is now optional in the schema and treated as optional wherever it's read, so report configs no longer need to specify an explicit test order.

Deployment

./scripts/deploy --steps per_project_conf run_services

ol-nata added 8 commits July 6, 2026 18:48
Determine report configuration applicability based on the tests it
configures rather than `test_names_order`, which is intended only for
sorting.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Treat `test_names_order` as optional when processing report
configurations, allowing report configurations without an explicit test
order.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Make `test_names_order` optional in the report configuration schema,
allowing report configurations without an explicit test order.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Y-axis config entries (and their nested fields) could previously be
empty at the schema level, which resulted in either an empty report
for the corresponding test or, due to a filtering bug, a report
showing everything unfiltered. The schema now forbids this.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Add a configuration reformatting step to remove empty y-axis values
from existing report configs, so they remain valid under the newly
tightened schema.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Filtering by y-axis-measurement values and by arguments whose matching
iterations should be excluded from the report, and assembling the
final report queryset from each test's results, each built their
result by materializing a separate queryset per condition and
combining them with `union()`, producing a query plan with a `UNION`
branch for every one of them.

Rewrite all three to build a single condition using per-condition
subqueries, then apply it in one `filter()`/`exclude()` call.

Related to: ts-factory#346
Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Checking whether a test had any results left after filtering fetched
the entire queryset just to test its truthiness. Use `exists()`
instead, which only needs a single lightweight query.

Related to: ts-factory#346
Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Improve report generation performance by eliminating redundant
per-result database queries when building `ReportPoint` objects.
Use `select_related` for `measurement` and `result.iteration.test`,
and `prefetch_related` for `result.iteration.test_arguments` and
`measurement.metas`.

Closes: ts-factory#346
Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Measurements report generation is very slow

1 participant