Skip to content

Commit d7a5c43

Browse files
authored
feat: add ability to change live tail refresh interval (#1432)
1 parent 664e902 commit d7a5c43

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
feat: add ability to change live tail refresh interval
6+
7+
Adds a dropdown selector in the search page that allows users to configure the live tail refresh interval. Options include 1s, 2s, 4s (default), 10s, and 30s. The selected refresh frequency is persisted in the URL query parameter.
8+

packages/app/src/DBSearchPage.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ import {
4949
Menu,
5050
Modal,
5151
Paper,
52+
Select,
5253
Stack,
5354
Text,
55+
Tooltip,
5456
} from '@mantine/core';
5557
import {
5658
useDebouncedCallback,
@@ -123,6 +125,15 @@ import { SearchConfig } from './types';
123125

124126
import searchPageStyles from '../styles/SearchPage.module.scss';
125127

128+
const LIVE_TAIL_REFRESH_FREQUENCY_OPTIONS = [
129+
{ value: '1000', label: '1s' },
130+
{ value: '2000', label: '2s' },
131+
{ value: '4000', label: '4s' },
132+
{ value: '10000', label: '10s' },
133+
{ value: '30000', label: '30s' },
134+
];
135+
const DEFAULT_REFRESH_FREQUENCY = 4000;
136+
126137
const ALLOWED_SOURCE_KINDS = [SourceKind.Log, SourceKind.Trace];
127138
const SearchConfigSchema = z.object({
128139
select: z.string(),
@@ -1014,6 +1025,11 @@ function DBSearchPage() {
10141025
parseAsInteger.withDefault(LIVE_TAIL_DURATION_MS),
10151026
);
10161027

1028+
const [refreshFrequency, setRefreshFrequency] = useQueryState(
1029+
'refreshFrequency',
1030+
parseAsInteger.withDefault(DEFAULT_REFRESH_FREQUENCY),
1031+
);
1032+
10171033
const updateRelativeTimeInputValue = useCallback((interval: number) => {
10181034
const label = getRelativeTimeOptionLabel(interval);
10191035
if (label) {
@@ -1032,7 +1048,7 @@ function DBSearchPage() {
10321048
useLiveUpdate({
10331049
isLive,
10341050
interval,
1035-
refreshFrequency: 4000,
1051+
refreshFrequency,
10361052
onTimeRangeSelect,
10371053
pause: isAnyQueryFetching || !queryReady || !isTabVisible,
10381054
});
@@ -1583,6 +1599,24 @@ function DBSearchPage() {
15831599
isLive && interval !== LIVE_TAIL_DURATION_MS
15841600
}
15851601
/>
1602+
{isLive && (
1603+
<Tooltip label="Live tail refresh interval">
1604+
<Select
1605+
size="sm"
1606+
w={80}
1607+
data={LIVE_TAIL_REFRESH_FREQUENCY_OPTIONS}
1608+
value={String(refreshFrequency)}
1609+
onChange={value =>
1610+
setRefreshFrequency(value ? parseInt(value, 10) : null)
1611+
}
1612+
allowDeselect={false}
1613+
comboboxProps={{
1614+
withinPortal: true,
1615+
zIndex: 1000,
1616+
}}
1617+
/>
1618+
</Tooltip>
1619+
)}
15861620
<Button
15871621
data-testid="search-submit-button"
15881622
variant="outline"

0 commit comments

Comments
 (0)