Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/live-tail-refresh-interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@hyperdx/app": patch
---

feat: add ability to change live tail refresh interval

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.

36 changes: 35 additions & 1 deletion packages/app/src/DBSearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ import {
Menu,
Modal,
Paper,
Select,
Stack,
Text,
Tooltip,
} from '@mantine/core';
import {
useDebouncedCallback,
Expand Down Expand Up @@ -123,6 +125,15 @@ import { SearchConfig } from './types';

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

const LIVE_TAIL_REFRESH_FREQUENCY_OPTIONS = [
{ value: '1000', label: '1s' },
{ value: '2000', label: '2s' },
{ value: '4000', label: '4s' },
{ value: '10000', label: '10s' },
{ value: '30000', label: '30s' },
];
const DEFAULT_REFRESH_FREQUENCY = 4000;

const ALLOWED_SOURCE_KINDS = [SourceKind.Log, SourceKind.Trace];
const SearchConfigSchema = z.object({
select: z.string(),
Expand Down Expand Up @@ -1014,6 +1025,11 @@ function DBSearchPage() {
parseAsInteger.withDefault(LIVE_TAIL_DURATION_MS),
);

const [refreshFrequency, setRefreshFrequency] = useQueryState(
'refreshFrequency',
parseAsInteger.withDefault(DEFAULT_REFRESH_FREQUENCY),
);

const updateRelativeTimeInputValue = useCallback((interval: number) => {
const label = getRelativeTimeOptionLabel(interval);
if (label) {
Expand All @@ -1032,7 +1048,7 @@ function DBSearchPage() {
useLiveUpdate({
isLive,
interval,
refreshFrequency: 4000,
refreshFrequency,
onTimeRangeSelect,
pause: isAnyQueryFetching || !queryReady || !isTabVisible,
});
Expand Down Expand Up @@ -1583,6 +1599,24 @@ function DBSearchPage() {
isLive && interval !== LIVE_TAIL_DURATION_MS
}
/>
{isLive && (
<Tooltip label="Live tail refresh interval">
<Select
size="sm"
w={80}
data={LIVE_TAIL_REFRESH_FREQUENCY_OPTIONS}
value={String(refreshFrequency)}
onChange={value =>
setRefreshFrequency(value ? parseInt(value, 10) : null)
}
allowDeselect={false}
comboboxProps={{
withinPortal: true,
zIndex: 1000,
}}
/>
</Tooltip>
)}
<Button
data-testid="search-submit-button"
variant="outline"
Expand Down
Loading