Skip to content
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

fix(web-analytics): fix bug with etc/unknown timezone #26457

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

rafaeelaudibert
Copy link
Member

@rafaeelaudibert rafaeelaudibert commented Nov 27, 2024

Problem

Fix bug with etc/unknown timezone

image

See #26376 (comment)

Changes

Just treat it as an empty string

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Unit test was updated

@@ -508,7 +508,7 @@ def _counts_breakdown_value(self):
# Get the difference between the UNIX timestamp at UTC and the UNIX timestamp at the event's timezone
# Value is in milliseconds, turn it to hours, works even for fractional timezone offsets (I'm looking at you, Australia)
return parse_expr(
"if(or(isNull(properties.$timezone), empty(properties.$timezone)), NULL, (toUnixTimestamp64Milli(parseDateTimeBestEffort(assumeNotNull(toString(timestamp, properties.$timezone)))) - toUnixTimestamp64Milli(timestamp)) / 3600000)"
"if(or(isNull(properties.$timezone), empty(properties.$timezone), properties.$timezone == 'Etc/Unknown'), NULL, (toUnixTimestamp64Milli(parseDateTimeBestEffort(assumeNotNull(toString(timestamp, properties.$timezone)))) - toUnixTimestamp64Milli(timestamp)) / 3600000)"
Copy link
Member Author

Choose a reason for hiding this comment

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

If I keep finding new exceptions, I'll create a CH dictionary to make this slightly faster

event="$pageview",
distinct_id=did,
timestamp=f"2019-02-17 00:00:00",
properties={"$session_id": sid, "$pathname": f"/path1", "$timezone": "Etc/Unknown"},
Copy link
Member

Choose a reason for hiding this comment

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

nice

@rafaeelaudibert rafaeelaudibert changed the title bug(web-analytics): fix bug with etc/unknown timezone fix(web-analytics): fix bug with etc/unknown timezone Nov 27, 2024
@rafaeelaudibert rafaeelaudibert enabled auto-merge (squash) November 27, 2024 10:53
@rafaeelaudibert rafaeelaudibert merged commit e5f1b34 into master Nov 27, 2024
93 of 94 checks passed
@rafaeelaudibert rafaeelaudibert deleted the 26376-fix-etc-unknown-error branch November 27, 2024 11:14
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