umami-software / umami

Umami is a simple, fast, privacy-focused alternative to Google Analytics.
https://umami.is
MIT License
21.96k stars 4.09k forks source link

Last 24 hours data is incomplete #2937

Open schlagmichdoch opened 2 weeks ago

schlagmichdoch commented 2 weeks ago

Describe the feature or enhancement

Problem

When looking at the data of the last 24 hours the data shown is incomplete. Umami only uses data aggregated into hours and only uses the data of the last 23 full hours and the visits that were added this hour.

Example

It is 13:42:00. Umami fetches the data from 1725105600000 to 1725191999999 in unixtimestamp in ms which corresponds to 14:00:00 yesterday to 13:59:59 GTM+2 today. This way the data is always incomplete as there is no data for 13:42:00 - 13:59:00 yet.

Expected behaviour

I had expected that the last 24 hours were used exactly so that all the stats like "+5%" / "-12%" actually make sense. Otherwise these calculations are done on incomplete data sets.

When it is 13:42:00 the data shown should start at 13:42:00.001 yesterday and end now (today 13:42:00.000).

Implementation

This seems to be easily doable, as I could successfully get the data by editing the request URL parameters sent to the /stats endpoint.

To keep everything consistent in the UI, the chart should then include the last 25 hours.

As a bonus there could be some kind of indicator how much of the oldest hour is used. E.g. if it's 13:40 it means that 1/3 of the oldest hour is used and 2/3 is not used anymore. 2/3 of the width of the bar could then be drawn in red.

schlagmichdoch commented 1 week ago

The same problem occurs for "Last x days" and "Last x months"

I can think of two possible solutions:

Still I'd also like to toggle the behavior described under expected bahaviour