Skip to content

feat(config): add STATS_EVENTS_USE_NAIVE_UTC_DATETIME flag#168

Merged
zzacharo merged 2 commits into
inveniosoftware:masterfrom
zzacharo:events-timezone-flag
Feb 20, 2026
Merged

feat(config): add STATS_EVENTS_USE_NAIVE_UTC_DATETIME flag#168
zzacharo merged 2 commits into
inveniosoftware:masterfrom
zzacharo:events-timezone-flag

Conversation

@zzacharo

Copy link
Copy Markdown
Member

Introduce STATS_EVENTS_USE_NAIVE_UTC_DATETIME (default: True) to strip tzinfo from event timestamps at build time. Set to False to opt-in to timezone-aware UTC datetimes.

@zzacharo zzacharo force-pushed the events-timezone-flag branch from 03797f6 to a35dd21 Compare February 19, 2026 16:38
Comment thread invenio_stats/config.py Outdated
Default behaviour will register the templates as search templates.
"""

STATS_EVENTS_USE_NAIVE_UTC_DATETIME = True

@utnapischtim utnapischtim Feb 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting it to True is for the migration purpose a good value. we play it safe, because with this setting it can't fail. But for a new instance this value leads to a necessary configuration to use the utc aware datetimes and this seems really strange. as a newcomer i would not expect that i have to configure it that way.

for me it would be better to set this value to False as the default value. Old instance which do a live update have to configure it, but instances which do mostly what is written in the migration steps do a index destroy with a full reindex and therefore don't need this flag at all.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index destroy doesnt affect the stats indices so they will be affected if they have already stat events. I think it would be easier to opt-in and describe the needed steps. WDYT?

Introduce STATS_EVENTS_UTC_DATETIME_ENABLED (default: False) to strip
tzinfo from event timestamps at build time. Set to True to opt-in to
timezone-aware UTC datetimes.
@zzacharo zzacharo force-pushed the events-timezone-flag branch from a35dd21 to a6f04c1 Compare February 20, 2026 10:46
@zzacharo zzacharo merged commit 24b1e02 into inveniosoftware:master Feb 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants