feat: Support sub-second (millisecond) precision in the time picker#2353
Draft
MikeShi42 wants to merge 5 commits into
Draft
feat: Support sub-second (millisecond) precision in the time picker#2353MikeShi42 wants to merge 5 commits into
MikeShi42 wants to merge 5 commits into
Conversation
- Update DateInput format to YYYY-MM-DD HH:mm:ss.SSS - Include .SSS in handleSearch format strings for both 12h/24h modes - Switch dateRangeToString to use 'withMs' format for sub-second precision - Update E2E page object placeholder to match new format - Add unit tests for millisecond parsing in dateParser and parseTimeRangeInput Resolves HDX-2133 Co-authored-by: Mike Shi <mike@hyperdx.io>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
E2E Test Results✅ All tests passed • 188 passed • 3 skipped • 1266s
Tests ran across 4 shards in parallel. |
The DateInput now displays values with .SSS suffix (e.g., '14:37:42.000') due to the updated valueFormat. Update E2E assertions to expect the millisecond-formatted output. Co-authored-by: Mike Shi <mike@hyperdx.io>
For DateTime (second-precision) columns, wrap time filter boundaries with toDateTime() to truncate sub-second values. This matches the existing toDate() pattern for Date columns and ensures the filter precision matches the column's storage precision. - DateTime64 columns: ms-level filtering via fromUnixTimestamp64Milli() - DateTime columns: second-level filtering via toDateTime(fromUnixTimestamp64Milli()) - Date columns: day-level filtering via toDate(fromUnixTimestamp64Milli()) Updated test mocks to use DateTime64(9) for timestamp columns (matching real OTel table schemas) and added explicit test cases for DateTime column behavior. Co-authored-by: Mike Shi <mike@hyperdx.io>
Only show millisecond precision in the time picker when the timestamp column is DateTime64 (sub-second capable). For DateTime columns (second precision), fall back to second-level display. - Add showMs prop to TimePicker (controls placeholder, format, and display strings) - Add showMs param to dateRangeToString and useNewTimeQuery - In DBSearchPage, derive showMs by looking up the timestamp column type from useColumns metadata - Remove forced inclusive operators for DateTime columns — the toDateTime() wrapper handles precision, operator choice stays with the caller - Update E2E locators to use regex matching for resilience against both formats Co-authored-by: Mike Shi <mike@hyperdx.io>
- Revert DateTime detection and toDateTime() wrapper in renderChartConfig — ClickHouse handles implicit type promotion correctly, no query-layer changes needed - Add showMs to useNewTimeQuery's useEffect dependency array so the displayed time string reformats when column metadata loads - Restore original test mocks and remove DateTime-specific test cases Co-authored-by: Mike Shi <mike@hyperdx.io>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The time picker for logs did not support sub-second date times while the logs are displayed at millisecond resolution. This PR adds millisecond (
.SSS) support to the time picker, conditional on the timestamp column type — ms is only shown when the column actually supports sub-second precision (DateTime64).Changes:
Time picker UI (packages/app)
showMsprop toTimePicker— controls placeholder (YYYY-MM-DD HH:mm:ssvsYYYY-MM-DD HH:mm:ss.SSS), value format, andhandleSearchdisplay stringsshowMsparam todateRangeToStringanduseNewTimeQuery— conditionally formats with'withMs'or'normal'DBSearchPage, derivesshowMsby looking up the timestamp column type fromuseColumnsmetadata:DateTime64→ ms shown,DateTime→ seconds onlyshowMstouseNewTimeQuery'suseEffectdependency array so the displayed time string reformats when column metadata loads/^YYYY-MM-DD HH:mm:ss/) for resilience against both formatsdateParserandparseTimeRangeInputHow it works
The
DBSearchPagelooks up the searched source's timestamp column type at runtime:This flag flows into both the time picker (display/input format) and the time query hook (range string formatting). The default is
true(ms shown) — the standard OTel tables useDateTime64(9).No changes to the query layer (
renderChartConfig) — ClickHouse handles implicit type promotion correctly, and thefrom/toURL params already carry epoch milliseconds viaDate.getTime().Screenshots or video
Time picker with millisecond placeholder
Time picker showing applied range with milliseconds
Full second range showing all 8 test results
Filtered to .509ms showing only 4 results
ms_filtering_verification.mp4
How to test on Vercel preview
Preview routes: /search
Steps:
References
To show artifacts inline, enable in settings.
Linear Issue: HDX-2133