Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/soft-donkeys-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---

feat: Implement query chunking for charts
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@mantine/spotlight": "7.9.2",
"@microsoft/fetch-event-source": "^2.0.1",
"@tabler/icons-react": "^3.5.0",
"@tanstack/react-query": "^5.56.2",
"@tanstack/react-query": "^5.90.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded to pull in the new experimental streamedQuery function.

If we want to avoid relying on the experimental feature, this could be implemented more verbosely with useInfiniteQuery.

"@tanstack/react-query-devtools": "^5.56.2",
"@tanstack/react-table": "^8.7.9",
"@tanstack/react-virtual": "^3.0.1",
Expand Down
5 changes: 2 additions & 3 deletions packages/app/src/components/DBTimeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function DBTimeChartComponent({
limit: { limit: 100000 },
};

const { data, isLoading, isError, error, isPlaceholderData, isSuccess } =
const { data, isLoading, isError, error, isSuccess, isFetching } =
useQueriedChartConfig(queriedConfig, {
placeholderData: (prev: any) => prev,
queryKey: [queryKeyPrefix, queriedConfig],
Expand All @@ -75,7 +75,6 @@ function DBTimeChartComponent({
}
}, [isError, isErrorExpanded, errorExpansion]);

const isLoadingOrPlaceholder = isLoading || isPlaceholderData;
const { data: source } = useSource({ id: sourceId });

const { graphResults, timestampColumn, groupKeys, lineNames, lineColors } =
Expand Down Expand Up @@ -338,7 +337,7 @@ function DBTimeChartComponent({
graphResults={graphResults}
groupKeys={groupKeys}
isClickActive={false}
isLoading={isLoadingOrPlaceholder}
isLoading={isFetching}
lineColors={lineColors}
lineNames={lineNames}
logReferenceTimestamp={logReferenceTimestamp}
Expand Down
12 changes: 7 additions & 5 deletions packages/app/src/components/PatternTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ export default function PatternTable({

const [selectedPattern, setSelectedPattern] = useState<Pattern | null>(null);

const { totalCount, isLoading: isTotalCountLoading } = useSearchTotalCount(
totalCountConfig,
totalCountQueryKeyPrefix,
);
const {
totalCount,
isLoading: isTotalCountLoading,
isTotalCountComplete,
} = useSearchTotalCount(totalCountConfig, totalCountQueryKeyPrefix);

const {
data: groupedResults,
Expand All @@ -46,7 +47,8 @@ export default function PatternTable({
totalCount,
});

const isLoading = isTotalCountLoading || isGroupedPatternsLoading;
const isLoading =
isTotalCountLoading || !isTotalCountComplete || isGroupedPatternsLoading;

const sortedGroupedResults = useMemo(() => {
return Object.values(groupedResults).sort(
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/components/SearchTotalCountChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export function useSearchTotalCount(
placeholderData: keepPreviousData, // no need to flash loading state when in live tail
});

const isTotalCountComplete = !!totalCountData?.isComplete;

const totalCount = useMemo(() => {
return totalCountData?.data?.reduce(
(p: number, v: any) => p + Number.parseInt(v['count()']),
Expand All @@ -39,6 +41,7 @@ export function useSearchTotalCount(
totalCount,
isLoading,
isError,
isTotalCountComplete,
};
}

Expand Down
Loading
Loading