feat(webui): Increase precision of time range in guided UI from seconds to milliseconds. #1543
Conversation
WalkthroughIntroduced a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Looks good, but when zooming in to only one log event, the timeline shows a bar for that log event, but result table is empty. We probably also need to do the same thing for buildSearchQuery to fix this.
--- a/components/webui/client/src/sql-parser/index.ts
+++ b/components/webui/client/src/sql-parser/index.ts
@@ -104,7 +104,7 @@ const buildSearchQuery = ({
timestampKey,
}: BuildSearchQueryProps): string => {
let queryString = `SELECT ${selectItemList} FROM ${databaseName}
-WHERE to_unixtime(${timestampKey}) BETWEEN ${startTimestamp.unix()} AND ${endTimestamp.unix()}`;
+WHERE to_unixtime(${timestampKey}) BETWEEN ${startTimestamp.valueOf() / MILLISECONDS_PER_SECOND} AND ${endTimestamp.valueOf() / MILLISECONDS_PER_SECOND}`;|
Okay good catch, i made change there as well |
junhaoliao
left a comment
There was a problem hiding this comment.
deferring to @hoophalab 's review
…ds to milliseconds. (y-scope#1543)
Description
I noticed a small issue where the total results displayed in ui was slightly lower than the amount ingested when running query with "all time". I believe this is due to a quirk of dayJS.unix() where it floors the timestamp to the nearest second. This PR replaces it with dayJS.valueOf() which includes milliseconds, and now the total results matches logs ingested.
Checklist
breaking change.
Validation performed
All time shows 1M results instead of slightly less than 1M with "all time"
Summary by CodeRabbit