Fix for current year not processed for new custom repors #18343
Labels
not-in-changelog
For issues or pull requests that should not be included in our release changelog on matomo.org.
Potential Bug
Something that might be a bug, but can't be reproduced (yet).
Milestone
Expected Behavior
We would expect that regardless of the number of months set using
rearchive_reports_in_past_last_n_months
that the reports for the current year will always be processed for the given plugin.Current Behavior
When setting a longer period of time for
rearchive_reports_in_past_last_n_months
such as for example 48 months, the current year reports for that plugin may not be processed. (This seems to work fine for something like 12 months)I've tested this a few times and have some log files that show different behaviour. This is most easily tested using a plugin such as Custom Reports.
For example, when leaving the setting as standard (6 months) we get the following in the core:archive logs after creating a new Custom Report for the Year period:
�[32mINFO [2021-11-10 22:57:43] 3657435 �[39m Archived website id 1, period = year, date = 2021-01-01, segment = '', 284 visits found. Time elapsed: 5.700s
(Note the lack of plugin = CustomReports)
Setting this to a longer period such as 12 months, we see that the plugin report itself is processed:
�[32mINFO [2021-11-10 23:01:57] 3686930 �[39m Archived website id 1, period = year, date = 2021-01-01, segment = '', plugin = CustomReports, report = 27, 284 visits found. Time elapsed: 0.527s
However, when we set the period to something much longer, such as 48 months we see the following output in the logs for the current year:
�[32mINFO [2021-11-10 23:20:15] 3809322 �[39m Archived website id 1, period = year, date = 2021-01-01, segment = '', 284 visits found. Time elapsed: 5.630s
(Again we note the lack of plugin = CustomReports for this archive run)
In my testing for example, the Year report for 2021 for this newly created report with 48 months of historical data was effectively never processed and showed not data:

Possible Solution
I'm not sure if this is perhaps related to when the current "Year" report is considered outdated. It's possible that because we expect the current Year report to be automatically invalidated and processed that we skip the invalidation of the plugin report for that same period. But if the year report was recently processed, then it's possible that it won't get processed for this report.
Steps to Reproduce (for Bugs)
rearchive_reports_in_past_last_n_months
to 48 monthsContext
This has the effect that the "Year" reports for the current year may not be correct. In one customers case the "Year" report only included data since the day the report was created and did not include any of the historical data from earlier in the year.
For reports that were created during the year with this setting, the "Year" report will basically always be incorrect.
Your Environment
The text was updated successfully, but these errors were encountered: