-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: more tz/date fiddling to get this property thing working #27423
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dd28632
fix: more tz/date fiddling to get this property thing working
pauldambra 011eb29
i think we just need a wider window
pauldambra cf8ea3b
Update UI snapshots for `chromium` (1)
github-actions[bot] e7a26e8
Merge branch 'master' into fix/more-tz-fixing
pauldambra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -684,15 +684,16 @@ export const sessionRecordingDataLogic = kea<sessionRecordingDataLogicType>([ | |
kind: NodeKind.HogQLQuery, | ||
query: hogql`SELECT properties, uuid | ||
FROM events | ||
WHERE timestamp > ${dayjs(earliestTimestamp - 1000) | ||
.utc() | ||
.format('YYYY-MM-DD HH:mm:ss.SSS')} | ||
AND timestamp < ${dayjs(latestTimestamp + 1000) | ||
.utc() | ||
.format('YYYY-MM-DD HH:mm:ss.SSS')} | ||
-- the timestamp range here is only to avoid querying too much of the events table | ||
-- we don't really care about the absolute value, | ||
-- but we do care about whether timezones have an odd impact | ||
-- so, we extend the range by a day on each side so that timezones don't cause issues | ||
WHERE timestamp > ${dayjs(earliestTimestamp).subtract(1, 'day')} | ||
AND timestamp < ${dayjs(latestTimestamp).add(1, 'day')} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about utc + formatting, won't this return a dayjs object, or is its default string representation the correct format? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
AND event in ${eventNames} | ||
AND uuid in ${eventIds}`, | ||
} | ||
|
||
const response = await api.query(query) | ||
if (response.error) { | ||
throw new Error(response.error) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaeelaudibert always best to comment on a file or line so we can thread 😊
I tried with and without and I don't believe it affects the HogQL query output
We don't want to pass in the number value
earliesTimestamp
since then CH doesn't use the indexBut passing in
dayjs
object constructed from it seems to get to the same place as formatting ourselvesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, probably because that's the default implementation for
toString()
. I'd still prefer the format call because I can understand what's actually interpolated. If I look at the code right now I have no idea if we're sending an UNIX timestamp, a UTC string, some ISO string, etc.It's not blocking, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pulling into this tread in one place with @joshsny too 😊
with this
dayjs
alone I getgreater(toTimeZone(events.timestamp, 'UTC'), '2025-01-08 09:57:56')
if I do
dayjs(earliestTimestamp).subtract(1, 'day').utc()
then I get
greater(toTimeZone(events.timestamp, 'UTC'), '2025-01-08 09:57:56')
and if I do the format on top then ofc I get whatever I formatted
the value is already UTC... the problem actually comes because HogQL is wrapping the column in the project TZ when I would love to say... this is all under my control and already UTC
I think I prefer passing in the dayjs object to the
hogql
string cos then we could fix things in one place in that template for all queries that pass a dayjs whereas if we pass strings then we always have to edit everywhere we pass the strings inbut 🤷 it's late and i just want to fix for users for now 🙈 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great argument, and I've actually learned something. We're doing that already, that's why you're getting the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally found something confusing about timezones 🫠