-
Notifications
You must be signed in to change notification settings - Fork 781
feat(search): Make default lookback configurable; reconstruct lookback from URL timestamps #3973
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
Merged
yurishkuro
merged 17 commits into
jaegertracing:main
from
yurishkuro:feat/configurable-default-lookback
May 27, 2026
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
05cc4ee
feat(search): Make default lookback configurable via search.defaultLo…
yurishkuro 0e7d915
feat(search): Reconstruct lookback from URL timestamps when absent
yurishkuro 95b501c
fix: Validate defaultLookback config and guard inverted timestamps
yurishkuro e5043e2
refactor(search): Rename search to searchConfig in SearchFormImpl
yurishkuro 6caf083
refactor(search): Inline searchConfig.defaultLookback
yurishkuro 2558234
refactor(config): Move defaultLookback above maxLookback in search co…
yurishkuro dfece54
refactor: Move time-range-options from constants/ to utils/
yurishkuro 5d7f4c2
refactor: Replace isValidLookback with asValidLookback
yurishkuro 6583a43
refactor(search): Remove redundant defaultLookback in SearchFormImpl
yurishkuro 6167ae3
docs(url): Clarify lookback reconstruction uses round-up semantics
yurishkuro 320760f
fix(search): Reconstruct lookback from timestamps in mapStateToProps
yurishkuro 1643eca
fix(search): Validate URL lookback param with asValidLookback
yurishkuro d390c38
refactor: Use if statement in asValidLookback for readability
yurishkuro 7f21c3a
refactor(search): Extract lookbackFromUrl, eliminate duplicated logic
yurishkuro d5f7c60
refactor(url): Avoid double-parsing in searchQueryFromUrl
yurishkuro 48632f3
fix(url): Validate URL lookback param in lookbackFromUrlState
yurishkuro 104c1bc
fix: Disallow 'custom' as search.defaultLookback config value
yurishkuro 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
packages/jaeger-ui/src/components/Monitor/ServicesView/timeFrameUtils.ts
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
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
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
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
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
30 changes: 0 additions & 30 deletions
30
packages/jaeger-ui/src/constants/time-range-options.test.ts
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) 2026 The Jaeger Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { ONE_HOUR_MS, TIME_RANGE_OPTIONS, lookbackFromDuration } from './time-range-options'; | ||
|
|
||
| describe('TIME_RANGE_OPTIONS', () => { | ||
| it('keeps lookback values and millisecond values aligned', () => { | ||
| const unitMs = { | ||
| m: 60_000, | ||
| h: ONE_HOUR_MS, | ||
| d: 24 * ONE_HOUR_MS, | ||
| w: 7 * 24 * ONE_HOUR_MS, | ||
| }; | ||
|
|
||
| TIME_RANGE_OPTIONS.forEach(({ lookback, valueMs }) => { | ||
| const match = lookback.match(/^(\d+)([mhdw])$/); | ||
| expect(match).not.toBeNull(); | ||
|
|
||
| const [, amount, unit] = match!; | ||
| expect(valueMs).toBe(Number(amount) * unitMs[unit as keyof typeof unitMs]); | ||
| }); | ||
| }); | ||
|
|
||
| it('lists options from shortest to longest', () => { | ||
| const values = TIME_RANGE_OPTIONS.map(({ valueMs }) => valueMs); | ||
| const sortedValues = [...values].sort((a, b) => a - b); | ||
|
|
||
| expect(values).toEqual(sortedValues); | ||
| }); | ||
| }); | ||
|
|
||
| describe('lookbackFromDuration', () => { | ||
| it('returns the exact matching option when duration equals a bucket', () => { | ||
| expect(lookbackFromDuration(ONE_HOUR_MS)).toBe('1h'); | ||
| expect(lookbackFromDuration(15 * 60_000)).toBe('15m'); | ||
| expect(lookbackFromDuration(2 * 24 * ONE_HOUR_MS)).toBe('2d'); | ||
| }); | ||
|
|
||
| it('snaps up to the next bucket when duration falls between two options', () => { | ||
| // 70 minutes is between 1h and 2h → should snap up to 2h | ||
| expect(lookbackFromDuration(70 * 60_000)).toBe('2h'); | ||
| // 1 minute is less than 5m → should return 5m (smallest bucket) | ||
| expect(lookbackFromDuration(60_000)).toBe('5m'); | ||
| }); | ||
|
|
||
| it('returns "custom" when duration exceeds the largest option', () => { | ||
| const largestMs = TIME_RANGE_OPTIONS[TIME_RANGE_OPTIONS.length - 1].valueMs; | ||
| expect(lookbackFromDuration(largestMs + 1)).toBe('custom'); | ||
| expect(lookbackFromDuration(365 * 24 * ONE_HOUR_MS)).toBe('custom'); | ||
| }); | ||
|
|
||
| it('returns the smallest option for duration of 0', () => { | ||
| expect(lookbackFromDuration(0)).toBe(TIME_RANGE_OPTIONS[0].lookback); | ||
| }); | ||
| }); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.