Task #6119
openTask #6116: EPIC: Speed up the stats updater daemon (scripts/workflow/update_stats.sh)
Spike: ask IIKO OLAP for a date-grouped range in one request instead of one request per day
0%
Description
Problem¶
IikoStatsGatheringService.getMetricValuesFromIikoDateDesc (line 117) loops currentDate backwards in delta steps and issues one OLAP report request per step. For the default delta = 1 day over a year that is 365 requests to obtain what is conceptually a single time series.
Idea¶
IIKO's OLAP v2 report API supports grouping rows by a date field (OpenDate.Typed and friends) inside one report. If the request DTOs can carry that group field, a whole range collapses into one request whose rows are already the per-day buckets we are building by hand.
This is by far the largest single multiplier available (×365 on the default delta), but it needs verification against the live IIKO server before committing to it.
Work¶
- Confirm against the IIKO server which date group field the configured report types accept, and that the aggregate values per bucket match what the current per-day requests return. Compare a known company/metric/week both ways.
- If it holds, extend
IikoOlapV2RequestsComposingService/GroupFieldsComposingServiceto emit the date group field, and add a range-mode path togetMetricValuesFromIikoDateDescthat issues one request and maps each returned row to aStatSliceBasewith the bucket's owndateStart/dateEnd. - Keep the per-day path as a fallback for
month_cumulative_revenue, whose windows are not uniform buckets and may not express as a simple grouping.
Blocked on nothing, but should land after the session reuse task so the verification runs are cheap.
Acceptance¶
- Written finding recorded on this issue either way (works / does not work, with evidence).
- If it works: a range fetch returns the same slice values as the day-by-day fetch for the same window.
No data to display