-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh Lifetime Statistics destroy statistic data #33896
Comments
Hi @bernd-reindl. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
Hi @engcom-Delta. Thank you for working on this issue.
|
Hi @bernd-reindl ,
|
@engcom-Delta there are no data to refresh in the develop instance. You need Data in report_viewed_product_aggregated_daily, report_viewed_product_aggregated_monthly and report_viewed_product_aggregated_yearly older than one day. Then you need a active cron job "visitor_clean" which is running everyday at midnight. This cron job runs "\Magento\Customer\Model\Visitor::clean()" which calls "\Magento\Customer\Model\ResourceModel\Visitor::clean()". The module "Magento_Reports" has a plugin "\Magento\Reports\Model\Plugin\Log::afterClean()" which is called after "\Magento\Customer\Model\ResourceModel\Visitor::clean()" and clean all entries from table 'report_event' which does not point to an existing entrie in table 'customer_visitor'. When running "Refresh Lifetime Statistics" now, the data in report_viewed_product_aggregated_* was created with the data in the table 'report_event'. But there are a lot of entries missing after cleaning the log. So the data in report_viewed_product_aggregated_* are corrupt after refreshing the statistics. Only the data newer than "\Magento\Customer\Model\Visitor::getCleanTime()" are correct. |
Hi @engcom-Lima. Thank you for working on this issue.
|
Hi @bernd-reindl, It seems this functionality of ‘Refresh Lifetime Statistics’ is working as expected. If you don’t want to destroy ‘Most Viewed’ data, you can deselect that option and select others. You can go through the documentation for same on below link: Now, what I don’t understand is the context of your problem. So in order to understand the problem you are facing, can you please update if you are trying to explain anything that is not expected behaviour ? Also please clarify the context. |
Ho @engcom-Lima, The refresh works correct. But with wrong (damaged) data. I try to explain. Every time a user request a product detail page, a entry in table 'report_event' is created. This entry consists of the event_type_id (1 for catalog_product_view), an logged_at timestamp, an object_id (the product ID), an subject_id (Visitor ID or Customer ID), an subtype (0 = customer; 1 = visitor) and an store_id. Also a entry in table 'report_viewed_product_index' is created when a user request the product detail page. At midnight the cronjob "visitor_clean" (See crontab.xml of Magento_Customer) runs and clean all entries from table 'customer_visitor' which older than 'Visitor::getCleanTime()'. This plugin calls \Magento\Reports\Model\Event::clean() which removes all entries from table 'report_event' which points to an subject_id, have the subtype 1 (Visitor) and where the subject_id isn't existing in table 'customer_visitor'. Now all entries from table 'report_event' older than 'Visitor::getCleanTime()' are removed. So the entries in table 'report_event' are different from them in table 'report_viewed_product_index'. Running ‘Refresh Lifetime Statistics’ aggregates the data from table 'report_event'. But there is missing a lot of data in this table because of cleaning the logs. SELECT * FROM SELECT count(*) FROM |
Hi @bernd-reindl, Thank you for the detailed explanation. What I understood from the explanation is that there is discrepancy in the data of tables I'll do further analysis accordingly. |
@engcom-Lima that's correct, because after running the |
Hi @bernd-reindl, I understood the issue now. In order to understand it's impact, can you please share some screenshots of the data which is coming as corrupt or the data that is missing which should have been there ? It would be really helpful. I'll do further analysis accordingly. Thanks |
Hi @engcom-Lima
As you can see, there are 68122 entries in report_viewed_product_index and 1542 entries since 1st of October. Hope this helps. |
Hi @engcom-November. Thank you for working on this issue.
|
We are confirming this issue as per the explanation |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-6022 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-November. Thank you for verifying the issue. |
❌ Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-6022 |
Preconditions (*)
Magento 2.4.x
Steps to reproduce (*)
Expected result (*)
Report for the view products must be shown because logs exists in the table report_viewed_product_index.
Actual result (*)
Most viewed product reports does not show the correct report.
Description
Everyday a midnight the cron job 'visitor_clean' cleans the visitors log. This is done by \Magento\Customer\Model\Visitor::clean() which calls \Magento\Customer\Model\ResourceModel\Visitor::clean().
The module "Magento_Reports" has a plugin "afterClean" for \Magento\Customer\Model\ResourceModel\Visitor::clean().
This plugin removes all entries from 'report_event' which points to an non existing entry in 'customer_visitor'.
So when you updating the livetime statistics now. A lot of entries are missing.
Additional Information (*)
When cron cleans visitor log, report_event table also get clean from app/code/Magento/Reports/Model/ResourceModel/Event.php:180
When we run lifetime statics refresh it collects all data by joining report_event table in app/code/Magento/Reports/Model/ResourceModel/Report/Product/Viewed.php:10
4. In collection it ignores the damaged data which has been removed in clean process.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: