Closed nh2 closed 3 weeks ago
π @nh2
Thank you for the report!
Seems like something went wrong either during "native stats start date" migration or during "stats start date" assignment. The latter one could produce a wrong date if somehow native stats start date was null and ClickHouse didn't have any had some recent data in events_v2
.
Would you be able to check what these values are set to in your PostgreSQL database?
$ cd hosting # or wherever you clone https://github.com/plausible/community-edition (previously called https://github.com/plausible/hosting)
$ docker compose exec plausible_db psql -U postgres -h localhost -d plausible_db
select * from sites where domain = 'yourdomain.com';
Ir would also be useful to know min/max dates from events_v2 table in your ClickHouse database
$ docker compose exec plausible_events_db clickhouse client -d plausible_events_db
select min(timestamp), max(timestamp) from events_v2 where site_id = `... the id from sites table in PostgreSQL`;
Thanks for the quick reply!
select * from sites where domain = 'yourdomain.com';
It shows
stats_start_date
= 2024-11-06
native_stats_start_at
= 2021-07-14 21:03:24
inserted_at
= 2021-07-14 21:03:24
updated_at
= 2024-11-05 23:48:22
select min(timestamp), max(timestamp) from events_v2 where site_id =
... the id from sites table in PostgreSQL
;
:) select min(timestamp), max(timestamp) from events_v2 where site_id = 4;
SELECT
min(timestamp),
max(timestamp)
FROM events_v2
WHERE site_id = 4
Query id: 5795b377-2716-4fd9-b28b-1b5274704520
βββββββmin(timestamp)ββ¬ββββββmax(timestamp)ββ
1. β 2021-07-14 21:02:05 β 2024-11-06 05:14:29 β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
So it seems like stats_start_date
was set wrong for some reason. I'll look into it later this week but a quick workaround would be to set it to 2021-07-14
$ docker compose exec plausible_db psql -U postgres -h localhost -d plausible_db
UPDATE sites WHERE id = 4 SET stats_start_date = '2021-07-14';
Small SQL syntax ordering issue, should be:
UPDATE sites SET stats_start_date = '2021-07-14' WHERE id = 4;
That fixed it, thank you very much @ruslandoga!
I'll be glad to assist your debugging once you get to it.
I checked https://github.com/NixOS/nixpkgs/pull/253687#issuecomment-2458716721 and according to your screenshot it seems like the dashboard has been accessed with some events in events_v2
so it's likely the reason why stats_start_date
was set to 2024-11-06
. Even though it is a bug I don't think we will be handling this edge case since v2.0.0 was released quite some time ago and I would think most people have upgraded by now.
@ruslandoga Fine by me.
However, I think it might save some people some hours if you update the text in https://github.com/plausible/analytics/releases/tag/v2.0.0 to add a sentence like
Note: If you access the Plausible UI before doing the migration, past dates will not be shown; in that case, perform the steps described in #4779.
Thank you for the suggestion! I've updated the release notes and the OP in the discussion for that release.
@ruslandoga Thanks! Also thanks for the extremely quick support, it made a long night a bit shorter!
Past Issues Searched
Issue is a Bug Report
Using official Plausible Cloud hosting or self-hosting?
Self-hosting
Describe the bug
After executing the upgrade to v2.0.0 incuding the data migration, I can see old data (good) but only in some views such as Last 12 months (
?period=12mo
) I cannot view data older than the migration.All time and Custom range are broken: they start at today (the day I did the migration).
So the historical data is clearly there but Plausible seems to have gotten into a state where older dates cannot be selected in some views, based on the time of the migration (today).
Expected behavior
I can see all historical data in all views.
Screenshots
Last 12 months is working:
All time only shows today:
Custom range only lets me select today:
Output of the v2.0.0 migration script
Plausible.DataMigration.NumericIDs.run
:Environment